Multistart apparently does not respect the supplied initial points

조회 수: 4 (최근 30일)
Hello,
I have a simple, but annoying, problem about multistart in MATLAB. Consider the following example from MATLAB description of multistart:
fun = @(x) x.^2 + 4*sin(5*x);
opts = optimoptions(@fmincon,'Algorithm','sqp');
problem = createOptimProblem('fmincon','objective',...
fun,'x0',2.5,'lb',-5,'ub',5,'options',opts);
ms = MultiStart;
[x,f] = run(ms,problem,1)
This gives me the following answer
The local solver ran once and converged with a positive local solver exit flag.
x =
-2.7713
f =
3.8366
But, I expected to roughly get x=2.159 based on the initial point x0=2.5 I supplied. I attach a figure which shows my initial point (open circle) and my expection of local minimum (red star).
Any idea?
Thanks in advance!
Babak

채택된 답변

Alan Weiss
Alan Weiss 2023년 4월 14일
The only error here is your expectation that fmincon always converges to the closest local minimum. It does not.
fun = @(x) x.^2 + 4*sin(5*x);
opts = optimoptions(@fmincon,'Algorithm','sqp');
problem = createOptimProblem('fmincon','objective',...
fun,'x0',2.5,'lb',-5,'ub',5,'options',opts);
ms = MultiStart;
[x,f] = run(ms,problem,1)
MultiStart completed the runs from all start points. The local solver ran once and converged with a positive local solver exit flag.
x = -2.7713
f = 3.8366
% Now let's see where fmincon goes
[x2,f2] = fmincon(problem)
Local minimum found that satisfies the constraints. Optimization completed because the objective function is non-decreasing in feasible directions, to within the value of the optimality tolerance, and constraints are satisfied to within the value of the constraint tolerance.
x2 = -2.7713
f2 = 3.8366
Understand? MultiStart works as documented. When you call it with 1 run, it takes the supplied start point and proceeds to call fmincon. The error was expecting fmincon to converge to the closest local minimum.
Alan Weiss
MATLAB mathematical toolbox documentation
  댓글 수: 1
Mohammad Shojaei Arani
Mohammad Shojaei Arani 2023년 4월 15일
Hi Alan,
Thanks for your response.
If you look at my figure you will see that my starting point is very far from the solution being found. But, as you mentioned in your response tro my other question the use of CustomStartPointSet should fix my problem. I hope it is not so complicated to do it (I am a mathematician but unfortunately am not a good programmer :-) ).
Thank!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Global or Multiple Starting Point Search에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by