ThB13.4
43rd IEEE Conference on Decision and Control December 14-17, 2004 Atlantis, Paradise Island, Bahamas
Efficient Computation of Controller Partitions in Multi-Parametric Programming R. Suard∗ , J. L¨ofberg∗ , P. Grieder∗ , M. Kvasnica∗ and M. Morari∗ Abstract— The off-line solution to optimal control problems for linear or piecewise-affine systems with constraints has garnered much attention because the on-line implementation can be realized with a simple look-up table. Specifically, multi-parametric programming techniques can be utilized to compute a piecewise-affine feedback law off-line. Even though the computation is performed off-line, the necessary computation time may easily become excessive for larger problems. This paper identifies the computation of minimal representations of polytopes as a key driver for complexity and presents an efficient method for reducing the associated computation cost. The method utilizes bounding-boxes and ray-shooting to discard redundant hyper-planes efficiently. A case study demonstrates the computational advantages.
I. I NTRODUCTION The solution to finite horizon constrained optimal control problems can be found by solving a multi-parametric program (MPP) [5], [7], [20], [1]. The parametric program yields a piecewise affine (PWA) feedback law, i.e., u = Fr x + Gr if x ∈ Pr where Pr is polyhedral and henceforth referred to as region r. The number of controller regions r may become very large even for small problems [14], such that the computation time of an MPP may become prohibitive even though it is computed off line. Even when this is not the case, it is of interest to compute the feedback solution quickly and efficiently since this facilitates controller evaluation and tuning. One of the key drivers of the necessary computation time is the computation of the controller regions Pr . Removal of redundant hyper-planes of the polytope Pr may easily take up to 50% of the overall computation time [20]. This is due to the fact, that the number of redundant hyper-planes generally grows very quickly if large prediction horizons are used in the optimization problem. This paper illustrates how bounding boxes and ray-shooting may be used to discard a large number of redundant hyper-planes, thus reducing the total controller computation time by up to 50% . This paper will first give a brief overview of multiparametric programming. In the subsequent section, an efficient polytope reduction scheme is presented along with a case study which illustrates the computational improvements. ∗ Institut f¨ ur Automatik, ETH - Swiss Federal Institute of Technology, CH-8092 Z¨urich Corresponding Author: E-mail:
[email protected], Tel. +41 01 632 7226
0-7803-8682-5/04/$20.00 ©2004 IEEE
II. M ULTI -PARAMETRIC P ROGRAMMING We will first consider optimal control problems for discrete-time linear time-invariant systems x(k + 1) = Ax(k) + Bu(k),
(1)
with A ∈ Rn×n and B ∈ Rm×n . Let x(k) denote the measured state at time k and xk denote the predicted state at time k given the state at time 0. Assume that the states and the inputs of system (1) are subject to the following constraints x(k) ∈ X ⊂ Rn ,
u(k) ∈ U ⊂ Rm , k ≥ 0,
(2)
where X and U are polyhedral sets containing the origin. For sake of simplicity, we will henceforth consider only quadratic performance objectives, although the proposed scheme is also applicable to linear optimization problems. Consider the finite-time constrained LQR problem, N −1 ∗ uk Ruk + xk Qxk (x(0)) = min JN u0 ,...,uN −1
k=0
+xN Qf xN xk ∈ X, uk ∈ U,
subj. to
,
(3a)
k ∈ {1, . . . , N }, (3b) k ∈ {0, . . . , N − 1}, (3c)
xk+1 = Axk + Buk , x0 = x(0), (3d) Q 0, Qf 0, R 0. (3e) The solution to problem (3) has been studied in [5]. We will briefly summarize k−1 the main results. By substituting xk = Ak x(0) + j=0 Ak Buk−1−j , problem (3) can be reformulated as ∗ (x(0)) JN
= x(0) Yx(0) + min UN HUN + x(0) FUN , (4a) UN
s.t.
GUN ≤ W + Ex(0),
(4b)
where the column vector UN [u0 , . . . , uN −1 ] ∈ RmN is the optimization vector and H, F, Y, G, W , E are easily obtained from Q, R, Qf , (1) and (2) (see [18] for details). ∗ (x(0)) the optimizer of (4). We denote with UN Definition 1: The set of active constraints AN (x(0)) at point x(0) of problem (4) is defined as AN (x(0))
3643
JA
∗ = {i ∈ JA | Gi UN (x) − Wi − Ei x = 0},
= {1, 2, . . . , q},
where Gi , Wi and Ei denote the i-th row of the matrices G, W and E, respectively and q denotes the number of constraints, i.e. G ∈ Rq×N m . N is the horizon length used to solve (4). Because problem (4) depends on x(0), the implementation of the finite time constrained LQR can be performed either by solving the quadratic program (4) for a given x(0), or as shown in [5], [20], by solving problem (4) for all x(0) within a polyhedral set of values, i.e., by considering (4) as a multi-parametric Quadratic Program (mp-QP). Theorem 1: [5] Consider the finite time constrained LQR (4). Then the set of feasible parameters XfN is convex, ∗ the optimizer UN : XfN → RN m is continuous and piecewise affine (PWA), i.e. ∗ (x(0)) = Fr x(0) + Gr if x(0) ∈ Pr UN Pr = {x ∈ Rn |Hr x ≤ Kr }, r = 0, . . . , R,
obtain the feedback law which optimizes the cost objective [3], [8]. Furthermore, it is often necessary to check whether two unions of polytopes are equal, which again requires extensive polytope computations [13], [4]. III. E FFICIENT P OLYTOPE R EDUCTION IN M ULTI -PARAMETRIC P ROGRAMMING Computing the minimal representation of polytopes has turned out to be the major bottle-neck in many multiparametric programs solved by The Multi Parametric Toolbox [17], and has been reported to be an issue also in other implementations [20]. The standard approach to detect if the jth constraint in the set Hx ≤ K
T H = h 1 h 2 . . . hs
T K = k1 k2 . . . ks
(5a) (5b)
and the value function J ∗ : XfN → R is continuous, convex and piecewise quadratic. Analysis of the mp-QP solution [5] leads to the following results on the solution of (4): {Pr }R r=0 is a polyhedral partition of XfN , where each Pr is defined by a constant set N of active constraints, i.e. AN (x) = AN r , ∀x ∈ Pr , Ar ⊆ JA , r = 0, . . . , R. In [5] the authors use the KKT conditions to compute the polyhedron Pr and the feedback , WAN law Fr , Gr as recalled next. First, new matrices GAN r r and SAN are formed by extracting the rows indexed by AN r r from G, W and S, where S = E + GH−1 F . Then, the polyhedron Pr = {x ∈ Rn |Hr x ≤ Kr } is computed as G(Fr + H−1 F ) − S Hr = , (6a) H−1 GAN )−1 SAN (GAN r r r W − GGr . (6b) Kr = −1 −(GAN H GAN )−1 WAN r r r
Note that the dimension of Hr is N (cx + cm ) × n, where cx and cu denote the number of hyper-planes defining X and U, respectively. We will henceforth use s to denote the number of initial hyper-planes s = N (cx + cm ). For instance, assume an optimization problem for a second order SISO system with prediction horizon N = 10 and bound constraints on all states and inputs. This would yield 60 hyper-planes for each initial representation of each controller region. In general, a large number of hyper-planes are redundant, and the proportion of redundant constraints grows with increasing prediction horizon N . In order for the MPP solvers to work correctly (e.g., [1], [20], [5]), it is necessary to compute the minimal representation of each controller region. This is crucial to guarantee that the controller partition will cover the entire feasible state space. Although polytope reduction is important when solving MPP, this aspect carries far more weight if we consider piecewise affine (PWA) systems. In optimal control of PWA systems, it is necessary to intersect a large number of controller regions (i.e., polytope reduction) in order to
(7)
is redundant, is to define a new polyhedron with the jth constraint removed,
˜ = h1 hj−1 hj+1 . . . hs T H
˜ = k1 kj−1 kj+1 . . . ks T K ˜ ≤K ˜ and maximize hTj x in the reduced polytope Hx max hTj x
(8a)
˜ ≤K ˜ Hx
(8b)
x
s.t.
If the optimal objective value of this problem is less than or equal to kj , the constraint is redundant and can be removed [10]. To detect and remove all redundant constraint, the algorithm requires the solution of s LPs with, in worst-case, s−1 constraints and n variables. To improve the performance of this algorithm, we need to reduce the number of LPs to be solved, and preferably also the size of the solved LPs. Our approach to do this is to perform an initial, computationally cheap, presolve analysis to detect a sub-set of the redundant and non-redundant constraints. A. Detecting non-redundant hyper-planes By detecting some of the non-redundant constraints, we can reduce the number of LPs that has to be solved to derive the minimal representation of the polytope. A simple randomized ray-shooting approach ([6]) has been implemented. 1) Initialize the set of non-redundant constraints IN = ∅. 2) Calculate an interior point xc , Hxc < K 3) Generate a random direction d ∈ Rn . 4) Calculate intersections between the line xc + ti d and k −hT x the hyper-planes hTi x = ki , giving ti = i hT id c . i 5) Find the closest intersecting hyper-planes along positive and negative direction d, corresponding to smallest positive and largest negative t respectively. Let
3644
the corresponding indices to these hyper-planes be ip and in . These constraints are non-redundant, IN := IN ∪ ip ∪ in . 6) Let the mid-point of the line between the two intersection points xc + tp d and xc + tn d serve as a new ti +ti interior point, xc := xc + p 2 n d. 7) Repeat from 3). These iterations are illustrated in Figure 1. The algorithm requires an interior point to begin with in step 2. To find one, we calculate the Chebychev center of the polytope, requiring the solution to one LP. Remark 1: Note that the active constraints (see Definition 1) which are obtained when solving the ChebychevBall problem can also be used to initialize the set of nonredundant constraints IN . Obviously, all half-spaces which are ‘touched’ by the ball are non-redundant, provided all duplicate half-spaces have been removed. The number of iterations is of-course an important parameter. In the current implementation, s/2 iterations are performed. Although there is no guarantee that we find all, or even a significant part of the non-redundant hyper-planes, the algorithm is simple enough to motivate its use. Note that the algorithm is most efficient when the proportion of redundant constraints is low.
improved upon by inferring more information from the constraints. The standard presolve analysis that is applied before solving an LP is required to be cheap in order to actually obtain runtime benefits. In contrast, we are here solving a total of s LPs for polytope reduction. Hence, we can spend a lot more effort on a presolve analysis which benefits each of the s LPs. Since tight lower and upper bounds are crucial for the detection of redundant constraints using (9), we solve 2n LPs to derive exact lower and upper bounds on x in the polytope Hx ≤ K. Specifically we solve the following LP for all i ∈ I = {1, . . . , n}: min ± xi
(11a)
Hx ≤ K
(11b)
x
s.t.
Of-course, spending the effort to solve 2n LPs to find the bounding box of the polytope, to be used in the possibly inefficient algorithm (9), is only reasonable if the expected number of detected redundant constraints is large and n is sufficiently small compared to s. This is generally the case if multi-parametric programming is used in the context of controller computation.
B. Detecting redundant hyper-planes By detecting redundant hyper-planes, we not only reduce the number of LPs that have to be solved in (8), but we also reduce the size of these LPs, since the corresponding constraints are removed. Detecting redundant constraints in LPs is a standard problem, and is done in most LP solvers during a presolve analysis of the problem. The key idea in presolve algorithms is to exploit variable bounds L ≤ x ≤ U to detect obviously redundant constraints [12].
To detect if hTi x ≤ ki , hi = hi1 hi2 . . . hin is redundant, each term in hTi x is individually maximized to obtain an upper bound on hTi x n j=1
hi xi ≤
j∈{j:hij >0}
hij Uj +
hij Lj
(9)
j:∈{j:hij 0}
Fig. 2. Illustration of a bounding box. If the bounding box does not intersect a hyper-plane, it is redundant.
C. Complete algorithm Pulling the three parts together, we obtain our reduction algorithm.
j∈{j:hij