yalmip / YALMIP

MATLAB toolbox for optimization modeling
https://yalmip.github.io/
Other
464 stars 134 forks source link

Is it possible to use yalmip('clear') to clear the specified variables without clearing the constraints? #1229

Closed NanjunLv closed 1 year ago

NanjunLv commented 1 year ago

ange with the loop. Since yalmip takes a lot of time to process the constraints, I would like to put the constraints outside the loop body and the objective function inside the loop body and use yalmip('clear') to clear the specified objective function at each loop, is this possible?

johanlofberg commented 1 year ago

No, as I said, your only way out is to either setup optimizer objects, or use persistent variables in your external function so that you don't redefine the variables and problem from scratch every time in there.

NanjunLv commented 1 year ago

Thank you very much for your answer. Can you write a simple example?

johanlofberg commented 1 year ago

https://yalmip.github.io/example/simulink/