Skip to content

Commit 0689b5c

Browse files
committed
changed: removed useless unpacking in transcriptions
1 parent ecc2714 commit 0689b5c

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/controller/transcription.jl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,8 +1124,7 @@ function predict!(
11241124
mpc::PredictiveController, model::NonLinModel, ::SingleShooting,
11251125
U0, _
11261126
)
1127-
nu, nx̂, ny, nd, nk = model.nu, mpc.estim.nx̂, model.ny, model.nd, model.nk
1128-
Hp, Hc = mpc.Hp, mpc.Hc
1127+
nu, nx̂, ny, nd, nk, Hp = model.nu, mpc.estim.nx̂, model.ny, model.nd, model.nk, mpc.Hp
11291128
D̂0 = mpc.D̂0
11301129
x̂0 = @views mpc.estim.x̂0[1:nx̂]
11311130
d0 = @views mpc.d0[1:nd]
@@ -1209,7 +1208,7 @@ custom constraints are include in the `g` vector.
12091208
function con_nonlinprog!(
12101209
g, mpc::PredictiveController, ::NonLinModel, ::TranscriptionMethod, x̂0end, Ŷ0, gc, ϵ
12111210
)
1212-
nx̂, nŶ = length(x̂0end), length(Ŷ0)
1211+
nŶ = length(Ŷ0)
12131212
for i in eachindex(g)
12141213
mpc.con.i_g[i] || continue
12151214
if i nŶ
@@ -1276,7 +1275,7 @@ function con_nonlinprogeq!(
12761275
geq, X̂0, Û0, K0,
12771276
mpc::PredictiveController, model::NonLinModel, ::MultipleShooting, U0, Z̃
12781277
)
1279-
nu, nx̂, ny, nd, nk = model.nu, mpc.estim.nx̂, model.ny, model.nd, model.nk
1278+
nu, nx̂, nd, nk = model.nu, mpc.estim.nx̂, model.nd, model.nk
12801279
Hp, Hc = mpc.Hp, mpc.Hc
12811280
nΔU, nX̂ = nu*Hc, nx̂*Hp
12821281
D̂0 = mpc.D̂0

0 commit comments

Comments
 (0)