To install click the Add extension button. That's it.

The source code for the WIKI 2 extension is being checked by specialists of the Mozilla Foundation, Google, and Apple. You could also do it yourself at any point in time.

4,5
Kelly Slayton
Congratulations on this excellent venture… what a great idea!
Alexander Grigorievskiy
I use WIKI 2 every day and almost forgot how the original Wikipedia looks like.
Live Statistics
English Articles
Improved in 24 Hours
Languages
Recent
Show all languages
What we do. Every page goes through several hundred of perfecting techniques; in live mode. Quite the same Wikipedia. Just better.
.
Leo
Newton
Brights
Milds

Quadratic programming (QP) is the process of solving a special type of mathematical optimization problem—specifically, a (linearly constrained) quadratic optimization problem, that is, the problem of optimizing (minimizing or maximizing) a quadratic function of several variables subject to linear constraints on these variables. Quadratic programming is a particular type of nonlinear programming.

• 1/5
Views:
43 272
9 394
4 707
6 309
3 500
• Lecture 18: Equality Constrained Quadratic Programming
• Lecture 19: Inequality-constrained Quadratic Programming (IQP)
• Lecture 20: Inequality-constrained Quadratic Programming - Example
• Mod-01 Lec-22 Solution of Quadratic Programming problem using Simplex Method

## Problem formulation

The quadratic programming problem with n variables and m constraints can be formulated as follows.[1] Given:

• a real-valued, n-dimensional vector c,
• an n × n-dimensional real symmetric matrix Q,
• an m × n-dimensional real matrix A, and
• an m-dimensional real vector b,

the objective of quadratic programming is to find an n-dimensional vector x, that will

 ${\displaystyle {\text{minimize}}}$ ${\displaystyle {\tfrac {1}{2}}\mathbf {x} ^{\mathrm {T} }Q\mathbf {x} +\mathbf {c} ^{\mathrm {T} }\mathbf {x} }$ ${\displaystyle {\text{subject to}}}$ ${\displaystyle A\mathbf {x} \leq \mathbf {b} ,}$

where xT denotes the vector transpose of ${\displaystyle \mathbf {x} }$. The notation Axb means that every entry of the vector Ax is less than or equal to the corresponding entry of the vector b.

## Solution methods

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

In the case in which Q is positive definite, the problem is a special case of the more general field of convex optimization.

### Equality constraints

Quadratic programming is particularly simple when Q is positive definite and there are only equality constraints; specifically, the solution process 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

${\displaystyle {\text{Minimize}}\quad {\tfrac {1}{2}}\mathbf {x} ^{\mathrm {T} }Q\mathbf {x} +\mathbf {c} ^{\mathrm {T} }\mathbf {x} }$
${\displaystyle {\text{subject to}}\quad E\mathbf {x} =\mathbf {d} }$

is given by the linear system

${\displaystyle {\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 ${\displaystyle \lambda }$ is a set of Lagrange multipliers which come out of the solution alongside ${\displaystyle \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 ${\displaystyle 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.[4]

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 ${\displaystyle \mathbf {d} =0}$ (generalizing to nonzero is straightforward). Looking at the constraint equations:

${\displaystyle E\mathbf {x} =0}$

introduce a new variable ${\displaystyle \mathbf {y} }$ defined by

${\displaystyle Z\mathbf {y} =\mathbf {x} }$

where ${\displaystyle \mathbf {y} }$ has dimension of ${\displaystyle \mathbf {x} }$ minus the number of constraints. Then

${\displaystyle EZ\mathbf {y} =0}$

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

${\displaystyle {\tfrac {1}{2}}\mathbf {x} ^{T}Q\mathbf {x} +\mathbf {c} ^{T}\mathbf {x} \quad \Rightarrow \quad {\tfrac {1}{2}}\mathbf {y} ^{T}Z^{T}QZ\mathbf {y} +(Z^{T}\mathbf {c} )^{T}\mathbf {y} }$

the solution of which is given by:

${\displaystyle Z^{T}QZ\mathbf {y} =-Z^{T}\mathbf {c} }$

Under certain conditions on ${\displaystyle Q}$, the reduced matrix ${\displaystyle Z^{T}QZ}$ will be positive definite. It is possible to write a variation on the conjugate gradient method which avoids the explicit calculation of ${\displaystyle Z}$.[5]

## Lagrangian duality

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

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

Defining the (Lagrangian) dual function ${\displaystyle g(\lambda )}$, defined as ${\displaystyle g(\lambda )=\inf _{x}L(x,\lambda )}$, we find an infimum of ${\displaystyle L}$, using ${\displaystyle \nabla _{x}L(x,\lambda )=0}$ and positive-definiteness of Q:

${\displaystyle x^{*}=-Q^{-1}A^{T}\lambda .}$

Hence the dual function is

${\displaystyle g(\lambda )=-{\tfrac {1}{2}}\lambda ^{T}AQ^{-1}A^{T}\lambda -\lambda ^{T}b,}$

and so the Lagrangian dual of the QP is

${\displaystyle {\text{ maximize}}\quad -{\tfrac {1}{2}}\lambda ^{T}AQ^{-1}A^{T}\lambda -\lambda ^{T}b}$

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.[6] If, on the other hand, Q is indefinite, then the problem is NP-hard.[7] In fact, even if Q has only one negative eigenvalue, the problem is NP-hard.[8]

## Solvers and scripting (programming) languages

Name Brief info
AIMMS A software system for modeling and solving optimization and scheduling-type problems
ALGLIB Dual licensed (GPL/proprietary) numerical library (C++, .NET).
AMPL A popular modeling language for large-scale mathematical optimization.
APMonitor Modeling and optimization suite for LP, QP, NLP, MILP, MINLP, and DAE systems in MATLAB and Python.
CGAL An open source computational geometry package which includes a quadratic programming solver.
CPLEX Popular solver with an API (C, C++, Java, .Net, Python, Matlab and R). Free for academics.
CVXOPT Python-based open-source solver for convex optimization problems (including quadratic programming)
Excel Solver Function A nonlinear solver adjusted to spreadsheets in which function evaluations are based on the recalculating cells. Basic version available as a standard add-on for Excel.
GAMS A high-level modeling system for mathematical optimization
Gurobi Solver with parallel algorithms for large-scale linear programs, quadratic programs and mixed-integer programs. Free for academic use.
IMSL A set of mathematical and statistical functions that programmers can embed into their software applications.
IPOPT Ipopt (Interior Point OPTimizer) is a software package for large-scale nonlinear optimization
Artelys Knitro An Integrated Package for Nonlinear Optimization
Maple General-purpose programming language for mathematics. Solving a quadratic problem in Maple is accomplished via its QPSolve command.
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)
NAG Numerical Library A collection of mathematical and statistical routines developed by the Numerical Algorithms Group for multiple programming languages (C, C++, Fortran, Visual Basic, Java and C#) and packages (MATLAB, Excel, R, LabVIEW). The Optimization chapter of the NAG Library includes routines for quadratic programming problems with both sparse and non-sparse linear constraint matrices, together with routines for the optimization of linear, nonlinear, sums of squares of linear or nonlinear functions with nonlinear, bounded or no constraints. The NAG Library has routines for both local and global optimization, and for continuous or integer problems.
GNU Octave A free (its licence is GPLv3) general-purpose and matrix-oriented programming-language for numerical computing, similar to MATLAB. Quadratic programming in in GNU Octave is available via its qp command
OptimJ Free Java-based Modeling Language for Optimization supporting multiple target solvers and available as an Eclipse plugin.[9][10]
R (Fortran) GPL licensed universal cross-platform statistical computation framework, see its quadprog page. Ported to javascript under MIT License. Ported to C# under LGPL.
SAS/OR A suite of solvers for Linear, Integer, Nonlinear, Derivative-Free, Network, Combinatorial and Constraint Optimization; the Algebraic modeling language OPTMODEL; and a variety of vertical solutions aimed at specific problems/markets, all of which are fully integrated with the SAS System.
TK Solver Mathematical modeling and problem solving software system based on a declarative, rule-based language, commercialized by Universal Technical Systems, Inc..
TOMLAB Supports global optimization, integer programming, all types of least squares, linear, quadratic and unconstrained programming for MATLAB. TOMLAB supports solvers like Gurobi, CPLEX, SNOPT and KNITRO.
XPRESS Solver for large-scale linear programs, quadratic programs, general nonlinear and mixed-integer programs. Has API for several programming languages, also has a modelling language Mosel and works with AMPL, GAMS. Free for academic use.

## 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. ^ a b Murty, Katta 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. MR 949214.
3. ^ Delbos, F.; Gilbert, J.Ch. (2005). "Global linear convergence of an augmented Lagrangian algorithm for solving convex quadratic optimization problems" (PDF). Journal of Convex Analysis. 12: 45–69.
6. ^ Kozlov, M. K.; S. P. Tarasov; 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. Missing or empty |title= (help)