Seron, M.(SLIDES)-2004-The Geometry of Quadratic Programming

Embed Size (px)

Citation preview

  • 8/2/2019 Seron, M.(SLIDES)-2004-The Geometry of Quadratic Programming

    1/31

    The Geometry of Quadratic Programming

    Mara M. Seron

    September 2004

    Centre for Complex DynamicSystems and Control

  • 8/2/2019 Seron, M.(SLIDES)-2004-The Geometry of Quadratic Programming

    2/31

    Outline

    1 Introduction

    2 The Geometry of Quadratic Programming

    QP Solution for N = 2

    QP Solution for Arbitrary N

    3 Solution Using the KKT Optimality Conditions

    Centre for Complex DynamicSystems and Control

    http://-/?-http://-/?-
  • 8/2/2019 Seron, M.(SLIDES)-2004-The Geometry of Quadratic Programming

    3/31

    Introduction

    In the previous lecture we saw how dynamic programming can beused to derive a simple parameterisation of a finite horizon optimal

    control problem and its RHC implementation.

    Here we will analyse the geometric structure of the finite horizon

    optimal control problem when seen as a quadratic

    programme [QP].

    Using this geometric structure, we will re-derive in the next lecture

    the 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

  • 8/2/2019 Seron, M.(SLIDES)-2004-The Geometry of Quadratic Programming

    4/31

    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) : V

    2(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}) 1

    2x2

    Px2 +1

    2

    1k=0

    xkQxk + u

    kRuk

    . (3)

    Centre for Complex DynamicSystems and Control

  • 8/2/2019 Seron, M.(SLIDES)-2004-The Geometry of Quadratic Programming

    5/31

    Th A i d Q d i P

  • 8/2/2019 Seron, M.(SLIDES)-2004-The Geometry of Quadratic Programming

    6/31

    The Associated Quadratic Program

    For the above problem, the corresponding QP optimal solution is

    QP: u(x) = arg minuR

    12uHu + uFx, (6)

    where

    u =u0u1

    , H = R

    1

    +(KB)

    2

    KBKB 1

    , F = RK

    +KBKAKA

    , (7)

    and R is the square

    u

    .

    Note that the Hessian H is positive definite since R > 0 and

    hence R = R + BPB > 0.

    Centre for Complex DynamicSystems and Control

    Th G t f Q d ti P i

  • 8/2/2019 Seron, M.(SLIDES)-2004-The Geometry of Quadratic Programming

    7/31

    The Geometry of Quadratic Programming

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

    Consider the equation

    1

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

    R

    u0

    u1

    u(x)

    u

    (x)

    This defines ellipsoids in R2

    centred at u

    (x) = H1Fx.

    Then the QP in (6) amounts to

    finding the smallest ellipsoid that

    intersects the boundary of R,

    and u(x) is the point of

    intersection.

    Centre for Complex DynamicSystems and Control

  • 8/2/2019 Seron, M.(SLIDES)-2004-The Geometry of Quadratic Programming

    8/31

    G t f QP Mi i E lid Di t

  • 8/2/2019 Seron, M.(SLIDES)-2004-The Geometry of Quadratic Programming

    9/31

    Geometry of QP as Minimum Euclidean Distance

    Ru0

    u1

    u(x)

    u

    (x)

    In the new coordinates, the level

    sets are circlesin R2 centred at

    u

    (x) = H1/2Fx.

    Then the QP in (6) amounts tofinding the point in R that is

    closestto u

    (x) in the Euclidean

    distance.

    This transformed geometric picture allows us to immediately write

    down the solution to the QP for this special case.

    Centre for Complex DynamicSystems and Control

    Solution Using Geometry

  • 8/2/2019 Seron, M.(SLIDES)-2004-The Geometry of Quadratic Programming

    10/31

    Solution Using Geometry

    R

    R1

    R2

    R3R4R5

    R6

    R7

    R8

    u0

    u1

    u(x)

    u

    (x)

    The solution of the

    QP is obtained bypartitioning R2 into

    nine regions.

    The first region is

    the polytope R.

    Regions R1 to R8are delimited by

    lines that are

    normal to the faces

    of R and pass

    through its vertices.

    Centre for Complex DynamicSystems and Control

    Solution Using Geometry

  • 8/2/2019 Seron, M.(SLIDES)-2004-The Geometry of Quadratic Programming

    11/31

    Solution Using Geometry

    The optimal constrainedsolution u(x) is determined by the

    region in which the optimal unconstrainedsolution u

    (x) lies, in

    the following way:

    R

    R1

    R3R5

    R7

    u0

    u1

    u(x)

    u

    (x)

    First, the solution in R is

    u(x) = u

    (x);

    Next, the solution in regionsR1, R3, R5 and R7 is simply

    equal to the vertex that is

    contained in the region.

    Finally, the solution inregions R2, R4, R6 and R8 is

    defined by the orthogonal

    projection of u

    (x) onto the

    faces of R.

    Centre for Complex DynamicSystems and Control

    Geometric QP Characterisation

  • 8/2/2019 Seron, M.(SLIDES)-2004-The Geometry of Quadratic Programming

    12/31

    Geometric QP Characterisation

    As a result of above procedure, we obtain a characterisation of the

    QP solution in an active region Ri as

    u(x) = H1/2u(x) if u

    (x) Ri,

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

    (x) = H1/2Fx.

    We next proceed to find an algebraic description of a particular

    region and an expression for u

    (x) in it.

    Centre for Complex DynamicSystems and Control

    Region Calculation

  • 8/2/2019 Seron, M.(SLIDES)-2004-The Geometry of Quadratic Programming

    13/31

    Region Calculation

    R

    R8

    n1

    n4

    f4

    u0

    u1

    v1v4 u(x)

    u

    (x)

    Consider the active region R8associated with face f4.

    It is delimited by face f4 and its normals

    n1 and n4 passing through the vertices

    v1 and v4.

    The line that contains face f4corresponds to the second control u1equal to the saturation level , that is

    u1 = [0 1]u = in the original

    u-coordinates.

    In the new u-coordinates (9), it is then

    defined by the equation

    f4 : [0 1]H1/2

    u = .

    Centre for Complex DynamicSystems and Control

    Region Calculation

  • 8/2/2019 Seron, M.(SLIDES)-2004-The Geometry of Quadratic Programming

    14/31

    Region Calculation

    R

    R8

    n1n4

    f4

    u0

    u1

    v1

    v4 u

    (x)

    u

    (x)

    Hence, face f4 is:

    f4 : [0 1]H1/2

    u = .

    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]H1/2u

    H1[1 1] [1 0]H1/2u H1[1 1]

    Centre for Complex DynamicSystems and Control

    Solution Calculation

  • 8/2/2019 Seron, M.(SLIDES)-2004-The Geometry of Quadratic Programming

    15/31

    Solution Calculation

    R

    R8

    n1

    n4

    f4

    u0

    u1

    v1v4 u(x)

    u

    (x)

    The optimal constrained solution in R8is given by the normal projection of the

    unconstrained solution u

    (x) onto

    face f4.

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

    passing through u

    (x):

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

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

    (x).

    Centre for Complex DynamicSystems and Control

    Solution Calculation

  • 8/2/2019 Seron, M.(SLIDES)-2004-The Geometry of Quadratic Programming

    16/31

    Solution Calculation

    Hence, u(x) satisfies:

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

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

    (x).

    Using u = H1/2u = H1/2[u0

    (x) u1

    (x)] and

    u

    (x) = H1

    /2

    Fx in the above equations, and solving for the firstcomponent u

    0(x) yields

    u0

    (x) = Gx h. (10)

    where

    G = K + KBKA1 + (KB)2

    h = KB1 + (KB)2

    .

    Note that the above matrices coincide with the previously derived

    using Dynamic Programming.

    Centre for Complex DynamicSystems and Control

    Recapitulation

  • 8/2/2019 Seron, M.(SLIDES)-2004-The Geometry of Quadratic Programming

    17/31

    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) = H1Fx.

    A similar characterisation can be derived in the remaining regions.

    Centre for Complex DynamicSystems and Control

    Geometric QP Characterisation More General Cases

  • 8/2/2019 Seron, M.(SLIDES)-2004-The Geometry of Quadratic Programming

    18/31

    Geometric QP Characterisation. More General Cases

    We will now consider arbitrary horizon N, m 1 inputs, and more

    general constraints, leading to a QP of the form

    u(x) = arg min

    ux

    1

    2uHu + uFx, (11)

    where u RNm, and where the constraint set

    u x, RqNm (12)

    is a polyhedron inRNm

    .

    Centre for Complex DynamicSystems and Control

    Geometric QP Characterisation. More General Cases

  • 8/2/2019 Seron, M.(SLIDES)-2004-The Geometry of Quadratic Programming

    19/31

    Geometric QP Characterisation. More General Cases

    Again, it is convenient to work in the u-coordinates u = H1/2u to

    turn the QP into a minimum Euclidean distance problem.

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

    u x, H1/2.

    R

    Figure: Example of constraint set u x in R3

    Centre for Complex DynamicSystems and Control

  • 8/2/2019 Seron, M.(SLIDES)-2004-The Geometry of Quadratic Programming

    20/31

    Region Calculation

  • 8/2/2019 Seron, M.(SLIDES)-2004-The Geometry of Quadratic Programming

    21/31

    Region Calculation

    Recall the constraint set

    u x, RqNm.

    A face is determined by a subset of the above q inequality

    constraints 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 the

    notation M indicates selection of rows of M with indices in .

    The active region associated with face (13) is

    [

    ]1u [

    ]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

    Solution Calculation

  • 8/2/2019 Seron, M.(SLIDES)-2004-The Geometry of Quadratic Programming

    22/31

    Ca a

    The optimal constrained solution u(x) in the above active region

    is given by the point of the corresponding face that is closest to the

    unconstrained solution u (x) = H1/2Fx.

    This point is given by

    u(x) =

    [

    ]1( x) [I

    [

    ]1]H

    1/2Fx.

    In the original coordinates u = H1/2u we have

    u(x) = H1/2

    [

    ]1( x)

    H1/2[I [

    ]1]H

    1/2Fx,

    Gx + h.

    Centre for Complex DynamicSystems and Control

    Recapitulation

  • 8/2/2019 Seron, M.(SLIDES)-2004-The Geometry of Quadratic Programming

    23/31

    p

    The solution in an active region is

    u(x) =

    [

    ]1( x) [I

    [

    ]1]H

    1/2Fx

    (15)

    H1/2(Gx + h).

    if

    [

    ]1 u

    (x) [

    ]1[ x]

    s[I

    [

    ]1] u

    (x) [s + s

    [

    ]1]x

    +s + s[]1,(16)

    where u

    (x) = H1/2Fx and and s are the indices of active and

    inactive constraints, respectively.

    Centre for Complex DynamicSystems and Control

    Solution Using the KKT Optimality Conditions

  • 8/2/2019 Seron, M.(SLIDES)-2004-The Geometry of Quadratic Programming

    24/31

    g p y

    The geometric structure of QP has allowed us to derive its solution

    in an active region.

    The same solution can be derived using the KKT optimality

    conditions, as we show next.

    Centre for Complex DynamicSystems and Control

    The KKT Optimality Conditions

  • 8/2/2019 Seron, M.(SLIDES)-2004-The Geometry of Quadratic Programming

    25/31

    p y

    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 conditionshold:

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

    g(z) = 0,

    0.

    (KKT)

    Centre for Complex DynamicSystems and Control

    KKT Conditions for QP

  • 8/2/2019 Seron, M.(SLIDES)-2004-The Geometry of Quadratic Programming

    26/31

    For the QP problem

    minimise1

    2 zHz + zc,

    subject to:

    Lz W,

    the KKT conditions (KKT) are:

    Primal Feasibility (PF): L z W,

    Dual Feasibility (DF): Hz + c + L = 0,

    0,

    Complementary Slackness (CS):

    (L z W) = 0.(17)

    If H is positive definite, the KKT conditions are necessary and

    sufficient for z to be the unique global minimum.

    Centre for Complex DynamicSystems and Control

    QP Characterisation Using KKT Conditions

  • 8/2/2019 Seron, M.(SLIDES)-2004-The Geometry of Quadratic Programming

    27/31

    g

    Recall the QP (11) used in MPC:

    In the original coordinates

    minimise1

    2uHu + uFx,

    subject to:

    u x.

    In the u-coordinates u = H1/2u

    minimise1

    2uu + u

    H1/2Fx,

    subject to:

    u x.

    When solved for different values of x, the above problem is

    referred to as a multiparametric quadratic program[mp-QP].

    An mp-QP is a QP in which the linear term in the objective function

    and the right hand side of the constraints depend linearly on a

    vector of parameters (the state vector x in this case).

    Centre for Complex DynamicSystems and Control

    QP Characterisation Using KKT Conditions

  • 8/2/2019 Seron, M.(SLIDES)-2004-The Geometry of Quadratic Programming

    28/31

    Let u(x) be the optimal solution of the above problem. The KKT

    conditions (17) then are

    u

    (x) + x , (PF)u(x) + H1/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 the

    equality 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

    QP Characterisation Using KKT Conditions

  • 8/2/2019 Seron, M.(SLIDES)-2004-The Geometry of Quadratic Programming

    29/31

    Using s = 0, 0 in the (first) dual feasibility condition (DF1)

    and solving foru

    (x) yields

    u(x) = H1/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]H1/2Fx, (21)

    which is identical to (15).

    Centre for Complex DynamicSystems and Control

    QP Characterisation Using KKT Conditions

  • 8/2/2019 Seron, M.(SLIDES)-2004-The Geometry of Quadratic Programming

    30/31

    The inequalities (16) that define the region in the state space

    where 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

    Connection Between Geometry and KKT

  • 8/2/2019 Seron, M.(SLIDES)-2004-The Geometry of Quadratic Programming

    31/31

    In summary, we can see that the geometric characterisation

    given before is a particular arrangement of the KKT optimalityconditions.

    R

    n1n4

    R8

    f4

    u0

    u1In particular:

    The halfspace above a face (for

    example, f4) is given by the

    nonnegativity of the Lagrange

    multipliers corresponding to active

    constraints on the face.

    The band between normals to theface (for example, between n1 and

    n4) is given by feasibility of the

    inactive constraints on the face.

    Centre for Complex DynamicSystems and Control