Optimization problem not finding the actual optimal value
10 views (last 30 days)
Show older comments
Pascual Ferrans Ramírez
on 14 Mar 2022
Commented: Matt J
on 15 Mar 2022
Hello!
I am trying to solve an optimization problem in the Problem-Based mode and I am having problems finding the local optimum. The function I am looking to optimize is located in a .m file developed by me, in which a single output Y value is calculated, which depends on the simulation and run of a computational model of my own. I am defining the objective of my problem with fcn2optimexpr and the optimization method I am using is fmincon. No matter what initial value X (a single variable) I assign to the problem, the program always tells me that it has already found the local optimum at the initial point assigned to X, without further iterations. I have already tried to modify the program tolerances (step size, objetive and contraint) and it keeps throwing the same result. Also, I tried changing the searching algoritm and nothing has worked out. Any idea what I can be doing wrong? Thank you very much. Below is the code used to define the problem and the text obtained in response.
prob = optimproblem("Description", "Optimization SUDS", "ObjectiveSense", "maximize");
x = optimvar('x');
x.LowerBound = 0;
x.UpperBound = 1;
obj = fcn2optimexpr(@opti, x);
prob.Objective = obj;
initialGuess.x = 0.1;
options = optimoptions("fmincon","Display","iter", "PlotFcn",["optimplotx",...
"optimplotfval","optimplotstepsize"]);
[sol, fval, exitflag, output] = solve(prob, initialGuess, "Options",options);
Initial Point is a local minimum that satisfies the constraints.
Optimizacion completed because at the initial point, the objetive function is non-decreasing in feasible directions to within the value of the optimality tolerance, and contraints are satisfied to within the value of the contraint tolerance
2 Comments
Torsten
on 14 Mar 2022
What do you get back if you call your objective with the initial guess for x ?
Accepted Answer
Matt J
on 14 Mar 2022
Edited: Matt J
on 14 Mar 2022
Making sure you don't have any round(), ceil(), floor() or other discretization operations in your simulation code. Also, make sure you have read the guidelines on optimizing a simulation here,
Finally, since your problem only has a single unknown, I would use fminbnd().
3 Comments
More Answers (0)
See Also
Categories
Find more on Problem-Based Optimization Setup in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!