Filter löschen
Filter löschen

Different solutions of fmincon when changing x0

2 Ansichten (letzte 30 Tage)
Daniela Würmseer
Daniela Würmseer am 31 Mär. 2022
Bearbeitet: Matt J am 26 Apr. 2022
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)

Akzeptierte Antwort

Torsten
Torsten am 31 Mär. 2022
Bearbeitet: Torsten am 31 Mär. 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 Kommentare
Shaily_T
Shaily_T am 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
Matt J am 26 Apr. 2022
Bearbeitet: Matt J am 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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by