Optimal Control Lectures Direct Solution Methods
Optimal Control Lectures Direct Solution Methods
Benoı̂t Chachuat (McMaster University) Direct Methods Optimal Control 1 / 32 Benoı̂t Chachuat (McMaster University) Direct Methods Optimal Control 2 / 32
Studied extensively over the last 30 years Lagrange Interpolating Polynomials (Degree M)
Proved successful for many complex applications M
∆ (M) t−tk−1
X
Take advantage of the power of state-of-the-art NLP solvers uj (t) = Ujk (t, ω k ) = ω ki,j φi tk −tk−1 , tk−1 ≤ t ≤ tk
i =0 uj (t)
Can be applied to ODE, DAE and even PDAE models Ujk (t, ω k )
k
ωM,j
Three Main Variants
1, if M = 0 k
1 Direct simultaneous approach
ω1,j
M
k
τ − τq
Y
(M) ∆ ω0,j
◮ or orthogonal collocation, or full discretization φi (τ ) = , if M ≥ 1
τ i − τq
q=0
t
2 Direct sequential approach q6=i tk−1 tk
◮ or single-shooting or control vector parameterization (CVP) τ
0 τ0 τ1 τM 1
3 Direct multiple-shooting approach with collocation points 0 ≤ τ0 ≤ τ1 < · · · < τM−1 < τM ≤ 1
Benoı̂t Chachuat (McMaster University) Direct Methods Optimal Control 3 / 32 Benoı̂t Chachuat (McMaster University) Direct Methods Optimal Control 4 / 32
Control Parameterization Direct Simultaneous Method
piecewise constant piecewise linear without continuity
u(t) piecewise linear with continuity piecewise cubic with continuity Principle
Transcription into a finite-dimensional NLP through discretization of both
control and state variables
State Collocation
x(t) = X (t, ξ k ), tk−1 ≤ t ≤ tk , k = 1, . . . , ns
Benoı̂t Chachuat (McMaster University) Direct Methods Optimal Control 6 / 32 Benoı̂t Chachuat (McMaster University) Direct Methods Optimal Control 7 / 32
Direct Simultaneous Method (cont’d) Direct Simultaneous Method (cont’d)
Class Exercise: Discretize the following optimal control problem into an
Fully-Discretized Optimization Problem NLP via the full discretization approach:
Z 1
1
Determine: ω 1 , . . . , ω ns ∈ IRnu M , ξ 1 , . . . , ξ ns ∈ IRnx N and v ∈ IRnv that min [u(t)]2 dt
u(t) 0 2
minimize: φ(X ns (tns , ξ ns ), v) s.t. ẋ(t) = u(t) − x(t); x(0) = 1
x(1) = 0
subject to: X kt (tk,q , ξ k ) = f (tk,q , X k (tk,q , ξ k ), U k (tk,q , ω k ), v), ∀k, q
X 1 (t0 , ξ 1 ) = h(v); X k+1 (tk , ξ k+1 ) = X k (tk , ξ k ), ∀k Consider a single control stage, ns = 1
ψ i
(X ns (t , ξ ns ), v) ≤0 Approximate the state and control profiles using affine functions,
ns
e M=N=1
ψ (X ns (tns , ξ ns ), v) = 0
κi (tk,q , X k (tk,q , ξ k ), U k (tk,q , ω k ), v) ≤ 0, ∀k, q
κe (t k,q , X k (t k,q , ξ k ), U k (t
k,q , ω k ), v) = 0, ∀k, q
L U
ξk ∈ [ξ , ξ ], ω∈ [ω , ω U ],
L v∈ [vL , vU ]
∆
with tk,q = tk−1 + τq (tk − tk−1 ), k = 1, . . . , ns , q = 1, . . . , N
Benoı̂t Chachuat (McMaster University) Direct Methods Optimal Control 8 / 32 Benoı̂t Chachuat (McMaster University) Direct Methods Optimal Control 9 / 32
Benoı̂t Chachuat (McMaster University) Direct Methods Optimal Control 10 / 32 Benoı̂t Chachuat (McMaster University) Direct Methods Optimal Control 11 / 32
Direct Sequential Method (cont’d) Direct Sequential Method (cont’d)
Class Exercise: Discretize the following optimal control problem into an
NLP via the sequential approach:
Partially-Discretized Optimization Problem Z 1
1
min [u(t)]2 dt
u(t) 0 2
Determine: ω1 , . . . , ω ns ∈ IRnu M and v ∈ IRnv that
s.t. ẋ(t) = u(t) − x(t); x(0) = 1
minimize: φ(x(tns ), v) x(1) = 0
subject to: ẋ(t) = f (t, x(t), U k (t, ω k ), v); x(t0 ) = h(v) Consider a single control stage, ns = 1
i
ψ (x(tns ), v) ≤ 0 Approximate the control profile using affine functions, M = 1
ψ e (x(tns ), v) = 0
κi (t, x(t), U k (t, ω k ), v) ≤ 0, tk−1 ≤ t ≤ tk , ∀k
κe (t, x(t), U k (t, ω k ), v) = 0, tk−1 ≤ t ≤ tk , ∀k
ω(t) ∈ [ω L , ω U ], v ∈ [vL , vU ]
Benoı̂t Chachuat (McMaster University) Direct Methods Optimal Control 12 / 32 Benoı̂t Chachuat (McMaster University) Direct Methods Optimal Control 13 / 32
ns Z
X tk n o2
t t t Kij (p) := max 0; κij (t, x(t), U k (t, ω k ), v) dt
k=1 tk−1
Control Variables
U(t, ω) But, relaxation needed to ensure regular constraints:
Numerical
Integration Kj (p) ≤ ǫ
t
with ǫ > 0 a small nonnegative constant
Issue 1: How to calculate the cost and constraint values and derivatives?
Benoı̂t Chachuat (McMaster University) Direct Methods Optimal Control 14 / 32 Benoı̂t Chachuat (McMaster University) Direct Methods Optimal Control 15 / 32
Direct Sequential Method (cont’d) Direct Sequential Method (cont’d)
Benoı̂t Chachuat (McMaster University) Direct Methods Optimal Control 15 / 32 Benoı̂t Chachuat (McMaster University) Direct Methods Optimal Control 16 / 32
x2 (t)
u(t) 10
0
−20 ≤ u(t) ≤ 20, ∀t 5
-0.5
0 x2 (t)
path constraint
Solution Approach Used -5
0 0.2 0.4
t
0.6 0.8 1
-1
0 0.2 0.4
t
0.6 0.8 1
Benoı̂t Chachuat (McMaster University) Direct Methods Optimal Control 17 / 32 Benoı̂t Chachuat (McMaster University) Direct Methods Optimal Control 18 / 32
Multiple-Shooting Method Multiple-Shooting Method (cont’d)
Principle
Transcription into a finite-dimensional NLP through discretization of the Original Optimal Control Problem
control variables only, with state discontinuities allowed at stage times ˆ 0 , tf ]nu and v ∈ IRnv that
Determine: u ∈ C[t
xk (tk ) − ξ k+1
0 = 0, k = 1, . . . , ns − 1
Benoı̂t Chachuat (McMaster University) Direct Methods Optimal Control 19 / 32 Benoı̂t Chachuat (McMaster University) Direct Methods Optimal Control 20 / 32
Class Exercise: Give sufficient conditions for existence of an optimal 2 Calculate the functional derivatives, Fpj (p̄), w.r.t. p1 , . . . , pnp
solution to the partially-discretized optimization problem ◮ 3 possible procedures: finite differences, forward sensitivity analysis,
adjoint sensitivity analysis
Benoı̂t Chachuat (McMaster University) Direct Methods Optimal Control 23 / 32 Benoı̂t Chachuat (McMaster University) Direct Methods Optimal Control 24 / 32
ẋ(t) = f (t, x(t), p); x(t0 ) = h(p) with: ẋpi (t) = f x (t, x(t), p) xpi (t) + f pi (t, x(t), p); xpi (t0 ) = hpi (p)
ẋp1 (t) = f x (t, x(t), p) xp1 (t) + f p1 (t, x(t), p); xp1 (t0 ) = hp1 (p)
Number of state & state sensitivity equations: (nx + 1) × np
.. ..
. . But, independent of the number of functionals, nF
ẋpnp (t) = f x (t, x(t), p) xpnp (t) + f pnp (t, x(t), p); xpnp (t0 ) = hpnp (p) Adjoint (Reverse) Sensitivity Approach:
Fp1 (p) = φx (x(tf ), p)xp1 (tf ) + φp1 (x(tf ), p) with: λ̇(t) = −f x (t, x(t), p)T λ(t); λ(tf ) = φx (x(tf ), p)
..
.
Number of state & adjoint equations: 2nx × nF
Fpnp (p) = φx (x(tf ), p)xpnp (tf ) + φpnp (x(tf ), p)
But, independent of the number of parameters
Benoı̂t Chachuat (McMaster University) Direct Methods Optimal Control 27 / 32 Benoı̂t Chachuat (McMaster University) Direct Methods Optimal Control 28 / 32
Benoı̂t Chachuat (McMaster University) Direct Methods Optimal Control 29 / 32 Benoı̂t Chachuat (McMaster University) Direct Methods Optimal Control 30 / 32
Functional Derivatives (cont’d) Existence of an Optimal Solution (Finite Dimension)
Benoı̂t Chachuat (McMaster University) Direct Methods Optimal Control 31 / 32 Benoı̂t Chachuat (McMaster University) Direct Methods Optimal Control 32 / 32