How to add user defined function as constraint for optimization?
Mostra commenti meno recenti
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 Commenti
Torsten
il 6 Lug 2022
This should help:
Faruk Šehić
il 6 Lug 2022
Torsten
il 6 Lug 2022
Yes. Use the solver-based instead of the problem-based approach.
Faruk Šehić
il 6 Lug 2022
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Get Started with Optimization Toolbox in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!