How to migrate an Optimization Problem obtained with 'optimproblem' to a Global Optimization Problem that you would get from 'createOptimProblem'
Mostrar comentarios más antiguos
I was using the Optimization Toolbox and now I want to set up the same problem with the Global Optimization Toolbox using GlobalSearch (new to me).
It seems that I have to use the function 'createOptimProble', which uses different conventions than 'optimproblem'. If I already have a problem defined with 'optimproblem', call it 'prob', I would expect something like the following to work (it won't because e.g. the initial point is missing):
gs = GlobalSearch;
[xg,fg,flg,og] = run(gs,prob)
That is, I would expect 'run' to accept OptimizationProblem objects. Am I missing somethng? If not, is there a simple way to migrate OptimizationProblem objects to be used in 'run'?
ANNEX
Below the structure of my OptimizationProblem (There may be a typo, I redefined everything to make it more understandable and MWE, I cannot provide @MyFUN and the Simulink models, but they are irrelevant).
% Define optimization variable (3 parameters of a Simulink model)
x = optimvar('x', 1, 3, 'LowerBound', zeros(1, 3), 'UpperBound', 10000*ones(1, 3));
% Define optimization expression: sets the 3 parameters in the Simulink model,
% simulates it and returns 3 KPIs
[MyObj, MyConstr1, MyConstr2] = fcn2optimexpr(@MyFUN, x,...
'OutputSize', [1, 1], 'ReuseEvaluation', true);
% Define optimization problem
prob = optimproblem;
prob.Objective = MyObj;
prob.Constraints.MyConstr1 = MyConstr1 <= ValueMyConstr1;
prob.Constraints.MyConstr2 = MyConstr2 <= ValueMyConstr2;
% Define initial point
init_point = [eps, 1000, eps];
x0.x = init_point;
% Define options
options = optimoptions(@fmincon,...
'Display', 'iter-detailed', 'Algorithm', 'interior-point',...
'OptimalityTolerance', 1e-10, 'StepTolerance', 1e-10,...
'FiniteDifferenceStepSize', 1e-6);
% Solve with Optimization Toolbox
[sol, fval, exitflag, output] = solve(prob, x0,...
'options', options, 'solver', 'fmincon')
Thanks!
1 comentario
Joan Vazquez
el 20 de Mzo. de 2020
Respuestas (0)
Categorías
Más información sobre Linear Least Squares en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!