A primal-dual path following quadratic program solver for Matlab, with explicit
offline factorization analysis. It is influenced by
CVXOPT (coneqp) and CVXGEN.
boxqp was written to enable Matlab simulation of MPC-style controllers and
estimators, although it can solve any Quadratic Program (QP) of the form
minimize (1/2)x'*P*x + q'*x subject to A*x = b, (dual var y) G*x + s = h, (dual var z >= 0) s >= 0.
s and problem data
In its simplest form,
boxqp can be called with the following syntax:
% set up convex problem qp = struct; qp.P = ...; qp.A = ...; qp.G = ...; % sparse matrices qp.q = ...; qp.b = ...; qp.h = ...; % sparse or dense vectors % solve problem [fval, x, ws, status] = boxqp(qp);
To make use of structure we do the following:
% offline qp = make_mpc(A, B, z, xmin, xmax, umin, umax, Q, Qf, R, T); ws0 = boxqp_initial(qp); sd = boxqp_analyze(qp, ws0); % online [fval, x, ws, status] = boxqp(qp, sd, ws0);
make_mpc.mscript that creates a QP description
qp, which is a Matlab struct with fields
boxqp_initial.mobtains an initial guess used in the path following method. The structure
ws0contains warm-start information.
boxqp_analyze.mperforms symbolic analysis of the KKT matrix and chooses the best fill-reducing permutation. The structure
sdcontains offline analysis information.
boxqp.mthe solver itself
This solver requires the command
which is available from the LDL package, a part of
Here is an installation procedure:
localhost$ wget http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-4.5.2.tar.gz localhost$ tar xvzf SuiteSparse-4.5.2.tar.gz
then, within Matlab:
> cd SuiteSparse/LDL/MATLAB/ > ldl_install
This will make the command
ldlsparse(..) available for the solver, enabling
factorization caching. Use
addpath to add LDL to the Matlab
MPC problem, n = 8 (states), m = 4 (inputs), T = 20 (horizon)
|Avg Solve time (ms)||Rate (Hz)|
|boxqp (no structure)||21.44||46.6|