The quadratic programming problem with n variables and m constraints can be formulated as follows.2 Given:
the objective of quadratic programming is to find an n-dimensional vector x, that will
where xT denotes the vector transpose of x, and the notation Ax ⪯ b means that every entry of the vector Ax is less than or equal to the corresponding entry of the vector b (component-wise inequality).
As a special case when Q is symmetric positive-definite, the cost function reduces to least squares:
where Q = RTR follows from the Cholesky decomposition of Q and c = −RT d. Conversely, any such constrained least squares program can be equivalently framed as a quadratic programming problem, even for a generic non-square R matrix.
When minimizing a function f in the neighborhood of some reference point x0, Q is set to its Hessian matrix H(f(x0)) and c is set to its gradient ∇f(x0). A related programming problem, quadratically constrained quadratic programming, can be posed by adding quadratic constraints on the variables.
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.
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
is given by the linear system
where λ is a set of Lagrange multipliers which come out of the solution alongside 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 the 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.
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 d = 0 (generalizing to nonzero is straightforward). Looking at the constraint equations:
introduce a new variable y defined by
where y has dimension of x minus the number of constraints. Then
and if Z is chosen so that EZ = 0 the constraint equation will be always satisfied. Finding such Z 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:
the solution of which is given by:
Under certain conditions on Q, the reduced matrix ZTQZ will be positive definite. It is possible to write a variation on the conjugate gradient method which avoids the explicit calculation of Z.6
See also: Dual problem
The Lagrangian dual of a quadratic programming problem is also a quadratic programming problem. To see this let us focus on the case where c = 0 and Q is positive definite. We write the Lagrangian function as
Defining the (Lagrangian) dual function g(λ) as g ( λ ) = inf x L ( x , λ ) {\displaystyle g(\lambda )=\inf _{x}L(x,\lambda )} , we find an infimum of L, using ∇ x L ( x , λ ) = 0 {\displaystyle \nabla _{x}L(x,\lambda )=0} and positive-definiteness of Q:
Hence the dual function is
and so the Lagrangian dual of the quadratic programming problem is
Besides the Lagrangian duality theory, there are other duality pairings (e.g. Wolfe, etc.).
For positive definite Q, when the problem is convex, the ellipsoid method solves the problem in (weakly) polynomial time.7
Ye and Tse8 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 Vaidya9 present another algorithm, which requires O(L * log L * n3.67 * log n) arithmetic operations.
If Q is indefinite, (so the problem is non-convex) then the problem is NP-hard.10 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 Q has only one negative eigenvalue, the problem is (strongly) NP-hard.11
Moreover, finding a KKT point of a non-convex quadratic program is CLS-hard.12
There are some situations where one or more elements of the vector x will need to take on integer values. This leads to the formulation of a mixed-integer quadratic programming (MIQP) problem.13 Applications of MIQP include water resources14 and the construction of index funds.15
Polynomial optimization16 is a more general framework, in which the constraints can be polynomial functions of any degree, not only 2.
Wright, Stephen J. (2015), "Continuous Optimization (Nonlinear and Linear Programming)", in Nicholas J. Higham; et al. (eds.), The Princeton Companion to Applied Mathematics, Princeton University Press, pp. 281–293 ↩
Nocedal, Jorge; Wright, Stephen J. (2006). Numerical Optimization (2nd ed.). Berlin, New York: Springer-Verlag. p. 449. ISBN 978-0-387-30303-1.. 978-0-387-30303-1 ↩
Murty, Katta G. (1988). Linear complementarity, linear and nonlinear programming. Sigma Series in Applied Mathematics. Vol. 3. Berlin: Heldermann Verlag. pp. xlviii+629 pp. ISBN 978-3-88538-403-8. MR 0949214. Archived from the original on 2010-04-01. 978-3-88538-403-8 ↩
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. Archived (PDF) from the original on 2022-10-09. http://www.heldermann-verlag.de/jca/jca12/jca1203_b.pdf ↩
Gould, Nicholas I. M.; Hribar, Mary E.; Nocedal, Jorge (April 2001). "On the Solution of Equality Constrained Quadratic Programming Problems Arising in Optimization". SIAM J. Sci. Comput. 23 (4): 1376–1395. Bibcode:2001SJSC...23.1376G. CiteSeerX 10.1.1.129.7555. doi:10.1137/S1064827598345667. /wiki/Bibcode_(identifier) ↩
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. {{cite journal}}: Missing or empty |title= (help) /wiki/Leonid_Khachiyan ↩
Ye, Yinyu; Tse, Edison (1989-05-01). "An extension of Karmarkar's projective algorithm for convex quadratic programming". Mathematical Programming. 44 (1): 157–179. doi:10.1007/BF01587086. ISSN 1436-4646. S2CID 35753865. https://doi.org/10.1007/BF01587086 ↩
Kapoor, S; Vaidya, P M (1986-11-01). "Fast algorithms for convex quadratic programming and multicommodity flows". Proceedings of the eighteenth annual ACM symposium on Theory of computing - STOC '86. New York, NY, USA: Association for Computing Machinery. pp. 147–159. doi:10.1145/12130.12145. ISBN 978-0-89791-193-1. S2CID 18108815. 978-0-89791-193-1 ↩
Sahni, S. (1974). "Computationally related problems" (PDF). SIAM Journal on Computing. 3 (4): 262–279. CiteSeerX 10.1.1.145.8685. doi:10.1137/0203021. http://www.cise.ufl.edu/~sahni/papers/comp.pdf ↩
Pardalos, Panos M.; Vavasis, Stephen A. (1991). "Quadratic programming with one negative eigenvalue is (strongly) NP-hard". Journal of Global Optimization. 1 (1): 15–22. doi:10.1007/bf00120662. S2CID 12602885. /wiki/Doi_(identifier) ↩
Fearnley, John; Goldberg, Paul W.; Hollender, Alexandros; Savani, Rahul (2023). "The Complexity of Computing KKT Solutions of Quadratic Programs". arXiv:2311.13738 [cs.CC]. /wiki/ArXiv_(identifier) ↩
Lazimy, Rafael (1982-12-01). "Mixed-integer quadratic programming". Mathematical Programming. 22 (1): 332–349. doi:10.1007/BF01581047. ISSN 1436-4646. S2CID 8456219. /wiki/Doi_(identifier) ↩
Propato Marco; Uber James G. (2004-07-01). "Booster System Design Using Mixed-Integer Quadratic Programming". Journal of Water Resources Planning and Management. 130 (4): 348–352. doi:10.1061/(ASCE)0733-9496(2004)130:4(348). /wiki/Doi_(identifier) ↩
Cornuéjols, Gérard; Peña, Javier; Tütüncü, Reha (2018). Optimization Methods in Finance (2nd ed.). Cambridge, UK: Cambridge University Press. pp. 167–168. ISBN 9781107297340. 9781107297340 ↩
Tuy, Hoang (2016), Tuy, Hoang (ed.), "Polynomial Optimization", Convex Analysis and Global Optimization, Springer Optimization and Its Applications, vol. 110, Cham: Springer International Publishing, pp. 435–452, doi:10.1007/978-3-319-31484-6_12, ISBN 978-3-319-31484-6, retrieved 2023-12-16 978-3-319-31484-6 ↩