Comparison of Constrained Optimization Functions
employ global optimization algorithms, and are thus suitable when a global optimum is needed.
can find exact global optima for a class of optimization problems containing arbitrary polynomial problems. However, the algorithms used have a very high asymptotic complexity and therefore are suitable only for problems with a small number of variables.
always finds a global maximum, even in cases that are numerically unstable. The left-hand side of the constraint here is (x2+y2-1010)2 (x2+y2)
This input differs from the previous one only in the twenty-first decimal digit, but the answer is quite different, especially the location of the maximum point. For an algorithm using 16 digits of precision both problems look the same, hence it cannot possibly solve them both correctly.
only attempts to find a local minimum, therefore is suitable when a local optimum is needed, or when it is known in advance that the problem has only one optimum or only a few optima that can be discovered using different starting points.
Even for local optimization, it may still be worth using NMinimize
for small problems. NMinimize
uses one of the four direct search algorithms (Nelder-Mead, differential evolution, simulated annealing, and random search), then finetunes the solution by using a combination of KKT solution, the interior point, and a penalty method. So if efficiency is not an issue, NMinimize
should be more robust than FindMinimum
, in addition to being a global optimizer.
This shows the default behavior of NMinimize
on a problem with four variables.
This shows that two of the post-processors, KKT and FindMinimum
, do not give the default result. Notice that for historical reasons, the name FindMinimum
, when used as an option value of PostProcess
, stands for the process where a penalty method is used to convert the constrained optimization problem into unconstrained optimization methods and then solved using (unconstrained) FindMinimum
However, if efficiency is important, FindMinimum
can be used if you just need a local minimum, or you can provide a good starting point, or you know the problem has only one minimum (e.g., convex), or your problem is large/expensive. This uses FindMinimum
to solve the same problem with seven variables. The constraints are relatively expensive to compute. Clearly FindMinimum
in this case is much faster than NMinimize