How to add user defined function as constraint for optimization?
Mostrar comentarios más antiguos
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 comentarios
Torsten
el 6 de Jul. de 2022
This should help:
Faruk Šehić
el 6 de Jul. de 2022
Torsten
el 6 de Jul. de 2022
Yes. Use the solver-based instead of the problem-based approach.
Faruk Šehić
el 6 de Jul. de 2022
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Choose a Solver en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!