Quadratic programming
Template:External links Quadratic programming (QP) is a special type of mathematical optimization problem. It is the problem of optimizing (minimizing or maximizing) a quadratic function of several variables subject to linear constraints on these variables.
Contents
Problem formulation
The quadratic programming problem can be formulated as follows.^{[1]}
Suppose is a positive integer representing the number of variables and is a positive integer representing the number of constraints. Suppose is an -dimensional real vector, is an real symmetric matrix, is an real matrix, and is an -dimensional real vector.
The quadratic programming problem is
minimize | |
subject to |
where denotes the vector transpose of . The notation means that every entry of the vector is less than or equal to the corresponding entry of the vector .
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,
- active set,^{[2]}
- augmented Lagrangian,^{[3]}
- conjugate gradient,
- gradient projection,
- extensions of the simplex algorithm.^{[2]}
Convex quadratic programming is a special case of the more general field of convex optimization.
Equality constraints
Quadratic programming is particularly simple when there are only equality constraints; specifically, the problem 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 .
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 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.^{[4]}
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 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's possible to write a variation on the conjugate gradient method which avoids the explicit calculation of .^{[5]}
Lagrangian duality
{{#invoke:see also|seealso}}
The Lagrangian dual of a QP is also a QP. To see that let us focus on the case where and Q is positive definite. We write the Lagrangian function as
Defining the (Lagrangian) dual function , defined as , we find an infimum of , using
hence the dual function is
hence 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 Q, the ellipsoid method solves the problem in polynomial time.^{[6]} If, on the other hand, Q is indefinite, then the problem is NP-hard.^{[7]} In fact, even if Q has only one negative eigenvalue, the problem is NP-hard.^{[8]}
Solvers and scripting (programming) languages
Name | Brief info |
---|---|
AIMMS | A software system for modeling and solving optimization and scheduling-type problems |
AMPL | A popular modeling language for large-scale mathematical optimization. |
CPLEX | Popular solver with an API (C,C++,Java,.Net, Python, Matlab and R). Free for academics. |
CVXOPT | Free software package for convex optimization, based on the Python programming language |
Excel Solver Function | A 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 |
Gurobi | Solver with parallel algorithms for large-scale linear programs, quadratic programs and mixed-integer programs. Free for academic use. |
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 |
JOptimizer | open source library for solving minimization problem with linear equality and convex inequality constraints (is implemented in Java) |
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. |
OOQP | OOQP is an object-oriented interior-point solver for convex QPs.^{[9]}^{[10]} |
OpenOpt | BSD licensed universal cross-platform numerical optimization framework, see its QP page and other problems involved. Uses NumPy arrays and SciPy sparse matrices. |
OptimJ | Free Java-based Modeling Language for Optimization supporting multiple target solvers and available as an Eclipse plugin.^{[11]}^{[12]} |
qpOASES | Open-source C++ implementation of an online active set strategy |
R | GPL licensed universal cross-platform statistical computation framework, see its quadprog page |
SAS/OR | A 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. |
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 Gurobi, 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. |
See also
- Support vector machine
- Sequential quadratic programming
- Quadratically constrained quadratic programming
- Linear programming
- Nonlinear programming
References
Notes
- ↑ {{#invoke:citation/CS1|citation |CitationClass=book }}.
- ↑ ^{2.0} ^{2.1} {{#invoke:citation/CS1|citation |CitationClass=book }}
- ↑ {{#invoke:Citation/CS1|citation |CitationClass=journal }}
- ↑ Google search.
- ↑ {{#invoke:Citation/CS1|citation |CitationClass=journal }}
- ↑ {{#invoke:Citation/CS1|citation |CitationClass=journal }} Translated in: {{#invoke:Citation/CS1|citation |CitationClass=journal }}
- ↑ {{#invoke:Citation/CS1|citation |CitationClass=journal }}
- ↑ {{#invoke:Citation/CS1|citation |CitationClass=journal }}
- ↑ Template:Cite web
- ↑ Template:Cite web
- ↑ Template:Cite paper
- ↑ Template:Cite paper
Bibliography
- {{#invoke:citation/CS1|citation
|CitationClass=book }}
- {{#invoke:citation/CS1|citation
|CitationClass=book }} A6: MP2, pg.245.