mathopt / DynamicOED.jl

Optimal experimental design of ODE and DAE systems in julia
https://mathopt.github.io/DynamicOED.jl/
MIT License
8 stars 0 forks source link

MethodError in examples. #30

Closed KBodolai closed 1 month ago

KBodolai commented 1 month ago

Tying to the JOSS Review: openjournals/joss-reviews#6605.

I've been going through the examples, I had no issue with the example in the home section of the docs, but when I try to run the linear system and the Lotka-Volterra example, I get the following error when running:

@named constraint_system = ConstraintSystem(constraint_equations, optimization_variables, [])
```julia ERROR: MethodError: vcat(::ComponentArrays.ComponentVector{Num, Vector{Num}, Tuple{ComponentArrays.Axis{(controls = 1:0, initial_conditions = 1:0, measurements = ViewAxis(1:10, Axis(w₁ = 1:10,)), regularization = 11)}}}, ::Vector{Any}) is ambiguous. Candidates: vcat(V::AbstractVector...) @ Base abstractarray.jl:1616 vcat(A::AbstractVecOrMat...) @ Base abstractarray.jl:1678 vcat(A::Union{Number, AbstractVecOrMat}...) @ Base abstractarray.jl:1990 vcat(A::Union{LinearAlgebra.UniformScaling, AbstractVecOrMat}...) @ LinearAlgebra ~/julia-1.9.0/share/julia/stdlib/v1.9/LinearAlgebra/src/uniformscaling.jl:411 vcat(A::Union{Number, LinearAlgebra.UniformScaling, AbstractVecOrMat}...) @ LinearAlgebra ~/julia-1.9.0/share/julia/stdlib/v1.9/LinearAlgebra/src/uniformscaling.jl:413 vcat(A::AbstractArray, B::AbstractArray) @ Base abstractarray.jl:1988 vcat(A::AbstractArray...) @ Base abstractarray.jl:1989 vcat(x::ComponentArrays.ComponentVector{<:Number}, args...) @ ComponentArrays ~/.julia/packages/ComponentArrays/pJerZ/src/array_interface.jl:61 Possible fix, define vcat(::ComponentArrays.ComponentVector{<:Number}, ::AbstractVector) Stacktrace: [1] _ @ ~/.julia/packages/ModelingToolkit/oIgbi/src/systems/optimization/constraints_system.jl:80 [inlined] [2] ConstraintsSystem @ ~/.julia/packages/ModelingToolkit/oIgbi/src/systems/optimization/constraints_system.jl:73 [inlined] [3] ConstraintsSystem(constraints::Vector{Inequality}, states::ComponentArrays.ComponentVector{Num, Vector{Num}, Tuple{ComponentArrays.Axis{(controls = 1:0, initial_conditions = 1:0, measurements = ViewAxis(1:10, Axis(w₁ = 1:10,)), regularization = 11)}}}, ps::Vector{Any}; observed::Vector{Any}, name::Symbol, default_u0::Dict{Any, Any}, default_p::Dict{Any, Any}, defaults::Dict{Any, Any}, systems::Vector{ConstraintsSystem}, connector_type::Nothing, continuous_events::Nothing, discrete_events::Nothing, checks::Bool, metadata::Nothing) @ ModelingToolkit ~/.julia/packages/ModelingToolkit/oIgbi/src/systems/optimization/constraints_system.jl:132 [4] top-level scope @ ~/.julia/packages/ModelingToolkit/oIgbi/src/systems/abstractsystem.jl:1003 ```

This comes from a new installation of Julia, following the installation steps and running the examples as presented in the docs. I'll have some more time to inspect the issue later this week, but in the meantime, any idea of what may be causing this?

Cheers, K.

AlCap23 commented 1 month ago

Thanks @KBodolai !

Yes, this is a missing Num[] in the ConstraintSystem and it seems I forgot to update the docs accordingly 😅 .

AlCap23 commented 1 month ago

It seems there is an error in the docs build. The PR #31 updated the docs, but it did not get published.