Optimization problem not finding the actual optimal value
조회 수: 10 (최근 30일)
이전 댓글 표시
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
채택된 답변
Matt J
2022년 3월 14일
편집: Matt J
2022년 3월 14일
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Problem-Based Optimization Setup에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!