Exercise Dynamic Programming
Exercise Dynamic Programming
(1)
subject to ẋ1 = (1 − x22 ) x1 − x2 + u, x1 (0) = 0
ẋ2 = x1 , x2 (0) = 1
−1 ≤ x1 (t) ≤ 1, −1 ≤ x2 (t) ≤ 1, −1 ≤ u(t) ≤ 1,
with T = 10.
To be able to solve the problem using dynamic programming, we parameterize the control
trajectory into N = 20 piecewise constant intervals. On each interval, we then take NK steps
of a RK4 integrator in order to get a discrete-time OCP of the form:
N −1
(k) (k)
X
minimize F0 (x1 , x2 , u(k) )
x,u
k=0
Tasks:
5.1 On the course webpage and on Gist1 , you will find an incomplete implementation of
dynamic programming for problem (2). Add the missing calculation of the cost-to-go
function to get the script working.
5.2 Add the additional end-point constraint x1 (T ) = −0.5 and x2 (T ) = −0.5. How does the
solution change?
1
https://gist.github.com/jaeandersson/e37e796e094b3c6cad9e