MATLAB: Objective and constraints having a common function – Problem based in Matlab 2016b

common objective and constraintsfunction conversionMATLABmatlab 2016boptimization expressionOptimization Toolboxoptimvar

Hi,
In my current optimization problem, both the objective and cosntraint functions are calculated following a time-consuming simulink run. In order to avoid having to run the simulation twice at each iteration (one to compute the objective, one to compute the constraint), I would like to apply the same method as described in https://fr.mathworks.com/help/optim/ug/objective-and-constraints-using-common-function.html.
However, my work only gives access to Matlab 2016b, and the functions used are not available yet : optimvar, fcn2optimexpr.
Is there a way to convert my function "compute_all" (which computes both the objective and the constraint) to an optimization expression, but in Matlab 2016b ?
Thank you for your help,
Thomas

Best Answer

Perhaps what you are looking for is in Objective and Nonlinear Constraints in the Same Function.
Alan Weiss
MATLAB mathematical toolbox documentation
Related Question