MATLAB: Do the FMINCON and FMINUNC functions from the Optimization Toolbox fail to give a global optimum

convergefminconfminuncgloballocalOptimization Toolboxoptimum

I would like to know why the FMINCON and FMINUNC functions (or any optimization function in Optimization Toolbox) provide incorrect results. I also would like to know why the solution from these functions is not a minimum.

Best Answer

All the functions in Optimization Toolbox are derivative-based search algorithms and do not guarantee a global minimum. In fact, any derivative-based optimization algorithm known so far will not guarantee a global minimum.
------------------------------------
How do you qualify a solution to be "Optimum" or not "Optimum"?
Note that when FMINCON/FMINUNC or other functions in the Optimization Toolbox stop execution, a message is printed saying why it stopped. The message "Optimization terminated successfully" indicates that one or more of the stopping criteria were satisfied before it stopped. If you are not satisfied with the solution, you may want to change one or more stopping criteria so that the function will not stop at the same point.
When the optimizer stops prematurely (not at the optimum), typical messages could be:
1) Number of function evaluation exceeded (Increase MaxFunEvals - Maximum number of function evaluations allowed ).
2) Number of iteration exceeded (Increase MaxIter - Maximum number of iterations allowed)
You can get a complete list of such parameters using function OPTIMSET/OPTIMGET:
help optimset
When the optimizer stops at optimum point, a typical message is:
1) Magnitude of directional derivative in search direction
less than 2*options.TolFun and maximum constraint violation
is less than options.TolCon
No Active Constraints
The above message means that the directional derivative of the objective function is close to 2*TolFun (the stopping criteria); hence, the optimizer stopped successfully. Also, note that TolCon (tolerence on costraints) is also satisfied at this point. "No Active Constraints" means that none of the constraints (Bound, nonlinear, linear) are "exactly" satisfied. This is also interpreted as the solution not on the constraint boundary.
It is always a good idea to start the optimization at different starting points to verify that it converges to same solution. If it does not, but the optimizer is saying "Optimization terminated successfully", your problem has more than one local minimum. In such cases, you must decide which solution point is good for you.
Refer to the "Typical Problems and How to Deal with them" section of the HTML help if you do not have the manual. You can access this help here:
See the solution linked below for a multi-modal function optimization.
Related Question