How to add user defined function as constraint for optimization?
Afficher commentaires plus anciens
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 commentaires
Torsten
le 6 Juil 2022
This should help:
Faruk Šehić
le 6 Juil 2022
Torsten
le 6 Juil 2022
Yes. Use the solver-based instead of the problem-based approach.
Faruk Šehić
le 6 Juil 2022
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Get Started with Optimization Toolbox dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!