Different solutions of fmincon when changing x0
1 view (last 30 days)
Show older comments
I wanted to ask if it is normal that fmincon can have different solutions with different x0?
I implement an Algoritjm by myself and use fmincon as follows:
options = optimoptions('fmincon','Display','iter','Algorithm','sqp');
x = fmincon(fun,x0,A,b,Aeq,beq,lb,ub,nonlcon,options)
0 Comments
Accepted Answer
Torsten
on 31 Mar 2022
Edited: Torsten
on 31 Mar 2022
I wanted to ask if it is normal that fmincon can have different solutions with different x0?
There can be several reasons for fmincon to converge to different "solutions" dependent on the starting point. But - sure - the optimization algorithm implemented in "fmincon" tries to find local extrema. If a function has more than one or is ill-behaved, it depends on the starting point to which of the local extrema the algorithm converges.
2 Comments
Shaily_T
on 26 Apr 2022
Could you please elaborate more on an ill-behaved function? Is it inherent to the function or can be dependent on our codes as well? I mean for example something wrong in our code.
And is there a way to determine which of the probabilities you mentioned is the case in our function? I mean being ill-behaved or having more than one extrema.
Thank you in advance!
Matt J
on 26 Apr 2022
Edited: Matt J
on 26 Apr 2022
You can look at the function values at the two solutions to see if they are nearly the same. If so, then plainly you have multiple minima. Better still, given the two solutions x1 and x2,you could plot the 1D function
g(t)=fun(t*x1+(1-t)*x2) % t from -1 to 2
If the graph is very flat between t=0 and t=1 or is very bumpy, it is a likely sign that your graph has multiple local/global minima.
More Answers (0)
See Also
Categories
Find more on Genomics and Next Generation Sequencing 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!