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!