Explicit Characterisation of Receding Horizon · PDF fileExplicit Characterisation of Receding...
Transcript of Explicit Characterisation of Receding Horizon · PDF fileExplicit Characterisation of Receding...
Explicit Characterisation ofReceding Horizon Control
Marıa M. Seron
September 2004
Centre for Complex DynamicSystems and Control
Outline
1 Solution Using GeometrySolution for Arbitrary NExample
2 Implementation of the Explicit SolutionCalculation of the Explicit SolutionOn-line Implementation of the Explicit SolutionSuboptimal Solutions and Approximations
Centre for Complex DynamicSystems and Control
The Receding Horizon Optimal Control Problem
Let the system be given by
xk+1 = Axk + Buk , |uk | ≤ ∆, (1)
where xk ∈ Rn and ∆ > 0 is the input constraint level. Consider the
following fixed horizon optimal control problem
P2(x) : V2 (x) , min V2({xk }, {uk }), (2)
subject to:
xk+1 = Axk + Buk for k = 0, 1,
x0 = x ,
uk ∈ U , [−∆,∆] for k = 0, 1,
where the objective function in (2) is
V2({xk }, {uk }) ,12
x2Px2 +12
1∑
k=0
(
xk Qxk + uk Ruk
)
. (3)
Centre for Complex DynamicSystems and Control
The Receding Horizon Optimal Control Problem
In the objective function we select Q > 0, R > 0 and P satisfyingthe algebraic Riccati equation
P = A PA +Q − K RK , (4)
whereK , R−1BPA , R , R + BPB . (5)
Let the control sequence that minimises (3) be
{u0 , u
1 }. (6)
Then the RHC law is given by the first element of (6) (whichdepends on the current state x0 = x), that is,
K2(x) = u0 . (7)
Centre for Complex DynamicSystems and Control
Solution of the Associated QP
In the previous lecture we showed that the solution in active regionR8 is
u(x) =
[
−Gx − h∆
]
where
G =K + KBKA1 + (KB)2
h =KB
1 + (KB)2∆,
if
R8 :
[0 1]u
(x) ≥ ∆
H1∆[−1 1] ≤ [1 0]Hu
(x) ≤ H1∆[1 1]
where u
(x) = −H−1Fx.
Centre for Complex DynamicSystems and Control
Solution of the Associated QP
The above solution is valid whenever u
(x) = −H−1Fx belongs toR8, that is, it satisfies the equations
R8 :
[0 1]u ≥ ∆
H1∆[−1 1] ≤ [1 0]Hu ≤ H1∆[1 1].
Thus, setting u = u
(x) = −H−1Fx in the above equations weobtain a characterisation of R8 in the state space:
R8 :
−[0 1]H−1Fx ≥ ∆
H1∆[−1 1] ≤ −[1 0]Fx ≤ H1∆[1 1].
Centre for Complex DynamicSystems and Control
Geometric RHC Characterisation for N = 2
If we proceed in a similar way with the remaining regions, weobtain a characterisation of the RHC law in the form
K2(x) =
−Kx if x ∈ R,
∆ if x ∈ R1 ∪ R2 ∪ R3,
−Gx + h if x ∈ R4,
−∆ if x ∈ R5 ∪ R6 ∪ R7,
−Gx − h if x ∈ R8,
−8 −6 −4 −2 0 2 4 6 8−4
−3
−2
−1
0
1
2
3
4
PSfrag replacements
x1k
x2 k R
R1
R2
R3 R4 R5
R6
R7R8
where the regions R, R1, . . . , R8 in the state space are obtainedusing geometric arguments as described before.
We can see that the above characterisation coincides with the oneobtained previously using Dynamic Programming.
Centre for Complex DynamicSystems and Control
Geometric RHC Characterisation. More General Cases
For arbitrary horizon N, m ≥ 1 inputs, and more generalconstraints, as we showed in the previous lecture, the QP solutionin a particular active region corresponding to the face
Φ`u = ∆` − Λ`x ,
has the form
u(x) = H−1/2Φ
`[Φ`Φ
`]−1(∆` − Λ`x)
− H−1/2[I − Φ`[Φ`Φ
`]−1Φ`]H
−1/2Fx ,
, G`x + h`.
Centre for Complex DynamicSystems and Control
Geometric RHC Characterisation. More General Cases
The above QP solution is valid in the state space region
L`x ≤ W`,
where
L` =
[
[Φ`Φ`]−1(Λ` − Φ`H−1/2F)
ΦsΦ
`[Φ`Φ`]
−1(Λ` − Φ`H−1/2F) + (Λs − ΦsH−1/2F)
]
W` =
[
[Φ`Φ`]−1∆`
∆s + ΦsΦ
`[Φ`Φ`]
−1∆`
]
Centre for Complex DynamicSystems and Control
Geometric RHC Characterisation. More General Cases
Thus, the optimal QP solution in an active region (corresponding toactive constraints with indices in `) is
u(x) , G`x + h`,
whenever x satisfiesL`x ≤ W`.
The RHC law KN(x) in the above region is then given by the first melements of the above solution:
KN(x) = [Im 0](G`x + h`) if L`x ≤ W`. (8)
Centre for Complex DynamicSystems and Control
Geometric RHC Characterisation. More General Cases
To compute the complete RHC solution in the state space onerequires, for example, procedures that
enumerate all combinations of active constraints, or
recursively partition the state space searching for activeregions, or
enumerate all parameterised vertices based on doubledescription properties of polyhedra.
We will briefly comment on these computational issues later.
Centre for Complex DynamicSystems and Control
Example
Consider a system with matrices
A =
[
0.8955 −0.18970.0948 0.9903
]
, B =
[
0.09480.0048
]
.
In the objective function we take N = 4, Q =
[
0 00 2
]
and R = 0.01.
The terminal state weighting matrix P is chosen as the solution ofthe algebraic Riccati equation P = A PA +Q − K RK , whereK , R−1BPA and R , R + BPB.
We consider input constraints of the form |uk | ≤ 2.
Centre for Complex DynamicSystems and Control
Example
The state space partition for this case is shown in Figure (a). A“zoom” of this partition is shown in Figure (b). The region denotedby X0 is the projection onto the state space of the constraintpolyhedron; in regions X2, X3 and X4 only one constraint is active;in regions X5 and X6 two constraints are active; in region X7 threeconstraints are active; finally, X1 is the union of all regions wherethe control is saturated to the value −2.
−2.5 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2−1
−0.8
−0.6
−0.4
−0.2
0
0.2
0.4
0.6
0.8
1
PSfrag replacements
x1
x 2 X0
X1
X2
X3
X4
X5
X6
X7
(a) Complete partition.
−1.6 −1.5 −1.4 −1.3 −1.2 −1.1 −1 −0.90.15
0.2
0.25
0.3
0.35
0.4
0.45
0.5
0.55
PSfrag replacements
x1
x 2 X0
X1 X2
X3
X4
X5
X6
X7
(b) Zoom.Centre for Complex DynamicSystems and Control
Example
The resulting RHC law (8) is
K4(x) = Gix + hi , if x ∈ Xi , i = 0, . . . , 7, (9)
where
G0 = −[4.4650 13.5974], h0 = 0,
G1 = [ 0 0 ], h1 = −2,
G2 = −[5.6901 15.9529], h2 = −0.7894,
G3 = −[4.9226 13.8202], h3 = −0.4811,
G4 = −[4.5946 13.3346], h4 = −0.2684,
G5 = −[6.6778 16.8644], h5 = −1.7057,
G6 = −[5.1778 13.4855], h6 = −0.9355,
G7 = −[7.4034 16.8111], h7 = −2.6783.
Similar expressions hold in the remaining unlabelled regions.These can be obtained by symmetry.
Centre for Complex DynamicSystems and Control
Example
The figures show the state state partitions for horizons N = 2,N = 3, N = 4 and N = 5.
−3 −2 −1 0 1 2 3
−1
−0.8
−0.6
−0.4
−0.2
0
0.2
0.4
0.6
0.8
1
PSfrag replacements
x1
x 2
N=2
N=3
N=4
N=5 −3 −2 −1 0 1 2 3
−1
−0.8
−0.6
−0.4
−0.2
0
0.2
0.4
0.6
0.8
1
PSfrag replacements
x1
x 2
N=2
N=3
N=4
N=5
−3 −2 −1 0 1 2 3
−1
−0.8
−0.6
−0.4
−0.2
0
0.2
0.4
0.6
0.8
1
PSfrag replacements
x1
x 2
N=2
N=3
N=4
N=5 −3 −2 −1 0 1 2 3
−1
−0.8
−0.6
−0.4
−0.2
0
0.2
0.4
0.6
0.8
1
PSfrag replacements
x1
x 2
N=2
N=3
N=4
N=5
Centre for Complex DynamicSystems and Control
Example
We next consider an initial condition x0 = [−1.2 0.53] andsimulate the system under the RHC (9).
The figure shows the resultingstate space trajectory.
The trajectory starts in region X4
and moves, successively, intoregions X6, X5, X1, X1, X0, andstays in X0 thereafter.
−1.4 −1.2 −1 −0.8 −0.6 −0.4 −0.2 0
0
0.1
0.2
0.3
0.4
0.5
0.6
PSfrag replacements
x1
x 2
Centre for Complex DynamicSystems and Control
Recapitulation
The geometric characterisation of QP of the form
u(x) = Φ`[Φ`Φ
`]−1(∆ − Λ`x) − [I − Φ`[Φ`Φ
`]−1Φ`]H
−1/2Fx (10)
= H1/2(G`x + h`)
if
[
[Φ`Φ`]−1(Λ` − Φ`H−1/2F)
ΦsΦ
`[Φ`Φ`]
−1(Λ` − Φ`H−1/2F) + (Λs − ΦsH−1/2F)
]
︸ ︷︷ ︸
L`
x ≤[
[Φ`Φ`]−1∆`
∆s + ΦsΦ
`[Φ`Φ`]
−1∆`
]
︸ ︷︷ ︸
W`
,
(11)
leads to the RHC characterisation
KN(x) = [Im 0](G`x + h`) if L`x ≤ W`.
The same characterisation can be obtained using the KKToptimality conditions, as we showed in the previous lecture.
Centre for Complex DynamicSystems and Control
Explicit vs Implicit
Recall what we defined as explicit procedures as opposed toimplicit, or numerical, procedures:
Explicit
x
PSfrag replacements
fp(z) = z2+ 2apz + bp
z ∂fp∂z = 0⇒ z(p) = −ap
Implicit (numerical)
PSfrag replacements
fp(z) = z2+ 2apz + bp
zz0pzk
pzk+1p
. . .
We have now obtained an explicit characterisation of RHC, whichcan replace the traditional numerical RHC solution in onlineimplementations.
Centre for Complex DynamicSystems and Control
Numerical Implementation of RHC
Centre for Complex DynamicSystems and Control
Explicit Solution
Centre for Complex DynamicSystems and Control
Implementation of the Explicit Solution
Key issues:
Off line
How to efficiently calculate KN(x) for all x of interest (regionpartition and corresponding control law).
How to store KN(x) as a function of x (look-up table).
On line
How to retrieve the value of KN(x) given x.
Centre for Complex DynamicSystems and Control
Calculation of the Explicit Solution
Naive approach: enumeration of all possible combinations ofactive constraints.
Semi-naive approach: combine the above with dynamicprogramming.
More efficient: use algorithms to implement multiparametricquadratic programming (Dua, Pistikopoulos, Bemporad,Tondel, Johansen).
Better: combine the above with reachability analysis (Grieder,Borrelli, Torrisi, Morari).
New approach: enumeration of all parameterised verticesbased on double description properties of polyhedral regions(Olaru and Dumur).
Centre for Complex DynamicSystems and Control
On-line Implementation of the Explicit Solution
Once the look-up table is precomputed and stored, the on-linecomputation is reduced to:
(i) identifying the “current region”, that is, deciding in whichregion the current state belongs and
(ii) computing the control input using the affine control lawcorresponding to that region.
The first step is the most computationally demanding.
Centre for Complex DynamicSystems and Control
Searching the Look-up Table
Naive approach: sequential search through the regions of thepolyhedral partition.
Efficient approach: organise the partition in a binary searchtree: each level, or “node”, is associated with one hyperplaneinequality. When the tree is used “on line” for the current state,at each node one inequality is evaluated, its sign checked,and the left or right subtree selected based on the sign.Traversing the tree from the “root” to a “leaf” node, the controllaw corresponding to the current state is found.
Tøndel, Johansen and Bemporad (2002) proposed an algorithm toconstruct a binary search tree with search time logarithmic in thenumber of polyhedral regions.
Centre for Complex DynamicSystems and Control
Binary Search Algorithm
Centre for Complex DynamicSystems and Control
Example: A Simple Binary Search
Consider the double integrator with matrices
A =
[
1 10 1
]
, B =
[
0.51
]
, C =[
1 0]
,
|u(k )| ≤ 1, Q = I2, R = 0.01, and P chosen as the solution of thealgebraic Riccati equation.
For N = 5, for example, the state-space partition and RHC law are:
−10 −8 −6 −4 −2 0 2 4 6 8 10−5
−4
−3
−2
−1
0
1
2
3
4
5
PSfrag replacements
x1
x 2 X0
X1X2
X3X4
X5
K5(x) = G`x + h` if x ∈ X`
X` G` h`X0 -[0.9653 1.3895] 0X1 -[0.6154 1.2870] -0.4156X2 -[0.4390 1.2121] -0.7982X3 -[0.3399 1.1665] -1.1746X4 -[0.2771 1.1367] -1.5495X5 0 -1
Centre for Complex DynamicSystems and Control
Example: A Simple Binary Search
The “look-up table” implementation of RHC checks, at each timeinstant, in which region the current state is and picks thecorresponding control law from a stored table.
We first consider a simple Matlab code that implements this searchin one step. This has only a few lines of code.
We will use the double integrator example with N from 2 to 10, inthe area −20 ≤ x1 ≤ 20, −8 ≤ x2 ≤ 8, to compare the performanceof the ‘look-up table” implementation of RHC and Matlab’s QPalgorithm.
The total data stored for the look-up table uses 20448 bytes.
Centre for Complex DynamicSystems and Control
Example: A Simple Binary Search
We grid the state space with 3600 points and, for each point of thegrid we evaluate the controller using each method, and for eachmethod
we measure computation time
we measure number of floating point operations.
We then average the latter two measures over the grid.
We repeat the same for horizons N = 2, . . . , 10.
Centre for Complex DynamicSystems and Control
Example: A Simple Binary Search
The left figure is a plot of computation times, and right figure showsthe number of floating point operations (flops), for the “look-uptable” method (solid line) and QP (dashed-dotted line) as afunction of the horizon N.
2 3 4 5 6 7 8 9 100
0.005
0.01
0.015
0.02
0.025
0.03
0.035
0.04
N
seco
nds
Figure: Computation time
2 3 4 5 6 7 8 9 100
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
1.8
2
x 105
N
flops
Figure: Flops
Centre for Complex DynamicSystems and Control
Example: A Simple Binary Search
The performance of both algorithms is comparable in relationwith computation speed, although the number of flops is muchlarger for the “look-up table” method.
This is expected since, as the horizon increases, there aremore regions in the state space partition that have to bechecked at each instant.
This problem can be easily mitigated by splitting the regionsinto an orthogonal binary search tree; this increases the totalnumber of regions (as some of the original regions are dividedinto smaller subregions) but the number of checks at eachsample time is smaller and so there are less flops.
Centre for Complex DynamicSystems and Control
Example: A Simple Binary Search
To accomplish this task we divide the area of interest into thesmaller subregions of a grid defined by Nh separatinghyperplanes parallel to the axes.
The original RHC partition is then intersected with the grid toform a new partition.
The maximum number of inequalities to check at each sampletime is then Nh plus the maximum number of inequalities ofthe new RHC regions inside each subregion of the grid.
Centre for Complex DynamicSystems and Control
Example: A Simple Binary Search
For the double integrator example, the total number of regionsof the original RHC partition in the area of interest−20 ≤ x1 ≤ 20, −8 ≤ x2 ≤ 8 is N0 = 165 and the total numberof hyperplane inequalities to check at each time is 632.
We next grid the area using using five horizontal lines andseven vertical lines (that is, Nh = 12), defining a grid with 48subregions, as shown in the following figure.The intersection of the original RHC partition with the gridyields a total of 672 regions, but the maximum number ofinequalities to check at each sample time is Nh+96=108.
The data stored in this case use 164352 bytes (compare with20448 bytes used before).
Centre for Complex DynamicSystems and Control
Example: A Simple Binary Search
−20 −15 −10 −5 0 5 10 15 20−8
−6
−4
−2
0
2
4
6
8
x1
x2
Figure: Binary partition using 12 hyperplanes
Centre for Complex DynamicSystems and Control
Example: A Simple Binary Search
The inclusion of the binary search tree in the algorithm fortable look-up does not add too much complexity to the Matlabcode, which has approximately 30 lines.
To compare the “on-line” performance of the new tablelook-up algorithm and QP, we proceed as before, averagingcomputation time and number of floating point operations overa state space grid of 3600 points.
In all cases, the binary search tree has Nh = 12 separatinghyperplanes.
Centre for Complex DynamicSystems and Control
Example: A Simple Binary Search
The left figure is a plot of computation times, and the right figureshows the number of floating point operations (flops), for the“binary search look-up table” method (solid line) and QP(dashed-dotted line) as a function of the horizon N.
2 3 4 5 6 7 8 9 100
0.005
0.01
0.015
0.02
0.025
0.03
N
seco
nds
Figure: Computation time
2 3 4 5 6 7 8 9 100
1
2
3
4
5
6x 10
4
N
flops
Figure: Flops
Centre for Complex DynamicSystems and Control
Example: A Simple Binary Search
We can see from these figures that the table look-up usingbinary search has much better performance than the standardQP algorithm.
Both measures (computation time and number of floatingpoint operations) stay approximately constant for all horizons.
Centre for Complex DynamicSystems and Control
Suboptimal Solutions and Approximations
For RHC problems of large dimension (large state and inputdimensions and long constraint horizons) it may be unrealisticto compute the exact explicit solution, and even if that werepossible, its implementation would be impractical due to thelarge amount of memory that would be required to store acomplex region partition.
On the other hand, on-line optimisation to solve theassociated QP may also be impractical from the computationtime perspective.
Centre for Complex DynamicSystems and Control
Suboptimal Solutions and Approximations
Possible simplifications:
Regional solutions.
Approximate partition for example, using orthogonalhyperplanes in the tree nodes.
Approximate partition using neural networks.
Input trajectory parameterisation to reduce degrees offreedom.
Allow certain degree of suboptimality and constraint violation.
More ... on-going research and growing literature.
Centre for Complex DynamicSystems and Control