Skip to content

Commit 55e4aa9

Browse files
committed
added: ShootingMethod and CollocationMethod abstract types
1 parent 08a09e3 commit 55e4aa9

File tree

4 files changed

+104
-101
lines changed

4 files changed

+104
-101
lines changed

src/controller/construct.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -600,11 +600,11 @@ end
600600
ex̂, fx̂, gx̂, jx̂, kx̂, vx̂, bx̂,
601601
Eŝ, Fŝ, Gŝ, Jŝ, Kŝ, Vŝ, Bŝ,
602602
gc!=nothing, nc=0
603-
) -> con, nϵ, P̃Δu, P̃u, Ẽ, Ẽŝ
603+
) -> con, nϵ, P̃Δu, P̃u, Ẽ
604604
605605
Init `ControllerConstraint` struct with default parameters based on estimator `estim`.
606606
607-
Also return `P̃Δu`, `P̃u`, `Ẽ` and `Ẽŝ` matrices for the the augmented decision vector `Z̃`.
607+
Also return `P̃Δu`, `P̃u` and `` matrices for the the augmented decision vector `Z̃`.
608608
"""
609609
function init_defaultcon_mpc(
610610
estim::StateEstimator{NT},
@@ -660,7 +660,7 @@ function init_defaultcon_mpc(
660660
C_ymin , C_ymax , c_x̂min , c_x̂max , i_g,
661661
gc! , nc
662662
)
663-
return con, nϵ, P̃Δu, P̃u, Ẽ, Ẽŝ
663+
return con, nϵ, P̃Δu, P̃u, Ẽ
664664
end
665665

666666
"Repeat predictive controller constraints over prediction `Hp` and control `Hc` horizons."

src/controller/linmpc.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ struct LinMPC{
55
NT<:Real,
66
SE<:StateEstimator,
77
CW<:ControllerWeights,
8-
TM<:TranscriptionMethod,
8+
TM<:ShootingMethod,
99
JM<:JuMP.GenericModel
1010
} <: PredictiveController{NT}
1111
estim::SE
@@ -54,7 +54,7 @@ struct LinMPC{
5454
NT<:Real,
5555
SE<:StateEstimator,
5656
CW<:ControllerWeights,
57-
TM<:TranscriptionMethod,
57+
TM<:ShootingMethod,
5858
JM<:JuMP.GenericModel
5959
}
6060
model = estim.model
@@ -71,7 +71,7 @@ struct LinMPC{
7171
Eŝ, Gŝ, Jŝ, Kŝ, Vŝ, Bŝ = init_defectmat(model, estim, transcription, Hp, Hc)
7272
# dummy vals (updated just before optimization):
7373
F, fx̂, Fŝ = zeros(NT, ny*Hp), zeros(NT, nx̂), zeros(NT, nx̂*Hp)
74-
con, nϵ, P̃Δu, P̃u, Ẽ, Ẽŝ = init_defaultcon_mpc(
74+
con, nϵ, P̃Δu, P̃u, Ẽ = init_defaultcon_mpc(
7575
estim, weights, transcription,
7676
Hp, Hc,
7777
PΔu, Pu, E,
@@ -156,7 +156,7 @@ arguments. This controller allocates memory at each time step for the optimizati
156156
- `N_Hc=Diagonal(repeat(Nwt,Hc))` : positive semidefinite symmetric matrix ``\mathbf{N}_{H_c}``.
157157
- `L_Hp=Diagonal(repeat(Lwt,Hp))` : positive semidefinite symmetric matrix ``\mathbf{L}_{H_p}``.
158158
- `Cwt=1e5` : slack variable weight ``C`` (scalar), use `Cwt=Inf` for hard constraints only.
159-
- `transcription=SingleShooting()` : a [`TranscriptionMethod`](@ref) for the optimization.
159+
- `transcription=SingleShooting()` : [`SingleShooting`](@ref) or [`MultipleShooting`](@ref).
160160
- `optim=JuMP.Model(OSQP.MathOptInterfaceOSQP.Optimizer)` : quadratic optimizer used in
161161
the predictive controller, provided as a [`JuMP.Model`](@extref) object (default to
162162
[`OSQP`](https://osqp.org/docs/parsers/jump.html) optimizer).
@@ -215,7 +215,7 @@ function LinMPC(
215215
N_Hc = Diagonal(repeat(Nwt, get_Hc(move_blocking(Hp, Hc)))),
216216
L_Hp = Diagonal(repeat(Lwt, Hp)),
217217
Cwt = DEFAULT_CWT,
218-
transcription::TranscriptionMethod = DEFAULT_LINMPC_TRANSCRIPTION,
218+
transcription::ShootingMethod = DEFAULT_LINMPC_TRANSCRIPTION,
219219
optim::JuMP.GenericModel = JuMP.Model(DEFAULT_LINMPC_OPTIMIZER, add_bridges=false),
220220
kwargs...
221221
)
@@ -259,7 +259,7 @@ function LinMPC(
259259
N_Hc = Diagonal(repeat(Nwt, get_Hc(move_blocking(Hp, Hc)))),
260260
L_Hp = Diagonal(repeat(Lwt, Hp)),
261261
Cwt = DEFAULT_CWT,
262-
transcription::TranscriptionMethod = DEFAULT_LINMPC_TRANSCRIPTION,
262+
transcription::ShootingMethod = DEFAULT_LINMPC_TRANSCRIPTION,
263263
optim::JM = JuMP.Model(DEFAULT_LINMPC_OPTIMIZER, add_bridges=false),
264264
) where {NT<:Real, SE<:StateEstimator{NT}, JM<:JuMP.GenericModel}
265265
isa(estim.model, LinModel) || error(MSG_LINMODEL_ERR)

src/controller/nonlinmpc.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ struct NonLinMPC{
9494
Eŝ, Gŝ, Jŝ, Kŝ, Vŝ, Bŝ = init_defectmat(model, estim, transcription, Hp, Hc)
9595
# dummy vals (updated just before optimization):
9696
F, fx̂, Fŝ = zeros(NT, ny*Hp), zeros(NT, nx̂), zeros(NT, nx̂*Hp)
97-
con, nϵ, P̃Δu, P̃u, Ẽ, Ẽŝ = init_defaultcon_mpc(
97+
con, nϵ, P̃Δu, P̃u, Ẽ = init_defaultcon_mpc(
9898
estim, weights, transcription,
9999
Hp, Hc,
100100
PΔu, Pu, E,

0 commit comments

Comments
 (0)