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 ,
1938 dt = error (" dt is required for SimpleTauLeaping." ))
@@ -62,12 +81,6 @@ function DiffEqBase.solve(jump_prob::JumpProblem, alg::SimpleTauLeaping;
6281 interp = DiffEqBase. ConstantInterpolation (t, u))
6382end
6483
65- struct SimpleAdaptiveTauLeaping{T <: AbstractFloat } <: DiffEqBase.DEAlgorithm
66- epsilon:: T # Error control parameter
67- end
68-
69- SimpleAdaptiveTauLeaping (; epsilon= 0.05 ) = SimpleAdaptiveTauLeaping (epsilon)
70-
7184function compute_hor (nu)
7285 hor = zeros (Int, size (nu, 2 ))
7386 for j in 1 : size (nu, 2 )
@@ -109,9 +122,8 @@ function DiffEqBase.solve(jump_prob::JumpProblem, alg::SimpleAdaptiveTauLeaping;
109122 seed = nothing ,
110123 dtmin = 1e-10 ,
111124 saveat = nothing )
112- if jump_prob. massaction_jump === nothing
113- error (" SimpleAdaptiveTauLeaping requires a JumpProblem with a MassActionJump." )
114- end
125+ validate_pure_leaping_inputs (jump_prob, alg) ||
126+ error (" SimpleAdaptiveTauLeaping can only be used with PureLeaping JumpProblem with a MassActionJump." )
115127 prob = jump_prob. prob
116128 rng = DEFAULT_RNG
117129 (seed != = nothing ) && seed! (rng, seed)
0 commit comments