Hw01sol PDF
Hw01sol PDF
Optimal Control
Homework Solution # 1
Due: Jan 26, 2004 (Monday)
1. (30%)
A meteor is moving along the path (Earth is at the origin)
y = x2 + 3x 6.
A space station is at (x, y) = (2, 2). Find the closest point of approach, (x, y), and the
distance from this point to the space station.
Solution:
This problem may be stated as:
min J := (x 2)2 + (y 2)2
x,y
subject to y = x2 + 3x 6, x 0, y 0.
= 0 2(x 2) + 21 x + 31 + 2 = 0
= 0 2(y 2) 1 + 3 = 0.
First assume the inequality constraints are not active, i.e., 2 = 3 = 0. Then
x=
4 31
, 1 = 2(y 2)
2(1 + 1
which implies
x =
3y + 8
4 6(y 2)
=
.
2(1 + 2(y 2))
2y 3
3y 8
2y 3
!2
3y 8
3
6.,
2y 3
which may be solved to give three candidate solutions: {8.22, 2.05, 0.92}, and the
corresponding x: {1.68, 1.71, 4.53}. Take the positive solutions only, we therefore
obtain
(x , y ) = (1.71, 2.05).
Since the inequality constraints are indeed inactive, this is the optimal solution, and
the optimal cost is J = 0.087.
(Run hw01 1.m for the numerical solution and plot.)
1
N
1
X
i=0
where Q(N ) 0, Q 0, r > 0. Find the optimal control, and the closed loop state
and co-state equations. Dont worry about the solution of these equations.
Solution:
First form the Hamiltonian:
Hi = xTi Qxi + ru2i + Ti+1 (Axi + Dxi ui + bui ).
Stationarity condition:
Hi
= 2rui b + (Ti+1 Dxi + b) = 0,
ui
which may be solved to give
1
ui = Ti+1 (Dxi + b).
2r
The costate equation is given by
i =
Hi
xi
!T
= 2QN xN .
xN
The TPBVP corresponding to the optimal trajectory is given by
N =
Dxi T
(Dxi + b)
2r i+1
DT i+1 T
= 2Qxi + AT i+1
i+1 (Dxi + b)
2r
= 2QN xN , x0 given.
xi+1 = Axi
i
N
3. (40%)
Consider the following bilinear system:
x(i + 1) = x(i)u(i) + 1
with the performance index
J=
and final state constraint x(N ) = 0.
2
1
1 NX
u2
2 i=0 i
(a) (15%) Find the optimal control and the closed loop state and co-state equations.
(b) (15%) Suppose that x(0) = 1 and N = 2. Use the result from part 3a to find the
optimal state and co-state sequences, the optimal control, and the optimal value
of the performance index.
(c) (10%) Convert the optimal control problem in part 3b into a static optimization
and find the optimal control sequence and the optimal value of the performance
index.
Solution:
xi+1 = xi ui + 1, x0 = 1, x2 = 0.
(a) Form the Hamiltonian
u2i
+ i+1 (xi ui + 1).
2
i
Solve for the optimal control from H
= ui + i+1 xi = 0:
ui
Hi =
ui = i+1 xi .
Costate equation:
Hi
= i = i+1 ui .
xi
TPBVP:
xi+1 = i+1 x2i + 1, x0 , xN given
i = xi 2i+1 .
(b) For N = 2, x0 = 1, x2 = 0, we have
x1 = 1 + 1
x2 = 2 x21 + 1
= l2 (1 1 )2 + 1
1 = x1 22 .
Use 1 and x1 equations to solve for x1 , we get
x1 = 1 + 1 = x1 22 + 1 =
And then solve for 1 :
1 =
1
.
1 22
22
.
1 22
2
+ 1 = 0.
(1 22 )2
3
Solve for 2 , we get two real solutions: {1.49, 0.52}. Compute J for each candidate
2 , we get J = {4.8, 0.67}. Therefore, the optimal 2 is 0.52, and 1 = 0.38,
u0 = 0.38, u1 = 0.72. the optimal state trajectory is
x0 = 1, x1 = 1.38, x2 = 0.
(c) The equivalent static optimization problem is
1
min (u20 + u21 )
2
u0 ,u1
subject to
0 = (u0 + 1)u1 + 1.
For the Hamiltonian:
1
H = (u20 + u21 ) + ((u0 + 1)u1 + 1).
2
First order condition:
u0 + u1 = 0
u1 + (u0 + 1) = 0.
Solve u0 , u1 in terms of :
2
1 2
=
.
1 2
u0 =
u1
Substitute into the constraint equation and solve for , we get the same two real
roots as 2 in the previous part: {1.49, 0.52}. Now check the second order condition:
"
#
2H
1
=
1
u2
which is positive definite if and only if 1 2 > 0. Therefore, the optimal is
0.52. Substituting into u0 and u1 , we obtain the same solution as before.