Why is fmincon ending in points it knows are sub-optimal?
2 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
采纳的回答
Alan Weiss
2016-11-2
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 个评论
Alan Weiss
2016-11-3
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
更多回答(1 个)
Matt J
2016-11-2
编辑:Matt J
2016-11-2
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.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!