Why is fmincon ending in points it knows are sub-optimal?

12 views (last 30 days)
So I'm running fmincon on some complex function.
First-order Norm of
Iter F-count f(x) Feasibility optimality step
0 6 1.264764e+04 0.000e+00 6.529e+09
1 13 -3.111363e+04 0.000e+00 1.043e+10 1.485e+01
2 19 -3.413651e+04 0.000e+00 7.615e+09 8.769e+03
3 25 -3.861130e+04 0.000e+00 1.613e+09 6.264e+02
4 34 -3.840241e+04 0.000e+00 1.376e+09 9.530e-03
5 41 -3.843143e+04 0.000e+00 5.582e+09 9.954e-01
I get this and it ends there at Iteration 5, returning the parameter values of that iteration and calling it an optimum. However, clearly, iteration 3 had found a superior feasable solution.
Any clue as to why this is happening? And how to stop that? The program that ultimately calls on fmincon is a complex code written by someone else, that I don't understand fully. Could he have put some option to stop fmincon from returning the values at iteration 3 instead of the ones at the last iteration?

Accepted Answer

Alan Weiss
Alan Weiss on 2 Nov 2016
It appears that the first-order optimality measure is nowhere near zero, so I am sure that fmincon does not claim that it reached a minimum. It probably stopped because the norm of the step was too small, meaning it could not proceed. For suggestions on what to do in this case, see Local Minimum Possible.
Alan Weiss
MATLAB mathematical toolbox documentation
  6 Comments
Patrick Aoun
Patrick Aoun on 2 Nov 2016
Oh well if that's the case that would definitely answer the original question.
Alan Weiss
Alan Weiss on 3 Nov 2016
Matt is quite correct that fmincon does not enforce monotonicity of the objective function during its iterations, and does not use the whole history in deciding when to stop, but uses only the current iteration's data.
And Patrick, I'm tickled that you were impressed by my analysis of your problem when I had no access to any problem details. But I see these types of optimization issues often--after all, it is my job!
Alan Weiss
MATLAB mathematical toolbox documentation

Sign in to comment.

More Answers (1)

Matt J
Matt J on 2 Nov 2016
Edited: Matt J on 2 Nov 2016
However, clearly, iteration 3 had found a superior feasable solution.
That is not clear because the "Feasibility" metric is only displayed to a few decimal places. My first thought is to check the feasibility values to higher precision.
There is in any case rather little information here with which to diagnose. We would need to have the exitflag and other output information from fmincon to really make good guesses.
The program that ultimately calls on fmincon is a complex code written by someone else, that I don't understand fully. Could he have put some option to stop fmincon from returning the values at iteration 3 instead of the ones at the last iteration?
The input would definitely also help with diagnosis. You could set a breakpoint at the line of the code where fmincon is called. Then save all of its inputs to the base workspace (e.g., with this ) so that they can be run and studied separately.
  1 Comment
Patrick Aoun
Patrick Aoun on 2 Nov 2016
Edited: Patrick Aoun on 2 Nov 2016
Thanks for the answer
Wouldn't feasability write something like 1.000e-07 if it was not 0? As for the output options you're right I'll provide them soon.
The breakpoint in front of the fmincon is clever I'm doing this right now thanks.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!