11struct SimpleTauLeaping <: DiffEqBase.DEAlgorithm end
22
3+ struct SimpleAdaptiveTauLeaping{T <: AbstractFloat } <: DiffEqBase.DEAlgorithm
4+ epsilon:: T # Error control parameter
5+ end
6+
7+ SimpleAdaptiveTauLeaping (; epsilon= 0.05 ) = SimpleAdaptiveTauLeaping (epsilon)
8+
39function validate_pure_leaping_inputs (jump_prob:: JumpProblem , alg)
410 if ! (jump_prob. aggregator isa PureLeaping)
511 @warn " When using $alg , please pass PureLeaping() as the aggregator to the \
@@ -14,6 +20,19 @@ function validate_pure_leaping_inputs(jump_prob::JumpProblem, alg)
1420 jump_prob. regular_jump != = nothing
1521end
1622
23+ function validate_pure_leaping_inputs (jump_prob:: JumpProblem , alg:: SimpleAdaptiveTauLeaping )
24+ if ! (jump_prob. aggregator isa PureLeaping)
25+ @warn " When using $alg , please pass PureLeaping() as the aggregator to the \
26+ JumpProblem, i.e. call JumpProblem(::DiscreteProblem, PureLeaping(),...). \
27+ Passing $(jump_prob. aggregator) is deprecated and will be removed in the next breaking release."
28+ end
29+ isempty (jump_prob. jump_callback. continuous_callbacks) &&
30+ isempty (jump_prob. jump_callback. discrete_callbacks) &&
31+ isempty (jump_prob. constant_jumps) &&
32+ isempty (jump_prob. variable_jumps) &&
33+ jump_prob. massaction_jump != = nothing
34+ end
35+
1736function DiffEqBase. solve (jump_prob:: JumpProblem , alg:: SimpleTauLeaping ;
1837 seed = nothing , dt = error (" dt is required for SimpleTauLeaping." ))
1938 validate_pure_leaping_inputs (jump_prob, alg) ||
@@ -61,12 +80,6 @@ function DiffEqBase.solve(jump_prob::JumpProblem, alg::SimpleTauLeaping;
6180 interp = DiffEqBase. ConstantInterpolation (t, u))
6281end
6382
64- struct SimpleAdaptiveTauLeaping{T <: AbstractFloat } <: DiffEqBase.DEAlgorithm
65- epsilon:: T # Error control parameter
66- end
67-
68- SimpleAdaptiveTauLeaping (; epsilon= 0.05 ) = SimpleAdaptiveTauLeaping (epsilon)
69-
7083function compute_hor (nu)
7184 hor = zeros (Int, size (nu, 2 ))
7285 for j in 1 : size (nu, 2 )
@@ -108,9 +121,8 @@ function DiffEqBase.solve(jump_prob::JumpProblem, alg::SimpleAdaptiveTauLeaping;
108121 seed = nothing ,
109122 dtmin = 1e-10 ,
110123 saveat = nothing )
111- if jump_prob. massaction_jump === nothing
112- error (" SimpleAdaptiveTauLeaping requires a JumpProblem with a MassActionJump." )
113- end
124+ validate_pure_leaping_inputs (jump_prob, alg) ||
125+ error (" SimpleAdaptiveTauLeaping can only be used with PureLeaping JumpProblem with a MassActionJump." )
114126 prob = jump_prob. prob
115127 rng = DEFAULT_RNG
116128 (seed != = nothing ) && seed! (rng, seed)
0 commit comments