Skip to content

Commit ee21ac7

Browse files
committed
wip: MultipleShooting for MHE
I'm not sure how I want to structure the decision vector. Ideally, when `Nk < He`, the estimated state and process noise should be at the same postion in the vector from a time step to another. This is easy for single shooting since we just ignore the end of the vector. This is a bit more tricky for multiple shooting.
1 parent d24731f commit ee21ac7

2 files changed

Lines changed: 29 additions & 6 deletions

File tree

src/estimator/mhe/construct.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,6 +1279,12 @@ function init_predmat_mhe(
12791279
return E, G, J, B, ex̄, Ex̂, Gx̂, Jx̂, Bx̂
12801280
end
12811281

1282+
function init_defectmat_mhe(
1283+
model::LinModel{NT}, He, i_ym, Â, B̂u, Ĉm, B̂d, D̂dm, x̂op, f̂op, p
1284+
) where {NT<:Real}
1285+
1286+
end
1287+
12821288
"""
12831289
init_optimization!(
12841290
estim::MovingHorizonEstimator, model::LinModel, optim::JuMP.GenericModel

src/transcription.jl

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ Construct a direct single shooting [`TranscriptionMethod`](@ref).
1818
For [`MovingHorizonEstimator`](@ref) objects, the decision variable in the optimization
1919
problem is (excluding the slack ``ϵ``):
2020
```math
21-
\mathbf{Z} =
22-
= \begin{bmatrix}
21+
\mathbf{Z}
22+
= \begin{bmatrix}
2323
\mathbf{x̂}_k(k-N_k+p) \\
2424
\mathbf{Ŵ} \end{bmatrix}
2525
= \begin{bmatrix}
@@ -51,9 +51,24 @@ struct SingleShooting <: ShootingMethod end
5151
5252
Construct a direct multiple shooting [`TranscriptionMethod`](@ref).
5353
54-
The decision variable is (excluding ``ϵ``):
54+
For [`MovingHorizonEstimator`](@ref) objects, the decision variable is (excluding ``ϵ``):
55+
```math
56+
\mathbf{Z} = \begin{bmatrix}
57+
\mathbf{X̂_0} \\
58+
\mathbf{Ŵ} \\
59+
\mathbf{X̂_0} \end{bmatrix}
60+
= \begin{bmatrix}
61+
\mathbf{x̂}_k(k-N_k+p) \\
62+
\mathbf{Ŵ} \\
63+
\mathbf{x̂}_k(k-N_k+p)
64+
= \begin{bmatrix}
65+
66+
```
67+
and, for [`PredictiveController`](@ref) types:
5568
```math
56-
\mathbf{Z} = \begin{bmatrix} \mathbf{ΔU} \\ \mathbf{X̂_0} \end{bmatrix}
69+
\mathbf{Z} = \begin{bmatrix}
70+
\mathbf{ΔU} \\
71+
\mathbf{X̂_0} \end{bmatrix}
5772
```
5873
thus it also includes the predicted states, expressed as deviation vectors from the
5974
operating point ``\mathbf{x̂_{op}}`` (see [`augment_model`](@ref)):
@@ -68,11 +83,13 @@ where ``\mathbf{x̂}_i(k+j)`` is the state prediction for time ``k+j``, estimate
6883
observer at time ``i=k`` or ``i=k-1`` depending on its `direct` flag. Note that
6984
``\mathbf{X̂_0 = X̂}`` if the operating point is zero, which is typically the case in practice
7085
for [`NonLinModel`](@ref).
86+
87+
# TODO: the subscript notation is presumably wrong for the MHE.
7188
72-
This transcription computes the predictions by calling the augmented discrete-time model
89+
This transcription codmputes the predictions by calling the augmented discrete-time model
7390
in the equality constraint function recursively over ``H_p``, or by updating the linear
7491
equality constraint vector for [`LinModel`](@ref). It is generally more efficient for large
75-
control horizon ``H_c``, unstable or highly nonlinear models/constraints. Multithreading
92+
``H_c`` or ``H_e`` values, unstable or highly nonlinear models/constraints. Multithreading
7693
with `f_threads` or `h_threads` keyword arguments can be advantageous if ``\mathbf{f}`` or
7794
``\mathbf{h}`` in the [`NonLinModel`](@ref) is expensive to evaluate, respectively.
7895

0 commit comments

Comments
 (0)