Direct Transcription Using Single Point Collocation For Students
Direct Transcription Using Single Point Collocation For Students
Here, t0 is the initial or start time, tf is the final or end time, and tf − t0 is refereed to as the horizon length.
Additionally,
Problem properties:
• Infinite-dimensional
• Solution non-unique
• Solution discontinuous
Mesh nodes:
M := {t0 , t1 , . . . , tN } ∀i ∈ {1, 2, . . . , N − 1} :
t0 < t1 < . . . < tN = tf ti = t0 + αi (tf − t0 ) =⇒ hi = (αi+1 − αi )(tf − t0 )
hi := ti+1 − ti , h := max hi 0 < α1 < . . . < αN −1 < 1, αi given
i
q := (q0 , q1 , . . . , qN −1 ) ∈ RN nu
qi ∈ Rnu , i = 0, 1, . . . , N − 1
si+1 − si
x̃(t) := si + (t − ti ), ∀t ∈ [ti , ti+1 ], i = 0, 1, . . . , N − 1
ti+1 − ti
˙ dx̃ si+1 − si
=⇒ x̃(t) = (t) = , ∀t ∈ (ti , ti+1 ), i = 0, 1, . . . , N − 1
dt ti+1 − ti
2
Figure 3: Piecewise affine state parameterization
s := (s0 , s1 , . . . , sN ) ∈ RN nx
si ∈ Rnx , i = 0, 1, . . . , N − 1, N
3
4 Discretizing path constraints
5 Boundary constraints
ψE (x (t0 ) , x(tf ), θ, t0 , tf ) = 0
ψI (x (t0 ) , x (tf ) , θ, t0 , tf ) ≤ 0
⇓
ψE (x̃ (t0 ) , x̃(tf ), θ, t0 , tf ) = 0 ψE (s0 , sN , θ, t0 , tf ) = 0
⇐⇒
ψI (x̃ (t0 ) , x̃ (tf ) , θ, t0 , tf ) ≤ 0 x̃ p.w.a. ψI (s0 , sN , θ, t0 , tf ) ≤ 0
In many optimal control problems we are given an estimate / measurement of the state at x̂ ∈ Rnx at
the current time t0 . In this case, the constraint
x(t0 ) = x̂ =⇒ s0 = x̂
x̃ p.w.a.
6 Cost function
Original:
Z tf
VM (x(t0 ), x(tf ), θ, t0 , tf ) + l(x(t), u(t), θ, t)dt ≡ J
t0
Approximate with numerical integration (quadrature). E.g. can use trapezoidal rule:
N
X −1
=⇒ J ≈ VM (x̃(t0 ), x̃(tf ), θ, t0 , tf ) + Li (x̃(ti ), x̃(ti+1 ), ũ(t+
i ), θ, ti , ti+1 )dt
i=0
4
Figure 4: Cost function approximation using trapezoidal rule
" #
−
l(x̃(ti ), ũ(t+
i ), θ, ti ) + l(x̃(ti+1 ), ũ(ti+1 ), θ, ti+1 )
Li = (ti+1 − ti )
2
ti+1 − ti
=⇒ Li (si , si+1 , qi , θ, ti , ti+1 ) = (l(si , qi , θ, ti ) + l(si+1 , qi , θ, ti+1 ))
2
VM (x̃(t0 ), x̃(tf ), θ, t0 , tf ) = VM (s0 , sN , θ, t0 , tf )
x̃ : p.w.a
ũ : p.w.c
Quadrature : trapezoidal
Collocation : mid-point
Path constraints : mesh points
N
X −1
=⇒ s0 1
min
, s , ..., s
VM (s0 , sN , θ, t0 , tf ) + Li (si , si+1 , qi , θ, ti , ti+1 ) =: F (ω)
N,
q0 , q1 , ..., qN −1 , i=0
θ, t0 , tf
subject to
si+1 − si si + si+1 ti + ti+1
f , , qi , θ, = 0, ∀i ∈ {0, 1, . . . , N − 1}
ti+1 − ti 2 2
si+1 − si
g , si , 0, qi , θ, ti ≤ 0 ∀i ∈ {0, 1, . . . , N − 1}
ti+1 − ti
si+1 − si
g , sN , 0, qN −1 , θ, tN ≤ 0
ti+1 − ti
ψE (s0 , sN , θ, t0 , tf ) = 0
ψI (s0 , sN , θ, t0 , tf ) ≤ 0
5
Remember to substitute ti = t0 + αi (tf − t0 ) everywhere =⇒ ti+1 − ti = (αi+1 − αi )(tf − t0 )
t −t t −t
Uniform mesh =⇒ ti+1 − ti = f N 0 = h, ∀i and ti = t0 + i f N 0 , ∀i.
min F (ω)
ω
s.t.
G(ω) = 0
H(ω) ≤ 0
where
s0
q0
s1
F (ω) := as above
q1
..
ω :=
.
sN −1
qN −1
sN
t0
tf
s1 −s0
g t1 −t0 , s0 , 0, q0 , θ, t0
..
s1 −s0 s0 +s1 t0 +t1
f t1 −t0 , 2 , q0 , θ, 2
.
..
si+1 −si
g ti+1 −ti , si , 0, qi , θ, ti
.
si+1 −si si +si+1 ti +ti+1 H(ω) := .
f ti+1 −ti , , q , θ, ..
2 i 2
G(ω) :=
.
..
sN −sN −1
g tN −tN −1 , sN −1 , 0, qN −1 , θ, tN −1
sN −sN −1 sN −1 +sN tN −1 +tN
s −sN −1
f tN −tN −1 , , q , θ, g tN , s , 0, q , θ, t
2 N −1 2 N N −1 N
N −tN −1
ψE (s0 , sN , θ, t0 , tf ) ψI (s0 , sN , θ, t0 , tf )
Contributors
• Lester Shi
• Hua Tu