0% found this document useful (0 votes)
66 views7 pages

HPIPM Solver Paper

The document presents HPIPM, a high-performance quadratic programming framework aimed at solving model predictive control problems efficiently. It supports various QP types and features robust interior point method solvers that outperform existing solutions in speed. HPIPM is designed for extensibility and ease of use, making it suitable for embedded optimization applications.

Uploaded by

quiopas264
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views7 pages

HPIPM Solver Paper

The document presents HPIPM, a high-performance quadratic programming framework aimed at solving model predictive control problems efficiently. It supports various QP types and features robust interior point method solvers that outperform existing solutions in speed. HPIPM is designed for extensibility and ease of use, making it suitable for embedded optimization applications.

Uploaded by

quiopas264
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

HPIPM: a high-performance quadratic

programming framework for model


predictive control ?
Gianluca Frison ∗ Moritz Diehl ∗

Department of Microsystems Engineering, University of Freiburg,
email: {gianluca.frison, moritz.diehl} at imtek.uni-freiburg.de

Abstract:
This paper introduces HPIPM, a high-performance framework for quadratic programming (QP),
designed to provide building blocks to efficiently and reliably solve model predictive control
arXiv:2003.02547v2 [math.OC] 6 Jun 2020

problems. HPIPM currently supports three QP types, and provides interior point method (IPM)
solvers as well (partial) condensing routines. In particular, the IPM for optimal control QPs is
intended to supersede the HPMPC solver, and it largely improves robustness while keeping the
focus on speed. Numerical experiments show that HPIPM reliably solves challenging QPs, and
that it outperforms other state-of-the-art solvers in speed.

Keywords: quadratic programming, model predictive control, embedded optimization, software

1. INTRODUCTION The different IPM solvers are meant to provide different


trade-offs between computational speed and robustness,
The aim of this paper is to introduce the quadratic with the fastest but least robust algorithm being analogous
programming (QP) framework in the high-performance to the one implemented in HPMPC. At their core, the
software HPIPM in the context of model predictive con- IPM solvers in HPIPM comprise a common set of routines
trol (MPC) (Maciejowski, 2002). Among other features, that operate only on vectors and are agnostic of the QP
the HPIPM software provides an interior point method type or even the matrix format employed. Conversely,
(IPM) for the solution of linear-quadratic optimal control the KKT modules, which account for the computationally
problems (OCP), which has been used in numerous ap- most intensive operations, are tailored to the specific QP
plications. In this regard it is intended to supersede the type, and are currently implemented using BLASFEO.
software HPMPC (Frison et al., 2014), which comprises
Alongside these QP types and respective IPM solvers,
both hardware-tailored linear algebra (LA) routines and
HPIPM implements routines to convert between them.
solvers for QPs in the MPC form. The LA framework
Condensing and partial condensing (Axehill, 2015) rou-
in HPMPC has been completely reimplemented and ex-
tines convert an OCP QP into a dense QP and an OCP
tended in the BLASFEO software (Frison et al., 2018),
QP with shorter horizon, respectively. These (partially)
which targets routines operating on both the panel-major
condensed QPs can be solved with tailored IPM solvers,
matrix format proposed in HPMPC, and the column-
and their solution expanded back into the original OCP
major matrix format used in the standard BLAS appli-
QP format by means of dedicated routines. The (partial)
cation programming interface (API). Analogously, the QP
condensing and expansion routines can also be employed as
framework in HPMPC has been completely reimplemented
stand-alone routines, and coupled with other QP solvers.
and extended in the HPIPM software, which is the subject
As such, HPIPM provides a complete QP framework.
of the current paper.
HPIPM uses encapsulation mechanisms for its C API:
More in detail, HPIPM is an open-source C-coded high-
the C structures are not assumed to be accessed directly,
performance framework for QP, and it is designed in
but through setters and getters. This fact has several im-
a modular fashion with two distinct goals: to be easily
portant consequences: for example, it allows the problem
extendable to handle new QP types, and to serve as
data to be stored in the C structures in a format efficient
the basis for more generic algorithms such as solvers for
for the solver while setters and getters are designed to
nonlinear programming (NLP). At the time of writing,
be convenient for the user. Additionally, this enhances
HPIPM supports three QP types: a dense QP, an OCP
maintainability, as the internal layout of the structures can
QP, and a tree-structured OCP QP. For each of them, it
freely change as long as the setters and getters expose the
defines C structures for the QP itself, its solution and its
same API. Another key feature of HPIPM is its memory
residuals. These structures serve as arguments to a set of
management, which eases its embedded use: no internal
routines factorizing and solving the Karush-Kuhn-Tucker
memory allocation takes place, as HPIPM operates on ex-
(KKT) system and implementing a family of IPM solvers.
ternally provided chunks of memory. On top of the C API,
? This research was supported by the German Federal Ministry for HPIPM provides interfaces to the high-level programming
Economic Affairs and Energy (BMWi) via eco4wind (0324125B) and languages Matlab, Octave, Simulink and Python.
DyConPV (0324166B), and by DFG via Research Unit FOR 2401.
At the time of writing, HPIPM is employed as a QP The primal variables comprise generic variables v and
solver in several NLP solvers such as acados (Verschueren slack variables sl (su ) associated to the lower (upper)
et al., 2019), Control Toolbox (Giftthaler et al., 2018), constraints. The Hessian matrices of the slacks Z l and
MPCC (Liniger et al., 2015) and MATMPC (Chen et al., Z u are diagonal. The matrices J ·,· are made of rows from
2018). In particular, in the case of acados it provides the identity matrices, and are employed to select only some
entire QP framework and it is deeply embedded in the components in box and soft constraints. Furthermore,
source code, in the sense that the members of the OCP QP the constraint matrices are the same for the upper and
type are directly accessed when building the QP approxi- the lower constraints, meaning that all constraints in the
mation at each SQP iteration. Furthermore, the (partial) formulation are two-sided. A mask (not represented in
condensing routines provided by HPIPM are used as pre- the above dense QP formulation) can be employed to
processing step in the solution of these QPs by means dynamically activate or deactivate the single upper and/or
of other QP solvers such as qpOASES (Ferreau et al., lower constraints. The considerations in this paragraph
2014), qpDUNES (Frasch et al., 2014), OSQP (Stellato apply also to the OCP and tree OCP QP.
et al., 2017), OOQP (Gertz and Wright, 2003). In the
case of the Control Toolbox, HPIPM is used through its
setter-based C API as a QP solver for both constrained 2.2 OCP QP
and unconstrained linear-quadratic OCPs and it provides
the feedback gains needed in the iterative linear quadratic The OCP QP type describes a QP formulation handling
regulator (iLQR) algorithm (Li and Todorov, 2004). In many common OCP and MPC problems such as linear-
the case of MATMPC, HPIPM is used through its C quadratic regulators (LQR), constrained linear MPC prob-
API within mex sources in Matlab, for both the IPM lems, and QP sub-problems in sequential quadratic pro-
solver and the (partial) condensing routines. In the case gramming (SQP) algorithms for non-linear OCP and MPC
of MPCC, HPIPM is currently the solver of choice for problems.
real-time applications (replacing the originally employed " #T R S r  " #
FORCES solver (Domahidi et al., 2012)), and it is used 1 un  Tn n n  un
XN
through its Matlab interface. minx,u,s xn Sn Qn qn xn +
2 1
n=0 rnT qnT 0 1
2. QP FORMULATIONS  T  l   
l
1 snu   Zn 0 znl sln
HPIPM currently defines three QP types: a dense QP, an + s 0 Znu znu  sun 
2 1n
OCP QP and tree-structured OCP QP. As a distinctive l T
(zn ) (znu )T 0 1
feature compared to most other QP solvers, all QP for- s.t. xn+1 = An xn + Bn un + bn , n ∈ H\{N }
mulations define a special type of variable, the slacks, " #  b,u  " s,u #
which do not enter the dynamics equality constraints un Jn 0   Jn
u
and which give a diagonal contribution to Hessian and xn ≤  0 Jn  b,x n
+ Jns,x sln , n ∈ H
xn
inequality constraint matrices. The exploitation of this dn Dn Cn Jns,g
structure allows their elimination from the QP formulation  b,u
Jn

0  
" s,u #
Jn
 
un
in computational complexity linear in the number of slack u
 0 J b,x  n − Jns,x sun ≤ xn  , n ∈ H
variables, making it computationally cheap to use them. n xn
Dn Cn Jns,g dn
The slack variables can be used to efficiently implement
soft constraints with L1 and L2 penalties. sln ≥ sln , n ∈ H
sun ≥ sun , n ∈ H
2.1 Dense QP
where H = {0, 1, . . . , N }. This problem has a multi-stage
The dense QP type describes a generic QP where Hes- structure, with cost and inequality constraints defined
sian and constraint matrices are assumed to be dense. stage-wise, and with dynamics equality constraints cou-
This formulation can handle the QP sub-problems aris- pling pairs of consecutive stages. The primal variables are
ing in single-shooting discretization schemes or in state- divided into state variables xn , control (or input) variables
condensing schemes in the OCP and MPC frameworks. un and slack variables associated to the lower (upper)
 T    constraints sln (sun ). The size of all variables (number of
1 v H g v states nxn , number of controls nun and number of slacks
minv,s +
2 1 gT 0 1 nsn ), as well as the number of box constraints nbn and
 T  l l
  general polytopic constraints ngn can freely vary stage-
l
1 s Z 0 z sl
+ su   0 Z u z u  su  wise. All data matrices and vectors can vary stage-wise, as
2 1 required e.g. to solve QP sub-problems arising in multiple-
(z l )T (z u )T 0 1
shooting discretization schemes (Bock and Plitt, 1984).
s.t. Av = b
   b,v   s,v  Note that the current formulation does not support equal-
v J J
≤ v + s,g sl ity constraints other than the dynamics equations, and
d C J therefore other types of equality constraints (as e.g. the
 b,v   s,v   
J J u v constraint on the initial state value x0 = x̂0 ) have to be
v − s,g s ≤ reformulated as inequality constraints with equal upper
C J d
and lower limits. The IPM variant employed in HPIPM
sl ≥ sl
(see Section 4.2) is able to handle such reformulation well.
su ≥ su This also applies to the tree OCP QP.
2.3 Tree OCP QP where the slack variables t = Cy − d ≥ 0 have been intro-
duced, and nc denotes the total number of constraints. In
The tree OCP QP type can handle many common case the Hessian matrix H is positive definite, the QP is
robust and scenario-based OCP and MPC problems, convex and a point satisfying the KKT conditions is the
see (Kouzoupis, 2019) and references therein. unique global minimizer.
" #T R S r  " #
X 1 un n n n un Equations (2a)-(2d) are a system of nonlinear equations
minx,u,s xn SnT Qn qn  xn + f (y, π, λ, t) = 0, where the only nonlinear equation is
2 1
n∈N rnT qnT 0 1 (2d). In a nut shell, a primal-dual IPM is Newton method
 T  l    applied to the system of equations fτ (y, π, λ, t) = 0 with
l
1 snu   Zn 0 znl sln equation (2d) relaxed as
+ s 0 Znu znu  sun 
2 1n λi ti = τ, i = 1, . . . , nc
(zn ) (znu )T 0
l T 1
 The homotopy parameter τ is related to the barrier
n ∈ N \L parameter in barrier methods, and it is shrunk toward
s.t. xm = Am xn + Bm un + bm ,
m ∈ C(n) zero as the iterations approach the solution of (2). A line
" #  b,u  " s,u # search procedure is used to ensure the strict satisfaction
un Jn 0   Jn
u
xn ≤  0 Jnb,x  n
+ Jns,x sln , n ∈ N of the inequalities (2e) on the sign of Lagrange multipliers
xn
dn Dn Cn Jns,g and slacks of inequality constraints.
 b,u  " s,u #  
Jn 0   Jn un At every iteration k of the Newton method, the Newton
 0 J b,x  un − Jns,x sun ≤ xn  , n ∈ N step (∆yaff , ∆πaff , ∆λaff , ∆taff ) is found solving the linear
n xn
Dn Cn Jns,g dn system
 T T
T
sln ≥ sln , n ∈ N ∇fτk (yk , πk , λk , tk ) ∆yaff ∆πaff ∆λTaff tTaff =
sun ≥ sun , n ∈ N = −fτk (yk , πk , λk , tk )
N is the set of nodes in the tree and N̂ is its cardinality. which takes the form
The set L contains the leaves of the tree, while C(n) H −AT −C T 0 ∆yaff
  
denotes the set of the children of node n. All data matrices −A 0 0 0  ∆πaff 
=
and vector can vary node-wise.  −C 0 0 I  ∆λaff 
0 0 Tk Λk ∆taff
3. ALGORITHM
Hyk − A πk − C T λk + g
T
rg
   

HPIPM implements in a modular fashion all algorithmic −Ayk + b  rb 


= − = ˙ −   (3)
 
building blocks needed to implement many variants of a −Cyk + tk + d rd
primal-dual IPM. This algorithmic richness can be used Λk Tk e − τk e rm
e.g. to trade off computational speed and robustness, to The diagonal matrices Λk and Tk have on their diagonal
adapt it to the specific application. the elements of the vector λk and tk respectively. The
function fτk (yk , πk , λk , tk ) at the right hand side (RHS)
3.1 Primal-dual IPM is denoted as the residual function.
This section contains some basic notion about primal- 3.2 Delta and absolute IPM formulations
dual IPM algorithms. In particular, the IPM algorithm
is derived from the KKT conditions, and not from the The formulation of the Newton step in (3) is denoted as
barrier methods theory. The interested reader can find a ‘delta formulation’ in this paper, in the sense that the
more detailed presentations in (Wright, 1997; Nocedal and solution of the linear system (3) gives the Newton step.
Wright, 2006). By exploiting the linearity of the first three equations in
(2), and using for the RHS of the forth equation in (3) the
Let us consider the generic QP in the form expression
1 T
miny y Hy + g T y Tk ∆λaff + Λk ∆taff = Tk (λaff − λk ) + Λk (taff − tk )
2
(1) = Tk λaff + Λk taff − 2Λk Tk e
s.t. Ay = b
Cy ≥ d the linear system (3) can be rewritten as
H −AT −C T 0 yaff g
    
The Lagrangian function for this QP reads
1 −A 0 0 0  πaff  b
= −  (4)
 
L(v, π, λ) = y T Hy + g T y − π T (Ay − b) − λT (Cy − d)  −C 0 0 I  λaff  d
2 0 0 Tk Λk taff −Λk Tk e − τk e
where π and λ are the Lagrange multipliers of the equality
and inequality constraints, respectively. The first order In this paper, this formulation is denoted as ‘absolute
necessary KKT optimality conditions read formulation’, in the sense that the solution of the linear
system (4) gives the next full-step Newton iterate, and
Hy + g − AT π − C T λ = 0 (2a)
the Newton step can be computed as the difference with
− Ay + b = 0 (2b) respect to the current iterate
− Cy + d + t = 0 (2c)  T T
T
λ i ti = 0 i = 1 . . . , nc (2d) ∆yaff ∆πaff ∆λTaff ∆tTaff =
 T T T T T  T T T T T
(λ, t) ≥ 0 (2e) = yaff πaff λaff taff − yk πk λk tk (5)
The advantage of the absolute formulation is that (5) has of states xn and inputs nu is constant across stages, the
a computational complexity linear in the number of vari- computational complexity is of O(N (nx + nu )3 ) flops,
ables, while the evaluation of the residual function at the which is linear in the number of stages.
RHS of (3) involves matrix-vector multiplications, which
In the case of the tree OCP QP type, the linear system
for dense matrices have a quadratic computational com-
in (6) is factorized using a Riccati recursion modified to
plexity. Therefore, especially in case of systems with few
exploit the tree structure (Frison et al., 2017). This factor-
variables, the absolute formulation can be computationally
ization proceeds from the leaves of the tree, and therefore
faster. On the other hand, as the iterate approaches the
it does not introduce any fill-in outside the problem data
solution, the computation of the Newton step as in (5)
blocks. The Riccati recursion can be implemented using
incurs in increasingly severe cancellation errors, as the two
the same two variants described for the OCP QP type.
vectors at the RHS nearly coincide. This effect is exacer-
In case the number of states xn and inputs nu is constant
bated by the fact that typically in late IPM iterations the
across stages and realizations, the computational complex-
conditioning of the linear system gets increasingly worse.
ity is of O(N̂ (nx + nu )3 ), and therefore it is linear in the
3.3 KKT system solution number of nodes in the tree N̂ .

The ill-conditioning arises from the fact that in HPIPM, as 3.4 Iterative refinement
in most IPM solvers, the slacks tk and the Lagrange mul-
tipliers λk are eliminated as a pre-processing step before In practice, due to the finite accuracy of numerical compu-
the actual factorization, as the resulting linear system is tations, any procedure for the solution of the KKT system
in the form of the KKT system of an equality-constrained (3) can compute the solution only up to a certain accuracy.
QP, and therefore efficient factorization procedures for this Especially in case of unstable or ill-conditioned systems,
class of systems can be employed. and in late IPM iterations, the ill-conditioning of the KKT
In HPIPM, the variables ∆taff and ∆λaff are eliminated, in system (3) can make the accuracy in the Newton step too
this order, from the KKT system in (3), and the resulting low to be useful for the IPM algorithm. In such cases,
system of linear equations it may be beneficial to employ a few iterative refinement
steps in order to attempt to improve the accuracy of the
H + C T Tk−1 Λk C −AT ∆yaff
  
= Newton step.
−A 0 ∆πaff
The iterative refinement residuals are defined as the resid-
r − C T (Tk−1 Λk rd − Tk−1 rm )
 
=− g (6) uals in the solution of the KKT system (3),
rb  ir  
rg H −AT −C T 0 ∆yaff rg
   
which is in the form of the KKT system of an equality con-  rir  −A 0
strained QP, is solved with structure-exploiting routines b
 ir  = 0 0 ∆π aff rb 
 r  ˙  −C 0 +
   
operating on dense sub-matrices in case of all QP types d 0 I  ∆λaff   rd 
currently supported. This approach corresponds to stati- rmir 0 0 Tk Λk ∆taff rm
cally selecting the pivoting sequence based solely on spar- In case they are not small enough, it is possible to solve
sity, and hand-crafting efficient factorization algorithms again a system in the form (3) with the same KKT
tailored to the QP type at hand. The alternative approach, matrix at the left hand side (LHS) and the iterative
which is currently not employed in HPIPM, is to directly refinement residuals as RHS, and compute a correction
factorize the KKT system in (3) using sparse LA, which term to iteratively improve the accuracy of the Newton
may additionally perform dynamic pivoting for stability in step. Since no new matrix factorization is performed, the
an attempt to keep the conditioning under control. computation of this correction term is cheap compared to
In HPIPM, in the case of the dense QP type, the linear the factorization and solution of the KKT system in (3),
system in (6) is solved using either the Schur-complement especially in case of large systems.
or the null-space methods (Nocedal and Wright, 2006).
In case the dense QPs arise from the condensing of the 3.5 Condensing and partial condensing
OCP QP type, there are no equality constraints, and the
factorization of the KKT matrix in (6) can be simply HPIPM provides a condensing module, which implements
performed using the dense Cholesky factorization. routines to convert an OCP QP into a dense QP by
eliminating the state variables at all stages except stage 0.
In the case of the OCP QP type, as proposed in the This is possible because such state variables are not real
MPC context by (Steinbach, 1994) and similarly to degrees of freedom, as they are determined uniquely from
HPMPC (Frison et al., 2014), the linear system in (6) the inputs and the state at stage 0 by using the dynamics
is factorized using a structure-exploiting backward Ric- equality constraints. The partial (or block) condensing
cati recursion. Two versions of the Riccati recursion are module, which converts an OCP QP into another OCP
available (Frison, 2015): (a) the classical implementation QP with smaller number of stages, is built on top of the
(which requires the reduced Hessian with respect to the condensing module in a modular fashion, by performing
dynamics equality constraints to be positive definite, but condensing on blocks of stages.
allows the full-space Hessian to be indefinite), and (b)
the square-root implementation (which in order to reduce There exist at least three Hessian condensing algorithms
the flop count employs the Cholesky factorization of the with different computational complexities, ranging be-
Riccati recursion matrix, and therefore requires the full- tween quadratic and cubic in both the number of states
space Hessian to be positive definite). In case the number and the number of stages (Frison, 2015). The algorithm
currently implemented in HPIPM is the algorithm pro- step length. This algorithm is indicated for small and
posed in (Frison et al., 2016), which has a computational well-conditioned systems, in case tight bounds on the
complexity quadratic in the number of stages and cubic solution accuracy are not required.
in the number of states. This algorithm is based on a speed The focus lies on the high solution speed, but the
backward recursion which has similarities to the Riccati more reliable IPM delta formulation is employed. The
recursion. As such, two versions of this condensing algo- KKT residuals are computed at each IPM iteration,
rithm are available: one analogous to the classical Riccati and exit conditions are additionally based on minimum
recursion and one analogous to the square-root Riccati re- residuals tolerance.
cursion, with similar requirements about Hessian positive balance In this mode, the accuracy of the KKT factor-
definiteness. This condensing algorithm is the fastest when ization is checked by computing its iterative refinement
the state at stage 0 is kept as an optimization variable residuals. In case accuracy is too low, the factorization
(such as in partial condensing) and in case of long horizons. is repeated by replacing all Cholesky factorizations of
normal matrices in the form A · AT with array algo-
4. IMPLEMENTATION rithms based on QR factorizations, which have better
numerical properties as they never explicitly form the
4.1 Linear algebra worse-conditioned normal matrix A · AT . Furthermore,
a few iterative refinement steps are performed on the
Algorithms in HPIPM are explicitly designed to exploit prediction-centering-correction direction, in case this is
the overall structure of the optimization algorithms. Spar- not accurate enough.
sity within data and working matrices is not considered. robust In this mode, the KKT factorization is always per-
Therefore, computations are cast in term of operations on formed using the more accurate array algorithms based
matrices with fixed structure, like e.g. dense, symmetric, on QR factorizations. A higher number of iterative re-
triangular or diagonal. finement steps is performed on the prediction-centering-
correction direction, in case this is not accurate enough.
In HPIPM, the KKT modules contain the most com-
putationally expensive routines, such as KKT system Some additional implementation choices are common to
factorization and solution, and residuals computation. all modes. The Mehrotra’s corrector step is implemented
Such operations have computational complexities cubic or conditionally, and is only applied if it is not increasing
quadratic in the number of (stage) variables. In case of the duality measure too much compared to the affine
all currently implemented QP types, in the KKT modules step; otherwise, a predictor-centering step is applied. The
HPIPM employs the structure-based interface in the high- Hessian matrix of both primal and dual variables can be
performance LA library BLASFEO (Frison et al., 2018) regularized by adding a scaled identity matrix during fac-
for such operations. These routines are designed to give torization; this regularization does not affect the original
close-to-peak performance for matrices of moderate size problem data, and therefore the effect of regularization on
(assumed to fit in cache) and are optimized for several the solution can be offset by means of iterative refinement.
hardware architectures (e.g. exploiting different classes of The value of the inequality constraint Lagrange multipliers
SIMD instructions). and slacks is bounded to a minimum value, in order to give
the possibility to bound the ill-conditioning of the KKT
The IPM core operations in HPIPM are independent of the system in late IPM iterations. Finally, it is possible to
specific QP type and solely operate on unstructured arrays provide a guess to warm start either the primal, or both
of doubles holding e.g. the set of all primal variables, or the primal and the dual variables (this second option is
Lagrange multipliers or slack variables. These operations particularly effective in SQP algorithms, since close to the
have computational complexity linear in the number of NLP solution a good guess for the primal variables is zero,
variables, and are currently offered in two implementa- and for the dual variables coincides with the Lagrange
tions, one coded in generic C and one using AVX intrinsics. multipliers of the NLP).
4.2 IPM implementation choices 5. NUMERICAL EXPERIMENTS
At a high-level, HPIPM implements an infeasible-start In this section, numerical experiments evaluate the relative
Mehrotra’s predictor-corrector IPM (Mehrotra, 1992), speed (Section 5.1) and robustness (Section 5.2) of the
proposed in the MPC context e.g. in (Rao et al., 1998). different HPIPM modes, and compare HPIPM to other
This standard algorithmic scheme is tweaked by several ar- state-of-the-art MPC solvers (Section 5.3).
guments, whose different choice gives rise to a family of al-
gorithms with different trade-offs between computational
5.1 Linear mass spring system
speed and reliability. A ‘mode’ argument is introduced in
order to select pre-defined sets of arguments tailored to a
particular purpose. The modes currently available are: The linear mass spring system is a scalable benchmark
commonly employed to evaluate linear MPC solvers (Wang
speed abs This mode selects an algorithm analogous to and Boyd, 2010). The variant proposed in (Domahidi et al.,
the one implemented in HPMPC. The focus lies on 2012) is considered, comprising a horizontal chain of M
the highest solution speed, and the IPM is based on masses connected to each other and to walls using springs,
the absolute formulation. The residuals are optionally and where the first M − 1 masses are controlled using a
computed only before returning, and therefore the IPM force. Therefore the number of states nx = 2M , inputs
loop exit conditions are only based on duality measure nu = M − 1 and box constraints nb = nx + nu = 3M − 1
tolerance, maximum number of iterations and minimum per stage scales with the number of masses.
Table 1. Comparison of solvers for box- 1
constrained linear MPC: speed abs, speed
and robust modes for HPIPM, low-level inter-
faces for HPMPC. M is the number of masses; 0.8

Percentage of problems solved


N is the horizon length. Runtimes in seconds;
number of IPM iterations fixed to 10. Intel 0.6
Core i7 4800MQ CPU with ‘Haswell’ target in
BLASFEO and ‘AVX2’ target in HPMPC.
0.4 qpoases
HPIPM HPIPM HPIPM HPMPC
M N speed abs speed robust low-level hpipm_balance
0.2
2 10 6.71 · 10−5 1.17 · 10−4 1.80 · 10−4 5.7 · 10−5
4 10 1.10 · 10−4 1.82 · 10−4 3.67 · 10−4 8.9 · 10−5 hpipm_speed
6 30 6.36 · 10−4 9.00 · 10−4 1.96 · 10−3 4.88 · 10−4 0
11 10 4.62 · 10−4 6.22 · 10−4 1.61 · 10−3 4.05 · 10−4 100 101 102
15 10 8.29 · 10−4 1.05 · 10−3 2.94 · 10−3 7.51 · 10−4 Time factor
30 30 1.21 · 10−2 1.45 · 10−2 4.53 · 10−2 1.17 · 10−2
Fig. 1. Performance graph on the 43 problems from the
Table 1 compares the solution time for 3 HPIPM modes Maros-Mészáros QP test set with up to 250 variables
with HPMPC. The algorithm in HPIPM with speed abs and up to 1001 constraints. Intel Core i7 4810MQ
mode is analogous to the one in HPMPC, and the com- CPU with ‘Haswell’ target in BLASFEO.
putational times are also within 10-15% of each other;
HPIPM is slightly slower due to its more modular nature, particular, the NLP framework acados is employed to
and its use of an external LA library. The HPIPM speed generate constrained time-varying linear MPC problems.
mode is about 2 times slower for small system, but the The test problem is the nonlinear hanging chain problem
difference decreases for large systems (since the same KKT used for the comparison of QP solvers in (Kouzoupis et al.,
factorization is employed). The HPIPM robust mode is 2018), where the chain of masses starts at rest position,
roughly 3 times slower for all systems, since a slower but and a strong perturbation is generated by overwriting the
more accurate KKT factorization is employed. controller output in the first 5 simulation steps; afterwards
the controller takes over again and takes the chain of
5.2 CUTEr masses back to the resting position. Four free masses are
employed, accounting for a total of 24 states (the 3D
This section evaluates the performance and robustness position and velocity of each free mass), 3 controls (the
of HPIPM using the challenging Maros-Mészáros test set 3D force acting on the last mass), 4 state and 3 control
of convex QPs (Maros and Mészáros, 1999), which can bounds; the control horizon is of 8 seconds, divided into
be accessed though the CUTEr testing environment. In 40 equidistant stages.
particular, the QPs available on the qpOASES COIN-OR
repository are employed, which are the 43 problems with The numerical experiment consists of a closed loop sim-
up to 250 variables and up to 1001 constraints, as discussed ulation of 50 steps, where the real time iteration scheme
in (Ferreau et al., 2014). All matrices are in dense format. in acados is used to generate one QP to be solved per
simulation step. Optionally partial condensing is employed
Figure 1 contains a performance graph comparing the to reformulate the OCP QP into another OCP QP with
performance of the speed and balance modes in HPIPM 5 stages. The QP solution times are in Figure 2 for the
with qpOASES; the required accuracy is set to 10−6 for solvers HPIPM (speed mode; OCP QP solver for the fully
the infinity norm of residuals. HPIPM in speed mode is sparse or partially condensed QP; dense QP solver for the
the fastest solver in about 50% of the problems, but it fails condensed QP), OSQP (sparse solver for the fully sparse or
to solve 4 problems. HPIPM in balance mode can solve all partially condensed QP) and qpOASES (for the condensed
problems, it is the fastest solver in about 20% – and within QP). (Partial) condensing is provided by the acados wrap-
a factor 2 of the fastest solver for more than 90% – of the per to the corresponding HPIPM routines. Note that only
problems. qpOASES is the fastest solver in the remaining the call to the QP solver is timed: therefore, the (partial)
30% of the problems, but it gets quickly outperformed condensing time is not included, nor the SQP algorithm
(often by a factor 10 or more) in the remaining problems. time. Warm start is employed for OSQP and qpOASES, as
these solvers are found to benefit from it; OSQP employs a
HPIPM in speed abs mode (not shown in Figure 1) would
polishing step to improve the low accuracy of the ADMM
fail to converge in 32 problems, and return an inaccurate
(Alternating Direction Method of Multipliers) solution.
solution in the remaining problems. This shows the great
improvement in reliability over HPMPC (which imple- HPIPM solving the partially condensed OCP QP stands
ments an algorithm analogous to HPIPM in speed abs out as the fastest solver, with solution times steadily below
mode, but can not be directly compared as it does not 1 millisecond. Both HPIPM and OSQP are significantly
provide a dense QP solver) in case of challenging QPs. faster in solving the partially condensed QP compared
to the corresponding fully sparse QP. In general, HPIPM
5.3 Chain of masses (being an IPM) shows a rather constant solution time,
while qpOASES (active set) and OSQP (ADMM) require
This section compares the performance of HPIPM against more time (due to more iterations) when the QP problems
other state-of-the-art QP solvers for MPC problems. In are more challenging, at the beginning of the simulation.
linear model predictive control. In Proc. of the European
hpipm_ocp
Control Conference, 128–133.
hpipm_ocp_pcond Frison, G. (2015). Algorithms and Methods for High-
10 -2 hpipm_dense
Performance Model Predictive Control. Ph.D. thesis,
Technical University of Denmark (DTU).
osqp
Frison, G., Kouzoupis, D., Diehl, M., and Jørgensen, J.B.
osqp_pcond
(2017). A high-performance Riccati based solver for
Time [s]

qpoases tree-structured quadratic programs. In Proc. of the


IFAC World Congress, volume 50, 14399–14405.
Gertz, E.M. and Wright, S.J. (2003). Object-oriented
software for quadratic programming. ACM Transactions
10-3
on Mathematical Software, 29(1), 58–81.
Giftthaler, M., Neunert, M., Stäuble, M., and Buchli, J.
(2018). The Control Toolbox - an open-source C++
0 10 20 30
Simulation step
40 50
library for robotics, optimal and model predictive con-
trol. In IEEE International Conference on Simulation,
Fig. 2. Comparison of QP solvers in the solution of QPs Modeling, and Programming for Autonomous Robots.
generated using acados in a closed loop MPC simu- Kouzoupis, D. (2019). Structure-exploiting numerical
lation on the nonlinear chain of masses. Intel Core i7 methods for tree-sparse optimal control problems. Ph.D.
4810MQ CPU with ‘Haswell’ target in BLASFEO. thesis, University of Freiburg.
Kouzoupis, D., Frison, G., Zanelli, A., and Diehl, M.
6. CONCLUSION (2018). Recent advances in quadratic programming
algorithms for nonlinear model predictive control. Viet-
This paper introduced HPIPM, a high-performance QP
nam Journal of Mathematics, 46(4), 863–882.
framework for the solution of MPC problems. HPIPM
Li, W. and Todorov, E. (2004). Iterative linear quadratic
provides IPM solvers for dense, OCP and tree OCP QPs,
regulator design for nonlinear biological movement sys-
as well as (partial) condensing routines. In particular,
tems. In Proc. of the 1st International Conference on
compared to the predecessor HPMPC solver, reliability is
Informatics in Control, Automation and Robotics.
shown to be significantly improved in case of challenging
Liniger, A., Domahidi, A., and Morari, M. (2015).
QPs. Numerical experiments show that HPIPM speed
Optimization-based autonomous racing of 1:43 scale RC
excels against other state-of-the-art QP solvers for MPC.
cars. Optimal Control Applications and Methods, 36(5),
REFERENCES 628–647.
Maciejowski, J.M. (2002). Predictive Control with Con-
Axehill, D. (2015). Controlling the level of sparsity in straints. Prentice Hall.
MPC. Systems & Control Letters, 76, 1–7. Maros, I. and Mészáros, C. (1999). A repository of
Bock, H.G. and Plitt, K.J. (1984). A multiple shooting al- convex quadratic programming problems. Optimization
gorithm for direct solution of optimal control problems. Methods and Software, 11, 431–449.
In Proc. of the IFAC World Congress, 242–247. Mehrotra, S. (1992). On the Implementation of a Primal-
Chen, Y., Bruschetta, M., Picotti, E., and Beghi, A. Dual Interior Point Method. SIAM Journal on Opti-
(2018). Matmpc - a matlab based toolbox for real-time mization, 2(4), 575–601.
nonlinear model predictive control. arXiv preprint. Nocedal, J. and Wright, S.J. (2006). Numerical Optimiza-
Domahidi, A., Zgraggen, A., Zeilinger, M.N., Morari, M., tion. Springer, 2 edition.
and Jones, C.N. (2012). Efficient interior point methods Rao, C.V., Wright, S.J., and Rawlings, J.B. (1998). Ap-
for multistage problems arising in receding horizon con- plication of interior-point methods to model predictive
trol. In Proc. of the IEEE Conference on Decision and control. Journal of Optimization Theory and Applica-
Control (CDC), 668–674. tions, 99, 723–757.
Ferreau, H.J., Kirches, C., Potschka, A., Bock, H.G., and Steinbach, M.C. (1994). A structured interior point SQP
Diehl, M. (2014). qpOASES: a parametric active-set method for nonlinear optimal control problems. In
algorithm for quadratic programming. Mathematical R. Bulirsch and D. Kraft (eds.), Computation Optimal
Programming Computation, 6(4), 327–363. Control, 213–222. Birkhäuser, Basel Boston Berlin.
Frasch, J.V., Vukov, M., Ferreau, H.J., and Diehl, M. Stellato, B., Banjac, G., Goulart, P., Bemporad, A., and
(2014). A new quadratic programming strategy for Boyd, S. (2017). OSQP: An operator splitting solver for
efficient sparsity exploitation in SQP-based nonlinear quadratic programs. ArXiv e-prints.
MPC and MHE. In Proc. of the IFAC World Congress. Verschueren, R., Frison, G., Kouzoupis, D., van Duijkeren,
Frison, G., Kouzoupis, D., Jørgensen, J.B., and Diehl, M. N., Zanelli, A., Novoselnik, B., Frey, J., Albin, T., Quiry-
(2016). An efficient implementation of partial condens- nen, R., and Diehl, M. (2019). acados: a modular open-
ing for nonlinear model predictive control. Proc. of the source framework for fast embedded optimal control.
IEEE Conference on Decision and Control, 4457–4462. arXiv preprint.
Frison, G., Kouzoupis, D., Sartor, T., Zanelli, A., and Wang, Y. and Boyd, S. (2010). Fast model predictive
Diehl, M. (2018). BLASFEO: Basic linear algebra sub- control using online optimization. IEEE Transactions
routines for embedded optimization. ACM Transactions on Control Systems Technology, 18(2), 267–278.
on Mathematical Software, 44(4), 42:1–42:30. Wright, S.J. (1997). Primal-Dual Interior-Point Methods.
Frison, G., Sorensen, H.B., Dammann, B., and Jørgensen, SIAM Publications, Philadelphia.
J.B. (2014). High-performance small-scale solvers for

You might also like