lecture 13: optimisation -...

17
Lecture 13: RLSC - Prof. Sethu Vijayakumar 1 Lecture 13: Optimisation (planning under constraints) Contents: Planning under constraints Optimisation of a function (with constraints) Optimisation of a functional (with constraints) Pontryagin’s Minimisation Principle Example: LQR Lecturer: Dr. David Braun

Upload: others

Post on 19-Jul-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lecture 13: Optimisation - wcms.inf.ed.ac.ukwcms.inf.ed.ac.uk/ipab/rlsc/lecture-notes/RLSC_Lec13.pdf · Lecture 13: RLSC - Prof. Sethu Vijayakumar 5 • At the minimum (or any stationary

Lecture 13: RLSC - Prof. Sethu Vijayakumar 1

Lecture 13: Optimisation (planning under constraints)

Contents:

• Planning under constraints • Optimisation of a function (with constraints)

• Optimisation of a functional (with constraints)

• Pontryagin’s Minimisation Principle

• Example: LQR

Lecturer: Dr. David Braun

Page 2: Lecture 13: Optimisation - wcms.inf.ed.ac.ukwcms.inf.ed.ac.uk/ipab/rlsc/lecture-notes/RLSC_Lec13.pdf · Lecture 13: RLSC - Prof. Sethu Vijayakumar 5 • At the minimum (or any stationary

Planning & Optimisation

Lecture 13: RLSC - Prof. Sethu Vijayakumar 2

Page 3: Lecture 13: Optimisation - wcms.inf.ed.ac.ukwcms.inf.ed.ac.uk/ipab/rlsc/lecture-notes/RLSC_Lec13.pdf · Lecture 13: RLSC - Prof. Sethu Vijayakumar 5 • At the minimum (or any stationary

Planning & Optimisation

Lecture 13: RLSC - Prof. Sethu Vijayakumar 3

Minimisation of a function

Constrained Unconstrained

Fun

ctio

nal

Fun

ctio

n

Minimisation of a functional

Minimisation of a function

under (algebraic) constraints

Minimisation of a functional

under (differential) constraints

Page 4: Lecture 13: Optimisation - wcms.inf.ed.ac.ukwcms.inf.ed.ac.uk/ipab/rlsc/lecture-notes/RLSC_Lec13.pdf · Lecture 13: RLSC - Prof. Sethu Vijayakumar 5 • At the minimum (or any stationary

1. Minimisation of a function

Lecture 13: RLSC - Prof. Sethu Vijayakumar 4

• Consider a minimisation problem:

where

• The objective is to find such that

• The following equation provides a necessary condition for to be a minimum

• However, this equation defines all stationary points, and as such its solution may also be a maximum or an inflection points of the considered function.

• A sufficient condition for a minimum is provided by:

is a positive definite matrix

)(min xfnRx

0)( *

x

x

f

nRx * )(min)( * xfxfnRx

*x

)( *

2

2

xx

f

RRf n :

Page 5: Lecture 13: Optimisation - wcms.inf.ed.ac.ukwcms.inf.ed.ac.uk/ipab/rlsc/lecture-notes/RLSC_Lec13.pdf · Lecture 13: RLSC - Prof. Sethu Vijayakumar 5 • At the minimum (or any stationary

Minimisation of a function

Lecture 13: RLSC - Prof. Sethu Vijayakumar 5

• At the minimum (or any stationary point), the differential of a function has to be zero (consider a one variable case):

• At the minimum, the function cannot decrease regardless of how its argument changes:

)(min)( * xfxfifRx

00)(0)(,1 ** dfxdx

dfxx

dx

dfdfx

00)()(,1 *

2

22*

2

2

fxdx

fdxx

dx

fdfx

)()( 32*

2

2

xOxxdx

fddff

Page 6: Lecture 13: Optimisation - wcms.inf.ed.ac.ukwcms.inf.ed.ac.uk/ipab/rlsc/lecture-notes/RLSC_Lec13.pdf · Lecture 13: RLSC - Prof. Sethu Vijayakumar 5 • At the minimum (or any stationary

Imposition of constraints

Lecture 13: RLSC - Prof. Sethu Vijayakumar 6

),(min 21, 21

yxfxx

0),( 21 xxg

))(,(min

)(0),(

1

1

1

1

1

221

1

xgxf

xgxxxg

x

• Consider the minimisation of a function subject to algebraic constraints:

• To solve this problem, we can attempt to reduce this constrained minimisation to the previously discussed unconstrained one by elimination of the constraints:

Page 7: Lecture 13: Optimisation - wcms.inf.ed.ac.ukwcms.inf.ed.ac.uk/ipab/rlsc/lecture-notes/RLSC_Lec13.pdf · Lecture 13: RLSC - Prof. Sethu Vijayakumar 5 • At the minimum (or any stationary

Lagrange multiplier method

Lecture 13: RLSC - Prof. Sethu Vijayakumar 7

0

~

,

~

,0

~

222111

f

x

g

x

f

x

f

x

g

x

f

x

f

• Alternatively, we may also employ the Lagrange multiplier method by following the procedure described below:

1. Define the Lagrangian:

2. Define an unconstrained minimisation:

3. Find the solution of the above problem by applying the condition(s) previously presented for unconstrained minimisation:

),,(~

min 21,, 21

xxfxx

),(),(),,(~

212121 xxgxxfxxf

Page 8: Lecture 13: Optimisation - wcms.inf.ed.ac.ukwcms.inf.ed.ac.uk/ipab/rlsc/lecture-notes/RLSC_Lec13.pdf · Lecture 13: RLSC - Prof. Sethu Vijayakumar 5 • At the minimum (or any stationary

Example

Lecture 13: RLSC - Prof. Sethu Vijayakumar 8

02

~

,02

~

,02

~

212

2

1

1

xx

fx

x

fx

x

f

• Find the minimiser of the following constrained problem:

• Lagrange multiplier method:

• The solution of these equations provides a (unique and global) minimum

of the original problem:

))2((min),,(~

min 21

2

2

2

1),,(

21,, 3

2121

xxxxxxfRxxxx

)(min),(min 2

2

2

1),(

21, 2

2121

xxxxfRxxxx

02),( 1221 xxxxg

2,1,1 21 xx

Page 9: Lecture 13: Optimisation - wcms.inf.ed.ac.ukwcms.inf.ed.ac.uk/ipab/rlsc/lecture-notes/RLSC_Lec13.pdf · Lecture 13: RLSC - Prof. Sethu Vijayakumar 5 • At the minimum (or any stationary

2. Minimisation of a functional

Lecture 13: RLSC - Prof. Sethu Vijayakumar 9

dtxxtLI

T

TCx

0

],0[),,(min

1

0)0()0()()(,0

x

x

LTxT

x

L

x

L

dt

d

x

L

• Consider the minimisation problem:

where

• The following differential (Euler-Lagrange) equation and the associated boundary condition provide the necessary conditions for the above functional minimisation (see the next page for the derivation):

RTCI ],0[: 1

Page 10: Lecture 13: Optimisation - wcms.inf.ed.ac.ukwcms.inf.ed.ac.uk/ipab/rlsc/lecture-notes/RLSC_Lec13.pdf · Lecture 13: RLSC - Prof. Sethu Vijayakumar 5 • At the minimum (or any stationary

Calculus of variations

10

0,0)0()0()()(0,

x

L

dt

d

x

Lx

x

LTxT

x

LIx

• An increment of a functional along a function is defined by:

where defines the variation of and

is the variation of the functional.

• According to the Fundamental Theorem of the Calculus of Variations,

for a function that minimises (or maximises) the functional .

T

T

xdtx

L

dt

d

x

Lx

x

LTxT

x

L

dtxx

Lx

x

LI

0

0

)0()0()()(

tohIdtxxtLxxxxtLI

T

..)),,(),,((0

)()( * txtxx

Lecture 8: RLSC - Prof. Sethu Vijayakumar

x

I

I x

10 Lecture 13: RLSC - Prof. Sethu Vijayakumar

Page 11: Lecture 13: Optimisation - wcms.inf.ed.ac.ukwcms.inf.ed.ac.uk/ipab/rlsc/lecture-notes/RLSC_Lec13.pdf · Lecture 13: RLSC - Prof. Sethu Vijayakumar 5 • At the minimum (or any stationary

Imposition of constraints

Lecture 13: RLSC - Prof. Sethu Vijayakumar 11

0

0,

)0(),,,(,),,())((min xxuxtfxdtuxtLTxI

T

xu

),,(),,(),,( uxtfuxtLuxtH

• Consider now a problem where minimization of a functional is subject to differential constraints:

• Following the Lagrange multiplier method, we may first define the Hamiltonian function: and then replace the above problem with the following unconstrained minimisation:

dtxHdtxfLI

TT

xu)())((

~min

00,,

Page 12: Lecture 13: Optimisation - wcms.inf.ed.ac.ukwcms.inf.ed.ac.uk/ipab/rlsc/lecture-notes/RLSC_Lec13.pdf · Lecture 13: RLSC - Prof. Sethu Vijayakumar 5 • At the minimum (or any stationary

Imposition of constraints

Lecture 13: RLSC - Prof. Sethu Vijayakumar 12

0

)0()0()()()()(~

),,,(

0

dtxH

uu

Hx

x

H

xTxTTxTx

Ixu

T

• Following the Fundamental Theorem of the Calculus of Variations:

• The necessary conditions follows:

))!,,,(min(0

)()(,

)0(, 0

uxtHu

H

Tx

Tx

H

xxH

x

u

Page 13: Lecture 13: Optimisation - wcms.inf.ed.ac.ukwcms.inf.ed.ac.uk/ipab/rlsc/lecture-notes/RLSC_Lec13.pdf · Lecture 13: RLSC - Prof. Sethu Vijayakumar 5 • At the minimum (or any stationary

Pontryagin’s Minimum Principle

Lecture 13: RLSC - Prof. Sethu Vijayakumar 13

),,,(min

)()(,

)0(, 0

uxtH

Tx

Tx

H

xxH

x

u

0

0

)0(),,,(,),,())((min xxuxtfxdtuxtLTxI

T

u

• Consider the following problem subject to differential and control constraints:

(where is a time-invariant, closed and convex) .

• According to the PMP the following equations provide the necessary conditions for optimality of the solution:

Page 14: Lecture 13: Optimisation - wcms.inf.ed.ac.ukwcms.inf.ed.ac.uk/ipab/rlsc/lecture-notes/RLSC_Lec13.pdf · Lecture 13: RLSC - Prof. Sethu Vijayakumar 5 • At the minimum (or any stationary

Example: LQR

Lecture 13: RLSC - Prof. Sethu Vijayakumar 14

0

0

)0(,,)(2

1)()(

2

1xxBuAxxdtRuuQxxTxPTxI

T

TT

T

T

TT

T

T

BRuBRuu

H

TxPTAQxx

H

xxBuAxH

x

1

0

0

)()(,

)0(,

• Quadratic objective functional and linear dynamics:

• Define the Hamiltonian function:

• Application of PMP leads to the following conditions:

)(2

1BuAxRuuQxxH TTT

Page 15: Lecture 13: Optimisation - wcms.inf.ed.ac.ukwcms.inf.ed.ac.uk/ipab/rlsc/lecture-notes/RLSC_Lec13.pdf · Lecture 13: RLSC - Prof. Sethu Vijayakumar 5 • At the minimum (or any stationary

Example: LQR -

Lecture 13: RLSC - Prof. Sethu Vijayakumar 15

)(),( ttxx

)(tuu

)()(,

)0(, 0

1

TxPTAQxx

H

xxBBRAxx

T

T

T

• By substituting the optimal control inputs into the dynamics one obtains the following two-point boundary value problem (TPBVP):

• Using the shooting method we can find:

• Finally, substituting into the optimal control solution, we obtain:

)()( 1 tBRtuu T

)(t

Page 16: Lecture 13: Optimisation - wcms.inf.ed.ac.ukwcms.inf.ed.ac.uk/ipab/rlsc/lecture-notes/RLSC_Lec13.pdf · Lecture 13: RLSC - Prof. Sethu Vijayakumar 5 • At the minimum (or any stationary

Example: LQR -

Lecture 13: RLSC - Prof. Sethu Vijayakumar 16

Px

T

TT PTPPBPBRQPAPAP )(,1

xtPBRxtuu T )(),( 1

),( xtuu

xPBRxuu T

1)(

• In order to obtain a linear feedback control law, let us introduce the following substitution:

• Plugging this relation into the TPBVP, the following matrix Riccati equation is defined:

• The solution of the above equation and the relation provide a time-varying linear feedback control-law:

• In a special case, when the differential equation is time-invariant and the time horizon is infinite, the linear feedback controller becomes time-invariant:

PBBRPQPAAP TT 10

Px

Page 17: Lecture 13: Optimisation - wcms.inf.ed.ac.ukwcms.inf.ed.ac.uk/ipab/rlsc/lecture-notes/RLSC_Lec13.pdf · Lecture 13: RLSC - Prof. Sethu Vijayakumar 5 • At the minimum (or any stationary

Lecture 13: RLSC - Prof. Sethu Vijayakumar 17

For more details refer to …

• D. E. Kirk, Optimal Control Theory: An Introduction. Englewood Cliffs, NJ: Prentice-Hall, 1970.

• A. E. Bryson and Y. C. Ho, Applied Optimal Control. Hemisphere, Wiley, 1975.

• J. T. Betts, “Survey of numerical methods for trajectory optimization,” AIAA

Journal of Guidance, Control and Dynamics, vol. 21, no. 2, pp. 193–207, 1998.