MS-E2148 Dynamic optimization Exercise 2
Exercise 2.2
a)Find the curve, which is an extremal for the functional
J(x) = Z tf 0 p 1 + ˙x2 (t)dt,
when x(0) = 5 and the end point has to be on the circle x2
(t) + (t−5)2
−4 = 0. Check your result geometrically. Hint: The end point condition is of the form m(x(tf), tf) = 0. Draw a picture to define the dependence of δxf and δtf.
b) What ifx(0) = 2 and the end point is on the curve θ(t) =−4t+ 5 ?
Solution
a) Let’s again write the Euler equation:
F = (1 + ˙x2 )1/2 , Fx = 0, Fx˙ = ˙x(1 + ˙x 2 )−1/2 then 0 = Fx− d dtFx˙ = x(1 + ˙¨ x2 )−1/2 + ˙x(1 + ˙x2 )−3/2 ·(1/2)·2 ˙x·x¨ = x¨ (1 + ˙x2 )−1/2 −x˙2 (1 + ˙x2 )−3/2 = x¨ 1 + ˙x−1/2 (1 + ˙x2 )3/2 − ˙ x2 (1 + ˙x2 )3/2 = x¨ 1 (1 + ˙x2 )3/2 ⇒ x¨= 0.
The solutions are thus lines
x∗
(t) =c1t+c2. From the initial condition we get c2 = 5.
Because the end point has to lie on a curve θ(t) (note that in part a) it is not convenient to calculateθ(t), because the end point is on a circle), δxf and δtf are dependent (see Fig. 1). We see that
x∗
Figure 1: Sketch of a problem, where x(tf) and tf are free, but related.
and also approximately it holds
˙ θ(tf) =
δxf
δtf . (2)
We could use insert these geometric interpretations in the following transversality condition that we are using (however, we do it only in part b) )
Fxδxf˙ + (F −Fx˙x)δtf˙ = 0, where Fx˙ =c1(1 +c 2 1) −1/2 F −Fx˙x˙ = (1 +c 2 1) 1/2 −c2 1(1 +c 2 1) −1/2 .
Thus, the transversality condition is
0 = c1(1 +c 2 1) −1/2 δxf + (1 +c2 1) 1/2 −c2 1(1 +c 2 1) −1/2 δtf = c1δxf + (1 +c 2 1−c 2 1)δtf (3) = c1δxf +δtf.
The end point has to be on the circle x2
(t) + (t−5)2
−4 = 0. However, to make it something we can more easily work with, let’s do a Taylor approximation of it at the end point(x(tf), tf):
2x(tf)δxf + 2(tf −5)δtf = 0.
We are studying the extremal x∗
(t), so we can write
2x∗
(tf)δxf + 2(tf −5)δtf = 0,
δxf = 5−tf x∗
(tf)δtf, (4)
when we are at the goal curve. By combining Eqs. (3) and (4), we get
δtf 5−tf x∗ (tf)c1 + 1 = 0.
This has to hold for arbitrary δtf, thus
x∗
(tf) +c1(5−tf) = 0 ⇔ x
∗
(tf) =c1(tf −5), from which follows
x∗
(tf) =c1tf + 5 =c1tf −5c1 ⇒ c1 =−1 so the optimal trajectory is
x∗
(t) = −t+ 5.
The solution is depicted in Fig. 2. It’s the shortest distance from the point (0,5) to the goal set, i.e., the circle. Hence the optimal trajectory cuts the arch of the circle perpendicularly.
Figure 2: The optimal trajectory for Exercise 2.2 is the shortest distance from point (0,5) to the arch of the circle.
b) Now the initial condition is x(0) = 2and the end point has to satisfy the condition
x(tf) = −4tf + 5 =θ(tf).
the Euler equation is the same as in part a), so the solutions are lines
x∗
(t) =c1t+ 2.
The transversality condition is again the same as in part a) (see Kirk p. 151 or Lecture 2), except here we have not inserted the relation from Eq. (2), because we can directly calculate
˙ θ(t), 0 = Fx(x˙ ∗ (tf),x˙∗ (tf), tf) ˙dθ(tf)−x˙∗ (tf) +F(x∗ (tf),x˙∗ (tf), tf) = x˙ ∗ (tf) (1 + ˙x∗2 (tf))1/2 −4−x˙ ∗ (tf) + (1 + ˙x∗2 (tf)) 1/2 = −4 ˙x∗ (tf)−x˙∗2 (tf) + 1 + ˙x∗2 (tf) = −4 ˙x∗ (tf) + 1 ⇒ x˙∗ (tf) = 1 4.
Now we can easily conclude thatc1 = 1/4, out of which follows
x∗
(t) = 1 4t+ 2.
Exercise 2.3
Find the necessary conditions for the extremalx∗
(t),t0 ≤t≤t1, which maximizes the functional Z t1
t0
F(x(t),x(t), t)dt˙
when t0 and t1 are only known. Notice, that x(t0)and x(t1) can also be chosen optimally.
Solution
The variation of the functional is attained as usual δJ(x, δx) = Z t1 t0 ∂F ∂x(x(t),x(t), t)δx˙ + ∂F ∂x˙(x(t),x(t), t)δ˙ x˙ dt = Z t1 t0 ∂F ∂x(x(t),x(t), t)˙ − d dt ∂F ∂x˙ (x(t),x(t), t)˙ δx dt (5) +∂F ∂x˙ (x(t1),x(t˙ 1), t1)δx(t1)− ∂F ∂x˙ (x(t0),x(t˙ 0), t0)δx(t0).
Suppose that the curvex∗
is an extremal for the free initial and end point problem. We denote the value of x∗
(t0) and x
∗
(t1) asx0 and x1, respectively. Now, consider a fixed initial and end point problem with the same functional, the same initial and final times, and with specified end points x(t0) = x0 and x(t1) = x1. The curve x
∗
must be an extremal for this fixed initial and end point problem; therefore,x∗
must be a solution of the Euler equation, and the integral term in Eq. (5) must be zero on an extremal.
∂F ∂x(x ∗ (t),x˙∗ (t), t)− d dt ∂F ∂x˙ (x ∗ (t),x˙∗ (t), t) = 0, ∀t∈[t0, t1].
The above reasoning can be used for the transversality conditions. The end points can be varied independently of each other by choosing separately δx(t0) = 0 or δx(t1) = 0, so both terms have to separately vanish, so we get two transversality conditions:
∂F ∂x˙(x ∗ (t0),x˙ ∗ (t0), t0) = 0, ∂F ∂x˙ (x ∗ (t1),x˙ ∗ (t1), t1) = 0.
Exercise 2.4
Find such extremals for the problem
min 4 Z 0 [ ˙x(t)−1]2 [ ˙x(t) + 1]2 dt ( x(0) = 0 x(4) = 2
which have one corner.
Solution
Let the possible corner point bet1. According to the Weierstrass-Erdmann boundary conditions (WE), the functions
Fx,˙ F −Fx˙x˙
have to be continuous, but x˙ is discontinuous in the corner point t1 (see Kirk p. 157). Let a := limt→t+ 1 x(t);˙ b := limt→t− 1 x(t);˙ a 6= b.
The aim is to find a, bso that W-E and Euler are both satisfied. From the W-E conditions we get two equations.
Now the functions
Fx˙ = 2 ˙ x(t)−1 ˙ x(t) + 12 + 2 ˙ x(t)−12 ˙ x(t) + 1 = 2 ˙ x(t)−1 ˙ x(t) + 1 ˙ x(t)−1 + ˙x(t) + 1 = 4 ˙ x(t)−1 ˙ x(t) + 1 ˙ x(t) F −Fx˙x˙ = ˙ x(t)−12 ˙ x(t) + 12 −4 ˙ x(t)−1 ˙ x(t) + 1 ˙ x2 (t) = ˙ x(t)−1 ˙ x(t) + 1 ˙ x2 (t)−1−4 ˙x2 (t) = −x(t)˙ −1 ˙ x(t) + 1 3 ˙x2 (t) + 1 are continuous, whereas x˙∗
(t) is discontinuous in the point t1.
The aim is to find the possible values for the limits a and b. The first continuity condition gives
4(a−1)(a+ 1)a= 4(b−1)(b+ 1)b=p(a) =p(b),
where pis a polynomial. The other continuity condition gives
(a−1)(a+ 1)(3a2
+ 1) = (b−1)(b+ 1)(3b2
where q is another polynom. Because the conditions are satisfied simultaneously, it also holds
p(a)q(b)−p(b)q(a) = 0.
By writing this open and grouping some the terms we get
(a2 −1)(b2 −1) a(3b2 + 1)−b(3a2 + 1) = 0.
It can be shown, that two possible solution pairs (a, b), for which holds
a6=b, are
(a, b) = (1,−1) ∨ (a, b) = (−1,1).
So we have found the limits for the both sides ofx˙∗
(t1)(two different cases). Lets write the Euler equation:
0 = Fx− d dtFx˙ = 0− 4¨x( ˙x+ 1) ˙x+ 4( ˙x−1)¨xx˙ + 4( ˙x−1)( ˙x+ 1)¨x = −4¨x ˙ x2 + ˙x+ ˙x2 −x˙ + ˙x2 −1 = −4¨x[3 ˙x2 −1] ⇒ x¨ 3 ˙x2 −1 = 0.
We can see that the solution for the differential equation is a line
x∗
(t) =c1t+c2.
There are two solutions, for which we can solve the integration constants from the end point conditions and the continuity condition.
First solution, (a, b) = (1,−1)
First piece of first solution, t∈[0, t1] First let’s use the initial point condition
x∗ 1(0) = 0 c2 = 0 ⇒ x∗ 1(t) =c1t. Then apply x˙∗ 1(t) = a= 1: ˙ x∗ 1(t) = 1 c1 = 1 ⇒ x∗ 1(t) =t.
Let’s use the end point condition x∗ 1(4) = 2 4c1+c2 = 2 c2 = 2−4c1 ⇒ x∗ 1(t) =c1t+ 2−4c1. Then apply x˙∗ 1(t) = b=−1: ˙ x∗ 1(t) = −1 c1 = −1 ⇒ x∗ 1(t) =−t+ 6. The extremalx∗
1(t)has to be continuous at the corner point t1:
lim t→t+ 1 x∗ 1(t) = lim t→t− 1 x∗ 1(t) t1 = −t1+ 6 t1 = 3
The second solution, where (a, b) = (−1,1) is solved the same way, and we attain the two solutions: x∗ 1(t) = t, 0≤t <3 −t+ 6, 3≤t ≤4 x∗ 2(t) = −t, 0≤t <1 t−2, 1≤t≤4 .
In the figure below the solutions are presented.
Figure 3: Optimal trajectories for Exercise 2.4, when one corner is allowed in the solution. The possible corner points aret = 1 and t = 3.