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
A problem is a difficulty which may be resolved by problem solving.
Problem(s) or The Problem may also refer to:
People
* Problem (rapper), (born 1985) American rapper Books
* ''Problems'' (Aristotle), an Aristotelian (or pseudo-Aristotelian) co ...
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 polynomial ...
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
In mathematics, nonlinear programming (NLP) is the process of solving an optimization problem where some of the constraints or the objective function are nonlinear. An optimization problem is one of calculation of the extrema (maxima, minima or s ...
.
"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
Real may refer to:
Currencies
* Brazilian real (R$)
* Central American Republic real
* Mexican real
* Portuguese real
* Spanish real
* Spanish colonial real
Music Albums
* ''Real'' (L'Arc-en-Ciel album) (2000)
* ''Real'' (Bright album) (2010) ...
-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 re ...
,
* 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'' (franchis ...
, 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 effici ...
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 gradi ...
. A related programming problem,
quadratically constrained quadratic programming, 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
In mathematics, specifically in topology,
the interior of a subset of a topological space is the union of all subsets of that are open in .
A point that is in the interior of is an interior point of .
The interior of is the complement of t ...
,
:*
active set,
:*
augmented Lagrangian,
:*
conjugate gradient
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 iterat ...
,
:*
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 n ...
.
In the case in which is
positive definite In mathematics, positive definiteness is a property of any object to which a bilinear form or a sesquilinear form may be naturally associated, which is positive-definite. See, in particular:
* Positive-definite bilinear form
* Positive-definite f ...
, 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 probl ...
.
Equality constraints
Quadratic programming is particularly simple when is
positive definite In mathematics, positive definiteness is a property of any object to which a bilinear form or a sesquilinear form may be naturally associated, which is positive-definite. See, in particular:
* Positive-definite bilinear form
* Positive-definite f ...
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 e ...
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
In numerical analysis and linear algebra, lower–upper (LU) decomposition or factorization factors a matrix as the product of a lower triangular matrix and an upper triangular matrix (see matrix decomposition). The product sometimes includes a p ...
), 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 a function, domain of the map which is mapped to the zero vector. That is, given a linear map between two vector space ...
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 iterativ ...
which avoids the explicit calculation of .
Lagrangian duality
The Lagrangian
dual 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 low ...
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 In mathematics, positive definiteness is a property of any object to which a bilinear form or a sesquilinear form may be naturally associated, which is positive-definite. See, in particular:
* Positive-definite bilinear form
* Positive-definite f ...
, the
ellipsoid method
In mathematical optimization, the ellipsoid method is an iterative method for convex optimization, minimizing convex functions. When specialized to solving feasible linear optimization problems with rational data, the ellipsoid method is an algor ...
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 denoted b ...
, 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; slight ...
and the
construction of index funds.
Solvers and scripting (programming) languages
See also
*
Sequential quadratic programming
Sequential quadratic programming (SQP) is an iterative method for constrained nonlinear optimization. SQP methods are used on mathematical problems for which the objective function and the constraints are twice continuously differentiable.
SQP me ...
*
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 function#As a polynomial function, li ...
*
Critical line method Portfolio optimization is the process of selecting the best portfolio (asset distribution), out of the set of all portfolios being considered, according to some objective. The objective typically maximizes factors such as expected return, and minimi ...
References
Further reading
*
* A6: MP2, pg.245.
*
External links
A page about QPNEOS Optimization Guide: Quadratic ProgrammingQuadratic Programming
{{Optimization algorithms
Optimization algorithms and methods