Professional Documents
Culture Documents
Victor M. Becerra
School of Systems Engineering
University of Reading
1 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
Contents of Session 1
2 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
Contents of Session 2
3 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
ẋ = f[x(t), u(t), t]
where x : [t0 , tf ] :7→ Rnx is the state, u(t) : [t0 , tf ] 7→ Rnu is the
control, t is time, and f : Rnx × Rnu × R 7→ Rnx . Suppose that we
are interested in an interval of time such that t ∈ [t0 , tf ].
4 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
J = J[x(·), u(·), t0 , tf ]
5 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
6 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
7 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
8 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
9 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
10 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
||q(t)||22 = 1
||qc (t)||22 = 1
||h(t)||22 ≤ γ
||ḣ(t)||22 = ḣmax
2
12 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
13 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
where
ε̃(q, qc ) = 2T(qc )T q
ω̃(ω, ωc ) = ω − ωc
14 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
ωo is given by:
ωo (q) = nC2 (q)
where n is the orbital rotation rate, Cj is the j column of the
rotation matrix:
1 − 2(q32 + q42 ) 2(q2 q3 + q1 q4 )
2(q2 q4 − q1 q3 )
C(q) = 2(q2 q3 − q1 q4 ) 1 − 2(q22 + q42 ) 2(q3 q4 + q1 q2 )
2(q2 q4 + q1 q3 ) 2(q3 q4 − q1 q2 ) 1 − 2(q22 + q32 )
15 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
16 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
u1 h
20 u2 hmax
u3 10000
10 9000
8000
0
h (ft-lbf-sec)
7000
u (ft-lbf)
-10
6000
-20 5000
4000
-30
3000
0 1000 2000 3000 4000 5000 6000 7000 8000 0 1000 2000 3000 4000 5000 6000 7000 8000
time (s) time (s)
17 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
18 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
Indirect methods
Optimality conditions of continuous problems are derived
Attempt to numerically satisfy the optimality conditions
Requires numerical root finding and ODE methods.
Direct methods
Continuous optimal control problem is discretised
Need to solve a nonlinear programming problem
Later in these lectures, we will concentrate on some direct
methods.
19 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
20 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
21 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
22 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
23 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
24 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
f (y)
subject to
hl ≤ h(y) ≤ hu ,
yl ≤ y ≤ yu ,
where f : Rny 7→ R is a twice continuously differentiable scalar
function, and h : Rny 7→ Rnh is a vector function with twice
continuously differentiable elements hi . Problems such as the
above are often called nonlinear programming (NLP) problems.
25 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
26 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
27 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
28 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
29 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
For a scalar function f (x) and a single equality constraint h(x), the
figure illustrates the collinearity between the gradient of f and the
gradient of h at a stationary point, i.e. ∇x f (x∗ ) = −λ∇x c(x∗ ).
30 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
31 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
In fairly simple cases, the necessary conditions may help find the
solution. In general, however,
There is no analytic solution
It is necessary to solve the problem numerically
Numerical methods approach the solution iteratively.
32 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
33 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
34 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
Definition
Active and inactive constraints An inequality constraint qi (y) is
said to be active at y if qi (y) = 0. It is inactive at y if qi (y) < 0
Definition
Regular point Let y∗ satisfy c(y∗ ) = 0 and q(y∗ ) ≤ 0, and let
Ic (y∗ ) be the index set of active inequality constraints. Then we
say that y∗ is a regular point if the gradient vectors:
35 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
µ≥0
Ly [y∗ , λ, µ] = fy (y∗ ) + [cy (y∗ )]T λ + [qy (y∗ )]T µ = 0
(4)
Lλ [y∗ , λ] = c(y∗ ) = 0
µT q(y∗ ) = 0
36 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
37 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
38 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
39 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
Definition (Functional)
A functional J is a rule of correspondence that assigns to each
function x a unique real number.
40 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
41 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
Solution:
∆J = J(x + δx) − J(x) = . . .
Z 1
δJ = (2xδx) dt
0
42 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
If t0 and tf are also subject to small variations δt0 and δtf , then
the variation of J can be calculated as follows:
Z tf
∂L(x)
δJ = L(x(tf ))δtf − L(x(t0 ))δt0 + δx dt
t0 ∂x
43 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
Z tf n
Z tf (X )
∂L(x) ∂L(x)
δJ = δx dt = δxi dt
t0 ∂x t0 ∂xi
i=1
44 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
∆J = J(x) − J(x ∗ ) ≥ 0
∆J = J(x) − J(x ∗ ) ≤ 0
45 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
Important result
If x ∗ is a local minimiser or maximiser, then the variation of J is
zero:
δJ[x ∗ , δx] = 0
46 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
47 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
48 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
Example
Find an extremal for the following functional with x(0) = 0,
x(π/2) = 1.
Z π/2
2
ẋ (t) − x 2 (t) dt
J(x) =
0
Solution: the Euler-Lagrange equation gives −2x − 2ẍ = 0 such
that ẍ + x = 0
49 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
subject to
Differential constraints:
ẋ = f[x, u, t]
Algebraic path constraints
hL ≤ h[x(t), u(t), t] ≤ hU
Boundary conditions
ψ[x(t0 ), t0 , x(tf ), tf ] = 0
50 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
51 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
52 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
For the sake of simplicity, the first order optimality conditions for
the general optimal control problem will be given ignoring the path
constraints.
53 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
∂ψ ∂ψ ∂ψ ∂ψ
δψ = δx0 + δt0 + δxf + δtf
∂x(t0 ) ∂t0 ∂x(tf ) ∂tf
δx0 = δx(t0 ) + ẋ(t0 )δt0 , δxf = δx(tf ) + ẋ(tf )δtf
54 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
and
Z tf
δ [H − λẋ]dt = λT (t0 )δx0 − λT (tf )δxf
t0
+ H(tf )δtf − H(t0 )δt0
Z tf
∂H T ∂H T ∂H
+ + λ̇ δx + + ẋ δλ + δu dt
t0 ∂x ∂λ ∂u
55 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
Assuming that initial and terminal times are free, and that the
control is unconstrained, setting δJa = 0 results in the following
first order necessary optimality conditions.
∂H T
ẋ = ∂λ = f[x(t), u(t), t] (state dynamics)
∂H T
λ̇ = − ∂x (costate dynamics)
∂H
∂u =0 (stationarity condition)
56 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
ψ[x(t0 ), t0 , x(tf ), tf ] = 0
h iT h iT T h i
∂Φ ∂ψ ∂Φ ∂ψ
λ(t0 ) + ∂x(t 0 ) + ∂x(t 0 ) ν δx0 + −H(t0 ) + ∂t0 + ν T ∂t 0
δt0 = 0
h iT h iT T h i
∂Φ ∂ψ ∂Φ ∂ψ
−λ(tf ) + ∂x(tf ) + ∂x(tf ) ν δxf + H(tf ) + ∂tf + ν T ∂t f
δtf = 0
Note that δx0 depends on δt0 so in the second equation above the
terms that multiply the variations of δx0 and δt0 cannot be made
zero independently. Something similar to this happens in the third
equation.
57 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
58 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
ẋ = ∇λ H
λ̇ = −∇x H
59 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
60 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
ẋ = V cos θ
ẏ = V sin θ
√
where V (t) = 2gy . The performance index (we are after
minimum time), can be expressed as follows:
Z tf
J= 1dt = tf
0
61 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
λ̇x = 0
g
λ̇y = − (λx cos θ + λy sin θ)
V
and the stationarity condition is:
λy
0 = −λx V sin θ + λy V cos θ =⇒ tan θ =
λx
62 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
y (tf ) − y1 0
cos θ
λx = −
V
sin θ
λy = −
V
63 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
64 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
65 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
The figures illustrates numerical results with (x(0), y (0)) = (0, 0),
(x(tf ), y (tf )) = (2, 2) and g = 9.8.
1.4
1.5
1.2
control
1
1
y
0.8
0.5
0.6
0.4
0
0 0.5 1 1.5 2 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9
x time (s)
66 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
Assume that the optimal control is u∗ , and that the states and
co-states are fixed at their optimal trajectories x∗ (t), λ∗ (t). we
have that for all u close to u∗ :
67 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
68 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
69 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
70 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
71 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
72 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
H = 1 + λ1 x2 + λ2 u
Calculating ∂H/∂u gives no information on the control, so we need
to apply the minimum principle:
+1 if λ2 < 0
∗ ∗ ∗
u = arg min H[x , u, λ ] = undefined if λ2 = 0
u∈[−1,1]
−1 if λ2 > 0
73 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
74 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
75 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
H = L + λT f + µT c
76 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
77 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
Singular arcs
78 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
Singular arcs
79 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
Singular arcs
If the above conditions are satisfied, then the singular arc will
be optimal.
The presence of singular arcs may cause difficulties to
computational optimal control methods to find accurate
solutions if the appropriate conditions are not enforced a priori.
80 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
hL ≤ h[x(t), u(t), t] ≤ hU
81 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
82 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
Summary
83 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
Summary
84 / 85
Optimal Control and Applications
V. M. Becerra - Session 1 - 2nd AstroNet-II Summer School
Further reading
85 / 85
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
Victor M. Becerra
School of Systems Engineering
University of Reading
1 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
Contents of Session 2
2 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
3 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
4 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
5 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
6 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
7 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
8 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
Problem 1. Find all the free functions and variables (the controls
u(t), t ∈ [t0 , tf ], the states x(t), t ∈ [t0 , tf ], the parameters vector
p, and the times t0 , and tf ), to minimise the following
performance index,
Z tf
J = ϕ[x(t0 ), t0 , x(tf ), tf ] + L[x(t), u(t), t]dt
t0
subject to:
ẋ(t) = f[x(t), u(t), p, t], t ∈ [t0 , tf ],
9 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
10 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
uL ≤ u(t) ≤ uU , t ∈ [t0 , tf ],
xL ≤ x(t) ≤ xU , t ∈ [t0 , tf ],
pL ≤ p ≤ pU .
The following constraints allow for cases where the initial and/or
final times are not fixed but are to be chosen as part of the
solution to the problem:
t 0 ≤ t0 ≤ t̄0 ,
t f ≤ tf ≤ t̄f ,
tf − t0 ≥ 0.
11 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
x(t1 ) x(t2 )
x(t0 )
u(t0 )
u(t1 )
u(t2 )
u(tN −1 )
u(tN )
t0 t1 t2 tN −1 tN = tf
The figure illustrates the idea that the control u and state variables
x are discretized over the resulting grid.
12 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
F (y)
subject to:
0 Z(y) 0
HL ≤ H(y) ≤ HU
ΨL Ψ(y) ΨU
yL ≤ y ≤ yU
13 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
where
F is simply a mapping resulting from the evaluation of the
performance index,
Z is the mapping that arises from the discretisation of the
differential constraints over the gridpoints,
H arises from the evaluation of the path constraints at each of
the grid points, with associated bounds HL , HU ,
Ψ is simply a mapping resulting from the evaluation of the
event constraints.
14 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
15 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
Local discretisations
16 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
Local discretisations
dx̃(tk )
= f[x(tk ), u(tk ), p, tk ]
dt
dx̃(tk+1 )
= f[x(tk+1 ), u(tk+1 ), p, tk+1 ]
dt
The last two equations are called collocation conditions.
17 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
Local discretisations
true solution
x(tk+1 )
polynomial approximation
x(tk )
u(tk )
u(tk+1 )
tk tk+1
Local discretisations
where
K
X
xki = xk + hk ail fkl
l=1
Trapezoidal method
Trapezoidal method
21 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
Trapezoidal method
22 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
Trapezoidal method
23 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
Hermite-Simpson method
Let t̄k = (tk + tk+1 )/2, and ū(t̄k ) = (u(tk ) + u(tk+1 ))/2.
24 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
Hermite-Simpson method
1 hk
x̃(t̄k ) = [x(tk ) + x(tk+1 )] + [fk − fk+1 ]
2 8
hk
ζ(tk ) = x(tk+1 ) − x(tk ) − fk + 4f̄k + fk+1 = 0
6
where ζ(tk ) = 0 is the differential defect constraint at node tk
associated with the Hermite-Simpson method.
25 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
Hermite-Simpson method
vec(U)
vec(Ū)
vec(X)
y=
p
t0
tf
where
Ū = [u(t̄0 ) u(t̄1 ) . . . u(t̄N−1 )] ∈ Rnu ×N−1
26 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
Hermite-Simpson method
27 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
Local convergence
28 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
29 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
30 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
31 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
32 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
1 dN 2
LN (τ ) = (τ − 1)N
2N N! dτ N
Examples of Legendre polynomials are:
L0 (τ ) = 1
L1 (τ ) = τ
1
L2 (τ ) = (3τ 2 − 1)
2
1
L3 (τ ) = (5τ 3 − 3τ )
2
33 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
0.8
0.6
0.4
0.2
LN(τ)
−0.2
−0.4
−0.6
−0.8
−1
34 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
35 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
−1
−1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1
36 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
1 (τ 2 − 1)L̇N (τ )
φk (τ ) = (2)
N(N + 1)LN (τk ) τ − τk
38 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
1 1
0.5 0.5
0 0
−1 −1
−1 −0.5 0 0.5 1 −1 −0.5 0 0.5 1
39 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
where
LN (τk ) 1
if k 6= i
LN (τi ) τk −τi
Dki = −N(N + 1)/4 if k = i = 0 (4)
N(N + 1)/4 if k = i = N
0 otherwise
which is known as the differentiation matrix.
40 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
41 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
0 0
−2 −0.02
−4 −0.04
−1 −0.5 0 0.5 1 −1 −0.5 0 0.5 1
f(t), N=20 −9
x 10 error in f’(t), N=20
2 2
0 1
−2 0
−4 −1
−1 −0.5 0 0.5 1 −1 −0.5 0 0.5 1
42 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
44 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
Problem 3. Find all the free functions and variables (the controls
u(τ ), τ ∈ [−1, 1], the states x(τ ), t ∈ [−1, 1], the parameters
vector p, and the times t0 , and tf ), to minimise the following
performance index,
Z 1
J = ϕ[x(−1), t0 , x(1), tf ] + L[x(τ ), u(τ ), t(τ )]dτ
−1
subject to:
tf − t0
ẋ(τ ) = f[x(τ ), u(τ ), p, t(τ )], τ ∈ [−1, 1],
2
45 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
Boundary conditions:
46 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
t 0 ≤ t0 ≤ t̄0 ,
t f ≤ tf ≤ t̄f ,
tf − t0 ≥ 0.
47 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
48 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
49 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
50 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
51 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
˙ 0 ) x̃(τ
˙ 1 ) . . . x̃(τ
˙ N)
Ẋ = x̃(τ (13)
52 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
tf − t0
F= f[x̃(τ0 ), ũ(τ0 ), p, τ0 ] ... f[x̃(τN ), ũ(τN ), p, τN ] (14)
2
Define the differential defects at the collocation points as the
nx (N + 1) vector:
ζ = vec Ẋ − F = vec XDT − F
53 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
54 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
Multi-phase problems
55 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
Multi-phase problems
The figure illustrates the notion of multi-phase problems.
Phase 3
Phase 2
Phase 4
Phase 1
t
(1) (1) (2) (3) (4)
t0 tf tf tf tf
(2)
t0 (3)
t0
(4)
t0
56 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
Multi-phase problems
57 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
Scaling
58 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
Scaling
Scaling
sF = 1/||Fy ||2
60 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
61 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
62 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
63 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
64 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
˙
(t) = x̃(t) − f[x̃(t), ũ(t), p, t]
65 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
66 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
67 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
Mesh refinement
68 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
Mesh refinement
69 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
Mesh refinement
70 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
Mesh refinement
71 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
ṙ = v
µ T D
v̇ = − 3
r+ u+
krk m m
T
ṁ = −
g0 Isp
T
where r(t) = x(t) y (t) z(t) is the position,
T
v = vx (t) vy (t) vz (t) is the Cartesian ECI velocity, T is
the vacuum thrust, m is the mass, g0 is the acceleration of gravity
at sea level, Isp is the specific impulse of the engine,
T
u = ux uy uz is the thrust direction, and
T
D = Dx Dy Dz is the drag force.
73 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
74 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
75 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
76 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
This problem has been solved using the author’s open source
optimal control software PSOPT (see http://www.psopt.org)
Parameter values can be found in the code.
The problem was solved in eight mesh refinement iterations
until the maximum relative ODE error max was below
1 × 10−5 , starting from a coarse uniform grid and resulting in
a finer non-uniform grid.
77 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
alt
6550
6500
altitude (km)
6450
6400
0 100 200 300 400 500 600 700 800 900 1000
time (s)
78 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
10000 speed
9000
8000
7000
speed (m/s)
6000
5000
4000
3000
2000
1000
0 100 200 300 400 500 600 700 800 900 1000
time (s)
79 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
1 u1
u2
u3
0.8
0.6
0.4
u (dimensionless)
0.2
-0.2
-0.4
-0.6
0 100 200 300 400 500 600 700 800 900 1000
time (s)
80 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
81 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
J = −w (tf )
subject to the dynamic constraints for phases 1 and 3:
ẏ = A(y)∆g + b
ẏ = A(y)∆ + b
ẇ = −T /Isp
82 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
84 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
85 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
86 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
-45000
2000
0 -40000
-2000 -35000
-4000 -30000
-6000 -25000
z (km) -20000
-15000 x (km)
-10000 -10000
-5000 -5000
0
5000 0
10000 5000
15000
y (km) 2000010000
87 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
88 / 89
Optimal Control and Applications
V. M. Becerra - Session 2 - 2nd AstroNet-II Summer School
Further reading
89 / 89