Quadratic programming

Solver for quadratic objective functions with linear constraints.

quadprog finds a minimum for a problem specified by

$$\underset{x}{\mathrm{min}}\frac{1}{2}{x}^{T}Hx+{f}^{T}x\text{suchthat}\{\begin{array}{c}A\cdot x\le b,\\ Aeq\cdot x=beq,\\ lb\le x\le ub.\end{array}$$

*H*, *A*, and *Aeq* are matrices,
and *f*, *b*, *beq*,
*lb*, *ub*, and *x* are
vectors.

You can pass *f*, *lb*, and *ub* as
vectors or matrices; see Matrix Arguments.

`quadprog`

applies only to the solver-based approach. For a discussion
of the two optimization approaches, see First Choose Problem-Based or Solver-Based Approach.

solves the preceding problem subject to the additional restrictions
`x`

= quadprog(`H`

,`f`

,`A`

,`b`

,`Aeq`

,`beq`

,`lb`

,`ub`

)`lb `

≤` x `

≤` ub`

.
The inputs `lb`

and `ub`

are vectors of doubles,
and the restrictions hold for each `x`

component. If no equalities
exist, set `Aeq = []`

and
`beq = []`

.

If the specified input bounds for a problem are inconsistent, the output
`x`

is `x0`

and the output
`fval`

is `[]`

.

`quadprog`

resets components of `x0`

that violate the bounds
`lb `

≤` x `

≤` ub`

to the interior of the box defined by the bounds.
`quadprog`

does not change components that respect
the bounds.

returns the minimum for `x`

= quadprog(`problem`

)`problem`

, where `problem`

is a structure described in Description. Create
`problem`

by exporting a problem using the Optimization app;
see Exporting Your Work. Alternatively, create a
`problem`

structure from an
`OptimizationProblem`

object by using `prob2struct`

.

You can use the Optimization app for quadratic programming. Enter
`optimtool`

at the MATLAB^{®} command line, and choose the ```
quadprog - Quadratic
programming
```

solver. For more information, see Optimization App.

You can solve quadratic programming problems using the Problem-Based Optimization Setup. For examples, see Quadratic Programming.

[1] Coleman, T. F., and Y. Li. “A Reflective Newton
Method for Minimizing a Quadratic Function Subject to Bounds on Some of the
Variables.” *SIAM Journal on Optimization*. Vol. 6, Number
4, 1996, pp. 1040–1058.

[2] Gill, P. E., W. Murray, and M. H. Wright.
*Practical Optimization.* London: Academic Press,
1981.

[3] Gould, N., and P. L. Toint. “Preprocessing for quadratic
programming.” *Mathematical Programming.* Series B, Vol.
100, 2004, pp. 95–132.

`linprog`

| `lsqlin`

| `optimoptions`

| `prob2struct`