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!