@@ -299,14 +299,14 @@ function init_optimization!(mpc::NonLinMPC, optim::JuMP.GenericModel{JNT}) where
299299 model = mpc. estim. model
300300 nu, ny, nx̂, Hp, ng = model. nu, model. ny, mpc. estim. nx̂, mpc. Hp, length (con. i_g)
301301 # inspired from https://jump.dev/JuMP.jl/stable/tutorials/nonlinear/tips_and_tricks/#User-defined-operators-with-vector-outputs
302- Jfunc, gfunc = let mpc= mpc, model= model, ng= ng, nΔŨ= nΔŨ , nŶ= Hp* ny, nx̂= nx̂, nu= nu
302+ Jfunc, gfunc = let mpc= mpc, model= model, ng= ng, nΔŨ= nΔŨ, nŶ= Hp* ny, nx̂= nx̂, nu= nu, nU = Hp * nu
303303 last_ΔŨtup_float, last_ΔŨtup_dual = nothing , nothing
304304 Ŷ_cache :: DiffCache{Vector{JNT}, Vector{JNT}} = DiffCache (zeros (JNT, nŶ), nΔŨ + 3 )
305305 g_cache :: DiffCache{Vector{JNT}, Vector{JNT}} = DiffCache (zeros (JNT, ng), nΔŨ + 3 )
306306 x̂_cache :: DiffCache{Vector{JNT}, Vector{JNT}} = DiffCache (zeros (JNT, nx̂), nΔŨ + 3 )
307307 u0_cache:: DiffCache{Vector{JNT}, Vector{JNT}} = DiffCache (zeros (JNT, nu), nΔŨ + 3 )
308308 Ȳ_cache :: DiffCache{Vector{JNT}, Vector{JNT}} = DiffCache (zeros (JNT, nŶ), nΔŨ + 3 )
309- Ū_cache :: DiffCache{Vector{JNT}, Vector{JNT}} = DiffCache (zeros (JNT, nu ), nΔŨ + 3 )
309+ Ū_cache :: DiffCache{Vector{JNT}, Vector{JNT}} = DiffCache (zeros (JNT, nU ), nΔŨ + 3 )
310310 function Jfunc (ΔŨtup:: JNT... )
311311 ΔŨtud1 = ΔŨtup[begin ]
312312 Ŷ = get_tmp (Ŷ_cache, ΔŨtud1)
0 commit comments