Stable MPC with maximal terminal sets and quadratic terminal costs
Abstract
This paper develops a technique for computing a quadratic terminal cost for linear model predictive controllers that is valid for all states in the maximal control invariant set. This maximizes the set of recursively feasible states for the controller, ensures asymptotic stability using standard proofs, and allows for easy tuning of the controller in linear operation.
I Introduction
With its ability to optimize the closed-loop system under constraints on states and control signals, model predictive control (MPC) has emerged as the preferred control technique for many advanced applications. Although the underlying ideas can be traced back to the 1960’s [1] and industrial applications appeared already in the 70’s [2], a more complete theoretical understanding of MPC emerged first around the millenium [3]. Advances in optimization algorithms [4, 5, 6] now allow model-predictive controllers to run on cheap embedded hardware, and a wealth of applications have demonstrated the practical value of MPC [7]. With a number of excellent textbooks on MPC [8, 9, 10], it is fair to say that the field of model predictive control for linear constrained systems is rather complete. However, there are still a few important questions that have not been fully resolved. This paper aims to address one of them.
Specifically, we are concerned with the problem of achieving the maximal operating region of a linear MPC with quadratic stage and terminal costs, while guaranteeing asymptotic stability of the closed loop.
The standard stability theorems for linear MPC require that the terminal set is matched with an appropriate terminal cost. Textbooks on MPC, such as [8, 9, 10], only present partial and suboptimal solutions to this problem. The easiest approach is to require that the terminal state reaches the origin, in which case we do not need a terminal penalty. A less restrictive solution is to use the control invariant set induced by some linear state feedback controller as terminal set. A matching terminal cost can then be computed by solving a Lyapunov equation. However, both these approaches result in an unnecessarily small feasible region for the associated MPC controller. To increase their operating regions, one needs to use long prediction horizons. A more economical alternative is to use the maximal control invariant set as a terminal set. Although techniques for computing maximal control invariant sets are well-developed [11], it is not obvious how to match these with an appropriate terminal cost. This paper demonstrates how one can compute a quadratic terminal cost that is valid on the maximal control invariant set, hence allowing the largest possible operating region for the associated MPC controller while guaranteeing asymptotic stability of the closed-loop.
The challenge of determining terminal sets and terminal costs that enlarge the operating region for MPC controllers has been approached by several authors. For example, [12] used the invariant set of a saturated linear controller (instead of linear) as terminal set, [13] computed a piecewise affine terminal cost for hybrid MPC controllers, and [14] and [15] suggested to use terminal costs derived from the Minkowski (control) Lyapunov function induced by the terminal set. Although these latter two approaches enable the MPC controller to operate from all states in the interior of the maximal control invariant set [15], they have a few disadvantages. First, polyhedral Lyapunov functions can have many segments, and therefore be complex to represent and costly to use in the MPC computations. This issue is partially overcome in [14], where the same inequalities are used to define the terminal set and the terminal cost. The second, and more important, disadvantage of the approaches in [15, 14] is that the computed terminal cost only depends on the system dynamics and constraints, but is independent of the stage cost. This necessitates a different convergence proof and makes it hard to affect the properties of the controller when it regulates the system without activating any constraints.
This paper is organized as follows. Section II reviews the linear MPC set-up and the standard stability theorems. Our approach to terminal cost computation is developed in Section III, and evaluated numerically in Section IV. Finally, Section V concludes the paper.
Notation.
Our notation is largely standard. For a set , we let denote its boundary, and define the scaled set . We say that is a C-set if it is convex, compact, and includes the origin in its interior.
A simplex is the convex hull of affinely independent vectors which we refer to as vertices. A triangulation of a set is a subdivision of the set into a finite number of -dimensional simplices such that any two simplices intersect in a common face (a simplex of any lower dimension) or not at all. In a boundary triangulation, each simplex in the triangulation has one vertex at the origin.
II Linear Model Predictive Control
Consider the discrete-time linear system
(1) |
with linear constraints on the states and controls
(2) |
Both and are assumed to be polyhedral C-sets.
It is useful to view linear MPC as an approximate solution to the infinite-horizon control problem
(6) |
At every sampling instant , the MPC control law measures the state , solves the planning problem
(12) |
for the predicted optimal controls and predicted state trajectory , and applies the control
(13) |
In the planning problem, serves as an approximation of the infinite-horizon cost-to-go of (6) from state at the end of the planning horizon, while the terminal set ensures that the cost-to-go approximation is valid. The standard stability proof for linear MPC imposes the following requirements [8].
Theorem 1
Consider the system (1) with constraints (2) under the the RHC control law (12)-(13). Assume that is a reachable pair and let be the set of states for which the planning problem (12) admits a feasible solution. If
-
(a)
with detectable, ,
-
(b)
The sets , and are C-sets
-
(c)
For every , there exists a such that
Then, every trajectory of the closed-loop system remains in and .
While the first two conditions of the theorem are straightforward to verify, the last one is more involved. In essence, it requires that is control invariant and that is an upper bound on the true cost-to-go of (6) for all . MPC textbooks, such as [10, 9, 8], typically suggest two approaches to this problem. The first one is to set (forcing the state at the end of the planning horizon to zero), for which we can set . The second one is to choose a terminal set that is invariant under some linear state feedback . Specifically, one uses the largest invariant set of contained in the set . A valid quadratic upper bound of the cost-to-go is then where solves the Lyapunov equation
A particularly convenient choice is to use the infinite-horizon optimal LQR controller for the cost defined by and . In this way, the Lyapunov equation above is satisfied for the solution to the corresponding discrete-time algebraic Riccati equation
where . However, the terminal set computed in this way is not necessarily large.
Since must belong to , a smaller terminal set leads to a smaller set of (recursively) feasible states, and hence to a smaller operating region of the MPC controller. The operating region increases with the planning horizon , but with a small terminal set one typically need a long horizon to be able to operate from all states in the maximal control invariant set [16]. If one is able to use the maximal control invariant set as terminal set, on the other hand, the MPC controller will have the largest possible operating region already with a horizon of one. To illustrate the relationship between terminal set, prediction horizon, and operating regime of linear MPC, we consider the following example from [9].
Example 1
Consider the second-order system
under the MPC control (12)-(13) with
Figure 1 shows for different horizon lengths when the terminal set is taken to be the maximal invariant set of the infinite-horizon LQR-optimal control law. Note how the operating region of the MPC controller increases with increasing horizon length, and that even with a horizon of 24 samples, the MPC controller can only operate in a subset of the maximal control invariant set.
In the next section, we will develop a technique for computing a quadratic terminal cost so that one can use the maximal control invariant set as terminal set and still guarantee stability using Theorem 1.
III Computing a quadratic terminal cost valid on the maximal invariant set
Our procedure contains three key steps: we first determine the maximal invariant set, then recover an explicit feedback policy that renders the set invariant, and finally compute an upper bound on the infinite-horizon cost for this control law.
III-A Maximal control invariant and -contractive sets
Definition 1
Control invariance by itself does not imply that states in can be driven to zero. For example, if and , then but for all . Such situations can be detected and avoided by requiring that the terminal set is contractive in the following sense.
Definition 2
Note that the maximal -contractive set is identical to the maximal control invariant set. There are several techniques for computing the maximal control invariant set (e.g., [8, Algorithm 10.2]), but -contractive sets are typically computed using the following approach: define the predecessor set
and then execute the following algorithm [8, Algorithm 10.2]
-
1.
Set , .
-
2.
Let and .
-
3.
If , return else goto 2.
For a linear system with C-set constraints on the states and controls, the maximal control invariant set is also a C-set. However, even if and are polyhedral, the maximal invariant set may not be polyhedral and the algorithm above will not terminate. Conditions for when the algorithm is guaranteed to terminate in a finite number of steps, along with bounds for the number of iterations required, can be found in [17]. When we consider -contractive sets with , the situation becomes slightly more complicated since the constraints may limit our ability to contract; see [18] and [19] for a careful convergence analysis of the algorithm.
III-B Recovering the implicit feedback policy
The algorithm described above allows us to compute the maximal -contractive set of a linear system with C-set constraints on states and controls. From Definition 2, we therefore know that there exists an admissible control function that steers states in into . However, this control function is only implicit in the calculations. We will now demonstrate how we can recover as a continuous and piecewise linear control law.
The next result, which is a slight generalization of the conditions proposed by Gutman and Cwikel [20] (see also [11, §4]) demonstrates how we can determine control signals to apply at each vertex of a C-set to steer the state into .
Theorem 2
Together, the equality constraint and the conditions that and imply that for each vertex of , there is an admissible control action so that the next state belongs to and hence to . Since is a C-set, can be expressed as a system of linear inequalities or equalities. This means that the conditions in (17) constitute a linear programming feasibility problem.
Remark 1
Although we could fix for all , it can be useful to minimize to encourage the control to drive the state closer to the origin or to minimize the difference between the and a linear control law, e.g. .
As suggested by Gutman and Cwikel [20], it is possible to transform the vertex controls computed in Theorem 2 into a continuous feedback policy that is valid for all . To this end, consider a subdivision of into simplices , such that each simplex has one vertex at the origin and the remaining ones at extreme points of . Such a boundary triangulation of a C-set is readily determined using standard convex hull algorithms [21, Section 3]. Let for be the extreme points of , and be the index set for the vertices of .
Since is a simplex, any can be written as
(18) |
where and . Moreover, the vertices are affinely independent, so if we define as the matrix whose columns are the non-zero vertices of ordered in increasing vertex index , the matrix
has full rank. This implies that also has full rank.
Next, define so that . A feasible solution to the conditions in Theorem 2 then implies that
Since is convex, any convex combination of also belongs to . In particular, with defined above,
Similarly, since each , and the set is convex,
Thus, is admissible and renders -contractive under . To derive an explicit expression for the control policy, let be the matrix whose columns are for ordered in increasing vertex index and as the vector of for ordered in the same way. Then, for ,
and | ||||
In other words, the feedback policy
(19) |
renders -contractive. It is continuous and piecewise linear, and easy to extract from a solution to (17).
III-C A quadratic upper bound on the cost-to-go
Now that we have developed a procedure to recover an explicit feedback policy that renders the desired terminal set control invariant, we can proceed to compute an upper bound on the associated cost-to-go. In particular, consider . Then condition (d) of Theorem 1 reads
where and . There are such inequalities, one for each simplex in the boundary triangulation of the terminal set. As described in [22, 23] these conditions can be verified using semi-definite programming, where the condition that is encoded using the S-procedure. This leads to the next result.
Theorem 3
Remark 2
The first matrix inequality uses the S-procedure to reduce conservatism. Since is elementwise non-negative, and when , the term for . However, is not necessarily a positive semi-definite matrix and may be negative when . This makes the linear matrix inequality easier to satisfy than . The S-procedure is, in general, only a sufficient condition for checking positivity of a quadratic form on a polyhedron, but since is a simplex, this use of the S-procedure is loss-less up until dimension [23].
Remark 3
As discussed in § III-B, the matrices are invertible per definition. Nevertheless, one can multiply the linear matrix inequalities
by from the left and from the right without affecting the solution set. By accounting for the structure of , and , the resulting linear matrix inequality reads
This circumvents the need for recovering the feedback gains and avoids any inversions of the matrices.
Remark 4
As a final remark, we have used the objective , but there are many other options. One such example would be to minimize , or to minimize . Both are easily expressed as SDPs.
III-D The complete algorithm
We now have all the required components for computing a quadratic upper bound to the cost-to-go that is valid in the maximal control invariant set (and, more generally, in the maximal -contractive set). Specifically, we propose to use the following algorithm with .
-
1.
Compute and determine its boundary triangulation (including the vertices) using a convex hull algorithm.
-
2.
Recover admissible vertex controls that render -contractive by solving the linear program (17).
- 3.
-
4.
Solve the semidefinite program in Theorem 3 for .
If the algorithm returns a feasible solution , then the receding-horizon control law (12)-(13) with and renders the closed-loop control of the linear system (1) asymptotically stable according to Theorem 1.
Remark 5
Although the proposed procedure is numerical, the new steps that we have introduced rely on convex optimization, are fast and reliable to execute, and do not introduce any conservatism for systems of order . Still, since control invariance does not imply asymptotic stabilizability (cf. the discussion in § III-A), we cannot guarantee that the procedure will always find a quadratic upper bound on the infinite-horizon cost-to-go that is valid in the maximal control invariant set. However, with , the implicit feedback policy is guaranteed to make the closed loop asymptotically stable and should, in principle, admit a quadratic upper bound on the infinite-horizon cost within the associated maximal -contractive set.
III-E Horizon length and linear performance
With the computed terminal cost, the MPC controller will result in an asymptotically stable closed-loop for all horizon lengths. Close to the origin, it will realize the linear state-feedback that is optimal for a -horizon linear-quadratic control problem with stage cost defined by and , and terminal cost . The fact that the optimal unconstrained control is linear and easy to compute is a distinct advantage over approaches that use more complex terminal costs. It allows us to analyze the frequency domain properties of the controller near the origin, and understand how the horizon length affects the control performance. In particular, if the computed terminal cost matrix is very different from and we use a small horizon length, the linear operation of the MPC controller can be far from the infinite-horizon LQR controller. The difference diminishes with increasing horizon length, and is easy to quantify using the Riccati recursion for the associated finite-horizon LQR problem.
IV Numerical examples
In this section, we will illustrate various aspects of our framework by examples.
IV-A Horizon length and performance
Let us first return to the system in Example 1. The maximal control invariant set has vertices our procedure finds the terminal cost matrix
If we compare this with the Riccati solution
we note an increased incentive for the MPC controller to bring the terminal state closer to rest when we insist to operate within the maximal operating range. To validate our results further, we let , which is just inside the lower right corner of the maximal control invariant set in Figure 1. Recall that the MPC controller that uses the invariant set of the LQR controller and the terminal cost defined by above requires a planning horizon of at least samples to operate from this initial value. In contrast, the simulations shown in Figure 3 show how the MPC controller drives the system to rest for all horizon lengths.
Figure 4 shows the partitions of the corresponding explicit MPC control laws. Here, a lighter color indicates that the local behavior in the region is closer the infinite-horizon LQR controller, with white for perfect agreement and black for saturation. We notice how the linear behavior around becomes increasingly close to the infinite-horizon LQR controller as the prediction horizon increases.
IV-B Stability in absence of terminal set contractivity
Next, we consider the constrained linear system given by
and and . It turns out that the maximal control invariant set is itself.
Since is not contractive, this system is challenging for approaches such as [14] that use the Minkowski functional of the maximal control invariant set as terminal cost. To see that is not contractive, note that . In addition, the first component of is equal to for all , which means that also . Hence, the set is not contractive, and the corresponding Minkowski functional will not decrease for all .
However, the system admits a quadratic terminal cost that can be found by the approach developed in this paper. With and , the algorithm in Setion III-D returns
which is the infinite-horizon cost-to-go for the feedback law . In fact, all state feedback laws on the form with and and not both equal to zero are admissible in , render the closed-loop system asymptotically stable and invariant.
IV-C A higher-order system
As another example, we consider the system
with cost given by and , and constraints and . In this case, the maximal control invariant set is much larger (a factor 500x) in volume than the invariant set of the LQR controller, see Figure 5.
Yet, the quadratic upper bounds are quite similar: our procedure finds
while the Riccati solution is
We simulate the closed-loop system from . The MPC controller based on the LQR invariant set and terminal cost requires a horizon of for this initial value, and yields the closed-loop response shown in Figure 6. When we use the maximal control invariant set and our upper bound cost, on the other hand, we can use all horizon lengths and get practically indistinguishable responses even for .
V Conclusions
We have presented a numerical procedure for computing a quadratic cost-to-go for linear MPC controllers that is valid for the maximal control invariant sets. This results in the largest possible set of recursively feasible states for the MPC controller, while the closed-loop stability follows from the standard stability proof for linear MPC.
We believe that the suggested procedure could be adapted to many scenarios beyond linear MPC and maximal control invariant sets. In essence, the approach only relies on our ability to compute a control invariant set (not necessarily the maximal one), recover admissible vertex controls, and to interpolate these into a piecewise linear feedback law. We leave such extensions as future work.
References
- [1] A. I. Propoi. Application of linear programming methods for the synthesis of automatic sampled-data systems. Avtomat. i Telemekh, 24(7):912–920, 1963.
- [2] J. Richalet, A. Rault, J.L. Testud, and J. Papon. Model algorithmic control of industrial processes. IFAC Proceedings Volumes, 10(16):103–120, 1977. Preprints of the 5th IFAC/IFIP International Conference on Digital Computer Applications to Process Control, The Hague, The Netherlands, 1977.
- [3] D.Q. Mayne, J.B. Rawlings, C.V. Rao, and P.O.M. Scokaert. Constrained model predictive control: Stability and optimality. Automatica, 36(6):789–814, 2000.
- [4] A. Bemporad, M. Morari, V. Dua, and E.N. Pistikopoulos. The explicit linear quadratic regulator for constrained systems. Automatica, 38(1):3–20, 2002.
- [5] H.J. Ferreau, C. Kirches, A. Potschka, H.G. Bock, and M. Diehl. qpOASES: A parametric active-set algorithm for quadratic programming. Mathematical Programming Computation, 6(4):327–363, 2014.
- [6] B. Stellato, G. Banjac, P. Goulart, A. Bemporad, and S. Boyd. OSQP: an operator splitting solver for quadratic programs. Mathematical Programming Computation, 12(4):637–672, 2020.
- [7] S. V. Rakovic and W. S. Levine. Handbook of Model Predictive Control. Birkhäuser Basel, 2018.
- [8] F. Borrelli, A. Bemporad, and M. Morari. Predictive Control for Linear and Hybrid Systems. Cambridge University Press, USA, 2017.
- [9] B. Kouvaritakis and M. Cannon. Model Predictive Control. Advanced Textbooks in Control and Signal Processing. Springer International Publishing, 2016.
- [10] D.Q. Mayne, J.B. Rawlings, C.V. Rao, and P.O.M. Scokaert. Constrained model predictive control: Stability and optimality. Automatica, 36(6):789–814, 2000.
- [11] F. Blanchini. Set invariance in control. Automatica, 35(11):1747–1767, 1999.
- [12] J.A. De Doná, M.M. Seron, D.Q. Mayne, and G.C. Goodwin. Enlarged terminal sets guaranteeing stability of receding horizon control. Systems & Control Letters, 47(1):57–63, 2002.
- [13] F. Brunner, M. Lazar, and F. Allgöwer. Computation of piecewise affine terminal cost functions for model predictive control. In Proceedings of the 17th International Conference on Hybrid Systems: Computation and Control, HSCC ’14, page 1–10, New York, NY, USA, 2014. Association for Computing Machinery.
- [14] S. Grammatico and G. Pannocchia. Achieving a large domain of attraction with short-horizon linear MPC via polyhedral Lyapunov functions. In 2013 European Control Conference (ECC), 2013.
- [15] M. Schulze Darup and M. Mönnigmann. A stabilizing control scheme for linear systems on controlled invariant sets. Systems & Control Letters, 79:8–14, 2015.
- [16] P.O.M. Scokaert and J.B. Rawlings. Constrained linear quadratic regulation. IEEE Transactions on Automatic Control, 43(8):1163–1169, 1998.
- [17] E.G. Gilbert and K.T. Tan. Linear systems with state and control constraints: the theory and application of maximal output admissible sets. IEEE Transactions on Automatic Control, 36(9):1008–1020, 1991.
- [18] F. Blanchini. Ultimate boundedness control for uncertain discrete-time systems via set-induced Lyapunov functions. IEEE Transactions on Automatic Control, 39(2):428–433, 1994.
- [19] Moritz Schulze Darup and Mark Cannon. On the computation of - contractive sets for linear constrained systems. IEEE Transactions on Automatic Control, 62(3):1498–1504, 2017.
- [20] P.-O. Gutman and M. Cwikel. Admissible sets and feedback control for discrete-time linear dynamical systems with bounded controls and states. IEEE Transactions on Automatic Control, 31(4):373–376, 1986.
- [21] B. Büeler, A. Enge, and K. Fukuda. Exact Volume Computation for Polytopes: A Practical Study, pages 131–154. Birkhäuser Basel, Basel, 2000.
- [22] M. Johansson and A. Rantzer. Computation of piecewise quadratic Lyapunov functions for hybrid systems. IEEE Transactions on Automatic Control, 43(4):555–559, 1998.
- [23] M. Johansson. Piecewise linear control systems - a computational approach. Sprinver Verlag, 2002.