Introduction to Constrained Optimization in Mathematica

Optimization Problems

Constrained optimization problems are problems for which a function is to be minimized or maximized subject to constraints . Here is called the objective function and is a Boolean-valued formula. In Mathematica the constraints can be an arbitrary Boolean combination of equations , weak inequalities , strict inequalities , and statements. The following notation will be used.

stands for "minimize subject to constraints ", and

stands for "maximize subject to constraints ".

You say a point satisfies the constraints if is true.

The following describes constrained optimization problems more precisely, restricting the discussion to minimization problems for brevity.

Global Optimization

A point is said to be a global minimum of subject to constraints if satisfies the constraints and for any point that satisfies the constraints, .

A value is said to be the global minimum value of subject to constraints if for any point that satisfies the constraints, .

The global minimum value exists for any and . The global minimum value is attained if there exists a point such that is true and . Such a point is necessarily a global minimum.

If is a continuous function and the set of points satisfying the constraints is compact (closed and bounded) and nonempty, then a global minimum exists. Otherwise a global minimum may or may not exist.

Here the minimum value is not attained. The set of points satisfying the constraints is not closed.
In[1]:=
Click for copyable input
Out[1]=
Here the set of points satisfying the constraints is closed but unbounded. Again, the minimum value is not attained.
In[3]:=
Click for copyable input
Out[3]=
The minimum value may be attained even if the set of points satisfying the constraints is neither closed nor bounded.
In[4]:=
Click for copyable input
Out[4]=

Local Optimization

A point is said to be a local minimum of subject to constraints if satisfies the constraints and, for some , if satisfies , then .

A local minimum may not be a global minimum. A global minimum is always a local minimum.

Here FindMinimum finds a local minimum that is not a global minimum.
In[18]:=
Click for copyable input
Out[18]=
In[19]:=
Click for copyable input
Out[19]=
In[20]:=
Click for copyable input
Out[20]=

Solving Optimization Problems

The methods used to solve local and global optimization problems depend on specific problem types. Optimization problems can be categorized according to several criteria. Depending on the type of functions involved there are linear and nonlinear (polynomial, algebraic, transcendental, ...) optimization problems. If the constraints involve , you have integer and mixed integer-real optimization problems. Additionally, optimization algorithms can be divided into numeric and symbolic (exact) algorithms.

Mathematica functions for constrained optimization include Minimize, Maximize, NMinimize, and NMaximize for global constrained optimization, FindMinimum for local constrained optimization, and LinearProgramming for efficient and direct access to linear programming methods. The following table briefly summarizes each of the functions.

Function
Solves
Algorithms
FindMinimum,FindMaximumnumeric local optimizationlinear programming methods, nonlinear interior point algorithms, utilize second derivatives
NMinimize,NMaximizenumeric global optimizationlinear programming methods, Nelder-Mead, differential evolution, simulated annealing, random search
Minimize,Maximizeexact global optimizationlinear programming methods, cylindrical algebraic decomposition, Lagrange multipliers and other analytic methods, integer linear programming
LinearProgramminglinear optimizationlinear programming methods (simplex, revised simplex, interior point)

Summary of constrained optimization functions.

Here is a decision tree to help in deciding which optimization function to use.

Out[2]=
New to Mathematica? Find your learning path »
Have a question? Ask support »