Skip to content

Commit d3cad37

Browse files
committed
doc: sk instead of sknext
1 parent 2510575 commit d3cad37

1 file changed

Lines changed: 18 additions & 13 deletions

File tree

src/controller/transcription.jl

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -139,15 +139,19 @@ where ``\mathbf{K}`` encompasses all the intermediate stages of the deterministi
139139
(the first `nx` elements of ``\mathbf{x̂}``):
140140
```math
141141
\mathbf{K} = \begin{bmatrix}
142-
\mathbf{k}(k+0) \\
143-
\mathbf{k}(k+1) \\
142+
\mathbf{k}_{1}(k+0) \\
143+
\mathbf{k}_{2}(k+0) \\
144144
\vdots \\
145-
\mathbf{k}(k+H_p-1) \end{bmatrix}
145+
\mathbf{k}_{n_o}(k+0) \\
146+
\mathbf{k}_{1}(k+1) \\
147+
\mathbf{k}_{2}(k+1) \\
148+
\vdots \\
149+
\mathbf{k}_{n_o}(k+H_p) \end{bmatrix}
146150
```
147-
and ``\mathbf{k}(k+j)`` includes the deterministic state predictions for the ``n_o``
148-
collocation points at the ``j``th stage/interval/finite element (details in Extended Help).
149-
The `roots` keyword argument is either `:gaussradau` or `:gausslegendre`, for the roots of
150-
the Gauss-Radau or Gauss-Legendre quadrature, respectively.
151+
and ``\mathbf{k}_o(k+j)`` is the deterministic state prediction for the ``o``th collocation
152+
point at the ``j``th stage/interval/finite element (details in Extended Help). The `roots`
153+
keyword argument is either `:gaussradau` or `:gausslegendre`, for the roots of the
154+
Gauss-Radau or Gauss-Legendre quadrature, respectively.
151155
152156
This transcription computes the predictions by enforcing the collocation and continuity
153157
constraints at the collocation points. It is efficient for highly stiff systems, but
@@ -164,8 +168,9 @@ this transcription method (sparser formulation than [`MultipleShooting`](@ref)).
164168
165169
# Extended Help
166170
!!! details "Extended Help"
167-
See the Extended Help of [`TrapezoidalCollocation`](@ref) to understand why the
168-
stochastic states are left out of the ``\mathbf{K}`` vector.
171+
As explained in the Extended Help of [`TrapezoidalCollocation`](@ref), the stochastic
172+
states are left out of the ``\mathbf{K}`` vector since collocation methods required
173+
continuous-time dynamics and the stochastic model is discrete.
169174
170175
The collocation points are located at the roots of orthogonal polynomials, which is
171176
"optimal" for approximating the state trajectories with polynomials of degree ``n_o``.
@@ -1422,7 +1427,7 @@ the deterministic state derivative at the ``n_o`` collocation points and the mod
14221427
are computed by:
14231428
```math
14241429
\begin{aligned}
1425-
\mathbf{s_k}(k+j+1) &
1430+
\mathbf{s_k}(k+j) &
14261431
= \mathbf{M_o} \begin{bmatrix}
14271432
\mathbf{k}_1(k+j) - \mathbf{x_0}(k+j) \\
14281433
\mathbf{k}_2(k+j) - \mathbf{x_0}(k+j) \\
@@ -1435,7 +1440,7 @@ are computed by:
14351440
\mathbf{f}\Big(\mathbf{k}_{n_o}(k+j), \mathbf{û_0}(k+j), \mathbf{d̂_0}(k+j), \mathbf{p}\Big) \end{bmatrix}
14361441
\end{aligned}
14371442
```
1438-
for ``j = 0, 1, ... , H_p-1``, and knowing that the ``\mathbf{k}_i(k+j)`` vectors are
1443+
for ``j = 0, 1, ... , H_p-1``, and knowing that the ``\mathbf{k}_o(k+j)`` vectors are
14391444
extracted from the decision variable `Z̃`. The vectors ``\mathbf{x_0}(k+j)`` are the
14401445
deterministic state for time ``k+j``, also extracted from `Z̃`. The disturbed input
14411446
``\mathbf{û_0}(k+j)`` is defined in [`f̂_input!`](@ref). The defects for the stochastic
@@ -1478,7 +1483,7 @@ function con_nonlinprogeq!(
14781483
x̂0next_Z̃ = @views X̂0_Z̃[(1 + nx̂*(j-1)):(nx̂*j)]
14791484
scnext = @views geq[(1 + nx̂_nk*(j-1) ):(nx̂_nk*(j-1) + nx)]
14801485
ssnext = @views geq[(1 + nx̂_nk*(j-1) + nx):(nx̂_nk*(j-1) + nx̂)]
1481-
sknext = @views geq[(1 + nx̂_nk*(j-1) + nx̂):(nx̂_nk*j )]
1486+
sk = @views geq[(1 + nx̂_nk*(j-1) + nx̂):(nx̂_nk*j )]
14821487
x0 = @views x̂0[1:nx]
14831488
x0next_Z̃ = @views x̂0next_Z̃[1:nx]
14841489
xsnext = @views x̂0next[nx+1:end]
@@ -1501,7 +1506,7 @@ function con_nonlinprogeq!(
15011506
end
15021507
# TODO: remove the following allocations
15031508
k̇_Z̃ = Mo*Δk
1504-
sknext .= @. k̇_Z̃ -
1509+
sk .= @. k̇_Z̃ -
15051510
# ----------------- continuity constraint defects ------------------------------
15061511
scnext .= λo*x0 + Co*k_Z̃ - x0next_Z̃
15071512
end

0 commit comments

Comments
 (0)