# mpcActiveSetSolver

## Syntax

## Description

Using `mpcActiveSetSolver`

, you can solve a quadratic
programming (QP) problem using an active-set algorithm. This function provides access to
the built-in Model Predictive Control Toolbox™ active-set QP solver.

Using an active-set solver can provide fast and robust performance for small-scale and medium-scale optimization problems in both double and single precision.

This solver is useful for:

Advanced MPC applications that are beyond the scope of Model Predictive Control Toolbox software.

Custom QP applications, including applications that require code generation.

Alternatively, you can also access the built-in interior-point QP solver using
`mpcInteriorPointSolver`

.

`[`

finds an optimal solution `x`

,`exitflag`

]
= mpcActiveSetSolver(`H`

,`f`

,`A`

,`b`

,`Aeq`

,`beq`

,`iA0`

,`options`

)`x`

to a quadratic programming problem
by minimizing the objective function:

$$J=\frac{1}{2}{x}^{\u22ba}Hx+{f}^{\u22ba}x$$

subject to inequality constraints $$Ax\le b$$ and equality constraints $${A}_{eq}x={b}_{eq}$$. `exitflag`

indicates the validity of
`x`

.

## Examples

## Input Arguments

## Output Arguments

## Tips

The KWIK algorithm requires that the Hessian matrix

*H*be positive definite. When calculating`Linv`

, use the`chol`

function.`[L,p] = chol(H,'lower');`

If

`p`

= 0, then`H`

is positive definite. Otherwise,`p`

is a positive integer.`mpcActiveSetSolver`

provides access to the default active-set QP solver used by Model Predictive Control Toolbox software. Use this command to solve QP problems in your own custom MPC applications. For an example of a custom MPC application using`mpcActiveSetSolver`

, see Solve Custom MPC Quadratic Programming Problem and Generate Code.

## Algorithms

`mpcActiveSetSolver`

solves the QP problem using an active-set
method, the KWIK algorithm, based on [1]. For more
information, see QP Solvers.

## References

[1] Schmid, C., and L.T. Biegler.
"Quadratic Programming Methods for Reduced Hessian SQP." *Computers & Chemical Engineering* 18, no. 9 (September 1994):
817–32. https://doi.org/10.1016/0098-1354(94)E0001-4.

## Extended Capabilities

## Version History

**Introduced in R2020a**

## See Also

### Functions

`mpcActiveSetOptions`

|`mpcqpsolver`

|`mpcqpsolverOptions`

|`mpcInteriorPointSolver`

|`mpcInteriorPointOptions`

|`setCustomSolver`

|`quadprog`

(Optimization Toolbox)