How to add user defined function as constraint for optimization?
이전 댓글 표시
How to add user defined function as constraint for optimization? Example is given below. The problem that I know is a problem is that I am parsing a constraint to a function that sees that constraint as a variable, which it is not.
x = optimvar("x",3,3);
y = const1;
z = const2;
in loop:
return_val = my_fun(x(i,j),y)
prob.Constraints.Con1 = return_val >= z;
end loop
댓글 수: 4
Torsten
2022년 7월 6일
This should help:
Faruk Šehić
2022년 7월 6일
Torsten
2022년 7월 6일
Yes. Use the solver-based instead of the problem-based approach.
Faruk Šehić
2022년 7월 6일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Choose a Solver에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!