Template:Short description Template:Expert needed

Quadratic programming (QP) is the process of solving certain mathematical optimization problems involving quadratic functions. Specifically, one seeks to optimize (minimize or maximize) a multivariate quadratic function subject to linear constraints on the variables. Quadratic programming is a type of nonlinear programming.

"Programming" in this context refers to a formal procedure for solving mathematical problems. This usage dates to the 1940s and is not specifically tied to the more recent notion of "computer programming." To avoid confusion, some practitioners prefer the term "optimization" — e.g., "quadratic optimization."<ref name="PrincetonCompanion">Template:Citation</ref>

Problem formulationEdit

The quadratic programming problem with Template:Mvar variables and Template:Mvar constraints can be formulated as follows.<ref>Template:Cite book.</ref> Given:

the objective of quadratic programming is to find an Template:Mvar-dimensional vector Template:Math, that will

minimize <math>\tfrac{1}{2} \mathbf{x}^\mathrm{T} Q\mathbf{x} + \mathbf{c}^\mathrm{T} \mathbf{x}</math>
subject to <math>A \mathbf{x} \preceq \mathbf{b},</math>

where Template:Math denotes the vector transpose of Template:Math, and the notation Template:Math means that every entry of the vector Template:Math is less than or equal to the corresponding entry of the vector Template:Math (component-wise inequality).

Constrained least squaresEdit

As a special case when Template:Math is symmetric positive-definite, the cost function reduces to least squares:

minimize R \mathbf{x} - \mathbf{d}\|^2 </math>
subject to <math>A \mathbf{x} \preceq \mathbf{b},</math>

where Template:Math follows from the Cholesky decomposition of Template:Math and Template:Math. Conversely, any such constrained least squares program can be equivalently framed as a quadratic programming problem, even for a generic non-square Template:Math matrix.

GeneralizationsEdit

When minimizing a function Template:Mvar in the neighborhood of some reference point Template:Math, Template:Mvar is set to its Hessian matrix Template:Math and Template:Math is set to its gradient Template:Math. A related programming problem, quadratically constrained quadratic programming, can be posed by adding quadratic constraints on the variables.

Solution methodsEdit

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

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

Equality constraintsEdit

Quadratic programming is particularly simple when Template:Mvar 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

<math>\text{Minimize} \quad \tfrac{1}{2} \mathbf{x}^\mathrm{T} Q\mathbf{x} + \mathbf{c}^\mathrm{T} \mathbf{x}</math>
<math>\text{subject to} \quad E\mathbf{x} =\mathbf{d}</math>

is given by the linear system

<math>

\begin{bmatrix}

  Q & E^\top \\
  E & 0

\end{bmatrix} \begin{bmatrix} \mathbf x \\ \lambda \end{bmatrix} = \begin{bmatrix} -\mathbf c \\ \mathbf d \end{bmatrix} </math>

where Template:Math is a set of Lagrange multipliers which come out of the solution alongside Template:Math.

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 the problem is never positive definite (even if Template:Mvar is), making it potentially very difficult to find a good numeric approach, and there are many approaches to choose from dependent on the problem.

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 Template:Math (generalizing to nonzero is straightforward). Looking at the constraint equations:

<math>E\mathbf{x} = 0</math>

introduce a new variable Template:Math defined by

<math>Z \mathbf{y} = \mathbf x</math>

where Template:Math has dimension of Template:Math minus the number of constraints. Then

<math>E Z \mathbf{y} = \mathbf 0</math>

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

<math>\tfrac{1}{2} \mathbf{x}^\top Q\mathbf{x} + \mathbf{c}^\top \mathbf{x} \quad \implies \quad

\tfrac{1}{2} \mathbf{y}^\top Z^\top Q Z \mathbf{y} + \left(Z^\top \mathbf{c}\right)^\top \mathbf{y}</math>

the solution of which is given by:

<math>Z^\top Q Z \mathbf{y} = -Z^\top \mathbf{c}</math>

Under certain conditions on Template:Mvar, the reduced matrix Template:Math will be positive definite. It is possible to write a variation on the conjugate gradient method which avoids the explicit calculation of Template:Mvar.<ref>Template:Cite journal</ref>

Lagrangian dualityEdit

Template:See also

The Lagrangian dual of a quadratic programming problem is also a quadratic programming problem. To see this let us focus on the case where Template:Math and Template:Mvar is positive definite. We write the Lagrangian function as

<math>L(x,\lambda) = \tfrac{1}{2} x^\top Qx + \lambda^\top (Ax-b). </math>

Defining the (Lagrangian) dual function Template:Math as <math>g(\lambda) = \inf_{x} L(x,\lambda) </math>, we find an infimum of Template:Mvar, using <math>\nabla_{x} L(x,\lambda)=0</math> and positive-definiteness of Template:Mvar:

<math>x^* = -Q^{-1} A^\top \lambda.</math>

Hence the dual function is

<math>g(\lambda) = -\tfrac{1}{2} \lambda^\top AQ^{-1}A^\top \lambda - \lambda^\top b,</math>

and so the Lagrangian dual of the quadratic programming problem is

<math>\text{maximize}_{\lambda\geq 0} \quad -\tfrac{1}{2} \lambda^\top AQ^{-1} A^\top \lambda - \lambda^\top b.</math>

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

Run-time complexityEdit

Convex quadratic programmingEdit

For positive definite Template:Mvar, when the problem is convex, the ellipsoid method solves the problem in (weakly) polynomial time.<ref>Template:Cite journal Translated in: Template:Cite journal</ref>

Ye and Tse<ref>Template:Cite journal</ref> present a polynomial-time algorithm, which extends Karmarkar's algorithm from linear programming to convex quadratic programming. On a system with n variables and L input bits, their algorithm requires O(L n) iterations, each of which can be done using O(L n3) arithmetic operations, for a total runtime complexity of O(L2 n4).

Kapoor and Vaidya<ref>Template:Cite book</ref> present another algorithm, which requires O(L * log L * n3.67 * log n) arithmetic operations.

Non-convex quadratic programmingEdit

If Template:Mvar is indefinite, (so the problem is non-convex) then the problem is NP-hard.<ref>Template:Cite journal</ref> A simple way to see this is to consider the non-convex quadratic constraint xi2 = xi. This constraint is equivalent to requiring that xi is in {0,1}, that is, xi is a binary integer variable. Therefore, such constraints can be used to model any integer program with binary variables, which is known to be NP-hard.

Moreover, these non-convex problems might have several stationary points and local minima. In fact, even if Template:Mvar has only one negative eigenvalue, the problem is (strongly) NP-hard.<ref>Template:Cite journal</ref>

Moreover, finding a KKT point of a non-convex quadratic program is CLS-hard.<ref>Template:Cite arXiv</ref>

Mixed-integer quadratic programmingEdit

There are some situations where one or more elements of the vector Template:Math will need to take on integer values. This leads to the formulation of a mixed-integer quadratic programming (MIQP) problem.<ref>Template:Cite journal</ref> Applications of MIQP include water resources<ref>Template:Cite journal</ref> and the construction of index funds.<ref>Template:Cite book</ref>

Solvers and scripting (programming) languagesEdit

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.
Artelys Knitro An Integrated Package for Nonlinear Optimization
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.
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
GNU Octave A free (its licence is GPLv3) general-purpose and matrix-oriented programming-language for numerical computing, similar to MATLAB. Quadratic programming in GNU Octave is available via its qp command
HiGHS Open-source software for solving linear programming (LP), mixed-integer programming (MIP), and convex quadratic programming (QP) models
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.
Julia A high-level programming language with notable solving package being JuMP
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.
Python High-level programming language with bindings for most available solvers. Quadratic programming is available via the solve_qp function or by calling a specific solver directly.
R (Fortran) GPL licensed universal cross-platform statistical computation framework.
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.
SuanShu an open-source suite of optimization algorithms to solve LP, QP, SOCP, SDP, SQP in Java
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 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.

ExtensionsEdit

Polynomial optimization<ref>Template:Citation</ref> is a more general framework, in which the constraints can be polynomial functions of any degree, not only 2.

See alsoEdit

ReferencesEdit

Template:Reflist

Further readingEdit

|CitationClass=web }}

External linksEdit

Template:Mathematical programming Template:Optimization algorithms Template:Authority control