Build and simulate jump equations like Gillespie simulations and jump diffusions with constant and state-dependent rates and mix with differential equations and scientific machine learning (SciML)
using JumpProcesses
test_rate(u, p, t) = 3.0
test_affect!(integrator) = (integrator.u[1] += 1)
function test_urate(u, p, t)
if t > 1.0
error("test_urate does not handle t > 1.0")
else
return 4.0
end
end
test_jump = VariableRateJump(test_rate, test_affect!; urate=test_urate, rateinterval=(u,p,t)->0.9)
dprob = DiscreteProblem([0], (0.0, 1.0), nothing)
jprob = JumpProblem(dprob, Coevolve(), test_jump; dep_graph=[[1]])
for i in 1:100
solve(jprob, SSAStepper())
end
# sometimes throws ERROR: test_urate does not handle t > 1.0
I had a practical case where I ran into the above issue because my supplied urate function actually went haywire for t beyond my timespan. In general I think it would be a good property to only call the user-supplied functions for t in the timespan?
MWE
I had a practical case where I ran into the above issue because my supplied
urate
function actually went haywire fort
beyond my timespan. In general I think it would be a good property to only call the user-supplied functions fort
in the timespan?