-
-
Notifications
You must be signed in to change notification settings - Fork 232
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
MWE:
using ModelingToolkit, JumpProcesses
using ModelingToolkit: t_nounits as t
@parameters k
@variables X(t)
rate = k
affect = [X ~ X - 1]
crj = ConstantRateJump(1.0 ,[X ~ X - 1])
js1 = complete(JumpSystem([crj], t, [X], [k]; name = :js1))
js2 = complete(JumpSystem([crj], t, [X], []; name = :js2))
maj = MassActionJump(1.0, [X => 1], [X => -1])
js3 = complete(JumpSystem([maj], t, [X], [k]; name = :js2))
js4 = complete(JumpSystem([maj], t, [X], []; name = :js3))
u0 = [X => 10]
tspan = (0.0, 1.0)
ps = [k => 1.0]
dp1 = DiscreteProblem(js1, u0, tspan, ps)
dp2 = DiscreteProblem(js2, u0, tspan)
dp3 = DiscreteProblem(js3, u0, tspan, ps)
dp4 = DiscreteProblem(js4, u0, tspan)
jp1 = JumpProblem(js1, dp1, Direct()) # Works
jp2 = JumpProblem(js2, dp2, Direct()) # ERROR: MethodError: reducing over an empty collection is not allowed; consider supplying `init` to the reducer
jp3 = JumpProblem(js3, dp3, Direct()) # Works
jp4 = JumpProblem(js4, dp4, Direct()) # ERROR: MethodError: reducing over an empty collection is not allowed; consider supplying `init` to the reducer
Full error output from the last case:
ERROR: MethodError: reducing over an empty collection is not allowed; consider supplying `init` to the reducer
Stacktrace:
[1] reduce_empty(op::Base.BottomRF{typeof(vcat)}, ::Type{Union{}})
@ Base ./reduce.jl:360
[2] reduce_empty_iter(op::Base.BottomRF{typeof(vcat)}, itr::Tuple{}, ::Base.HasEltype)
@ Base ./reduce.jl:384
[3] reduce_empty_iter(op::Base.BottomRF{typeof(vcat)}, itr::Tuple{})
@ Base ./reduce.jl:383
[4] foldl_impl(op::Base.BottomRF{typeof(vcat)}, nt::Base._InitialValue, itr::Tuple{})
@ Base ./reduce.jl:49
[5] mapfoldl_impl(f::typeof(identity), op::typeof(vcat), nt::Base._InitialValue, itr::Tuple{})
@ Base ./reduce.jl:44
[6] mapfoldl(f::Function, op::Function, itr::Tuple{}; init::Base._InitialValue)
@ Base ./reduce.jl:175
[7] mapfoldl
@ ./reduce.jl:175 [inlined]
[8] mapreduce
@ ./reduce.jl:307 [inlined]
[9] reduce(op::Function, itr::Tuple{})
@ Base ./reduce.jl:490
[10] ModelingToolkit.JumpSysMajParamMapper(js::JumpSystem{…}, p::ModelingToolkit.MTKParameters{…}; jseqs::RecursiveArrayTools.ArrayPartition{…}, rateconsttype::Type)
@ ModelingToolkit ~/.julia/packages/ModelingToolkit/Mxj1Q/src/systems/jumps/jumpsystem.jl:511
[11] JumpProblem(js::JumpSystem{…}, prob::DiscreteProblem{…}, aggregator::Direct; callback::Nothing, kwargs::@Kwargs{})
@ ModelingToolkit ~/.julia/packages/ModelingToolkit/Mxj1Q/src/systems/jumps/jumpsystem.jl:440
[12] JumpProblem(js::JumpSystem{…}, prob::DiscreteProblem{…}, aggregator::Direct)
@ ModelingToolkit ~/.julia/packages/ModelingToolkit/Mxj1Q/src/systems/jumps/jumpsystem.jl:428
[13] top-level scope
@ ~/Desktop/Julia Playground/Environment - Catalyst test/playground.jl:440
Some type information was truncated. Use `show(err)` to see complete types.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working