Optimal Control 4SC000 Q2 2017-2018 Duarte Antunes Recap - - PowerPoint PPT Presentation

optimal control
SMART_READER_LITE
LIVE PREVIEW

Optimal Control 4SC000 Q2 2017-2018 Duarte Antunes Recap - - PowerPoint PPT Presentation

Optimal Control 4SC000 Q2 2017-2018 Duarte Antunes Recap Continuous-time optimal control problems Dynamic model x ( t ) = f ( x ( t ) , u ( t )) , x (0) = x 0 , t [0 , T ] Z T Cost g ( x ( t ) , u ( t )) dt + g T ( x ( T )) 0


slide-1
SLIDE 1

Optimal Control

4SC000 Q2 2017-2018 Duarte Antunes

slide-2
SLIDE 2

Recap

1

  • Continuous-time optimal control problems

˙ x(t) = f(x(t), u(t)), x(0) = x0, t ∈ [0, T]

Z T g(x(t), u(t))dt + gT (x(T)) Dynamic model Cost

  • We have seen two simple versions of the PMP considering
  • problems with no terminal constraints and final cost
  • problems with terminal constraints and no final cost

gT (x(T)) x(T) = ¯ x

slide-3
SLIDE 3

Recap

2

  • In both problems, we have

(u∗(t), x∗(t)) ˙ x∗(t) = f(x∗(t), u∗(t)) ˙ λ(t) = −( ∂

∂xf(x∗(t), u∗(t)))|λ(t) − ( ∂ ∂xg(x∗(t), u∗(t)))| ∂ ∂uf(x∗(t), u∗(t))|λ(t) + ∂ ∂ug(x∗(t), u∗(t))| = 0

λ(T) =

∂ ∂xgT (x∗(T))

State eq. Adjoint eq. Control eq.

  • The boundary conditions are different for the two problems

(no terminal state constraints) (terminal constraints) ∃λ(t), t ∈ [0, T] is an optimal path candidate if s.t. x∗(0) = ¯ x0 x∗(0) = ¯ x0 x∗(T) = ¯ x

  • It is also possible that only the terminal value of some variables are

constrained, xi(T) = ¯ xi, i ∈ C

slide-4
SLIDE 4

Outline

  • Pontryagin’s maximum principle
  • Examples
  • Hamiltonian’s principle in mechanics
  • Brachistochrone
  • Minimum energy problems
  • Minimal time problems for linear systems

(bang-bang control)

slide-5
SLIDE 5

3

Discussion

  • Last lecture we used an informal discretization approach to derive a simplified version of the PMP

.

  • The Pontryagin’s maximum principle is more general and it allows to consider constraints and free

terminal time problems. This requires a different mathematical framework in continuous-time. CT PMP CT DP DT PMP DT DP Discretization, step τ τ → 0 Taking the limit Optimal path and policy Stage decision problem CT control problem Optimal path and policy The goals for today are

  • State the general Pontryagin’s maximum principle.
  • Solve minimal time problems with the PMP for linear system with input constraints.
slide-6
SLIDE 6

4

Problem formulation

Control system

  • Final time and final state can be free or fixed.

Cost functional to be minimized

  • Initial time and initial state are fixed.

Assumptions

x(t) ∈ Rn u ∈ U ⊂ Rm for all

  • , control input may be constrained
  • Lipschitz property: for every bounded set , s.t.

∃L x0 = x(t0) ˙ x(t) = f(x(t), u(t)) D ∈ Rn × U |f(x1, u) − f(x2, u)| ≤ L|x1 − x2| (x1, u), (x2, u) ∈ D

  • are continuous.

x(0) = x0 J(u) = R T

0 g(x(t), u(t))dt

f, g, ∂f

∂x, ∂g ∂x

t0 = 0 T xf := x(T)

slide-7
SLIDE 7

5

Target set

  • Depending on the control objective, the final time and final state can be free or fixed, or

can belong to some set.

  • All the possibilities are captured by introducing a closed target set

and letting be the smallest time such that

  • fixed-time, fixed end state for some fixed (previous lecture)
  • fixed-time, free-end state (previous lecture)
  • r in general for some surface in
  • In particular only some of the state variables may be constrained.
  • free-time, fixed end state
  • r in general
  • free-time, free end state (not so common)

S1 Rn T (T, xf) ∈ S S = {T} × {xf} T, xf S = {T} × Rn {T} × S1 S ⊂ [0, ∞) × Rn S = [0, ∞) × Rn S = [0, ∞) × {x1} S = [0, ∞) × S1

slide-8
SLIDE 8

6

Target set

  • We assume that , differentiable
  • If the target set is never reached the cost is set to infinity.

S1 = {x ∈ Rn : h1(x) = · · · = hn−k(x) = 0} hi : Rn → R

  • We can always consider since it captures not only free time-fixed end

state problems ( ) but also fixed-time by considering time as a state Then, for this new problem

  • In particular,
  • fixed-time, free end state
  • fixed-time, fixed end state

xn+1 = t  ˙ x(t) ˙ xn+1(t)

  • =

 f(x(t), u(t)) 1

  • S = [0, ∞) × S1

S = [0, ∞) × {x1}  x(0) xn+1(0)

  • =

 x0

  • S = [0, ∞) × Rn × {t1}

S = [0, ∞) × S1 × {t1} S = [0, ∞) × {x1} × {t1}

slide-9
SLIDE 9

7

Terminal cost

  • To consider the problem with terminal cost

note that where

  • Then

and so there is no loss of generality in our problem formulation. x(0) = x0 ˙ x(t) = f(x(t), u(t)) J(u) = R T

0 g(x(t), u(t))dt + gT (xf)

gT (xf) = gT (0) + R T

d dtgT (x(t))dt d dtgT (x(t)) = ∂ ∂xgT (x(t)) ˙

x(t) =

∂ ∂xgT (x(t))f(x(t), u(t))

J(u) = R T

0 ¯

g(x(t), u(t))dt + constant ¯ g(x, u) = g(x, u) +

∂ ∂xgT (x)f(x, u)

slide-10
SLIDE 10

8

Pontryagin’s maximum principle

Let be an optimal control (in the global sense) and let be the corresponding optimal state trajectory. Then there exist a function and a constant satisfying for all and having the following properties: 1) and satisfy x∗ p∗ Consider an optimal control problem with target set . H : Rn × U × Rn × R → R with boundary conditions and , where is the Hamiltonian, defined as . 2) For each fixed , the function has a global maximum, i.e., hold for all and all . 3) for all 4) The vector is orthogonal to the tangent space to at t H(x∗(t), u∗(t), p∗(t), p∗

0) ≥ H(x∗(t), u, p∗(t), p∗ 0)

(p∗

0(t), p∗(t)) 6= (0, 0)

u → H(x∗(t), u, p∗(t), p∗

0)

u ∈ U H(x∗(t), u∗(t), p∗(t), p∗

0) = 0

S1 ˙ x∗ = ∂ ∂pH(x∗, u∗, p∗, p∗

0)

˙ p∗ = − ∂ ∂xH(x∗, u∗, p∗, p∗

0)

p∗

0 ≤ 0

S = [0, ∞) × S1

x∗ : [0, T] → Rn p∗ : [0, T] → Rn u∗ : [0, T] → U t ∈ [0, T] x∗(0) x∗(T) ∈ S1 H(x, u, p, p0) = p|f(x, u) + p0g(x, u) t ∈ [0, T] t ∈ [0, T] p∗(T) x∗(T) < p∗(T), d >= 0

∀d, i :< d, ∂ ∂xhi(x∗(T))| >= 0

slide-11
SLIDE 11

9

Discussion

  • These are still only necessary conditions for optimality and not sufficient. However a

local maximum or a local minimum cannot satisfy these conditions and thus these are necessary conditions for global optimality.

  • The function should be interpreted as our previous costate, but

multiplied by , . This is just a convention.

  • The scalar is called the abnormal multiplier. We can replace except in

degenerate cases which we will not address (in which case ).

  • Accordingly, the Hamiltonian is defined in a slightly different manner

which is obtained by multiplying by our previous definition p(t) = −λ(t) −1 p0 −1 p∗

0 = −1

p∗

0 = 0

H(x, u, p, −1) = p|f(x, u) − g(x, u) ˆ H(x, u, λ) = λ|f(x, u) + g(x, u) = −p|f(x, u) + g(x, u) = −H(x, u, p, −1) p(t) : [0, T] → Rn

slide-12
SLIDE 12

10

Conditions 1 and 2

  • The conditions stated in point 1) of the Theorem are nothing more that the equations

for the state and the co-state that we have obtained before. In our previous notation

  • The condition 2) states that has a (global) maximum. In our

previous notation this would correspond to a minimum. If there are no input constraints and are differentiable with respect to (our previous setting) then we must have Thus condition 2 is more general and shall allow us to handle input constraints ˙ x∗ = ∂ ∂pH(x∗, u∗, p∗, p∗

0)

˙ p∗ = − ∂ ∂xH(x∗, u∗, p∗, p∗

0)

u → H(x∗(t), u, p∗(t), p∗

0)

˙ x∗ = f(x∗, u∗, p∗) ˙ λ∗ = − ∂ ∂xf(x∗, u∗, λ∗)|λ∗ − ∂ ∂xL(x∗, u∗, λ∗)| u ∂ ∂uH(x∗, u, p∗, p∗

0)|u=u∗ = 0

∂ ∂uf(x∗, u∗, p∗)|λ∗ + ∂ ∂ug(x∗, u∗, p∗)| = 0 (as in previous lectures) (as in previous lectures) f, g

slide-13
SLIDE 13

11

Condition 3

  • Condition 3 states that the Hamiltonian must be zero.
  • For problems with fixed terminal time, recall the trick

where either or

  • This trick leads to an extra variable for the costate and the Hamiltonian for

the new problem, denoted by , is given by

  • Thus is constant and is constant (as in previous lectures)

Thus condition 3 is more general and shall allow us to handle free time problems for which the Hamiltonian must be zero. xn+1 = t  ˙ x(t) ˙ xn+1(t)

  • =

 f(x(t), u(t)) 1

  • pn+1(t)

˙ pn+1(t) = − ∂ ∂xn+1 ¯ H = 0 pn+1(t) ¯ H = 0 H ¯ H  x(0) xn+1(0)

  • =

 x0

  • S = [0, ∞) × Rn × {t1}

S = [0, ∞) × {x1} × {t1} ¯ H = ⇥p| pn+1 ⇤  f 1

  • − g = p|f − g

| {z }

H

+pn+1

slide-14
SLIDE 14

12

Condition 4

  • Condition 4 is called the transversality condition
  • For fixed terminal time, fixed terminal state problems

free (as in previous lectures)

  • For fixed terminal time, free terminal state problems there are no constraints so is free

and

S1 = {x ∈ Rn : h1(x) = · · · = hn−k(x) = 0}

hi : Rn → R

d

h(x(T)) = x(T) − xf = 0 = ⇒ d = 0 = ⇒ p∗(T) p∗(T) = 0 < p∗(T), d >= 0 ∀d, i :< d, ∂ ∂xhi(x∗(T))| >= 0

slide-15
SLIDE 15

13

Condition 4

  • Recall that if
  • Thus the Hamilton for the problem where we consider is

where can be shown to satisfy condition 1 of the theorem.

  • Then

(as in previous lectures) Thus condition 4 is more general. J(u) = R T

0 g(x(t), u(t))dt + gT (xf) =

R T

0 ¯

g(x(t), u(t))dt + constant

¯ g(x, u) = g(x, u) +

∂ ∂xgT (x)f(x, u)

p = ¯ p −

∂ ∂xgT (x)|

¯ H(x, p, u) = ¯ p|f(x, u) − (g(x, u) +

∂ ∂xgT (x)f(x, u))

¯ p(T) = 0 = ⇒ p(T) = − ∂

∂xgT (x(T))|

¯ g = p|f(x, u) − g(x, u)

slide-16
SLIDE 16

Historical note

The Pontryagin’s maximum principle was developed by the Pontryagin schools in the Soviet Union in the late 1950s. It was presented to the wider research community at the first IFAC World Congress in Moscow in 1960.

14

Lev Pontryagin (1908-1988) was a Soviet mathematician. He was born in Moscow and lost his eyesight due to a stove explosion when he was 14. Despite his blindness he was able to become one of the greatest mathematicians of the 20th century, partially with the help of his mother Tatyana Andreevna who read mathematical books and papers (source: wikipedia).

slide-17
SLIDE 17

Outline

  • Pontryagin’s maximum principle
  • Examples
  • Hamiltonian’s principle in mechanics
  • Brachistochrone
  • Minimum energy problems
  • Minimal time problems for linear systems

(bang-bang control)

slide-18
SLIDE 18

15

Hamiltonian’s principle in Mechanics

The motion of a conservative system, from time to time is such that the integral has a stationary value (typically a minimum), where L = T(u, q) − V (q) T V q u = ˙ q Lagrangian of the system

Principle of least action

Kinetic energy of the system Potential energy of the system Generalized velocity vector Generalized coordinate vector (state of the system) T I = R T

0 L(u, q)dt

slide-19
SLIDE 19

16

Hamiltonian’s principle in Mechanics

The Hamiltonian is then Consequently, the Euler-Lagrange equations are ˙ λ = −∂H ∂q = −∂L ∂q costate eq. control eq. state eq. u = ˙ q 0 = ∂H ∂u = ∂L ∂u + λ = 0 Combining the first two equations we obtain d dt(∂L ∂ ˙ q ) − ∂L ∂q = 0 which are the Lagrange’s equations of motion for a conservative system. H = L + λu

slide-20
SLIDE 20

17

Hamiltonian’s principle in Mechanics

If is not an explicit function of time, the Hamiltonian is constant Interesting: nature governs the motion of bodies with optimal control! L H = L − ∂L ∂u u = T − V − ∂T ∂u u = const One can show that the kinetic energy satisfies: (think of ) T = 1 2mv2 ∂T ∂u u = 2T Hence, we have −H = T + V = const that is, the kinetic plus potential energy is constant during the motion.

slide-21
SLIDE 21

Outline

  • Pontryagin’s maximum principle
  • Examples
  • Hamiltonian’s principle in mechanics
  • Brachistochrone
  • Minimum energy problems
  • Minimal time problems for linear systems

(bang-bang control)

slide-22
SLIDE 22

18

Brachistochrone

Find a path between two points in a vertical plane such that a particle sliding without friction along this path takes the shortest possible time to travel from one point to the other. x y a b yb

slide-23
SLIDE 23

Historical note

19 Johann Bernoulli posed the problem of the brachistochrone to the readers of Acta Eruditorum in June, 1696. Five mathematicians responded with solutions: Isaac Newton, Jakob Bernoulli (Johann's brother), Gottfried Leibniz, Ehrenfried Walther von Tschirnhaus and Guillaume de l'Hôpital. Four of the solutions (excluding l'Hôpital's) were published in the same edition of the journal as Johann Bernoulli's. In his paper Jakob Bernoulli showed that its solution is a cycloid. According to Newtonian scholar Tom Whiteside, Newton found the problem in his mail, in a letter from Johann Bernoulli, when he arrived home from the mint at 4 p.m., and stayed up all night to solve it and mailed the solution by the next post. This story gives some idea of Newton's power, since Johann Bernoulli took two weeks to solve it. In an attempt to outdo his brother, Jakob Bernoulli created a harder version of the brachistochrone problem. In solving it, he developed new methods that were refined by Leonhard Euler into what the latter called (in 1766) the calculus of variations. Joseph- Louis Lagrange did further work that resulted in modern infinitesimal calculus. (adapted from Wikipedia) Johann Bernoulli (1667 – 1748) was a Swiss mathematician, known for his contributions to infinitesimal calculus and educating Leonhard Euler. He was a professor of mathematics at the university of Groningen.

slide-24
SLIDE 24

20

Problem formulation

Let us relabel x → t

y → x

The initial kinetic and potential energy is zero, and we must have the following equation determining the velocity as a function of Then the total time is the integral of the arc-length over the velocity mv2 2 = mgx x Z b

a

p 1 + ( ˙ x(t))2 p 2gx(t) dt g = 9.8

slide-25
SLIDE 25

21

Optimal control

Z b

a

p 1 + u(t)2 p 2gx(t) dt ˙ x(t) = u(t) Dynamic model Cost function Hamiltonian H(x, u, λ) = L(x, u) + λu L(x, u) Terminal constraints x(a) = 0 x(b) = xb Optimality conditions ∂H ∂u = 0 H = constant

p 1 + u∗(t)2 p 2gx∗(t) − u∗(t)2 p 1 + u∗(t)2p 2gx∗(t) = constant

slide-26
SLIDE 26

22

Optimal solution

The solutions to the differential equation ˙ x∗(t) = s C − x∗(t) x∗(t) are cycloids determined implicitly by t(θ) = a + c(θ − sin(θ)) x(θ) = c(1 − sin(θ)) These equations describe the curve traced by a point on a circle of radius as this circle rolls without slipping on the horizontal axis. c

slide-27
SLIDE 27

Outline

  • Pontryagin’s maximum principle
  • Examples
  • Hamiltonian’s principle in mechanics
  • Brachistochrone
  • Minimum energy problems
  • Minimal time problems for linear systems

(bang-bang control)

slide-28
SLIDE 28

23

Minimum energy control

How to move a motion system described by a linear equation from point A to point B with minimum energy ˙ x(t) = Ax(t) + Bu(t) x(0) = x0 x(T) = xdesired

A B

minu R T

0 g(u(t))dt

Fx Fy y x

g(u)

is convex Assumption:

u ∈ R

slide-29
SLIDE 29

24

PMP

H(x, u, λ) = g(u) + λ|(Ax + Bu) ∂ ∂uH(x, u, λ) = ∂ ∂ug(u) + λ|B = 0 ˙ λ = −[ ∂ ∂xH(x, u, λ)]| = −A|λ ˙ x = Ax + Bu u = g−1

u (−λ|B)

g−1

u

:= ∂ ∂ug(u)

is invertible since is convex

g λ(t) = e−A|tλ(0)

x(T) = xdesired

imposing we obtain a linear system from which we can

  • btain λ(0)

= g−1

u (−B|λ)

x(t) = eAtx(0) + Z t eA(t−s)Bg−1

u (−B|e−A|s)dsλ(0)

slide-30
SLIDE 30

25

Example

A =  1

  • B =

 1

  • (double integrator)

g(u) = 1 4u4 x(0) = 

  • x(T) =

 1

  • T = 1

solution: g−1

u (y) = sign(y)y1/3

sign(y) =      1 if y > 0 − 1 if y < 0 0 if y = 0

  • r equivalently

Substituting in the expression

 1

  • = x(1) = e

 0

1

 

x(0)+ Z 1 e

 0

1

 (1−s) 

1

  • g−1

u (−

⇥ 1 ⇤ e

−  0

1

 s

λ(0))ds

1

  • =

Z 1 1 − s 1

  • g−1

u (sλ1(0) − λ2(0))ds

λ1(0) = 2λ2(0) = 203.54

slide-31
SLIDE 31

26

Results

t 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

u

  • 5
  • 4
  • 3
  • 2
  • 1
1 2 3 4 5 895185530450641/8796093022208)1/3 (heaviside(t - 1) - heaviside(t - 1/2)) - (895185530450641/8796093022208 - (895185530450641 t 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

x2 = dp/dt

0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 35807421218025641/3 heaviside(t - 1/2) (1 - 2 t)4/3)/262144 -...+ (3 35807421218025641/3 heaviside(t - 1) ((2 t - 1)4/3 - t 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

x1=p

0.2 0.4 0.6 0.8 1 35807421218025641/3 heaviside(t) ((3 (1 - 2 t)7/3)/14 - 3/14))/262144 -...+ (3 35807421218025641/3 heaviside(t - 1) ((3 (2 t - 1)7

time t time t time t

slide-32
SLIDE 32

27

Connection to controllability gramian

Suppose that , the initial condition is zero and is large

˙ x(t) = Ax(t) + Bu(t) x(T) = xdesired

g(u) = 1 2u2 x(0) = 0 min Z T 1 2u(t)2dt T (T → ∞) Then is the identify, the optimal control input is g−1

u

λ(0) u(t) = −B|e−A|tλ(0) and can be obtained from x(T) = Z T eA(T −s)BB|e−A|sdsλ(0) = Z T eArBB|eA|rdre−A|T λ(0) r = T − s λ(0) = eA|T W(T)−1x(T) W(T) = Z T eArBB|eA|rdr

slide-33
SLIDE 33

28

Connection to controllability gramian

Z T 1 2u(t)2dt = 1 2x(T)|W(T)−1 Z T eA(T −r)BB|eA|(T −r)dr | {z }

W (T )

W(T)−1x(T) = 1 2x(T)|W(T)−1x(T) W(T) = Z T eArBB|eA|rdr If is Hurwitz and is controllable, we can take the limit A (A, B) (T → ∞)

  • btaining

which is the controllability gramian - solution to: W∞ = Z ∞ eArBB|eA|rdr 0 = AW∞ + W∞A| + BB| Optimal cost

slide-34
SLIDE 34

Outline

  • Pontryagin’s maximum principle
  • Examples
  • Hamiltonian’s principle in mechanics
  • Brachistochrone
  • Minimum energy problems
  • Minimal time problems for linear systems

(bang-bang control)

slide-35
SLIDE 35

Minimal time problems

Consider the problem

min T ˙ x(t) = Ax(t) + Bu(t) t ≥ 0 x(0) = x0 x(T) = ¯ x (A, B)

subject to

  • We assume that is controllable
  • Without loss of generality we can assume ¯

x = 0

  • We can write the cost as T =

R T

0 1dt

  • For simplicity we assume u(t) ∈ R

−c ≤ ui(t) ≤ c i ∈ {1, . . . , m} u(t) ∈ Rm

  • Without loss of generality we can assume c = 1

29

slide-36
SLIDE 36

PMP

Maximize

  • r equivalently, minimize

ˆ H(x(t), u(t), λ(t)) = λ(t)|(Ax(t) + Bu(t)) + 1 H(x(t), u(t), p(t), −1) = p(t)|(Ax(t) + Bu(t)) − 1 λ(t) = −p(t) ˙ λ = − ∂ ˆ

H ∂x

˙ x = ∂ ˆ

H ∂λ

terminal constraints ,

˙ x(t) = Ax(t) + Bu(t) x(0) = x0 x(T) = ¯ x λ(0), λ(T)

free the function

30

u → ˆ H(x(t), u(t), λ(t))

is minimized when In particular

ˆ H(x(t), u(t), λ(t)) = 0 t = T |λ(T)|B| = 1

u(t) = −signλ(t)|B = ( − 1 if λ(t)|B > 0 1 if λ(t)|B ≤ 0

u(t) = [−1, 1]

˙ λ(t) = −A|λ(t)

slide-37
SLIDE 37

31

Discussion

u(t) = −signλ(t)|B = ( − 1 if λ(t)|B > 0 1 if λ(t)|B ≤ 0

  • The fact that

shows that the input always takes either the maximum or the minimum value.

  • For a given initial condition, the control input will switch between the minimum and the

maximum value until the state reaches the origin.

  • For this reason, this is called bang-bang control.
  • As explained in [Bryson,Hu, sec 3.9] there is a numerical procedure to find .

˙ x(t) = Ax(t) + Bu(t)

u(t) = −signλ(t)|B = ( − 1 if λ(t)|B > 0 1 if λ(t)|B ≤ 0

  • However, for two-dimensional systems one can typically find solutions by inspection.
  • To obtain the optimal path we must find such that when we solve

λ(0)

we obtain x(T) = 0

λ(0) ˙ λ(t) = −A|λ(t)

  • We also show to solve by inspection a problem for a fourth dimensional system.
slide-38
SLIDE 38

2D problem

32

Suppose that we wish to bring an object with a given initial position and velocity to rest at position zero in minimum time subject to a constraint on the magnitude of the force min T = Z T 1dt −1 ≤ u(t) ≤ 1 t for all (x1(0), x2(0)) x1(T) = 0 x2(T) = 0

x1 = 0 x1

u

˙ x1(t) = x2(t) ˙ x2(t) = u(t) ˙ x(t) = Ax(t) + Bu(t) A =  1

  • B =

 1

slide-39
SLIDE 39

Optimal solution

33

If is an optimal control trajectory, must minimize the Hamiltonian for each , i.e., {u∗(t)|t ∈ [0, T]} u∗(t) t Therefore u∗(t) = argmin−1≤u≤1[1 + λ1(t)x∗

2(t) + λ2(t)u]

u∗(t) = ( 1 if λ2(t) < 0 −1 if λ2(t) ≥ 0 The equations describing the costate are for some constants . λ2(t) = c2 − c1t ˙ λ2(t) = −λ1(t) ˙ λ1(t) = 0 λ1(t) = c1 c1, c2 Thus there are only four possibilities. and we must have . |λ2(T)| = 1

slide-40
SLIDE 40

Possibilities

34

u∗(t) = ( 1 if λ2(t) < 0 −1 if λ2(t) ≥ 0 λ2(t) = c2 − c1t T t λ2(t) T t λ2(t) T t λ2(t) T t λ2(t) T t −1 1 u∗(t) T t −1 1 u∗(t) T t −1 1 u∗(t) T t −1 1 u∗(t) |λ2(T)| = 1 A B C D

slide-41
SLIDE 41

Possibilities

35

Possibilities A and C correspond to cases where the origin is achieved by setting the actuation constant ( or ) for a given initial condition

u(t) = 1 u(t) = −1 0 = eAT x0 + R T

0 eA(T −s)B(−1)ds

0 = eAT x0 + R T

0 eA(T −s)Bds

u(t) = −1 x1 x2 u(t) = 1

  • r

x0 = R 0

T eA(−s)B(−1)ds

x0 = R 0

T eA(−s)Bds

x0 =  1

2T 2

−T

  • x0 =

 − 1

2T 2

T

slide-42
SLIDE 42

Control trajectories

36

u(t) = ξ ξ ∈ {+1, −1} x1(t) = x1(0) + x2(0)t + ξ t2 2 x2(t) = x2(0) + ξt x1(t) − 1 2ξ (x2(t))2 = x1(0) − 1 2ξ (x2(0))2 = constant x1 x2 u(t) = 1 u(t) = −1 x1 x2

Switching curve

u(t) = −1 x1 x2 u(t) = 1

(x1(0), x2(0))

trajectories switch when they hit the switching curve For an initial condition not lying in this curve, we know (from PMP co-state) that the control input can only switch once.

slide-43
SLIDE 43

37

Minimum time control for a quadcopter

How to move a (linearized model of a) quadcopter from one hovering position to another one in minimum time?

˙ x(t) = Ax(t) + Bu(t) x(0) = x0 x(T) = xdesired min T x0 xT

|u(t)| ≤ L

slide-44
SLIDE 44

38

Model

Linearized model (y-axis) Thrust Gravity ¨ y = 1 mT sin(θ) ¨ z = 1 mT cos(θ) − g T y z θ mg mass ¨ θ = 1 Iθ τθ x = ⇥ y ˙ y θ ˙ θ ⇤|

˙ x(t) = Ax(t) + Bu(t)

B =     1     u = τθ Iθ x(0) = ⇥0 0⇤| x(T) = ⇥¯ y 0⇤| |u(t)| ≤ L ≈ gθ T ≈ mg A =     1 g 1    

slide-45
SLIDE 45

39

Optimal control input

u(t) = −L sign( a3 |{z}

− λ1(0)

6Iθ

t3 + a2 |{z}

λ2(0) 2Iθ

t2 + a1 |{z}

−λ3(0)

t + a0 |{z}

λ4(0)

) |u(t)| = −L sign(λ(t)|B) = −L sign(λ4(t)) Polynomial of order 3 has at most 3 roots so there are at most three sign changes in the optimal control input λ(t) = e−A|tλ(0) =     1 −t 1

gt2 2

−gt 1 − gt3

6 gt2 2

−t 1         λ1(0) λ2(0) λ3(0) λ4(0)    

slide-46
SLIDE 46

40

Optimal control input

T

T1

T2 T3

T

T1

T2 T3

time time u(t) = −L sign(a3t3 + a2t2 + a1t + a0) Conclusion: search over is equivalent to search over switching times (and sign of the control input) λ(0) Ti T

T1

T2 T3

T

T1

T2 T3

time time

  • r
slide-47
SLIDE 47

41

Results

For u = τθ Iθ |u(t)| ≤ L Iθ = 0.002 L = 50 ¯ y = 1

t 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9

u

  • 60
  • 40
  • 20
20 40 60 100 heaviside(t - 941/2000) -...- 100 heaviside(t - 4964993749729043/36028797018963968) t 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9

d/dt3

  • 10
  • 8
  • 6
  • 4
  • 2
2 4 6 8 45215787882993825 heaviside(t - 1808631515319753/2251799813685248))/562949953421312 -...- 100 t heaviside(t - 1808631515319753 t 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9

3

  • 1
  • 0.8
  • 0.6
  • 0.4
  • 0.2
0.2 0.4 0.6 0.8 1 heaviside(t - 941/2000))/80000 -...+ (45215787882993825 t heaviside(t - 1808631515319753/2251799813685248))/562949953421312

T2 = 0.4705 T3 = 0.8032 T ∗ = 0.941 T1 = 0.1378 time t time t time t

slide-48
SLIDE 48

42

Results

t

0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9

v

0.5 1 1.5 2 2.5

2251799813685248))/5708990770823839524233143877797980545530986496 -...- (801431249760917353029788835347205 t

0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9

y

0.2 0.4 0.6 0.8 1

19200000000000 -...+ (483164605226563795468286475929144999878116613455 t heaviside(t - 1808631515319753/2251799813685248

time t time t

slide-49
SLIDE 49

43

Results

For u = τθ Iθ |u(t)| ≤ L Iθ = 0.002 ¯ y = 1 L = 100

t 0.1 0.2 0.3 0.4 0.5 0.6 0.7

u

  • 100
  • 50
50 100 200 heaviside(t - 791/2000) -...- 200 heaviside(t - 6081307241734005/9007199254740992) t 0.1 0.2 0.3 0.4 0.5 0.6 0.7

d/dt3

  • 15
  • 10
  • 5
5 10 heaviside(t - 8347098950128955/72057594037927936))/9007199254740992 -...- 200 t heaviside(t - 6081307241734005 t 0.1 0.2 0.3 0.4 0.5 0.6 0.7

3

  • 1.5
  • 1
  • 0.5
0.5 1 1.5 (625681 heaviside(t - 791/2000))/40000 -...- 100 t2 heaviside(t - 8347098950128955/72057594037927936)

T2 = 0.39558 T3 = 0.6752 T ∗ = 0.7910 T1 = 0.1158 time t time t time t

slide-50
SLIDE 50

44

Results

t

0.1 0.2 0.3 0.4 0.5 0.6 0.7

v

0.5 1 1.5 2 2.5 3

heaviside(t - 8347098950128955/72057594037927936))/280608314367533360295107487881526339773939048251392 t

0.1 0.2 0.3 0.4 0.5 0.6 0.7

y

0.2 0.4 0.6 0.8 1

19182358974289 heaviside(t - 791/2000))/9600000000000 -...- (245 t4 heaviside(t - 8347098950128955/72057594037927936

time t time t

slide-51
SLIDE 51

Concluding remarks

45

  • Pontryagin’s maximum principal is a very elaborate theorem and the proof

is far from trivial

  • We can tackle minimum time problems with the Pontryagin’s maximum

principle.

  • For systems with linear dynamics this leads to bang-bang control.
  • For 2D systems we can solve these by inspection by determining

switching curves.

Summary

After this lecture you should be able to

  • Solve simple minimum time-problems for linear systems with a two-

dimensional state.