Quadratic programming

Last updated

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.

Contents

"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:

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).

Constrained 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 = −RTd. 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.).

Run-time complexity

Convex quadratic programming

For positive definite Q, when the problem is convex, the ellipsoid method solves the problem in (weakly) polynomial time. [6]

Ye and Tse [7] 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(L2n4).

Kapoor and Vaidya [8] present another algorithm, which requires O(L * log L* n3.67 * log n) arithmetic operations.

Non-convex quadratic programming

If Q is indefinite, (so the problem is non-convex) then the problem is NP-hard. [9] 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. [10]

Moreover, finding a KKT point of a non-convex quadratic program is CLS-hard. [11]

Mixed-integer quadratic programming

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. [12] Applications of MIQP include water resources [13] and the construction of index funds. [14]

Solvers and scripting (programming) languages

NameBrief 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 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.
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/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.
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.

Extensions

Polynomial optimization [15] is a more general framework, in which the constraints can be polynomial functions of any degree, not only 2.

See also

Related Research Articles

In mathematics, a symmetric matrix with real entries is positive-definite if the real number is positive for every nonzero real column vector where is the row vector transpose of More generally, a Hermitian matrix is positive-definite if the real number is positive for every nonzero complex column vector where denotes the conjugate transpose of

<span class="mw-page-title-main">Linear programming</span> Method to solve optimization problems

Linear programming (LP), also called linear optimization, is a method to achieve the best outcome in a mathematical model whose requirements and objective are represented by linear relationships. Linear programming is a special case of mathematical programming.

<span class="mw-page-title-main">Ellipsoid</span> Quadric surface that looks like a deformed sphere

An ellipsoid is a surface that can be obtained from a sphere by deforming it by means of directional scalings, or more generally, of an affine transformation.

In mathematical optimization, the method of Lagrange multipliers is a strategy for finding the local maxima and minima of a function subject to equation constraints. It is named after the mathematician Joseph-Louis Lagrange.

In mathematics, a quadratic form is a polynomial with terms all of degree two. For example,

In mathematical optimization, Dantzig's simplex algorithm is a popular algorithm for linear programming.

<span class="mw-page-title-main">Optimal control</span> Mathematical way of attaining a desired output from a dynamic system

Optimal control theory is a branch of control theory that deals with finding a control for a dynamical system over a period of time such that an objective function is optimized. It has numerous applications in science, engineering and operations research. For example, the dynamical system might be a spacecraft with controls corresponding to rocket thrusters, and the objective might be to reach the Moon with minimum fuel expenditure. Or the dynamical system could be a nation's economy, with the objective to minimize unemployment; the controls in this case could be fiscal and monetary policy. A dynamical system may also be introduced to embed operations research problems within the framework of optimal control theory.

In mathematics, the Hessian matrix, Hessian or Hesse matrix 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 in the 19th century by the German mathematician Ludwig Otto Hesse and later named after him. Hesse originally used the term "functional determinants". The Hessian is sometimes denoted by H or, ambiguously, by ∇2.

In mathematical optimization theory, the linear complementarity problem (LCP) arises frequently in computational mechanics and encompasses the well-known quadratic programming as a special case. It was proposed by Cottle and Dantzig in 1968.

<span class="mw-page-title-main">Interior-point method</span> Algorithms for solving convex optimization problems

Interior-point methods are algorithms for solving linear and non-linear convex optimization problems. IPMs combine two advantages of previously-known algorithms:

Convex optimization is a subfield of mathematical optimization that studies the problem of minimizing convex functions over convex sets. Many classes of convex optimization problems admit polynomial-time algorithms, whereas mathematical optimization is in general NP-hard.

In linear algebra, an eigenvector or characteristic vector is a vector that has its direction unchanged by a given linear transformation. More precisely, an eigenvector, , of a linear transformation, , is scaled by a constant factor, , when the linear transformation is applied to it: . It is often important to know these vectors in linear algebra. The corresponding eigenvalue, characteristic value, or characteristic root is the multiplying factor .

In mathematical optimization, the Karush–Kuhn–Tucker (KKT) conditions, also known as the Kuhn–Tucker conditions, are first derivative tests for a solution in nonlinear programming to be optimal, provided that some regularity conditions are satisfied.

In mathematical optimization theory, duality or the duality principle is the principle that optimization problems may be viewed from either of two perspectives, the primal problem or the dual problem. If the primal is a minimization problem then the dual is a maximization problem. Any feasible solution to the primal (minimization) problem is at least as large as any feasible solution to the dual (maximization) problem. Therefore, the solution to the primal is an upper bound to the solution of the dual, and the solution of the dual is a lower bound to the solution of the primal. This fact is called weak duality.

Sequential quadratic programming (SQP) is an iterative method for constrained nonlinear optimization which may be considered a quasi-Newton method. SQP methods are used on mathematical problems for which the objective function and the constraints are twice continuously differentiable, but not necessarily convex.

In linear algebra, eigendecomposition is the factorization of a matrix into a canonical form, whereby the matrix is represented in terms of its eigenvalues and eigenvectors. Only diagonalizable matrices can be factorized in this way. When the matrix being factorized is a normal or real symmetric matrix, the decomposition is called "spectral decomposition", derived from the spectral theorem.

In mathematics, the quadratic eigenvalue problem (QEP), is to find scalar eigenvalues , left eigenvectors and right eigenvectors such that

Large margin nearest neighbor (LMNN) classification is a statistical machine learning algorithm for metric learning. It learns a pseudometric designed for k-nearest neighbor classification. The algorithm is based on semidefinite programming, a sub-class of convex optimization.

Augmented Lagrangian methods are a certain class of algorithms for solving constrained optimization problems. They have similarities to penalty methods in that they replace a constrained optimization problem by a series of unconstrained problems and add a penalty term to the objective, but the augmented Lagrangian method adds yet another term designed to mimic a Lagrange multiplier. The augmented Lagrangian is related to, but not identical with, the method of Lagrange multipliers.

The quadratic knapsack problem (QKP), first introduced in 19th century, is an extension of knapsack problem that allows for quadratic terms in the objective function: Given a set of items, each with a weight, a value, and an extra profit that can be earned if two items are selected, determine the number of items to include in a collection without exceeding capacity of the knapsack, so as to maximize the overall profit. Usually, quadratic knapsack problems come with a restriction on the number of copies of each kind of item: either 0, or 1. This special type of QKP forms the 0-1 quadratic knapsack problem, which was first discussed by Gallo et al. The 0-1 quadratic knapsack problem is a variation of knapsack problems, combining the features of unbounded knapsack problem, 0-1 knapsack problem and quadratic knapsack problem.

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. 1 2 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. 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.
  8. 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.
  9. 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.
  10. 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.
  11. Fearnley, John; Goldberg, Paul W.; Hollender, Alexandros; Savani, Rahul (2023). "The Complexity of Computing KKT Solutions of Quadratic Programs". arXiv: 2311.13738 [cs.CC].
  12. Lazimy, Rafael (1982-12-01). "Mixed-integer quadratic programming". Mathematical Programming. 22 (1): 332–349. doi:10.1007/BF01581047. ISSN   1436-4646. S2CID   8456219.
  13. 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).
  14. 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.
  15. 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

Further reading