Skip to content

Commit b324d07

Browse files
committed
debug: prepare diff with rand constants
1 parent 749fbcf commit b324d07

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/controller/nonlinmpc.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ function get_nonlincon_oracle(mpc::NonLinMPC, ::JuMP.GenericModel{JNT}) where JN
761761
Û0::Vector{JNT}, X̂0::Vector{JNT} = zeros(JNT, nU), zeros(JNT, nX̂)
762762
gc::Vector{JNT}, g::Vector{JNT} = zeros(JNT, nc), zeros(JNT, ng)
763763
gi::Vector{JNT}, geq::Vector{JNT} = zeros(JNT, ngi), zeros(JNT, neq)
764-
λi::Vector{JNT}, λeq::Vector{JNT} = ones(JNT, ngi), ones(JNT, neq)
764+
λi::Vector{JNT}, λeq::Vector{JNT} = rand(JNT, ngi), rand(JNT, neq)
765765
# -------------- inequality constraint: nonlinear oracle -----------------------------
766766
function gi!(gi, Z̃, ΔŨ, x̂0end, Ue, Ŷe, U0, Ŷ0, Û0, K0, X̂0, gc, geq, g)
767767
update_predictions!(ΔŨ, x̂0end, Ue, Ŷe, U0, Ŷ0, Û0, K0, X̂0, gc, g, geq, mpc, Z̃)

src/estimator/kalman.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,8 +1111,8 @@ function get_ekf_linfuncs(NT, model, i_ym, nint_u, nint_ym, jacobian)
11111111
x̂0 = zeros(NT, nx̂)
11121112
û0 = Cache(zeros(NT, nu))
11131113
k0 = Cache(zeros(NT, nk))
1114-
cst_u0 = Constant(zeros(NT, nu))
1115-
cst_d0 = Constant(zeros(NT, nd))
1114+
cst_u0 = Constant(rand(NT, nu))
1115+
cst_d0 = Constant(rand(NT, nd))
11161116
F̂prep = prepare_jacobian(
11171117
f̂_ekf!, x̂0next, jacobian, x̂0, û0, k0, cst_u0, cst_d0; strict
11181118
)

src/estimator/mhe/construct.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1478,7 +1478,7 @@ function get_nonlincon_oracle(
14781478
k0::Vector{JNT} = zeros(JNT, nk)
14791479
û0::Vector{JNT}, ŷ0::Vector{JNT} = zeros(JNT, nu), zeros(JNT, nŷ)
14801480
g::Vector{JNT}, gi::Vector{JNT} = zeros(JNT, ng), zeros(JNT, ngi)
1481-
λi::Vector{JNT} = ones(JNT, ngi)
1481+
λi::Vector{JNT} = rand(JNT, ngi)
14821482
# -------------- inequality constraint: nonlinear oracle -------------------------
14831483
function gi!(gi, Z̃, V̂, X̂0, û0, k0, ŷ0, g)
14841484
update_prediction!(V̂, X̂0, û0, k0, ŷ0, g, estim, Z̃)

src/model/linearization.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ function get_linearization_func(
2929
d = zeros(NT, nd)
3030
k = zeros(NT, nx*(solver.ni+1))
3131
cache_k = Cache(k)
32-
cst_x = Constant(x)
33-
cst_u = Constant(u)
34-
cst_d = Constant(d)
32+
cst_x = Constant(rand(NT, nx))
33+
cst_u = Constant(rand(NT, nu))
34+
cst_d = Constant(rand(NT, nd))
3535
A_prep = prepare_jacobian(f_x!, xnext, backend, x, cache_k, cst_u, cst_d; strict)
3636
Bu_prep = prepare_jacobian(f_u!, xnext, backend, u, cache_k, cst_x, cst_d; strict)
3737
Bd_prep = prepare_jacobian(f_d!, xnext, backend, d, cache_k, cst_x, cst_u; strict)

0 commit comments

Comments
 (0)