Skip to content

Commit 8d5cf9d

Browse files
committed
removed: useless assigns in warm-starting
1 parent f9ab2ef commit 8d5cf9d

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

‎src/estimator/mhe/transcription.jl‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,11 +1083,11 @@ function set_warmstart_mhe!(
10831083
predict_mhe!(V̂, X̂0, Û0, K, Ŷ0, estim, model, estim.transcription, x̂0arr, Ŵ, Z̃s)
10841084
Js = obj_nonlinprog(estim, model, x̄, V̂, Ŵ, Z̃s)
10851085
if !isfinite(Js)
1086-
Z̃s[nx̃+1:end] .= 0
1086+
Z̃s[nx̃+1:end] .= 0 # Ŵ = 0
10871087
end
10881088
# --- unused variable in Z̃ (applied only when Nk < He) ---
10891089
# We force the update of the NLP gradient and jacobian by warm-starting the unused
1090-
# variable in Z̃ at 1. Since estim.Ŵ is initialized with 0s, at least 1 variable in Z̃s
1090+
# variable of Ŵ in Z̃ at 1. Since Ŵ is initialized with 0s, at least 1 variable in Z̃s
10911091
# will be inevitably different at the following time step.
10921092
Z̃s[nx̃+nŵ*Nk+1:end] .= 1
10931093
JuMP.set_start_value.(Z̃var, Z̃s)
@@ -1146,7 +1146,6 @@ function set_warmstart_mhe!(
11461146
nε, nx̂, nŵ, He, Nk = estim.nε, estim.nx̂, estim.nx̂, estim.He, estim.Nk[]
11471147
nx̃, nŴ, nX̂, nK = nε + nx̂, nŵ*He, nx̂*He, nk*He
11481148
Z̃s = estim.buffer.Z̃
1149-
û0, ŷ0, x̄, k = buffer.û, buffer.ŷ, buffer.x̂, buffer.k
11501149
# --- slack variable ε ---
11511150
estim.nε == 1 && (Z̃s[begin] = estim.Z̃[begin])
11521151
# --- arrival state estimate x̂0arr ---
@@ -1170,11 +1169,11 @@ function set_warmstart_mhe!(
11701169
predict_mhe!(V̂, X̂0, Û0, K, Ŷ0, estim, model, estim.transcription, x̂0arr, Ŵ, Z̃s)
11711170
Js = obj_nonlinprog(estim, model, x̄, V̂, Ŵ, Z̃s)
11721171
if !isfinite(Js)
1173-
Z̃s[nx̃+nX̂+nK+1:end] .= 0
1172+
Z̃s[nx̃+nX̂+nK+1:end] .= 0 # Ŵ = 0
11741173
end
11751174
# --- unused variable in Z̃ (applied only when Nk < He) ---
11761175
# We force the update of the NLP gradient and jacobian by warm-starting the unused
1177-
# variable in Z̃ at 1. Since estim.Ŵ is initialized with 0s, at least 1 variable in Z̃s
1176+
# variable of Ŵ in Z̃ at 1. Since Ŵ is initialized with 0s, at least 1 variable in Z̃s
11781177
# will be inevitably different at the following time step.
11791178
Z̃s[nx̃+nX̂+nK+nŵ*Nk+1:end] .= 1
11801179
JuMP.set_start_value.(Z̃var, Z̃s)
@@ -1220,7 +1219,6 @@ function set_warmstart_mhe!(
12201219
nε, nx̂, nŵ, He, Nk = estim.nε, estim.nx̂, estim.nx̂, estim.He, estim.Nk[]
12211220
nx̃, nŴ, nX̂ = nε + nx̂, nŵ*He, nx̂*He
12221221
Z̃s = estim.buffer.Z̃
1223-
û0, ŷ0, x̄, k = buffer.û, buffer.ŷ, buffer.x̂, buffer.k
12241222
# --- slack variable ε ---
12251223
estim.nε == 1 && (Z̃s[begin] = estim.Z̃[begin])
12261224
# --- arrival state estimate x̂0arr ---
@@ -1241,11 +1239,11 @@ function set_warmstart_mhe!(
12411239
predict_mhe!(V̂, X̂0, Û0, K, Ŷ0, estim, model, estim.transcription, x̂0arr, Ŵ, Z̃s)
12421240
Js = obj_nonlinprog(estim, model, x̄, V̂, Ŵ, Z̃s)
12431241
if !isfinite(Js)
1244-
Z̃s[nx̃+nX̂+1:end] .= 0
1242+
Z̃s[nx̃+nX̂+1:end] .= 0 # Ŵ = 0
12451243
end
12461244
# --- unused variable in Z̃ (applied only when Nk < He) ---
12471245
# We force the update of the NLP gradient and jacobian by warm-starting the unused
1248-
# variable in Z̃ at 1. Since estim.Ŵ is initialized with 0s, at least 1 variable in Z̃s
1246+
# variable of Ŵ in Z̃ at 1. Since Ŵ is initialized with 0s, at least 1 variable in Z̃s
12491247
# will be inevitably different at the following time step.
12501248
Z̃s[nx̃+nX̂+nŵ*Nk+1:end] .= 1
12511249
JuMP.set_start_value.(Z̃var, Z̃s)

0 commit comments

Comments
 (0)