Optimal Control - Automatic Control...

3

Click here to load reader

Transcript of Optimal Control - Automatic Control...

Page 1: Optimal Control - Automatic Control Laboratorycontrol.ee.ethz.ch/~apnoco/Problems2014/OptimalControl/Optimal... · Optimal Control Problem 1 : KKT conditions ... The dynamics of the

1

Optimal Control

Problem 1 : KKT conditions

Solve the following quadratic optimization problem

minx1,...,xn

n∑i=1

qix2i

st.

n∑i=1

xi = c,

where qi > 0, ∀i ∈ [1, . . . , n] and c a given constant. Hint: use the KKT conditions.

Solution :

The Lagrangian is given by

L(x1, . . . , xN , λ) =n∑

i=1

qix2i + λ

(n∑

i=1

xi − c

).

The (necessary) optimality conditions on the optimizer (x?, λ?) read (KKT)

∂L

∂xi= 0 ⇐⇒ 2qixi + λ? = 0, ∀i = [1, . . . , n], (1)

∂L

∂λ= 0 ⇐⇒

n∑i=1

xi = c. (2)

From the first equation we deduce

x?i = − λ?

2qi, ∀i = [1, . . . , n].

Substituting the last result in the second KKT condition it follows thatn∑

i=1

− λ?

2qi= c =⇒ λ? = − 2c∑n

i=11qi

,

and consequentlyxi =

c

qi∑n

i=11qi

, ∀i = [1, . . . , n].

Problem 2 : Pontryagin’s principle

We are given a water tank system according to Figure 1.

The dynamics of the water tank are given according to the differential equation

x1 = −x1 + u,

x2 = x1 − x2.

We assume that initially both tanks are empty. The input 0 ≤ u(t) ≤ 1 is contraint for all times. The cost tobe minimized is

J =1

5

∫ 5

0

u(t)dt− x2(5).

Page 2: Optimal Control - Automatic Control Laboratorycontrol.ee.ethz.ch/~apnoco/Problems2014/OptimalControl/Optimal... · Optimal Control Problem 1 : KKT conditions ... The dynamics of the

2

Fig. 1. Water tank

1) State the problem as an optimal control problem.

2) Find the optimal input u(t).

Solution :

1) The optimal control problem can be stated as

infu

15

∫ T

0u(t)dt− x2(5)

s.t. x1 = −x1 + u,x2 = x1 − x2,0 ≤ u(t) ≤ 1, ∀t.

where the optimization variable u : [0, 5]→ R is a function.

2) The Hamiltonian for the aforementioned problem is

H(x, u, λ) =u

5+ λ1(−x1 + u) + λ2(x1 − x2).

The optimal state x?(t), control u?(t) and costate λ?(t) must satisfy the following conditions (Pontryaginprinciple): The system equations read

x?1(t) = −x?1(t) + u?(t),

x?2(t) = x?1(t)− x?2(t).

The costate equations reduce to

−λ?1(t) = −λ?1(t) + λ?2(t),

−λ?2(t) = −λ?2(t).

Page 3: Optimal Control - Automatic Control Laboratorycontrol.ee.ethz.ch/~apnoco/Problems2014/OptimalControl/Optimal... · Optimal Control Problem 1 : KKT conditions ... The dynamics of the

3

The minimum principle states that

u? = arg min0≤u≤1

H(x?, u, λ?)

= arg min0≤u≤1

u

5+ λ?1(t)(−x?1(t) + u) + 5λ?2(t)x

?1(t)

= arg min0≤u≤1

(1

5+ λ?1(t))u(t)

=

0

1

5+ λ?1(t) ≥ 0

11

5+ λ?1(t) < 0

We must have the initial/final conditions

λ?1(5) = 0, x?1(0) = 0

λ?2(5) = −1, x?2(0) = 0

We can now solve for the optimal costate trajectory directly. The optimal costate trajectories are

λ?1(t) = et−5(t− 5),

λ?2(t) = −et−5

The optimal control u?(t) can hence be found as

u?(t) ≈

{1 2.45 ≤ t ≤ 4.74

0 Otherwise