Skip to content

Commit ff923d2

Browse files
committed
debug: use gc! instead of gc in MHE construction
1 parent b92be59 commit ff923d2

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

src/estimator/mhe/construct.jl

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ function MovingHorizonEstimator(
570570
return MovingHorizonEstimator{NT}(
571571
model,
572572
He, i_ym, nint_u, nint_ym, cov, Cwt,
573-
gc, nc, p,
573+
gc!, nc, p,
574574
optim, gradient, jacobian, hessian, covestim;
575575
direct
576576
)
@@ -604,30 +604,30 @@ function validate_gc_mhe(NT, gc)
604604
ismutating = hasmethod(
605605
gc,
606606
Tuple{
607-
# LHS, , , Ŵ,
607+
# LHS, , X̂e , V̂e , Ŵe
608608
Vector{NT}, Vector{NT}, Vector{NT}, Vector{NT},
609-
# U , Ym , D , P̄ , x̄ , p , ε
609+
# Ue , Yem , De , P̄ , x̄ , p , ε
610610
Vector{NT}, Vector{NT}, Vector{NT}, AbstractMatrix{NT}, Vector{NT}, Any, NT
611611
}
612612
)
613613
isnonmutating = hasmethod(
614614
gc,
615615
Tuple{
616-
# , Ŵ,
616+
# X̂e , V̂e , Ŵe
617617
Vector{NT}, Vector{NT}, Vector{NT},
618-
# U , Ym , D , P̄ , x̄ , p , ε
618+
# Ue , Yem , De , P̄ , x̄ , p , ε
619619
Vector{NT}, Vector{NT}, Vector{NT}, AbstractMatrix{NT}, Vector{NT}, Any, NT
620620
}
621621
)
622622
if !(ismutating || isnonmutating)
623623
error(
624624
"the custom constraint function has no method with type signature "*
625-
"gc(::Vector{$(NT)}, ::Vector{$(NT)}, ::Vector{$(NT)}, "*
626-
"U::Vector{$(NT)}, Ym::Vector{$(NT)}, D::Vector{$(NT)}, "*
625+
"gc(X̂e::Vector{$(NT)}, V̂e::Vector{$(NT)}, Ŵe::Vector{$(NT)}, "*
626+
"Ue::Vector{$(NT)}, Yem::Vector{$(NT)}, De::Vector{$(NT)}, "*
627627
"P̄::Vector{$(NT)}, x̄::Vector{$(NT)}, p::Any, ϵ::$(NT)) "*
628628
"or mutating form gc!(LHS::Vector{$(NT)}, "*
629-
"::Vector{$(NT)}, ::Vector{$(NT)}, ::Vector{$(NT)}, "*
630-
"U::Vector{$(NT)}, Ym::Vector{$(NT)}, D::Vector{$(NT)}, "*
629+
"X̂e::Vector{$(NT)}, V̂e::Vector{$(NT)}, Ŵe::Vector{$(NT)}, "*
630+
"Ue::Vector{$(NT)}, Yem::Vector{$(NT)}, De::Vector{$(NT)}, "*
631631
"P̄::Vector{$(NT)}, x̄::Vector{$(NT)}, p::Any, ϵ::$(NT))"
632632
)
633633
end
@@ -637,11 +637,13 @@ end
637637
"Get mutating custom constraint function `gc!` from the provided function in argument."
638638
function get_mutating_gc_mhe(NT, gc)
639639
ismutating_gc = validate_gc_mhe(NT, gc)
640+
@show ismutating_gc
640641
gc! = if ismutating_gc
641642
gc
642643
else
643-
function gc!(LHS, X̂, V̂, Ŵ, U, Ym, D, P̄, x̄, p, ϵ)
644-
LHS .= gc(X̂, V̂, Ŵ, U, Ym, D, P̄, x̄, p, ϵ)
644+
function gc!(LHS, X̂e, V̂e, Ŵe, Ue, Yem, De, P̄, x̄, p, ϵ)
645+
println("ASDS")
646+
LHS .= gc(X̂e, V̂e, Ŵe, Ue, Yem, De, P̄, x̄, p, ϵ)
645647
return nothing
646648
end
647649
end

0 commit comments

Comments
 (0)