the geometry of quadratic programming - · pdf filethe geometry of quadratic programming...

31
The Geometry of Quadratic Programming Mar´ ıa M. Seron September 2004 Centre for Complex Dynamic Systems and Control

Upload: trinhnhi

Post on 02-Feb-2018

218 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: The Geometry of Quadratic Programming -  · PDF fileThe Geometry of Quadratic Programming Mar´ıa M. Seron September 2004 Centre for Complex Dynamic Systems and Control

The Geometry of Quadratic Programming

Marıa M. Seron

September 2004

Centre for Complex DynamicSystems and Control

Page 2: The Geometry of Quadratic Programming -  · PDF fileThe Geometry of Quadratic Programming Mar´ıa M. Seron September 2004 Centre for Complex Dynamic Systems and Control

Outline

1 Introduction

2 The Geometry of Quadratic ProgrammingQP Solution for N = 2QP Solution for Arbitrary N

3 Solution Using the KKT Optimality Conditions

Centre for Complex DynamicSystems and Control

Page 3: The Geometry of Quadratic Programming -  · PDF fileThe Geometry of Quadratic Programming Mar´ıa M. Seron September 2004 Centre for Complex Dynamic Systems and Control

Introduction

In the previous lecture we saw how dynamic programming can beused to derive a simple parameterisation of a finite horizon optimalcontrol problem and its RHC implementation.

Here we will analyse the geometric structure of the finite horizonoptimal control problem when seen as a quadraticprogramme [QP].

Using this geometric structure, we will re-derive in the next lecturethe result obtained via dynamic programming.

We start with a simple case of horizon N = 2 and input constraintsand then show how the same ideas extend to more general cases.

Centre for Complex DynamicSystems and Control

Page 4: The Geometry of Quadratic Programming -  · PDF fileThe Geometry of Quadratic Programming Mar´ıa M. Seron September 2004 Centre for Complex Dynamic Systems and Control

The Finite 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

Page 5: The Geometry of Quadratic Programming -  · PDF fileThe Geometry of Quadratic Programming Mar´ıa M. Seron September 2004 Centre for Complex Dynamic Systems and Control

The Finite Horizon Optimal Control Problem

To compare with the results previously obtained using DynamicProgramming, in the objective function

V2({xk }, {uk }) ,12

x2Px2 +12

1∑

k=0

(

xk Qxk + uk Ruk

)

,

we select Q > 0, R > 0 and P satisfying the algebraic Riccatiequation

P = A PA + Q − K RK , (4)

whereK , R−1BPA , R , R + BPB . (5)

Centre for Complex DynamicSystems and Control

Page 6: The Geometry of Quadratic Programming -  · PDF fileThe Geometry of Quadratic Programming Mar´ıa M. Seron September 2004 Centre for Complex Dynamic Systems and Control

The Associated Quadratic Program

For the above problem, the corresponding QP optimal solution is

QP: u(x) = arg minu∈R

12

uHu + uFx, (6)

where

u =[

u0

u1

]

, H = R

[

1 + (KB)2 KBKB 1

]

, F = R

[

K + KBKAKA

]

, (7)

and R is the square

[

]

≤ u ≤[

]

.

Note that the Hessian H is positive definite since R > 0 andhence R = R + BPB > 0.

Centre for Complex DynamicSystems and Control

Page 7: The Geometry of Quadratic Programming -  · PDF fileThe Geometry of Quadratic Programming Mar´ıa M. Seron September 2004 Centre for Complex Dynamic Systems and Control

The Geometry of Quadratic Programming

The QP in (6) has a nice geometric interpretation in the u-space.

Consider the equation

12

uHu + uFx = c, c constant . (8)

PSfrag replacements

R

u0

u1

u(x)

u

(x)

This defines ellipsoids in R2

centred at u

(x) = −H−1Fx.

Then the QP in (6) amounts tofinding the smallest ellipsoid thatintersects the boundary of R,and u(x) is the point ofintersection.

Centre for Complex DynamicSystems and Control

Page 8: The Geometry of Quadratic Programming -  · PDF fileThe Geometry of Quadratic Programming Mar´ıa M. Seron September 2004 Centre for Complex Dynamic Systems and Control

Coordinate Transformation

The problem can be simplified if we make a coordinatetransformation via the square root of the Hessian, that is,

u = H1/2u. (9)

In the new u-coordinates (9), the constraint set R is mapped intoanother set (denoted also by R).

The ellipsoids (8) are now circles centred at u

(x) = −H−1/2Fx.

Thus the QP (6) is transformed into the problem offinding the point in R that is closest to u

(x) in the

Euclidean distance.

This is qualitatively illustrated in the following figure.

Centre for Complex DynamicSystems and Control

Page 9: The Geometry of Quadratic Programming -  · PDF fileThe Geometry of Quadratic Programming Mar´ıa M. Seron September 2004 Centre for Complex Dynamic Systems and Control

Geometry of QP as Minimum Euclidean Distance

��

��

PSfrag replacements

R

R1

R2

R3

R4

R5

R6

R7

R8

u0

u1

u(x)

u

(x)

In the new coordinates, the levelsets are circles in R2 centred atu

(x) = −H−1/2Fx.

Then the QP in (6) amounts tofinding the point in R that isclosest to u

(x) in the Euclidean

distance.

This transformed geometric picture allows us to immediately writedown the solution to the QP for this special case.

Centre for Complex DynamicSystems and Control

Page 10: The Geometry of Quadratic Programming -  · PDF fileThe Geometry of Quadratic Programming Mar´ıa M. Seron September 2004 Centre for Complex Dynamic Systems and Control

Solution Using Geometry

��

��

PSfrag replacements

R

R1

R2

R3R4R5

R6

R7

R8

u0

u1

u(x)

u

(x)

The solution of theQP is obtained bypartitioning R2 intonine regions.

The first region isthe polytope R.

Regions R1 to R8

are delimited bylines that arenormal to the facesof R and passthrough its vertices.

Centre for Complex DynamicSystems and Control

Page 11: The Geometry of Quadratic Programming -  · PDF fileThe Geometry of Quadratic Programming Mar´ıa M. Seron September 2004 Centre for Complex Dynamic Systems and Control

Solution Using Geometry

The optimal constrained solution u(x) is determined by theregion in which the optimal unconstrained solution u

(x) lies, in

the following way:

��

��

��

����

PSfrag replacements

R

R1

R2

R3

R4

R5

R6

R7

R8

u0

u1

u(x)

u

(x)First, the solution in R isu(x) = u

(x);

Next, the solution in regionsR1, R3, R5 and R7 is simplyequal to the vertex that iscontained in the region.

Finally, the solution inregions R2, R4, R6 and R8 isdefined by the orthogonalprojection of u

(x) onto the

faces of R.

Centre for Complex DynamicSystems and Control

Page 12: The Geometry of Quadratic Programming -  · PDF fileThe Geometry of Quadratic Programming Mar´ıa M. Seron September 2004 Centre for Complex Dynamic Systems and Control

Geometric QP Characterisation

As a result of above procedure, we obtain a characterisation of theQP solution in an active region Ri as

u(x) = H−1/2u(x) if u

(x) ∈ Ri ,

where u(x) is an affine function of x and u

(x) = −H−1/2Fx.

We next proceed to find an algebraic description of a particularregion and an expression for u(x) in it.

Centre for Complex DynamicSystems and Control

Page 13: The Geometry of Quadratic Programming -  · PDF fileThe Geometry of Quadratic Programming Mar´ıa M. Seron September 2004 Centre for Complex Dynamic Systems and Control

Region Calculation

��

�� ��������

PSfrag replacements

R

R8

n1n4

f4

u0

u1

v1

v4 u(x)

u

(x)

Consider the active region R8

associated with face f4.

It is delimited by face f4 and its normalsn1 and n4 passing through the verticesv1 and v4.

The line that contains face f4corresponds to the second control u1

equal to the saturation level ∆, that isu1 = [0 1]u = ∆ in the originalu-coordinates.

In the new u-coordinates (9), it is thendefined by the equation

f4 : [0 1]H−1/2u = ∆.

Centre for Complex DynamicSystems and Control

Page 14: The Geometry of Quadratic Programming -  · PDF fileThe Geometry of Quadratic Programming Mar´ıa M. Seron September 2004 Centre for Complex Dynamic Systems and Control

Region Calculation

��

�� ��������

PSfrag replacements

R

R8

n1n4

f4

u0

u1

v1v4 u(x)

u

(x)

Hence, face f4 is:

f4 : [0 1]H−1/2u = ∆.

The normal lines n1 and n2 are:

n1 : [1 0]H1/2u = H1∆[1 1].

n4 : [1 0]H1/2u = H1∆[−1 1].

Combining the above three equations, region R8 is

R8 :

[0 1]H−1/2u ≥ ∆

H1∆[−1 1] ≤ [1 0]H1/2u ≤ H1∆[1 1]

Centre for Complex DynamicSystems and Control

Page 15: The Geometry of Quadratic Programming -  · PDF fileThe Geometry of Quadratic Programming Mar´ıa M. Seron September 2004 Centre for Complex Dynamic Systems and Control

Solution Calculation

��

�� ��������

PSfrag replacements

R

R8

n1n4

f4

u0

u1

v1

v4 u(x)

u

(x)

The optimal constrained solution in R8

is given by the normal projection of theunconstrained solution u

(x) onto

face f4.

That is, u(x) satisfies the equation offace f4 and that of the normal to itpassing through u

(x):

[0 1]H−1/2u(x) = ∆,

[1 0]H1/2u(x) = [1 0]H1/2u

(x).

Centre for Complex DynamicSystems and Control

Page 16: The Geometry of Quadratic Programming -  · PDF fileThe Geometry of Quadratic Programming Mar´ıa M. Seron September 2004 Centre for Complex Dynamic Systems and Control

Solution Calculation

Hence, u(x) satisfies:

[0 1]H−1/2u(x) = ∆,

[1 0]H1/2u(x) = [1 0]H1/2u

(x).

Using u = H1/2u = H1/2[u0 (x) u1 (x)] andu

(x) = −H−1/2Fx in the above equations, and solving for the firstcomponent u0 (x) yields

u0 (x) = −Gx − h. (10)

where

G =K + KBKA1 + (KB)2

h =KB

1 + (KB)2∆.

Note that the above matrices coincide with the previously derivedusing Dynamic Programming.

Centre for Complex DynamicSystems and Control

Page 17: The Geometry of Quadratic Programming -  · PDF fileThe Geometry of Quadratic Programming Mar´ıa M. Seron September 2004 Centre for Complex Dynamic Systems and Control

Recapitulation

The solution in active region R8 is

u(x) =

[

−Gx − h∆

]

if

R8 :

[0 1]u

(x) ≥ ∆

H1∆[−1 1] ≤ [1 0]Hu

(x) ≤ H1∆[1 1].

where u

(x) = −H−1Fx.

A similar characterisation can be derived in the remaining regions.

Centre for Complex DynamicSystems and Control

Page 18: The Geometry of Quadratic Programming -  · PDF fileThe Geometry of Quadratic Programming Mar´ıa M. Seron September 2004 Centre for Complex Dynamic Systems and Control

Geometric QP Characterisation. More General Cases

We will now consider arbitrary horizon N, m ≥ 1 inputs, and moregeneral constraints, leading to a QP of the form

u(x) = arg minΦu≤∆−Λx

12

uHu + uFx, (11)

where u ∈ RNm, and where the constraint set

Φu ≤ ∆ − Λx, Φ ∈ Rq×Nm (12)

is a polyhedron in RNm.

Centre for Complex DynamicSystems and Control

Page 19: The Geometry of Quadratic Programming -  · PDF fileThe Geometry of Quadratic Programming Mar´ıa M. Seron September 2004 Centre for Complex Dynamic Systems and Control

Geometric QP Characterisation. More General Cases

Again, it is convenient to work in the u-coordinates u = H1/2u toturn the QP into a minimum Euclidean distance problem.

Hence the constraint set, R, is the polyhedron given by:

Φu ≤ ∆ − Λx, Φ , ΦH−1/2.

PSfrag replacementsR

Figure: Example of constraint set Φu ≤ ∆ − Λx in R3

Centre for Complex DynamicSystems and Control

Page 20: The Geometry of Quadratic Programming -  · PDF fileThe Geometry of Quadratic Programming Mar´ıa M. Seron September 2004 Centre for Complex Dynamic Systems and Control

Active Regions

The procedure is the same as for N = 2, that is, we associate anactive region to each face of the constraint set (before weassociated region R8 to face f4). The active region is determinedby the constraints that are active on the face. For example:

Face f1 (one active constraint)and associated active region R1.PSfrag replacements

R

R1

R2

f1f2

f3

e1

v1

v2

Edge e1 (two active constraints)and associated active region R2.

����

������

������

PSfrag replacements

R

R1

R2

f1f2

f3 e1v1

v2

Centre for Complex DynamicSystems and Control

Page 21: The Geometry of Quadratic Programming -  · PDF fileThe Geometry of Quadratic Programming Mar´ıa M. Seron September 2004 Centre for Complex Dynamic Systems and Control

Region Calculation

Recall the constraint set

Φu ≤ ∆ − Λx, Φ ∈ Rq×Nm.

A face is determined by a subset of the above q inequalityconstraints that are active, that is, they hold as equality constraints:

Φ`u = ∆` − Λ`x, (13)

` ⊂ {1, 2, . . . , q} is the set of indices of active constraints and thenotation M` indicates selection of rows of M with indices in `.

The active region associated with face (13) is

[Φ`Φ`]−1Φ`u ≤ [Φ`Φ`]

−1[∆` − Λ`x]

Φs[I − Φ`[Φ`Φ`]

−1Φ`]u ≤ ∆s − Λsx − ΦsΦ

`[Φ`Φ`]

−1[Λ`x − ∆`],(14)

where s is the set of indices of inactive constraints.Centre for Complex DynamicSystems and Control

Page 22: The Geometry of Quadratic Programming -  · PDF fileThe Geometry of Quadratic Programming Mar´ıa M. Seron September 2004 Centre for Complex Dynamic Systems and Control

Solution Calculation

The optimal constrained solution u(x) in the above active regionis given by the point of the corresponding face that is closest to theunconstrained solution u

(x) = −H−1/2Fx.

This point is given by

u(x) = Φ`[Φ`Φ

`]−1(∆` − Λ`x) − [I − Φ`[Φ`Φ

`]−1Φ`]H

−1/2Fx.

In the original coordinates u = H−1/2u we have

u(x) = H−1/2Φ

`[Φ`Φ

`]−1(∆` − Λ`x)

− H−1/2[I − Φ`[Φ`Φ

`]−1Φ`]H

−1/2Fx,

, G`x + h`.

Centre for Complex DynamicSystems and Control

Page 23: The Geometry of Quadratic Programming -  · PDF fileThe Geometry of Quadratic Programming Mar´ıa M. Seron September 2004 Centre for Complex Dynamic Systems and Control

Recapitulation

The solution in an active region is

u(x) = Φ`[Φ`Φ

`]−1(∆` − Λ`x) − [I − Φ`[Φ`Φ

`]−1Φ`]H

−1/2Fx(15)

, H1/2(G`x + h`).

if

[Φ`Φ`]−1Φ` u

(x) ≤ [Φ`Φ`]

−1[∆` − Λ`x]

Φs[I − Φ`[Φ`Φ`]

−1Φ`] u

(x) ≤ −[Λs + ΦsΦ

`[Φ`Φ`]

−1Λ`]x

+∆s + ΦsΦ

`[Φ`Φ`]

−1∆`,

(16)where u

(x) = −H−1/2Fx and ` and s are the indices of active and

inactive constraints, respectively.

Centre for Complex DynamicSystems and Control

Page 24: The Geometry of Quadratic Programming -  · PDF fileThe Geometry of Quadratic Programming Mar´ıa M. Seron September 2004 Centre for Complex Dynamic Systems and Control

Solution Using the KKT Optimality Conditions

The geometric structure of QP has allowed us to derive its solutionin an active region.

The same solution can be derived using the KKT optimalityconditions, as we show next.

Centre for Complex DynamicSystems and Control

Page 25: The Geometry of Quadratic Programming -  · PDF fileThe Geometry of Quadratic Programming Mar´ıa M. Seron September 2004 Centre for Complex Dynamic Systems and Control

The KKT Optimality Conditions

Consider the following nonlinear programming problem:

minimise f (z),

subject to:

g(z) ≤ 0,

where f : Rr → R, g = [g1, . . . , gq] : Rr → Rq are differentiable.

Let z be a feasible solution, and let ` = {i : gi(z) = 0}.

Suppose that ∇gi(z) for i ∈ ` are linearly independent and let∇g , [∇g1, . . . ,∇gq].

If z is a local optimal solution, then there exist Lagrange multipliersµ = [µ1, . . . , µq] such that the following KKT conditions hold:

∇f (z) + ∇g(z)µ = 0,

µg(z) = 0,

µ ≥ 0.

(KKT)

Centre for Complex DynamicSystems and Control

Page 26: The Geometry of Quadratic Programming -  · PDF fileThe Geometry of Quadratic Programming Mar´ıa M. Seron September 2004 Centre for Complex Dynamic Systems and Control

KKT Conditions for QP

For the QP problem

minimise12

zHz + zc,

subject to:

Lz ≤ W ,

the KKT conditions (KKT) are:

Primal Feasibility (PF): Lz ≤ W ,Dual Feasibility (DF): Hz + c + L µ = 0,

µ ≥ 0,Complementary Slackness (CS): µ(Lz −W) = 0.

(17)If H is positive definite, the KKT conditions are necessary andsufficient for z to be the unique global minimum.

Centre for Complex DynamicSystems and Control

Page 27: The Geometry of Quadratic Programming -  · PDF fileThe Geometry of Quadratic Programming Mar´ıa M. Seron September 2004 Centre for Complex Dynamic Systems and Control

QP Characterisation Using KKT Conditions

Recall the QP (11) used in MPC:

In the original coordinates

minimise12

uHu + uFx,

subject to:

Φu ≤ ∆ − Λx.

In the u-coordinates u = H1/2u

minimise12

uu + uH−1/2Fx,

subject to:

Φu ≤ ∆ − Λx.

When solved for different values of x, the above problem isreferred to as a multiparametric quadratic program [mp-QP].

An mp-QP is a QP in which the linear term in the objective functionand the right hand side of the constraints depend linearly on avector of parameters (the state vector x in this case).

Centre for Complex DynamicSystems and Control

Page 28: The Geometry of Quadratic Programming -  · PDF fileThe Geometry of Quadratic Programming Mar´ıa M. Seron September 2004 Centre for Complex Dynamic Systems and Control

QP Characterisation Using KKT Conditions

Let u(x) be the optimal solution of the above problem. The KKTconditions (17) then are

Φu(x) + Λx ≤ ∆, (PF)

u(x) + H−1/2Fx + Φµ = 0, (DF1)

µ ≥ 0, (DF2)

µ[Φu(x) − ∆ + Λx] = 0. (CS)

Consider now an active set of indices ` for u(x), and let s be thecorresponding inactive set. We then have that u(x) satisfies theequality constraints (13), that is,

Φ`u(x) = ∆` − Λ`x. (18)

From (18), (CS) and (DF2), we have that

µs = 0, µ` ≥ 0.

Centre for Complex DynamicSystems and Control

Page 29: The Geometry of Quadratic Programming -  · PDF fileThe Geometry of Quadratic Programming Mar´ıa M. Seron September 2004 Centre for Complex Dynamic Systems and Control

QP Characterisation Using KKT Conditions

Using µs = 0, µ` ≥ 0 in the (first) dual feasibility condition (DF1)and solving for u(x) yields

u(x) = −H−1/2Fx − Φ`µ`. (19)

Using (19) in the active constraint equality (18) and solving for µ`gives

µ` = [Φ`Φ

`]−1[−Φ`H

−1/2Fx + Λ`x − ∆`]. (20)

Substituting the above equation into (19) we obtain

u(x) = Φ`[Φ`Φ

`]−1(∆`−Λ`x)− [I− Φ`[Φ`Φ

`]−1Φ`]H

−1/2Fx, (21)

which is identical to (15).

Centre for Complex DynamicSystems and Control

Page 30: The Geometry of Quadratic Programming -  · PDF fileThe Geometry of Quadratic Programming Mar´ıa M. Seron September 2004 Centre for Complex Dynamic Systems and Control

QP Characterisation Using KKT Conditions

The inequalities (16) that define the region in the state spacewhere the solution (21) is valid can be recovered as follows:

Combining the expression for the Lagrange multipliers (20)

µ` = [Φ`Φ

`]−1[−Φ`H

−1/2Fx + Λ`x − ∆`].

and the sign condition µ` ≥ 0 yields the first inequality in (16) .

Finally, the second inequality in (16) follows from primal feasibility(see (PF)) of the inactive constraints, that is,

Φsu(x) + Λsx ≤ ∆s ,

upon substitution of the expression (21) for the optimal solution.

Centre for Complex DynamicSystems and Control

Page 31: The Geometry of Quadratic Programming -  · PDF fileThe Geometry of Quadratic Programming Mar´ıa M. Seron September 2004 Centre for Complex Dynamic Systems and Control

Connection Between Geometry and KKT

In summary, we can see that the geometric characterisationgiven before is a particular arrangement of the KKT optimalityconditions.

����

������

PSfrag replacements

R

n1n4

R8

f4

u0

u1In particular:

The halfspace above a face (forexample, f4) is given by thenonnegativity of the Lagrangemultipliers corresponding to activeconstraints on the face.

The band between normals to theface (for example, between n1 andn4) is given by feasibility of theinactive constraints on the face.

Centre for Complex DynamicSystems and Control