Quadratic programming

Quadratic programming (QP) is a special type of mathematical optimization problem. It is the problem of optimizing (minimizing or maximizing) a quadratic function of several variables subject to linear constraints on these variables.

The quadratic programming problem can be formulated as:[1]

Assume x belongs to \mathbb{R}^{n} space. Both x and c are column vectors with n elements (n×1 matrices), and Q is a symmetric n×n matrix.

Minimize (with respect to x)

f(\mathbf{x}) = \tfrac{1}{2} \mathbf{x}^T Q\mathbf{x} %2B \mathbf{c}^T \mathbf{x}.

Subject to one or more constraints of the form:

 A\mathbf{x} \leq \mathbf b (inequality constraint)
 E\mathbf{x} = \mathbf d (equality constraint)

where \mathbf{x}^T indicates the vector transpose of \mathbf{x}. The notation  A \mathbf x \leq \mathbf b means that every entry of the vector A \mathbf x is less than or equal to the corresponding entry of the vector \mathbf b.

If the matrix Q\; is positive semidefinite matrix, then f is a convex function: In this case the quadratic program has a global minimizer if there exists some feasible vector \mathbf x (satisfying the constraints) and if f is bounded below on the feasible region. If the matrix Q\; is positive definite and the problem has a feasible solution, then the global minimizer is unique.

If Q\; is zero, then the problem becomes a linear program.

A related programming problem, quadratically constrained quadratic programming, can be posed by adding quadratic constraints on the variables.

Contents

Solution methods

For general problems a variety of methods are commonly used, including

Convex quadratic programming is a special case of the more general field of convex optimization.

Equality constraints

Quadratic programming is particularly simple when there are only equality constraints; specifically, the problem is linear. By using Lagrange multipliers and seeking the extremum of the Lagrangian, it may be readily shown that the solution to the equality constrained problem is given by the linear system:


\begin{bmatrix}
   Q & E^T \\
   E & 0
\end{bmatrix} 
\begin{bmatrix}
   \mathbf x \\
   \lambda
\end{bmatrix}
= 
\begin{bmatrix}
   -\mathbf c \\
   \mathbf d
\end{bmatrix}

where \lambda is a set of Lagrange multipliers which come out of the solution alongside \mathbf x.

The easiest means of approaching this system is direct solution (for example, LU factorization), which for small problems is very practical. For large problems, the system poses some unusual difficulties, most notably that problem is never positive definite (even if Q is), making it potentially very difficult to find a good numeric approach, and there are many approaches to choose from dependent on the problem [5].

If the constraints don't couple the variables too tightly, a relatively simple attack is to change the variables so that constraints are unconditionally satisfied. For example, suppose \mathbf d = 0 (generalizing to nonzero is straightforward). Looking at the constraint equations:

E\mathbf{x} = 0

introduce a new variable \mathbf y defined by

A \mathbf{y} = \mathbf x

where \mathbf y has dimension of \mathbf x minus the number of constraints. Then

E A \mathbf{y} = 0

and if A is chosen so that E A = 0 the constraint equation will be always satisfied. Finding such A entails finding the null space of E, which is more or less simple depending on the structure of E. Substituting into the quadratic form gives an unconstrained minimization problem:


\tfrac{1}{2} \mathbf{x}^T Q\mathbf{x} %2B \mathbf{c}^T \mathbf{x} \quad \Rightarrow \quad
\tfrac{1}{2} \mathbf{y}^T Z^T Q Z \mathbf{y} %2B (Z^T \mathbf{c})^T \mathbf{y}

the solution of which is given by:


Z^T Q Z \mathbf{y} = -Z^T \mathbf{c}

Under certain conditions on Q, the reduced matrix Z^T Q Z will be positive definite. It's possible to write a variation on the conjugate gradient method which avoids the explicit calculation of Z [6].

Lagrangian duality

The Lagrangian dual of a QP is also a QP. To see that let us focus on the case where c=0 and Q is positive definite. We write the Lagrangian function as

L(x,\lambda) = \tfrac{1}{2} x^{T}Qx %2B \lambda^{T}(Ax-b).

Defining the (Lagrangian) dual function g(\lambda), defined as g(\lambda) = \inf_{x} L(x,\lambda) , we find an infimum of L, using \nabla_{x} L(x,\lambda)=0:

x* = - Q^{-1}A^{T}\lambda, hence the dual function is
g(\lambda) = -\tfrac{1}{2}\lambda^{T}AQ^{-1}A^{T}\lambda - \lambda^{T}b

hence the Lagrangian dual of the QP is

maximize:  -\tfrac{1}{2}\lambda^{T}AQ^{-1}A^{T}\lambda - \lambda^{T}b

subject to: \lambda \geqslant 0.

Besides the Lagrangian duality theory, there are other duality pairings (e.g. Wolfe, etc.).

Complexity

For positive definite Q, the ellipsoid method solves the problem in polynomial time.[7] If, on the other hand, Q is indefinite, then the problem is NP-hard.[8] In fact, even if Q has only one negative eigenvalue, the problem is NP-hard.[9]

Solvers and scripting (programming) languages

Free open-source permissive licenses:

Name License Brief info
OpenOpt BSD Universal cross-platform numerical optimization framework, see its QP page and other problems involved. Uses NumPy arrays and SciPy sparse matrices.
qp-numpy BSD Built around the qld code written by K.Schittkowski of the University of Bayreuth, Germany

Free open-source copyleft (reciprocal) licenses:

Name License Brief info
CVXOPT GPL General purpose convex optimization solver written in Python

OOQP

Octave GPL General purpose GNU Octave solver for Quadratic Programming problems

Other Free open-source licenses:

Name License Brief info
CGAL QPL An exact solver QP_solver, part of the Computational Geometry Algorithms Library (CGAL)

Proprietary:

Name Brief info
AIMMS
AMPL
CPLEX Popular solver with an API for several programming languages
EXCEL Solver Function
FinMath A .NET numerical library containing an interior-point primal-dual solver for convex quadratic programming problems.
GAMS
Gurobi Solver with parallel algorithms for large-scale linear programs, quadratic programs and mixed-integer programs. Free for academic use.
Lingo
MATLAB A general-purpose and matrix-oriented programming-language for numerical computing. Quadratic programming in MATLAB requires the Optimization Toolbox in addition to the base MATLAB product
Mathematica A general-purpose programming-language for mathematics, including symbolic and numerical capabilities.
MOSEK A solver for large scale optimization with API for several languages (C++,java,.net, Matlab and python)
OptimJ Free Java-based Modeling Language for Optimization supporting multiple target solvers and available as an Eclipse plugin.[10][11]
Solver Foundation A .NET platform for modeling, scheduling, and optimization
TOMLAB Supports global optimization, integer programming, all types of least sqaures, linear, quadratic and unconstrained programming for MATLAB. TOMLAB supports solvers like Gurobi, CPLEX, SNOPT and KNITRO.
Xpress

See also

References

Notes

  1. ^ Nocedal, Jorge; Wright, Stephen J. (2006). Numerical Optimization (2nd ed.). Berlin, New York: Springer-Verlag. p. 449. ISBN 978-0-387-30303-1 .
  2. ^ Murty, K. G. (1988). Linear complementarity, linear and nonlinear programming. Sigma Series in Applied Mathematics. 3. Berlin: Heldermann Verlag. pp. xlviii+629 pp.. ISBN 3-88538-403-5. http://ioe.engin.umich.edu/people/fac/books/murty/linear_complementarity_webbook/.  (Available for download at the website of Professor Katta G. Murty.) MR949214
  3. ^ F. Delbos, J.Ch. Gilbert (2005). Global linear convergence of an augmented Lagrangian algorithm for solving convex quadratic optimization problems. Journal of Convex Analysis, 12, 45-69.
  4. ^ Murty, K. G. (1988). Linear complementarity, linear and nonlinear programming. Sigma Series in Applied Mathematics. 3. Berlin: Heldermann Verlag. pp. xlviii+629 pp.. ISBN 3-88538-403-5. http://ioe.engin.umich.edu/people/fac/books/murty/linear_complementarity_webbook/.  (Available for download at the website of Professor Katta G. Murty.) MR949214
  5. ^ Google search.
  6. ^ Nocedal, Jorge (2000), On the Solution of Equality Constrained Quadratic Programming Problems Arising in Optimization, SIAM Journal of Scientific Computing 
  7. ^ Kozlov, M. K.; S. P. Tarasov and Leonid G. Khachiyan (1979). "[Polynomial solvability of convex quadratic programming]". Doklady Akademii Nauk SSSR 248: 1049–1051.  Translated in: Soviet Mathematics - Doklady 20: 1108–1111. 
  8. ^ Sahni, S. "Computationally related problems," in SIAM Journal on Computing, 3, 262--279, 1974.
  9. ^ Quadratic programming with one negative eigenvalue is NP-hard, Panos M. Pardalos and Stephen A. Vavasis in Journal of Global Optimization, Volume 1, Number 1, 1991, pg.15-22.
  10. ^ http://www.in-ter-trans.eu/resources/Zesch_Hellingrath_2010_Integrated+Production-Distribution+Planning.pdf OptimJ used in an optimization model for mixed-model assembly lines, University of Münster
  11. ^ http://www.aaai.org/ocs/index.php/AAAI/AAAI10/paper/viewFile/1769/2076 OptimJ used in an Approximate Subgame-Perfect Equilibrium Computation Technique for Repeated Games

Bibliography

External links