fmincon does not converge to the best solution?
22 views (last 30 days)
Show older comments
Lu Huang on 10 Aug 2020
Answered: Walter Roberson on 10 Aug 2020
I have a question about fmincon. My optimization project is a 2-D problem.
I saved all the temporary function calls, and many temporary object values are better than the final solution, where all of these better variables are within the boundary.
The exitflag is 2. I have no idea why the final solution is not the best overall the function calls.
The setting for the 'options' are
Thank you so much.
Walter Roberson on 10 Aug 2020
fmincon can return a value that is worse than the initial point in some cases, especially if you are using interior-point. It was suggested to me that sqp is better in this regards.
Mathworks sent me further explanation:
'fmincon' basically tries to "prove a point is optimal" by reducing the "first-order optimality" measure below the OptimalityTolerance option (default is 1e-6). This number is shown in the 5th column. 'fmincon' by-default uses 'interior-point' algorithm and the 'interior-point' algorithm does behave unexpectedly. The problem is poorly scaled bounds which causes it to move away from the current point.
Another point to note is that barrier function may get away from initial solution if it is near boundary (in this case it may appear to be near the boundary due to the scale of bounds). The details are a bit involved which are given in the below link:
For now, we can increase the OptimalityTolerance options (to say 1e-3 or higher) to reduce this effect. However, we must remember that the value of OptimalityTolerance is the measure of "certificate of local optimality".
More Answers (0)
Find more on Solver Outputs and Iterative Display 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!