Skip to content

Commit d658a68

Browse files
committed
debug: MHE now works
1 parent f43ac3c commit d658a68

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ModelPredictiveControl"
22
uuid = "61f9bdb8-6ae4-484a-811f-bbf86720c31c"
33
authors = ["Francis Gagnon"]
4-
version = "1.4.1"
4+
version = "1.4.2"
55

66
[deps]
77
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"

src/estimator/mhe/construct.jl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,22 +1343,24 @@ function get_optim_functions(
13431343
end
13441344
= Z̃cache
13451345
ϵ = (nϵ 0) ? Z̃[begin] : zero(T) # ϵ = 0 if Cwt=Inf (meaning: no relaxation)
1346-
V̂, X̂0 = get_tmp(V̂_cache, Z̃1), get_tmp(X̂0_cache, Z̃1)
1347-
û0, ŷ0 = get_tmp(û0_cache, Z̃1), get_tmp(ŷ0_cache, Z̃1)
1348-
g = get_tmp(g_cache, Z̃1)
1346+
V̂, X̂0 = get_tmp(V̂_cache, T), get_tmp(X̂0_cache, T)
1347+
û0, ŷ0 = get_tmp(û0_cache, T), get_tmp(ŷ0_cache, T)
1348+
g = get_tmp(g_cache, T)
13491349
V̂, X̂0 = predict!(V̂, X̂0, û0, ŷ0, estim, model, Z̃)
13501350
g = con_nonlinprog!(g, estim, model, X̂0, V̂, ϵ)
13511351
end
13521352
return nothing
13531353
end
13541354
# --------------------- objective functions -------------------------------------------
13551355
function Jfunc(Z̃arg::Vararg{T, N}) where {N, T<:Real}
1356-
update_simulations!(Z̃arg, get_tmp(Z̃_cache, T))
1356+
= get_tmp(Z̃_cache, T)
1357+
update_simulations!(Z̃arg, Z̃)
13571358
x̄, V̂ = get_tmp(x̄_cache, T), get_tmp(V̂_cache, T)
13581359
return obj_nonlinprog!(x̄, estim, model, V̂, Z̃)::T
13591360
end
13601361
function Jfunc_vec(Z̃arg::AbstractVector{T}) where T<:Real
1361-
update_simulations!(Z̃arg, get_tmp(Z̃_cache, T))
1362+
= get_tmp(Z̃_cache, T)
1363+
update_simulations!(Z̃arg, Z̃)
13621364
x̄, V̂ = get_tmp(x̄_cache, T), get_tmp(V̂_cache, T)
13631365
return obj_nonlinprog!(x̄, estim, model, V̂, Z̃)::T
13641366
end

0 commit comments

Comments
 (0)