numerical methods for optimal control problems. part i: … · 2016. 5. 15. · references main...

18
Numerical Methods for Optimal Control Problems. Part I: Hamilton-Jacobi-Bellman Equations and Pontryagin Minimum Principle Ph.D. course in OPTIMAL CONTROL Emiliano Cristiani (IAC–CNR) [email protected] March 2013 E. Cristiani (IAC–CNR) Numerical Methods for Optimal Control Pbs March 2013 1 / 18

Upload: others

Post on 19-Mar-2021

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Numerical Methods for Optimal Control Problems. Part I: … · 2016. 5. 15. · References Main references 1 M. Bardi, I. Capuzzo Dolcetta, Optimal control and viscosity solutions

Numerical Methods for Optimal Control Problems.Part I: Hamilton-Jacobi-Bellman Equations and

Pontryagin Minimum Principle

Ph.D. course in OPTIMAL CONTROL

Emiliano Cristiani (IAC–CNR)[email protected]

March 2013

E. Cristiani (IAC–CNR) Numerical Methods for Optimal Control Pbs March 2013 1 / 18

Page 2: Numerical Methods for Optimal Control Problems. Part I: … · 2016. 5. 15. · References Main references 1 M. Bardi, I. Capuzzo Dolcetta, Optimal control and viscosity solutions

1 References

2 Optimal control problems

3 Finite horizon problemHJB approachFind optimal trajectories from HJBPMP approachHJB↔PMP connectionNumerical approximation

Direct methodsHJBPMPExploiting HJB↔PMP connection

4 Minimum time problem with targetHJB approachPMP approachNumerics for HJBNumerics for PMP

E. Cristiani (IAC–CNR) Numerical Methods for Optimal Control Pbs March 2013 2 / 18

Page 3: Numerical Methods for Optimal Control Problems. Part I: … · 2016. 5. 15. · References Main references 1 M. Bardi, I. Capuzzo Dolcetta, Optimal control and viscosity solutions

References

Main references

1 M. Bardi, I. Capuzzo Dolcetta, Optimal control and viscosity solutionsof Hamilton-Jacobi-Bellman equations, Birkhauser, Boston, 1997.

2 J. T. Betts, Practical methods for optimal control and estimationusing nonlinear programming, SIAM, 2010.

3 E. Cristiani, P. Martinon, Initialization of the shooting method via theHamilton-Jacobi-Bellman approach, J. Optim. Theory Appl., 146(2010), 321–346.

4 L. C. Evans, An introduction to mathematical optimal control theory,http://math.berkeley.edu/∼evans/

5 E. Trelat, Controle optimal: theorie et applications,http://www.ljll.math.upmc.fr/∼trelat/

E. Cristiani (IAC–CNR) Numerical Methods for Optimal Control Pbs March 2013 3 / 18

Page 4: Numerical Methods for Optimal Control Problems. Part I: … · 2016. 5. 15. · References Main references 1 M. Bardi, I. Capuzzo Dolcetta, Optimal control and viscosity solutions

Optimal control problems

Introduction

Controlled nonlinear dynamical systemy(s) = f (y(s), α(s)), s > ty(t) = x ∈ Rn

Solution:yx ,α(s)

Admissible controls: α ∈ A := α : [t,+∞)→ A, A ⊂ Rm

Regularity assumptions

Are they meaningful from the numerical point of view? Discussion.

E. Cristiani (IAC–CNR) Numerical Methods for Optimal Control Pbs March 2013 4 / 18

Page 5: Numerical Methods for Optimal Control Problems. Part I: … · 2016. 5. 15. · References Main references 1 M. Bardi, I. Capuzzo Dolcetta, Optimal control and viscosity solutions

Optimal control problems

Payoff

maxα∈A

Jx ,t [α]

Infinite horizon problem

Jx ,t [α] =

∫ ∞t

r(

yx ,α(s), α(s))

e−µsds, µ > 0

Finite horizon problem

Jx ,t [α] =

∫ T

tr(

yx ,α(s), α(s))

ds + g(yx ,α(T ))

Target problem

Jx ,t [α] =

∫ τ

tr(

yx ,α(s), α(s))

ds, τ := mins : yx ,α(s) ∈ T

E. Cristiani (IAC–CNR) Numerical Methods for Optimal Control Pbs March 2013 5 / 18

Page 6: Numerical Methods for Optimal Control Problems. Part I: … · 2016. 5. 15. · References Main references 1 M. Bardi, I. Capuzzo Dolcetta, Optimal control and viscosity solutions

Finite horizon problem HJB approach

HJB equation

Value function

v(x , t) := maxα∈A

Jx ,t [α], x ∈ Rn, t ∈ [0,T ]

Theorem (HJB equation)

Assume that v ∈ C 1. Then v solves

vt(x , t) + maxa∈Af (x , a) · ∇xv(x , t) + r(x , a) = 0, x ∈ Rn, t ∈ [0,T )

with the terminal condition

v(x ,T ) = g(x), x ∈ Rn

supJ=-inf-JWhat about cost functionals to be minimized?

E. Cristiani (IAC–CNR) Numerical Methods for Optimal Control Pbs March 2013 6 / 18

Page 7: Numerical Methods for Optimal Control Problems. Part I: … · 2016. 5. 15. · References Main references 1 M. Bardi, I. Capuzzo Dolcetta, Optimal control and viscosity solutions

Finite horizon problem Find optimal trajectories from HJB

Find α∗ by means of v

Given v(x , t) for any x ∈ Rn and t ∈ [0,T ], we define

α∗feedback(x , t) := arg maxa∈Af (x , a) · ∇xv(x , t) + r(x , a)

or, coming back to the original variables,

α∗feedback(y , s) := arg maxa∈Af (y , a) · ∇xv(y , s) + r(y , a).

Then, the optimal control is

α∗(s) = α∗feedback(y∗(s), s)

where y∗(s) is the solution ofy∗(s) = f (y∗(s), α∗feedback(y∗(s), s)), s > ty(t) = x

E. Cristiani (IAC–CNR) Numerical Methods for Optimal Control Pbs March 2013 7 / 18

Page 8: Numerical Methods for Optimal Control Problems. Part I: … · 2016. 5. 15. · References Main references 1 M. Bardi, I. Capuzzo Dolcetta, Optimal control and viscosity solutions

Finite horizon problem PMP approach

PMP

Theorem (Pontryagin Minimum Principle)

Assume α∗ is optimal and y∗ is the corresponding trajectory. Then thereexists a function p∗ : [t,T ]→ Rn (costate) such that

y∗(s) = f (y∗(s), α∗(s))

p∗(s) = −∇x f (y∗(s), α∗(s)) · p∗(s)−∇x r(y∗(s), α∗(s))

α∗(s) = arg maxa∈A

f (y∗(s), a) · p∗(s) + r(y∗(s), a)

with initial condition y∗(t) = x and terminal condition p∗(T ) = ∇g(y∗(T )).

PMP can fail!

Along the optimal trajectory the Hamiltonian H(y∗, p∗, a∗) = f ∗ · p∗ + r∗

may not be an explicit function of the control inputs.

E. Cristiani (IAC–CNR) Numerical Methods for Optimal Control Pbs March 2013 8 / 18

Page 9: Numerical Methods for Optimal Control Problems. Part I: … · 2016. 5. 15. · References Main references 1 M. Bardi, I. Capuzzo Dolcetta, Optimal control and viscosity solutions

Finite horizon problem HJB↔PMP connection

HJB↔PMP connection

Theorem

If v ∈ C 2, then

p∗(s) = ∇xv(y∗(s), s), s ∈ [t,T ].

The gradient of the value function gives the optimal value of the costateall along the optimal trajectory, in particular for s = t!

E. Cristiani (IAC–CNR) Numerical Methods for Optimal Control Pbs March 2013 9 / 18

Page 10: Numerical Methods for Optimal Control Problems. Part I: … · 2016. 5. 15. · References Main references 1 M. Bardi, I. Capuzzo Dolcetta, Optimal control and viscosity solutions

Finite horizon problem Numerical approximation

Direct methods

The control problem is entirely discretized and it is written in the form

Discrete problem

Find ξ∗ such that J(ξ∗) = maxξ∈Rn J(ξ), with J : Rn → R.

Fix a grid (s1, . . . , sn, . . . , sN) in [t,T ] with sn − sn−1 = ∆s. A discretecontrol function α is characterized by the vector (α1, . . . , αN) withαn = α(sn).Given (α1, . . . , αN), the ODE is discretized, for example, by

yn+1 = yn + ∆s f (yn, αn).

and so it is the payoff, for example

J(α) =∑n

r(yn, αn)∆s + g(yN) + penalization for ctrl and state constr.

Then, a gradient method is used to maximize J.E. Cristiani (IAC–CNR) Numerical Methods for Optimal Control Pbs March 2013 10 / 18

Page 11: Numerical Methods for Optimal Control Problems. Part I: … · 2016. 5. 15. · References Main references 1 M. Bardi, I. Capuzzo Dolcetta, Optimal control and viscosity solutions

Finite horizon problem Numerical approximation

Semi-Lagrangian discretization of HJB

vt(x , t) + maxa∈A

f (x , a) · ∇xv(x , t) + r(x , a)

= 0, x ∈ Rn, t ∈ [0,T )

Fix a grid in Ω× [0,T ], with Ω ⊂ Rn bounded. Steps: ∆x , ∆t. Nodes:x1, . . . , xM, t1, . . . , tN. Discrete solution: wn

i ≈ v(xi , sn).

wni − wn−1

i

∆t+ max

a∈A

wn(xi + ∆t f (xi , a)

)− wn

i

∆t+ r(xi , a)

= 0

wn−1i = max

a∈A

wn(xi + ∆t f (xi , a)

)︸ ︷︷ ︸to be interpolated

+r(xi , a)

= 0

CFL condition (not needed but useful)

∆t maxx ,a|f (x , a)| ≤ ∆x

E. Cristiani (IAC–CNR) Numerical Methods for Optimal Control Pbs March 2013 11 / 18

Page 12: Numerical Methods for Optimal Control Problems. Part I: … · 2016. 5. 15. · References Main references 1 M. Bardi, I. Capuzzo Dolcetta, Optimal control and viscosity solutions

Finite horizon problem Numerical approximation

Shooting method for PMP

Find the solution of S(p0) = 0, where

S(p0) := p(T )−∇g(y(T ))

and p(T ) and y(T ) are computed solving the ODEsαn = arg max

a∈Af (yn, a) · pn + r(yn, a)

yn+1 = yn + ∆s f (yn, αn)

pn+1 = pn + ∆s (−∇x f (yn, αn) · pn −∇x r(yn, αn))

with only initial conditions

y1 = x and p1 = p0

The solution of S(p0) = 0 can be found by means of an iterative methodlike bisection, Newton, etc.

E. Cristiani (IAC–CNR) Numerical Methods for Optimal Control Pbs March 2013 12 / 18

Page 13: Numerical Methods for Optimal Control Problems. Part I: … · 2016. 5. 15. · References Main references 1 M. Bardi, I. Capuzzo Dolcetta, Optimal control and viscosity solutions

Finite horizon problem Numerical approximation

HJB↔PMP for numerics

Idea [CM10]

1 Solve HJB on a coarse grid

2 Compute ∇xv(x , 0) = p0

3 Use it as initial guess for the shooting method.

Advantages

1 Fast in dimension ≤ 4, feasible in dimension 5-6.

2 Highly accurate

3 Reasonable guarantee to converge to the global maximum of J.

E. Cristiani (IAC–CNR) Numerical Methods for Optimal Control Pbs March 2013 13 / 18

Page 14: Numerical Methods for Optimal Control Problems. Part I: … · 2016. 5. 15. · References Main references 1 M. Bardi, I. Capuzzo Dolcetta, Optimal control and viscosity solutions

Minimum time problem with target HJB approach

HJB equation

Value function

v(x) := minα∈A

Jx [α], x ∈ Rn (t = 0)

with cost functional

Jx [α] =

∫ τ

0r(

yx ,α(s), α(s))

ds + g(yx ,α(τ)), τ := mins : yx ,α(s) ∈ T

Theorem (HJB equation)

Assume that v ∈ C 1. Then v solves the stationary equation

maxa∈A−f (x , a) · ∇xv(x)− r(x , a) = 0, x ∈ Rn\T

with boundary conditions

v(x) = g(x), x ∈ ∂T

E. Cristiani (IAC–CNR) Numerical Methods for Optimal Control Pbs March 2013 14 / 18

Page 15: Numerical Methods for Optimal Control Problems. Part I: … · 2016. 5. 15. · References Main references 1 M. Bardi, I. Capuzzo Dolcetta, Optimal control and viscosity solutions

Minimum time problem with target HJB approach

HJB equation

Eikonal equation

If f (x , a) = c(x)a, A = B(0, 1), r ≡ 1, and g ≡ 0, we get

maxa∈B(0,1)

c(x)a · ∇v(x) = 1, x ∈ Rn\T

or, equivalently,c(x)|∇v(x)| = 1, x ∈ Rn\T

with boundary conditions

v(x) = 0, x ∈ ∂T

Optimal trajectories ≡ characteristic lines ≡ gradient lines

E. Cristiani (IAC–CNR) Numerical Methods for Optimal Control Pbs March 2013 15 / 18

Page 16: Numerical Methods for Optimal Control Problems. Part I: … · 2016. 5. 15. · References Main references 1 M. Bardi, I. Capuzzo Dolcetta, Optimal control and viscosity solutions

Minimum time problem with target PMP approach

PMP

Theorem (Pontryagin Minimum Principle)

Assume α∗ is optimal and y∗ is the corresponding trajectory. Then thereexists a function p∗ : [0, τ ]→ Rn (costate) such that

y∗(s) = f (y∗(s), α∗(s))

p∗(s) = −∇x f (y∗(s), α∗(s)) · p∗(s)−∇x r(y∗(s), α∗(s))

α∗(s) = arg maxa∈A

f (y∗(s), a) · p∗(s) + r(y∗(s), a)

and

f (y∗(τ), α∗(s)) · p∗(s) + r(y∗(s), α∗(s)) = 0, s ∈ [0, τ ] (HJB)

with initial condition y∗(0) = x .

E. Cristiani (IAC–CNR) Numerical Methods for Optimal Control Pbs March 2013 16 / 18

Page 17: Numerical Methods for Optimal Control Problems. Part I: … · 2016. 5. 15. · References Main references 1 M. Bardi, I. Capuzzo Dolcetta, Optimal control and viscosity solutions

Minimum time problem with target Numerics for HJB

Semi-Lagrangian discretization of HJB

wi = mina∈A

w(xi + ∆t f (xi , a)

)+ ∆t r(xi , a)

Iterative solution

The fixed-point problem can be solved iterating the scheme untilconvergence, starting from any initial guess

w(k+1)i = min

a∈A

w (k)

(xi + ∆t f (xi , a)

)+ ∆t r(xi , a)

w

(0)i =

+∞ xi ∈ Rn\Tg(xi ) xi ∈ ∂T

CFL condition (not needed but useful)

∆t maxx ,a|f (x , a)| ≤ ∆x

E. Cristiani (IAC–CNR) Numerical Methods for Optimal Control Pbs March 2013 17 / 18

Page 18: Numerical Methods for Optimal Control Problems. Part I: … · 2016. 5. 15. · References Main references 1 M. Bardi, I. Capuzzo Dolcetta, Optimal control and viscosity solutions

Minimum time problem with target Numerics for PMP

Shooting method for PMP

Find the solution of S(p0, τ) = 0 where

S(p0, τ) :=(

y(τ)− T , f (y(τ), α(τ)) · p(τ) + r(y(τ), α(τ)))

and y(τ), p(τ) and α(τ) are computed solving the ODEsαn = arg max

a∈Af (yn, a) · pn + r(yn, a)

yn+1 = yn + ∆t f (yn, αn)

pn+1 = pn + ∆t (−∇x f (yn, αn) · pn −∇x r(yn, αn))

with only initial conditions

y1 = x and p1 = p0

E. Cristiani (IAC–CNR) Numerical Methods for Optimal Control Pbs March 2013 18 / 18