diff --git a/src/controller/nonlinmpc.jl b/src/controller/nonlinmpc.jl index 987be9ecc..6f244b44f 100644 --- a/src/controller/nonlinmpc.jl +++ b/src/controller/nonlinmpc.jl @@ -761,7 +761,7 @@ function get_nonlincon_oracle(mpc::NonLinMPC, ::JuMP.GenericModel{JNT}) where JN Û0::Vector{JNT}, X̂0::Vector{JNT} = zeros(JNT, nU), zeros(JNT, nX̂) gc::Vector{JNT}, g::Vector{JNT} = zeros(JNT, nc), zeros(JNT, ng) gi::Vector{JNT}, geq::Vector{JNT} = zeros(JNT, ngi), zeros(JNT, neq) - λi::Vector{JNT}, λeq::Vector{JNT} = ones(JNT, ngi), ones(JNT, neq) + λi::Vector{JNT}, λeq::Vector{JNT} = rand(JNT, ngi), rand(JNT, neq) # -------------- inequality constraint: nonlinear oracle ----------------------------- function gi!(gi, Z̃, ΔŨ, x̂0end, Ue, Ŷe, U0, Ŷ0, Û0, K0, X̂0, gc, geq, g) update_predictions!(ΔŨ, x̂0end, Ue, Ŷe, U0, Ŷ0, Û0, K0, X̂0, gc, g, geq, mpc, Z̃) diff --git a/src/estimator/kalman.jl b/src/estimator/kalman.jl index 9dd3d985e..26eae242b 100644 --- a/src/estimator/kalman.jl +++ b/src/estimator/kalman.jl @@ -1111,8 +1111,8 @@ function get_ekf_linfuncs(NT, model, i_ym, nint_u, nint_ym, jacobian) x̂0 = zeros(NT, nx̂) û0 = Cache(zeros(NT, nu)) k0 = Cache(zeros(NT, nk)) - cst_u0 = Constant(zeros(NT, nu)) - cst_d0 = Constant(zeros(NT, nd)) + cst_u0 = Constant(rand(NT, nu)) + cst_d0 = Constant(rand(NT, nd)) F̂prep = prepare_jacobian( f̂_ekf!, x̂0next, jacobian, x̂0, û0, k0, cst_u0, cst_d0; strict ) diff --git a/src/estimator/mhe/construct.jl b/src/estimator/mhe/construct.jl index ec92fc199..c9085fe68 100644 --- a/src/estimator/mhe/construct.jl +++ b/src/estimator/mhe/construct.jl @@ -1478,7 +1478,7 @@ function get_nonlincon_oracle( k0::Vector{JNT} = zeros(JNT, nk) û0::Vector{JNT}, ŷ0::Vector{JNT} = zeros(JNT, nu), zeros(JNT, nŷ) g::Vector{JNT}, gi::Vector{JNT} = zeros(JNT, ng), zeros(JNT, ngi) - λi::Vector{JNT} = ones(JNT, ngi) + λi::Vector{JNT} = rand(JNT, ngi) # -------------- inequality constraint: nonlinear oracle ------------------------- function gi!(gi, Z̃, V̂, X̂0, û0, k0, ŷ0, g) update_prediction!(V̂, X̂0, û0, k0, ŷ0, g, estim, Z̃) diff --git a/src/model/linearization.jl b/src/model/linearization.jl index 45b980999..5b05d6267 100644 --- a/src/model/linearization.jl +++ b/src/model/linearization.jl @@ -29,9 +29,9 @@ function get_linearization_func( d = zeros(NT, nd) k = zeros(NT, nx*(solver.ni+1)) cache_k = Cache(k) - cst_x = Constant(x) - cst_u = Constant(u) - cst_d = Constant(d) + cst_x = Constant(rand(NT, nx)) + cst_u = Constant(rand(NT, nu)) + cst_d = Constant(rand(NT, nd)) A_prep = prepare_jacobian(f_x!, xnext, backend, x, cache_k, cst_u, cst_d; strict) Bu_prep = prepare_jacobian(f_u!, xnext, backend, u, cache_k, cst_x, cst_d; strict) Bd_prep = prepare_jacobian(f_d!, xnext, backend, d, cache_k, cst_x, cst_u; strict)