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

Auto-Generated Algorithms For Nonlinear Model Predictive Control On Long and On Short Horizons

Uploaded by

haopengchen233
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)
11 views7 pages

Auto-Generated Algorithms For Nonlinear Model Predictive Control On Long and On Short Horizons

Uploaded by

haopengchen233
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

Auto-generated Algorithms for Nonlinear

Model Predictive Control on Long and on Short Horizons


Milan Vukov Alexander Domahidi Hans Joachim Ferreau Manfred Morari Moritz Diehl

Abstract— We present a code generation strategy for han- Nonlinear model predictive control (NMPC) allows one
dling long prediction horizons in the context of real-time nonlin- to apply MPC to nonlinear dynamical systems [3], [4]. The
ear model predictive control (NMPC). Existing implementations continuation/GMRES method [19], the advanced step NMPC
of fast NMPC algorithms use the real-time iteration (RTI)
scheme and a condensing technique to reduce the number of controller [28] and the real-time iteration (RTI) scheme [7],
optimization variables. Condensing results in a much smaller, [8] represent efficient algorithms for fast NMPC. The reader
but dense quadratic program (QP) to be solved at every time is referred to [9] for a more detailed overview.
step. While this approach is well suited for short horizons, Automatic code generation for convex optimization solvers
it leads to unnecessarily long execution times for problem became very popular recently. The basic idea of code gen-
formulations with long horizon. This paper presents a new
implementation of auto-generated NMPC code based on a eration is to exploit the fact that all problem dimensions
structure exploiting auto-generated QP solver. Utilizing such and structure is known a priori. This allows one to gen-
a QP solver, the condensing step can be avoided and execution erate highly customized and fast solver code, which then
times scale linearly with the horizon length instead of cubically. solves instances of a specific problem. The code generation
Our simulation results show that this approach significantly framework CVXGEN [17] was the first implementation that
decreases the execution time of NMPC with long horizons. For
a nonlinear test problem that comprises 9 states and 3 controls allowed one to export tailored interior-point (IP) solvers that
on a horizon with 50 time steps, an improvement by a factor can solve quadratic programs (QPs) very fast on embedded
of 2 was observed, reducing the execution time for one RTI to platforms. Following the observation that linear MPC prob-
below 4 milliseconds on a 3 GHz CPU. lems fall into the class of multistage problems with particular
structure [11], FORCES has been designed to overcome
I. INTRODUCTION the limitations of CVXGEN in terms of problem size. The
FORCES code generation framework [10] exports primal-
Model predictive control (MPC) has been originally de- dual interior point codes.
signed and used for control of large-scale processes, typically In a similar fashion, nonlinear MPC (NMPC) relevant
in the chemical and petroleum industry. Slow dynamics dimensions are also known before deployment of a controller
of those systems allowed large control intervals measured and highly efficient code can be generated to speed up com-
in tens of seconds or even hours, leaving enough time to putations. To our knowledge, the existing implementations of
compute a solution to the underlying optimization problem. NMPC code generators are AutoGenU [23] and the ACADO
However, progress in the area of optimization algorithms Code Generation tool [15]. The ACADO Code Generation
and computational hardware in the last two decades have tool exports efficient self-contained C-code that implements
extended the applicability of numerical optimization on em- the RTI scheme. The algorithm implements an sequential
bedded platforms. These developments made MPC suitable quadratic programming (SQP) framework and consists of
for control of fast dynamical systems with time constants in simulation and linearization of the nonlinear system, and
micro- and millisecond range. solution of a convex subproblem – a QP. The RTI scheme [8]
performs a single SQP iteration per sampling instant in
Milan Vukov and Moritz Diehl are with the Department of Electrical order to quickly deliver an approximate solution to the
Engineering, KU Leuven, Kasteelpark Arenberg 10, 3001 Leuven, Belgium.
Alexander Domahidi and Manfred Morari are with the Automatic Control optimization problem. An experimental verification of the
Laboratory, Department of Information Technology and Electrical Engineer- exported NMPC code is presented in [25], showing execution
ing, ETH Zurich, 8092 Zurich, Switzerland. times below 1.1 milliseconds per RTI step for a nontrivial
Hans Joachim Ferreau is with the ABB Corporate Research, Baden-
Dättwil, Switzerland. dynamic model.
Contact: [email protected] The original implementation of the code generator for non-
This research was supported by Research Council KUL: PFV/10/002 linear MPC within the ACADO toolkit utilizes the embedded
Optimization in Engineering Center OPTEC, GOA/10/09 MaNet and
GOA/10/11 Global real- time optimal control of autonomous robots version of the QP solver qpOASES [1]. The QP solver is
and mechatronic systems. Flemish Government: IOF/KP/SCORES4CHEM, based on an (online) active set strategy [12] and employs
FWO: PhD/postdoc grants and projects: G.0320.08 (convex MPC), dense linear algebra routines. To obtain feedback times in
G.0377.09 (Mechatronics MPC); IWT: PhD Grants, projects: SBO LeCoPro;
Belgian Federal Science Policy Office: IUAP P7 (DYSCO, Dynamical the milliseconds range, a technique called condensing [6]
systems, control and optimization, 2012-2017); EU: FP7-EMBOCON (ICT- is applied, which significantly reduces the number of opti-
248940), FP7-SADCO ( MC ITN-264735), ERC ST HIGHWIND (259 166), mization variables in the QP. However, both the condensing
Eurostars SMART, ACCM.
The authors would like to thank Janick Frasch and Timon Achtnich for procedure and an active-set QP solver have cubic complexity
helpful discussions during the preparation of this paper. in number of prediction intervals, leading to prohibitively
long execution times when long prediction horizons are The typical choice for NMPC is to use piecewise constant
needed. parametrization of controls, resulting in N control variables
In this paper we present an extension of the ACADO Code uk , k = 0, . . . , N − 1.
Generation tool for NMPC that can efficiently handle long In the context of multiple shooting, the state trajectory
prediction horizons. In particular, we present a variant of is computed independently on each subinterval [tk ,tk+1 ]. For
an auto-generated NMPC that is utilizing the structure ex- that purpose, additional variables sk are introduced to serve
ploiting QP solver FORCES [11], [10]. Employing FORCES as initial values:
bypasses usage of the condensing procedure, thus saves a
significant amount of computational time for long prediction ẋk (t) = f (xk (t), uk ), xk (tk ) = sk , t ∈ [tk ,tk+1 ]. (2)
horizons. The new implementation of the NMPC is tested
against the original, condensing based, NMPC on a scalable Furthermore, in order to ensure continuity of the optimal
example – a chain of masses connected with springs. The state trajectory on the whole horizon matching constraints
purpose of this paper is to explore at which horizon length are added to the NLP:
the cubic growth will make condensing non-competitive
compared with NMPC utilizing sparse QP solver. sk+1 = Fk (sk , uk ), k = 0, . . . , N − 1, (3)
The paper is organized as follows. In Section II, we
introduce the problem formulation of the nonlinear MPC where Fk represents the solution of the initial value problem
problem, and give the concept of the real-time iteration (RTI) (IVP) (2) at time t = tk+1 . The objective and path constraints
scheme and background on dense vs. sparse QP solvers. are discretized at the same grid as the states and controls.
Section III describes the ACADO Code Generation tool The NLP that comes as a result of the multiple shooting
and the extension to generating code that utilizes sparse discretization reads:
QP solvers. We give a numerical example showing the
1 N−1  
computational benefits for long horizons with the structure min
u, s 2 k=0
ks − x ref 2
k + ku − u ref 2
∑ k k Q k k R + ksN − xNref k2P
k
exploiting QP solver FORCES in Section IV. Section V
concludes the paper. (4a)

II. REAL-TIME ITERATIONS FOR s.t. s0 = x̂0 , (4b)


NONLINEAR MPC sk+1 = F(tk+1 ;tk , sk , uk ), k = 0, . . . N − 1, (4c)
We consider the following optimal control problem (OCP): u ≤ uk ≤ u, k = 0, . . . N − 1, (4d)
Z t0 +T  x ≤ sk ≤ x, k = 1, . . . N, (4e)
1 
min kx(t) − xref (t)k2Q + ku(t) − uref (t)k2R dt
x(·), u(·) t0 2 B. Generalized Gauss-Newton Method and Real-Time Itera-
+ kx(t0 + T ) − xref (t0 + T )k2P (1a) tions
Since the objective (4a) is of least squares form, the
s.t. x(t0 ) = x̂0 , (1b)
NLP (4) can be solved using a generalized Gauss-Newton
ẋ(t) = f (x(t), u(t)), (1c) method [5]. For sake of brevity, the optimization variables
of the NLP are summarized in a single column vector w =
u ≤ u(t) ≤ u, (1d)
[s00 u00 . . . s0N ]0 and we will refer to w as a current linearization
x ≤ x(t) ≤ x, for all t ∈ [t0 ,t0 + T ]. (1e) point. Linearizing the NLP around w, a sequential quadratic
programming (SQP) iteration is performed, and the NLP
Within this formulation t0 denotes the current time, T denotes variables are updated as follows
the length of the prediction horizon, x ∈ Rnx denotes the state
vector, u ∈ Rnu denotes the control vector. Vectors xref ∈ w+ = w + ∆w∗ , (5)
Rnx and uref ∈ Rnu denote time-varying state and control
references, respectively. The weighted least squares objective where ∆w∗ denotes the solution of the following QP:
in (1a) uses weighting matrices Q, P  0 and R  0. Variable
1 N−1 ∆sk 0 Q
0  s 
x̂0 denotes the (measurement of the) current state. Function
    
∆sk ∆sk gk
f (x, u) describes system dynamics with ordinary differential min ∑ ∆uk +
∆u, ∆s 2 k=0 R ∆uk ∆uk guk
equations (ODEs). The bounds on controls and states are
1
given in (1d) and (1e), respectively. + ∆xN0 P∆xN + ∆xN0 gxN (6a)
2
A. Direct Multiple Shooting Discretization s.t. ∆s0 = x̂0 − s0 , (6b)
We use the direct multiple shooting technique [6] to ∆sk+1 = ak + Ak ∆sk + Bk ∆uk , k = 0, . . . N − 1, (6c)
transform the infinite dimensional OCP (1) into a nonlinear u − uk ≤ ∆uk ≤ u − uk , k = 0, . . . N − 1, (6d)
program (NLP). The time horizon [t0 ,t0 + T ] is partitioned
on a finite grid into N subintervals [tk ,tk+1 ], k = 0, . . . , N − 1. x − sk ≤ ∆sk ≤ x − sk , k = 1, . . . N, (6e)
with Condensing based real-time iterations for NMPC
∂ Fk ∂ Fk Initialization: Initialize sk , k = 0, . . . , N and uk , k = 0, . . . , N − 1.
ak = Fk (sk , uk ) − sk+1 , Ak = (sk , uk ), Bk = (sk , uk ),
∂ sk ∂ uk Repeat online:
(7a) 1 Preparation step
gsk = Q(sk − xkref ), guk = R(uk − uref
k ). (7b) 1.1 Solve IVPs (2) and generate sensitivities Ak and Bk .
1.2 Evaluate objective.
The RTI scheme [8] uses the control and state variables 1.3 Condense large QP (6) into a smaller dense QP (12).
of the previous optimization run, possibly after a shift, as 1.4 Wait for a new state feedback x̂0 .
new linearization point, and performs only one Newton-type 2 Feedback step
iteration per sampling instant. Due to the fact that the initial 2.1 Use the state feedback to compute the linear term of the
value enters the problem linearly, it can be shown to deliver a dense QP and bounds on affine constraints.
generalized tangential predictor to perturbations, and nominal 2.2 Solve the dense QP (12).
2.3 Send the first control, u+
0 , to the process.
convergence of the resulting NMPC loop can be proven. We
refer to [9] and the references therein for a detailed survey
on the RTI and other algorithms for nonlinear MPC. Fig. 1: A simplified description of the classical condensing
based RTI scheme for NMPC.
C. Condensing procedure
The goal of the condensing procedure [6] is to reduce the
number of optimization variables in the QP (6). The system where Q ∈ R(N·nx )×(N·nx ) and R ∈ R(N·nu )×(N·nu ) are block di-
of linearized dynamic equations (6c) can be regarded as an agonal matrices with matrices Q and R on the corresponding
affine time variant dynamic system with steps ∆sk . Assuming diagonals.
∆s0 and the variables ∆w1 = (∆u0 , . . . , ∆uN−1 ) are known, the Analyzing (12) and (13), it can be easily concluded that
variables ∆w2 = (∆s1 , . . . , ∆sN ) can be obtained by a forward all quantities except the linear term gc and two terms in the
simulation. Thus, the resulting map is also affine: lower and upper affine constraint bounds can be precomputed
– in the RTI this is called as the preparation phase. As
∆w2 = d +C∆s0 + E∆w1 , (8)
soon as the current state x̂0 becomes available, the linear
Here, matrices C ∈ R(N·nx )×nx and E ∈ R(N·nx )×(N·nu ) have a term and lower and upper bounds of the affine constraints
special block structure: are computed and the QP (12) is solved. This is called the
  feedback phase. Once the QP is solved, the control vector

C0
 E0,0
 E0,1 on the first shooting interval is updated, u+ ∗
0 = u0 + ∆u0 ,
 C1  E1,1 
C= , E =  . . ,
 and immediately sent to the process. Afterwards, we can
 ...   ..
 .. ..
.  apply the so-called expansion step to obtain all variables
CN−1 E0,N−1 · · · EN−1,N−1 from the original QP (6). The control variables are updated
(9) with u+ ∗
k = uk + ∆uk , k = 1, . . . , N − 1, while variables sk are
where the corresponding blocks are computed as: updated using (8):

Ck = Ak · . . . · A0 , k = 0, . . . , N − 1, w+
2 = w2 + d +C∆s0 + E∆w1 . (14)
Ek,m = Ak Ek−1,m , k = 1, . . . , N − 1, m = 0, . . . , k − 1, The classical condensing based RTI scheme is shown on Fig.
Ek,k = Bk , k = 0, . . . , N − 1. 1.
(10) The main computational bottleneck of the condensing
Vector d can be computed by a forward simulation of the technique is the computation of the condensed Hessian Hc . In
affine dynamic system (6c) with ∆s0 = 0 and ∆w1 = 0. This particular, O(N 3 ) complexity results from the multiplication
yields a recursion: of E 0 with QE. A naive approach would lead to exactly
N 3 block multiplications. However, significant savings can
d0 = a0 , dk = ak + Ak dk−1 , k = 1, . . . , N − 1 (11)
be obtained by taking into account that matrix E is lower
Applying the condensing procedure to the original sparse block triangular and Q is block diagonal, along with the fact
QP (6), an equivalent, condensed, QP is obtained as: that we need to calculate only upper (or lower) triangular
1 0 blocks of the reduced Hessian Hc . This approach results in
min ∆w Hc ∆w1 + ∆w01 gc (12a) N(N + 1)(N + 2)/6 block multiplications, each of runtime
∆w1 2 1
complexity of n2u nx floating point operations (flops1 ). In other
s.t. w1 − w1 ≤ ∆w1 ≤ w1 − w1 (12b)
words, more than 75% block multiplications can be saved for
w2 − w̃2 ≤ E∆w1 ≤ w2 − w̃2 (12c) N > 7 compared to the naive approach.
with w̃2 = w2 + d + C∆s0 . The Hessian and the linear term On the other hand, condensing technique greatly reduces
of the condensed QP are obtained as: the number of optimization variables, from (N + 1)nx + Nnu
to Nnu . This allows us to solve (12) with an efficient
Hc = E 0 QE + R, (13a)
1 flops - addition, multiplication or fused multiply-accumulate operations
gc = E 0 Qd + E 0 gs + gu + E 0 QC∆s0 , (13b) of two floating point numbers
dense linear algebra QP solver, such as qpOASES [1], and control and dynamic optimization [14]. The tool implements
significantly reduce the feedback delays. The condensing the algorithmic ideas based on the real-time iteration scheme.
technique is known to perform well for relatively short The user interface allows one to specify nonlinear dynamic
horizons. model equations as well as objective and constraint func-
tions. The original implementation of code-generator allowed
D. Solution of the sparse problem for the export of generalized Gauss-Newton method for
The second way of solving (6) is to keep and optimize nonlinear MPC [15], and was followed up with extensions
all variables of the original problems: ∆s and ∆u, i.e. avoid that made it possible to specify and export a solver for
the aforementioned condensing procedure. This leaves far moving horizon estimation (MHE) [13]. The tool exploits
more variables in the problem. However, compared to the problem structure and dimensions together with sparsity
the condensed, dense QP (12), the problem described in (6) patterns to remove all unnecessary computations and remove
is highly structured. This structure can be exploited to yield the need for dynamic memory allocation. More details on the
a computational complexity of O N(n3x + n3u ) , significantly

ACADO Code Generation tool can be found in [2].
reducing the execution time of one real-time iteration for More recent extensions of the ACADO Code Genera-
long prediction horizons compared to the condensing based tion tool include support for implicit integrators for ODEs
approach. The exploration of this banded structure in the and differential algebraic equations (DAEs) [21], [20]. Those
solution of nonlinear control problems was first proposed in extensions allow handling of more challenging stiff dynamic
[24] and for linear MPC in [22]. models where usage of explicit integrators would require far
There are currently three freely available fast embedded more integration steps per prediction interval. This would
QP solvers that can exploit the structure of (6): an effi- directly lead to prohibitively long execution times.
cient prototype implementation of a primal-barrier interior Both the original implementation of auto-generated MPC
point method named fastMPC [26] and two auto-generated and the later MHE extension implement a condensing pro-
solvers that implement a primal-dual interior point method: cedure in order to solve a smaller-scale QP by means of a
CVXGEN [18], [16] and FORCES [11], [10]. CVXGEN is dense linear algebra QP solver. Cubic complexities of the
optimized for small problems and provides C-code that can condensing procedure and active-set based QP solver reduce
be executed in orders of milliseconds or even microseconds, the applicability of the considered approach for OCPs with
while FORCES has about the same speed but supports long horizons.
problems of arbitrary size. The latest extension of the tool that is presented in this
In this paper, we focus on employing FORCES, which paper makes it possible to solve long horizon OCPs with
supports more general convex multi-stage problems of the interior point based solver FORCES inside ACADO. This
form way the expensive O(N 3 ) condensing procedure is avoided,
1 N−1 0 and in fact exchanged for O(N) complexity coming from
min
z
∑ zk HF,k zk + z0k gF,k
2 k=0
(15a) structure-exploiting IP based QP solver. From user point
of view, only two options have to be changed in order to
s.t. CF,k zk + DF,k+1 zk+1 = cF,k , k = 0, . . . , N − 1, (15b) generate an MPC solver that is internally using FORCES to
hF,k (zk ) ≤ 0, k = 0, . . . , N. (15c) solve the QP (6).
The ACADO Code Generation tool generates self-
with N + 1 stage variables zk , coupling equality con- contained ANSI-C compliant code, which can be deployed
straints (15b) and convex inequality constraints hF,k . The on any platform supporting the standard C library. The same
problem (15) can be solved efficiently by exploiting the holds for the auto-generated FORCES based QP solver.
inherent problem structure. In particular, the Hessian in (15) The qpOASES solver is provided in form of self-contained
is block-diagonal, and together with (15b), this introduces a ANSI C++ code, thus creates slightly more dependencies.
block-banded structure in the reduced coefficient matrix of Branching in the exported code is minimized leading to
the linearized Karush-Kun-Tucker (KKT) system. Solving improved code locality, thus faster execution times. Further-
this system to obtain a search direction is the bottleneck more, heuristics have been implemented to unroll for-loops
of interior point methods, and can be done as suggested whenever possible to increase efficiency of the compiled
in [26], [11], [22], [24] quickly by exploiting the block- code.
banded structure. Moreover, the FORCES solver is able to
exploit certain special cases of MPC, for example how to IV. NUMERICAL SIMULATIONS
efficiently deal with diagonal Hessian block HF,k and take
advantage of the fact that (6) has only box constraints. In order to test both NMPC implementations we have
More general constraints such as quadratic constraints are chosen a chain of masses connected with springs [27],
supported as well, but not considered in this paper. illustrated in Fig. 2. The dynamics of this system is nonlinear
due to nonlinear spring forces. Furthermore, this model is
III. ACADO CODE GENERATION TOOL easily scalable, meaning that the problem complexity can
The ACADO Code Generation tool is part of the open- be increased by adding additional masses to the chain. The
source software package ACADO Toolkit for automatic goal of each controller is to move back the chain from its
TABLE I: Relevant dimensions of the NMPC controller
Fixed end
applied to the chain of masses; nx = 3(2M + 1), nu = 3.
1
Approach QP variables QP bounds Aff. constraints
0.5

0
Condensed Nnu Nnu NM
Sparse Nnu + (N + 1)nx Nnu + (N + 1)M 0
−0.5

−1
z [m]

−1.5

−2 affine inequalities, in form of (12c). Relevant controller QP


−2.5 dimensions are summarized in Tables I.
−3 0 All simulations are performed on a 3GHz Intel Q9650
0.2
−3.5
0.4 based desktop computer, running the 64-bit version of
−4 0.6
0
0.2 0.8
Ubuntu Linux 12.04. All codes are compiled with the
0.4
0.6
0.8
1
1
x [m] Intel 13.0.1 compiler, using the flags: -O3 -xHost.
y [m] Execution times are measured with the Linux func-
Fig. 2: A chain of masses connected with springs. The tion clock_gettime(), which yields resolution in the
blue chain denotes equilibrium state, the red chain illustrates nanosecond range.
disturbed state. The green patch represents a wall and black C. Results
dot the fixed point of the chain. Simulations are performed for three different variants of
chain mass problem, namely for M = 1, 2, 3. For each dy-
namic system ten controllers are tested, for different horizon
disturbed to its equilibrium state, respecting upper and lower lengths N in the range from 5 to 50. Simulation results are
bounds on both states and input variables. presented in Fig. 3. All plots show the maximum run-times
A. Simulation model for both types of controllers. Simulation results show that
for a test problem with 9 states, 3 control inputs and 50
We consider a chain with M balls of equal mass m that
prediction intervals, the execution time can be reduced by a
are connected with springs. All springs have equal rest length
factor greater than 2 when using the new extension of the
L and spring constant D. At both ends additional identical
auto-generated NMPC.
springs are attached. One end of the chain is attached to a Starting at horizon N = 5 and M = 1 we can observe that
fixed point, while the velocity of the other end u = (ux , uy , uz ) condensing based approach is very cheap. The feedback time
can be controlled. The center of each ball is represented by a is very short because a very small QP is solved, comprising
3-dimensional coordinate pi = (px,i , py,i , pz,i ). For the chain only 15 variables. On the other hand, the runtime of the
comprising M balls, an ODE that describes model dynamics sparse QP solver is more expensive due to its internal fac-
has nx = (2M + 1) · 3 states and nu = 3 controls. In the rest torizations which are of O(n3x + n3u ) complexity; in this case
of the paper it is assumed that all states can be measured. number of optimization variables is more than four times
For all details specific to the model we refer to [27]. larger that in the condensing based NMPC. Increasing the
B. Simulation scenario number of prediction intervals N, runtime of the condensing
based NMPC scales with N 3 , while the full-space NMPC
The continuous ODE model is parametrized by the mul-
scales linearly in N, as expected.
tiple shooting technique using intervals of Ts = 200 ms. In
For a fixed number number of prediction intervals N, in
order to reliably integrate the model we chose implicit Gauss-
the case of condensing based NMPC number of optimization
Legendre integrator of order four, with one integration step
variables is Nnu , i.e. independent of the number of states
per shooting interval. The constraints that the controller must
nx . However, an increase of the number of states nx leads
respect are defined as follows. There are simple input bounds
to an increased number of affine constraints (12c) – MN.
−1 m/s ≤ u j ≤ 1 m/s, j ∈ {x, y, z}, This directly makes an NMPC problem harder to solve,
i.e. requires more working set recalculations when using
and there is a set of tight state bounds imposed by a wall an active set based QP solver, resulting in longer runtimes.
next to the equilibrium plane (see Fig. 2): Increase of number of intervals N directly leads to a cubic
−0.01 m ≤ py,i , i = 0, . . . , M − 1. increase in the runtime of one RTI, as can be observed on
Fig. 3.
In other words, the chain must not hit the wall during the For a fixed number of controls nu and fixed horizon length
simulation. Compared to the simulation settings in [27], the N, run-time of the interior point QP solver is proportional to
wall is placed at a closer distance to the equilibrium plane. the n3x . For shorter horizons, this makes IP based solver less
This makes the problem even harder to solve, and this was favorable. In particular, as shown in Fig. 3, the condensing
a design decision made in order to increase the number of based solver is competitive until horizon lengths of 26, 40,
active constraints during the simulations. Note that in case and 50, for M = 1, 2, and 3, respectively. However, linear
of condensing based NMPC state bounds are transformed to complexity in N makes the IP based solver superior for
10 V. CONCLUSIONS AND OUTLOOK
NMPC with condensing This paper presents the most recent extension of the
NMPC with FORCES
8 ACADO toolkit Code Generation tool to efficiently handle
RTI execution time [ms]

small to medium scale NMPC problems with long horizons


6 in the millisecond range using the structure exploiting in-
terior point based solver FORCES. The exported code is
ANSI C/C++ compatible and can be deployed on arbitrary
4
embedded platforms. The obtained results reflect the benefits
of using condensing for short horizons and FORCES for long
2
horizons, making the ACADO code generation tool able to
solve a wide range of optimal control problems efficiently.
0 Future work will include extensions to support more
10 20 30 40 50
Horizon length general OCP formulations, as well as support for DAEs.
(a) Results obtained for chain with one mass R EFERENCES
20 [1] qpOASES Homepage. http://www.qpOASES.org, 2007–2013.
NMPC with condensing
[2] ACADO Toolkit Homepage. http://www.acadotoolkit.org, 2009–2013.
[3] F. Allgöwer and A. Zheng. Nonlinear Predictive Control, volume 26
NMPC with FORCES
of Progress in Systems Theory. Birkhäuser, Basel Boston Berlin, 2000.
RTI execution time [ms]

15 [4] L.T. Biegler and J.B Rawlings. Optimization approaches to nonlinear


model predictive control. In W.H. Ray and Y. Arkun, editors, Proc.
4th International Conference on Chemical Process Control - CPC IV,
pages 543–571. AIChE, CACHE, 1991.
10 [5] H.G. Bock. Recent advances in parameter identification techniques for
ODE. In P. Deuflhard and E. Hairer, editors, Numerical Treatment of
Inverse Problems in Differential and Integral Equations. Birkhäuser,
5 Boston, 1983.
[6] H.G. Bock and K.J. Plitt. A multiple shooting algorithm for direct
solution of optimal control problems. In Proceedings 9th IFAC World
Congress Budapest, pages 243–247. Pergamon Press, 1984.
0 [7] M. Diehl. Real-Time Optimization for Large Scale Nonlinear Pro-
10 20 30 40 50 cesses. PhD thesis, Universität Heidelberg, 2001. http://www.ub.uni-
Horizon length heidelberg.de/archiv/1659/.
(b) Results obtained for chain with two masses [8] M. Diehl, H.G. Bock, J.P. Schlöder, R. Findeisen, Z. Nagy, and
F. Allgöwer. Real-time optimization and Nonlinear Model Predictive
30 Control of Processes governed by differential-algebraic equations. J.
NMPC with condensing Proc. Contr., 12(4):577–585, 2002.
NMPC with FORCES [9] M. Diehl, H. J. Ferreau, and N. Haverbeke. Nonlinear model predictive
25
control, volume 384 of Lecture Notes in Control and Information
RTI execution time [ms]

Sciences, chapter Efficient Numerical Methods for Nonlinear MPC


20 and Moving Horizon Estimation, pages 391–417. Springer, 2009.
[10] A. Domahidi. FORCES website. http://forces.ethz.ch, 2011 – 2013.
[11] A. Domahidi, A. Zgraggen, M.N. Zeilinger, M. Morari, and C.N.
15
Jones. Efficient interior point methods for multistage problems arising
in receding horizon control. In IEEE Conference on Decision and
10 Control (CDC), pages 668 – 674, Maui, HI, USA, December 2012.
[12] H. J. Ferreau, H. G. Bock, and M. Diehl. An online active set strategy
5 to overcome the limitations of explicit MPC. International Journal of
Robust and Nonlinear Control, 18(8):816–830, 2008.
[13] H.J. Ferreau, T. Kraus, M. Vukov, W. Saeys, and M. Diehl. High-
0 speed moving horizon estimation based on automatic code generation.
10 20 30 40 50
In Proceedings of the 51th IEEE Conference on Decision and Control
Horizon length
(CDC 2012), Hawaii, 2012. (accepted).
(c) Results obtained for chain with three masses [14] B. Houska, H.J. Ferreau, and M. Diehl. ACADO Toolkit – An Open
Source Framework for Automatic Control and Dynamic Optimization.
Fig. 3: Maximum execution times of condensing based Optimal Control Applications and Methods, 32(3):298–312, 2011.
[15] B. Houska, H.J. Ferreau, and M. Diehl. An Auto-Generated Real-Time
NMPC () and NMPC with sparse QP solver (F); full lines Iteration Algorithm for Nonlinear MPC in the Microsecond Range.
and dashed lines denote cubic and linear fits, respectively. Automatica, 47(10):2279–2285, 2011.
Integration times, which are identical for both approaches, [16] J. Mattingley and S. Boyd. CVXGEN webage. http://cvxgen.com,
2008–2011.
are denoted with dotted lines. [17] J. Mattingley and S. Boyd. Convex Optimization in Signal Processing
and Communications, chapter Automatic Code Generation for Real-
Time Convex Optimization. Cambridge University Press, 2009.
[18] J. Mattingley, Y. Wang, and Stephen Boyd. Code generation for
receding horizon control. In Proceedings of the IEEE International
Symposium on Computer-Aided Control System Design, Yokohama,
Japan, 2010.
[19] T. Ohtsuka. A Continuation/GMRES Method for Fast Computation
longer horizons where the complexity of the condensing of Nonlinear Receding Horizon Control. Automatica, 40(4):563–574,
based NMPC is dominated by the cubic terms in N. 2004.
[20] R. Quirynen, S. Gros, and M. Diehl. Fast auto generated ACADO
integrators and application to MHE with multi-rate measurements. In
Proceedings of the European Control Conference, 2013.
[21] R. Quirynen, M. Vukov, and M. Diehl. Auto Generation of Implicit
Integrators for Embedded NMPC with Microsecond Sampling Times.
In Mircea Lazar and Frank Allgower, editors, Proceedings of the 4th
IFAC Nonlinear Model Predictive Control Conference, Noordwijker-
hout, The Netherlands, volume 4, 2012.
[22] C.V. Rao, S.J. Wright, and J.B. Rawlings. Application of Interior-
Point Methods to Model Predictive Control. Journal of Optimization
Theory and Applications, 99:723–757, 1998.
[23] H. Seguchi and T. Ohtsuka. Nonlinear Receding Horizon Control of
an Underactuated Hovercraft. International Journal of Robust and
Nonlinear Control, 13(3–4):381–398, 2003.
[24] M.C. Steinbach. Fast recursive SQP methods for large-scale optimal
control problems. PhD thesis, Universität Heidelberg, IWR, 1995.
[25] M. Vukov, W. Van Loock, B. Houska, H.J. Ferreau, J. Swevers, and
M. Diehl. Experimental Validation of Nonlinear MPC on an Overhead
Crane using Automatic Code Generation. In The 2012 American
Control Conference, Montreal, Canada., 2012.
[26] Y. Wang and S. Boyd. Fast model predictive control using online
optimization. IEEE Transactions on Control Systems Technology,
18(2):267–278, 2010.
[27] L. Wirsching, H. G. Bock, and M. Diehl. Fast NMPC of a chain of
masses connected by springs. In Proceedings of the IEEE International
Conference on Control Applications, Munich, pages 591–596, 2006.
[28] V. M. Zavala and L.T. Biegler. The Advanced Step NMPC Controller:
Optimality, Stability and Robustness. Automatica, 45:86–93, 2009.

You might also like