Quadratic programming (QP) is the process of solving certain
mathematical optimization
Mathematical optimization (alternatively spelled ''optimisation'') or mathematical programming is the selection of a best element, with regard to some criterion, from some set of available alternatives. It is generally divided into two subfi ...
problems involving
quadratic function
In mathematics, a quadratic polynomial is a polynomial of degree two in one or more variables. A quadratic function is the polynomial function defined by a quadratic polynomial. Before 20th century, the distinction was unclear between a polynomi ...
s. 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."
Problem formulation
The quadratic programming problem with variables and constraints can be formulated as follows.
Given:
* a
real-valued, -dimensional vector ,
* an -dimensional real
symmetric matrix
In linear algebra, a symmetric matrix is a square matrix that is equal to its transpose. Formally,
Because equal matrices have equal dimensions, only square matrices can be symmetric.
The entries of a symmetric matrix are symmetric with ...
,
* an -dimensional real
matrix
Matrix most commonly refers to:
* ''The Matrix'' (franchise), an American media franchise
** '' The Matrix'', a 1999 science-fiction action film
** "The Matrix", a fictional setting, a virtual reality environment, within ''The Matrix'' (franchi ...
, and
* an -dimensional real vector ,
the objective of quadratic programming is to find an -dimensional vector , that will
:
where denotes the vector
transpose
In linear algebra, the transpose of a matrix is an operator which flips a matrix over its diagonal;
that is, it switches the row and column indices of the matrix by producing another matrix, often denoted by (among other notations).
The tr ...
of , and the notation means that every entry of the vector is less than or equal to the corresponding entry of the vector (component-wise inequality).
Least squares
As a special case when ''Q'' is
symmetric positive-definite, the cost function reduces to least squares:
:
where follows from the
Cholesky decomposition
In linear algebra, the Cholesky decomposition or Cholesky factorization (pronounced ) is a decomposition of a Hermitian, positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose, which is useful for effi ...
of and . Conversely, any such constrained least squares program can be equivalently framed as a QP, even for generic non-square matrix.
Generalizations
When minimizing a function in the neighborhood of some reference point , is set to its
Hessian matrix
In mathematics, the Hessian matrix or Hessian is a square matrix of second-order partial derivatives of a scalar-valued function, or scalar field. It describes the local curvature of a function of many variables. The Hessian matrix was developed ...
and is set to its
gradient
In vector calculus, the gradient of a scalar-valued differentiable function of several variables is the vector field (or vector-valued function) \nabla f whose value at a point p is the "direction and rate of fastest increase". If the gr ...
. A related programming problem,
quadratically constrained quadratic program In mathematical optimization, a quadratically constrained quadratic program (QCQP) is an optimization problem in which both the objective function and the constraints are quadratic functions. It has the form
: \begin
& \text && \tfrac12 x^\mathr ...
ming, can be posed by adding quadratic constraints on the variables.
Solution methods
For general problems a variety of methods are commonly used, including
:*
interior point,
:*
active set,
:*
augmented Lagrangian,
:*
conjugate gradient,
:*
gradient projection,
:*extensions of the
simplex algorithm
In mathematical optimization, Dantzig's simplex algorithm (or simplex method) is a popular algorithm for linear programming.
The name of the algorithm is derived from the concept of a simplex and was suggested by T. S. Motzkin. Simplices are no ...
.
In the case in which is
positive definite, the problem is a special case of the more general field of
convex optimization
Convex optimization is a subfield of mathematical optimization that studies the problem of minimizing convex functions over convex sets (or, equivalently, maximizing concave functions over convex sets). Many classes of convex optimization prob ...
.
Equality constraints
Quadratic programming is particularly simple when is
positive definite and there are only equality constraints; specifically, the solution process is linear. By using
Lagrange multipliers
In mathematical optimization, the method of Lagrange multipliers is a strategy for finding the local maxima and minima of a function subject to equality constraints (i.e., subject to the condition that one or more equations have to be satisfied ...
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
:
where is a set of Lagrange multipliers which come out of the solution alongside .
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 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 (generalizing to nonzero is straightforward). Looking at the constraint equations:
:
introduce a new variable defined by
:
where has dimension of minus the number of constraints. Then
:
and if is chosen so that the constraint equation will be always satisfied. Finding such entails finding the
null space
In mathematics, the kernel of a linear map, also known as the null space or nullspace, is the linear subspace of the domain of the map which is mapped to the zero vector. That is, given a linear map between two vector spaces and , the kernel ...
of , which is more or less simple depending on the structure of . Substituting into the quadratic form gives an unconstrained minimization problem:
:
the solution of which is given by:
:
Under certain conditions on , the reduced matrix will be positive definite. It is possible to write a variation on the
conjugate gradient method
In mathematics, the conjugate gradient method is an algorithm for the numerical solution of particular systems of linear equations, namely those whose matrix is positive-definite. The conjugate gradient method is often implemented as an iter ...
which avoids the explicit calculation of .
Lagrangian duality
The Lagrangian
dual
Dual or Duals may refer to:
Paired/two things
* Dual (mathematics), a notion of paired concepts that mirror one another
** Dual (category theory), a formalization of mathematical duality
*** see more cases in :Duality theories
* Dual (grammatical ...
of a QP is also a QP. To see this let us focus on the case where and is positive definite. We write the
Lagrangian
Lagrangian may refer to:
Mathematics
* Lagrangian function, used to solve constrained minimization problems in optimization theory; see Lagrange multiplier
** Lagrangian relaxation, the method of approximating a difficult constrained problem with ...
function as
:
Defining the (Lagrangian) dual function as
, we find an
infimum
In mathematics, the infimum (abbreviated inf; plural infima) of a subset S of a partially ordered set P is a greatest element in P that is less than or equal to each element of S, if such an element exists. Consequently, the term ''greatest ...
of , using
and positive-definiteness of :
:
Hence the dual function is
:
and so the Lagrangian dual of the QP is
:
Besides the Lagrangian duality theory, there are other duality pairings (e.g.
Wolfe, etc.).
Complexity
For
positive definite , the
ellipsoid method
In mathematical optimization, the ellipsoid method is an iterative method for minimizing convex functions. When specialized to solving feasible linear optimization problems with rational data, the ellipsoid method is an algorithm which finds an ...
solves the problem in (weakly)
polynomial time
In computer science, the time complexity is the computational complexity that describes the amount of computer time it takes to run an algorithm. Time complexity is commonly estimated by counting the number of elementary operations performed by ...
. If, on the other hand, is indefinite, then the problem is
NP-hard
In computational complexity theory, NP-hardness ( non-deterministic polynomial-time hardness) is the defining property of a class of problems that are informally "at least as hard as the hardest problems in NP". A simple example of an NP-hard pr ...
.
There can be several stationary points and local minima for these non-convex problems. In fact, even if has only one negative
eigenvalue
In linear algebra, an eigenvector () or characteristic vector of a linear transformation is a nonzero vector that changes at most by a scalar factor when that linear transformation is applied to it. The corresponding eigenvalue, often denot ...
, the problem is (strongly)
NP-hard
In computational complexity theory, NP-hardness ( non-deterministic polynomial-time hardness) is the defining property of a class of problems that are informally "at least as hard as the hardest problems in NP". A simple example of an NP-hard pr ...
.
Integer constraints
There are some situations where one or more elements of the vector will need to take on
integer
An integer is the number zero (), a positive natural number (, , , etc.) or a negative integer with a minus sign ( −1, −2, −3, etc.). The negative numbers are the additive inverses of the corresponding positive numbers. In the language ...
values. This leads to the formulation of a mixed-integer quadratic programming (MIQP) problem. Applications of MIQP include
water resources
Water resources are natural resources of water that are potentially useful for humans, for example as a source of drinking water supply or irrigation water. 97% of the water on the Earth is salt water and only three percent is fresh water; sligh ...
and the
construction of index funds.
Solvers and scripting (programming) languages
See also
*
Sequential quadratic programming
*
Linear programming
Linear programming (LP), also called linear optimization, is a method to achieve the best outcome (such as maximum profit or lowest cost) in a mathematical model whose requirements are represented by linear relationships. Linear programming is ...
*
Critical line method
References
Further reading
*
* A6: MP2, pg.245.
*
External links
A page about QPNEOS Optimization Guide: Quadratic ProgrammingQuadratic Programming
{{Optimization algorithms
Optimization algorithms and methods