Quadratic programming

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."[1]

Problem formulation

The quadratic programming problem with n variables and m constraints can be formulated as follows.[2] 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

minimize
subject to

where xT denotes the vector transpose of x, and the notation Axb means that every entry of the vector Ax is less than or equal to the corresponding entry of the vector b (component-wise inequality).

Least squares

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

minimize
subject to

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.

Generalizations

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.

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

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.[5]

Lagrangian duality

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 , we find an infimum of L, using 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.).

Complexity

For positive definite Q, the ellipsoid method solves the problem in (weakly) polynomial time.[6] If, on the other hand, Q is indefinite, then the problem is NP-hard.[7] There can be several stationary points and local minima for these non-convex problems. In fact, even if Q has only one negative eigenvalue, the problem is (strongly) NP-hard.[8]

Integer constraints

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.[9] Applications of MIQP include water resources[10] and the construction of index funds.[11]

Solvers and scripting (programming) languages

Name Brief info
AIMMSA software system for modeling and solving optimization and scheduling-type problems
ALGLIBDual licensed (GPL/proprietary) numerical library (C++, .NET).
AMPLA popular modeling language for large-scale mathematical optimization.
APMonitorModeling and optimization suite for LP, QP, NLP, MILP, MINLP, and DAE systems in MATLAB and Python.
Artelys KnitroAn Integrated Package for Nonlinear Optimization
CGALAn open source computational geometry package which includes a quadratic programming solver.
CPLEXPopular solver with an API (C, C++, Java, .Net, Python, Matlab and R). Free for academics.
Excel Solver FunctionA 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.
GAMSA high-level modeling system for mathematical optimization
GNU OctaveA 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
HiGHSOpen-source software for solving linear programming (LP), mixed-integer programming (MIP), and convex quadratic programming (QP) models
IMSLA set of mathematical and statistical functions that programmers can embed into their software applications.
IPOPTIPOPT (Interior Point OPTimizer) is a software package for large-scale nonlinear optimization.
MapleGeneral-purpose programming language for mathematics. Solving a quadratic problem in Maple is accomplished via its QPSolve command.
MATLABA 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
MathematicaA general-purpose programming-language for mathematics, including symbolic and numerical capabilities.
MOSEKA solver for large scale optimization with API for several languages (C++, Java, .Net, Matlab and Python).
NAG Numerical LibraryA 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.
PythonHigh-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/ORA 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.
SuanShuan open-source suite of optimization algorithms to solve LP, QP, SOCP, SDP, SQP in Java
TK SolverMathematical modeling and problem solving software system based on a declarative, rule-based language, commercialized by Universal Technical Systems, Inc..
TOMLABSupports global optimization, integer programming, all types of least squares, linear, quadratic and unconstrained programming for MATLAB. TOMLAB supports solvers like CPLEX, SNOPT and KNITRO.
XPRESSSolver 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.

See also

References

  1. 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
  2. Nocedal, Jorge; Wright, Stephen J. (2006). Numerical Optimization (2nd ed.). Berlin, New York: Springer-Verlag. p. 449. ISBN 978-0-387-30303-1..
  3. 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.
  4. 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.
  5. 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. CiteSeerX 10.1.1.129.7555. doi:10.1137/S1064827598345667.
  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. {{cite journal}}: Missing or empty |title= (help)
  7. 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.
  8. 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.
  9. Lazimy, Rafael (1982-12-01). "Mixed-integer quadratic programming". Mathematical Programming. 22 (1): 332–349. doi:10.1007/BF01581047. ISSN 1436-4646. S2CID 8456219.
  10. 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).
  11. 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.

Further reading

This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.