Skip to content

Commit ad7371f

Browse files
committed
doc: internals for MHE relaxation
1 parent 506a836 commit ad7371f

File tree

4 files changed

+86
-11
lines changed

4 files changed

+86
-11
lines changed

docs/src/internals/predictive_control.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ ModelPredictiveControl.relaxterminal
3131
## Constraints
3232

3333
```@docs
34-
ModelPredictiveControl.linconstraint!
34+
ModelPredictiveControl.linconstraint!(::PredictiveController, ::LinModel)
3535
```

docs/src/internals/state_estim.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,21 @@ ModelPredictiveControl.init_predmat_mhe
2323
ModelPredictiveControl.init_matconstraint_mhe
2424
```
2525

26+
## Constraint Relaxation
27+
28+
```@docs
29+
ModelPredictiveControl.relaxarrival
30+
ModelPredictiveControl.relaxX̂
31+
ModelPredictiveControl.relaxŴ
32+
ModelPredictiveControl.relaxV̂
33+
```
34+
35+
## Constraints
36+
37+
```@docs
38+
ModelPredictiveControl.linconstraint!(::MovingHorizonEstimator, ::LinModel)
39+
```
40+
2641
## Evaluate Estimated Output
2742

2843
```@docs

src/controller/construct.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -672,8 +672,8 @@ constraints:
672672
\mathbf{A_{U_{max}}}
673673
\end{bmatrix} \mathbf{ΔŨ} ≤
674674
\begin{bmatrix}
675-
- \mathbf{U_{min}} + \mathbf{T} \mathbf{u}(k-1) \\
676-
+ \mathbf{U_{max}} - \mathbf{T} \mathbf{u}(k-1)
675+
- \mathbf{U_{min} + T} \mathbf{u}(k-1) \\
676+
+ \mathbf{U_{max} - T} \mathbf{u}(k-1)
677677
\end{bmatrix}
678678
```
679679
"""
@@ -745,8 +745,8 @@ Denoting the input increments augmented with the slack variable
745745
\mathbf{A_{Y_{max}}}
746746
\end{bmatrix} \mathbf{ΔŨ} ≤
747747
\begin{bmatrix}
748-
- \mathbf{Y_{min}} + \mathbf{F} \\
749-
+ \mathbf{Y_{max}} - \mathbf{F}
748+
- \mathbf{Y_{min} + F} \\
749+
+ \mathbf{Y_{max} - F}
750750
\end{bmatrix}
751751
```
752752
"""
@@ -786,8 +786,8 @@ the inequality constraints:
786786
\mathbf{A_{x̂_{max}}}
787787
\end{bmatrix} \mathbf{ΔŨ} ≤
788788
\begin{bmatrix}
789-
- \mathbf{x̂_{min}} + \mathbf{f_x̂} \\
790-
+ \mathbf{x̂_{max}} - \mathbf{f_x̂}
789+
- \mathbf{x̂_{min} + f_x̂} \\
790+
+ \mathbf{x̂_{max} - f_x̂}
791791
\end{bmatrix}
792792
```
793793
"""

src/estimator/mhe/construct.jl

Lines changed: 64 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,23 @@ end
633633
model::SimModel, C, c_x̂min, c_x̂max, x̂min, x̂max, ex̄
634634
) -> A_x̃min, A_x̃max, x̃min, x̃max, ẽx̄
635635
636-
TBW
636+
Augment arrival state constraints with slack variable ϵ for softening the MHE.
637+
638+
Denoting the MHE decision variable augmented with the slack variable ``\mathbf{Z̃} =
639+
[\begin{smallmatrix} ϵ \\ \mathbf{Z} \end{smallmatrix}]``, it returns the ``\mathbf{ẽ_x̄}``
640+
matrix that appears in the estimation error at arrival equation ``\mathbf{x̄} =
641+
\mathbf{ẽ_x̄ Z̃ + f_x̄}``. It also returns the augmented constraints ``\mathbf{x̃_{min}}`` and
642+
``\mathbf{x̃_{max}}``, and the ``\mathbf{A}`` matrices for the inequality constraints:
643+
```math
644+
\begin{bmatrix}
645+
\mathbf{A_{x̃_{min}}} \\
646+
\mathbf{A_{x̃_{max}}}
647+
\end{bmatrix} \mathbf{Z̃} ≤
648+
\begin{bmatrix}
649+
- \mathbf{x̃_{min} + f_x̄} \\
650+
+ \mathbf{x̃_{max} - f_x̄}
651+
\end{bmatrix}
652+
```
637653
"""
638654
function relaxarrival(::SimModel{NT}, C, c_x̂min, c_x̂max, x̂min, x̂max, ex̄) where {NT<:Real}
639655
ex̂ = -ex̄
@@ -655,7 +671,22 @@ end
655671
@doc raw"""
656672
relaxX̂(model::SimModel, C, C_x̂min, C_x̂max, Ex̂) -> A_X̂min, A_X̂max, Ẽx̂
657673
658-
TBW
674+
Augment estimated state constraints with slack variable ϵ for softening the MHE.
675+
676+
Denoting the MHE decision variable augmented with the slack variable ``\mathbf{Z̃} =
677+
[\begin{smallmatrix} ϵ \\ \mathbf{Z} \end{smallmatrix}]``, it returns the ``\mathbf{Ẽ_x̂}``
678+
matrix that appears in estimated states equation ``\mathbf{X̂} = \mathbf{Ẽ_x̂ Z̃ + F_x̂}``. It
679+
also returns the ``\mathbf{A}`` matrices for the inequality constraints:
680+
```math
681+
\begin{bmatrix}
682+
\mathbf{A_{X̂_{min}}} \\
683+
\mathbf{A_{X̂_{max}}}
684+
\end{bmatrix} \mathbf{Z̃} ≤
685+
\begin{bmatrix}
686+
- \mathbf{X̂_{min} + F_x̂} \\
687+
+ \mathbf{X̂_{max} - F_x̂}
688+
\end{bmatrix}
689+
```
659690
"""
660691
function relaxX̂(::LinModel{NT}, C, C_x̂min, C_x̂max, Ex̂) where {NT<:Real}
661692
if !isinf(C) # Z̃ = [ϵ; Z]
@@ -680,7 +711,21 @@ end
680711
@doc raw"""
681712
relaxŴ(model::SimModel, C, C_ŵmin, C_ŵmax, nx̂) -> A_Ŵmin, A_Ŵmax
682713
683-
TBW
714+
Augment estimated process noise constraints with slack variable ϵ for softening the MHE.
715+
716+
Denoting the MHE decision variable augmented with the slack variable ``\mathbf{Z̃} =
717+
[\begin{smallmatrix} ϵ \\ \mathbf{Z} \end{smallmatrix}]``, it returns the ``\mathbf{A}``
718+
matrices for the inequality constraints:
719+
```math
720+
\begin{bmatrix}
721+
\mathbf{A_{Ŵ_{min}}} \\
722+
\mathbf{A_{Ŵ_{max}}}
723+
\end{bmatrix} \mathbf{Z̃} ≤
724+
\begin{bmatrix}
725+
- \mathbf{Ŵ_{min}} \\
726+
+ \mathbf{Ŵ_{max}}
727+
\end{bmatrix}
728+
```
684729
"""
685730
function relaxŴ(::SimModel{NT}, C, C_ŵmin, C_ŵmax, nx̂) where {NT<:Real}
686731
A = [zeros(NT, length(C_ŵmin), nx̂) I]
@@ -695,7 +740,22 @@ end
695740
@doc raw"""
696741
relaxV̂(model::SimModel, C, C_v̂min, C_v̂max, E) -> A_V̂min, A_V̂max, Ẽ
697742
698-
TBW
743+
Augment estimated sensor noise constraints with slack variable ϵ for softening the MHE.
744+
745+
Denoting the MHE decision variable augmented with the slack variable ``\mathbf{Z̃} =
746+
[\begin{smallmatrix} ϵ \\ \mathbf{Z} \end{smallmatrix}]``, it returns the ``\mathbf{Ẽ}``
747+
matrix that appears in estimated sensor noise equation ``\mathbf{V̂} = \mathbf{Ẽ Z̃ + F}``. It
748+
also returns the ``\mathbf{A}`` matrices for the inequality constraints:
749+
```math
750+
\begin{bmatrix}
751+
\mathbf{A_{V̂_{min}}} \\
752+
\mathbf{A_{V̂_{max}}}
753+
\end{bmatrix} \mathbf{Z̃} ≤
754+
\begin{bmatrix}
755+
- \mathbf{V̂_{min} + F} \\
756+
+ \mathbf{V̂_{max} - F}
757+
\end{bmatrix}
758+
```
699759
"""
700760
function relaxV̂(::LinModel{NT}, C, C_v̂min, C_v̂max, E) where {NT<:Real}
701761
if !isinf(C) # Z̃ = [ϵ; Z]

0 commit comments

Comments
 (0)