Quadratic Programming Overview

As detailed in the MPC overview the optimization problem that is to be solved at each sample is formulated as a Quadratic Programming (QP) Problem. This page gives a very brief overview of what a QP is within the MPC context and this toolbox.

Standard jMPC QP Problem

The QP solved by the jMPC Toolbox takes the following form:

where:

HQuadratic (diagonal) and bilinear (off-diagonal) cost function termsDense Matrix, Symmetric
fLinear cost function termsDense Vector
ALinear inequality constraint termsDense Matrix
bLinear inequality constraint right hand sideDense Vector
xDecision variablesDense Vector

For the purposes of this documentation the decision variable vector x is renamed to z to avoid conflicting with the state variable vector common in control.

QP Example

In order to solve the QP at each sample within an MPC simulation, the jMPC Toolbox provides several QP Solvers, which all solve the problem as defined above. As an example of using one of the supplied solvers, consider the following (toy) example:

All supplied solvers use the same calling strategy, as follows:

[z,exitflag,iter] = qpsolver(H,f,A,b,maxiter,tol,verbose,z0,lam0,t0)

Where the arguments are as follows:

HCost function H matrix
fCost function f vector
AConstraint function A matrix
bConstraint function b vector
maxiterMaximum number of iterations of the solver (optional)
tolConvergence tolerance (scalar, optional)
verbose0 for no print out, 1 for print out (optional)
z0Initial (warm start) decision variable vector (optional)
lam0Initial (warm start) dual variable vector (optional)
t0Initial (warm start) slack variable vector (optional)

And the return variables are:

zSolution vector
exitflagFlag indicating solver status (1 = solved, negative = failed)
iterNumber of iterations taken to solve


The above problem can be solved using quad_wright, one of the supplied solvers with jMPC:

%Define Problem
H = eye(3);
f = [-2;-3;-1];
A = [1 1 1;3 -2 -3; 1 -3 2];
b = [1;1;1];

%Setup Solver
maxiter = 30;
tol = 1e-6;
verbose = 1;

%Solve
[z,exitflag,iter] = quad_wright(H,f,A,b,maxiter,tol,verbose)

See the QP Solvers page for more information on the supplied solvers and their algorithms.