Consider for the sake of a minimal example the following pure jump problem.
rn2 = @reaction_network begin a, 0 --> X end a prob2_jump = JumpProblem(rn2, DiscreteProblem(rn2, , (0.0, 10.0), [1.0]), Direct())
I would like to change the rate
X passes a certain threshold. A straightforward discrete callback
_cond(u,t,integ) = u > 5 _affect!(integ) = integ.p = 0.0 _cb = DiscreteCallback(_cond, _affect!)
does not work. Certainly because
integ.p does not affect the jump callbacks.
Changing the mass-action-rates in the jump problem works as demonstrated in https://diffeq.sciml.ai/stable/types/jump_types/#Remaking-JumpProblems , but there is no accessing the jump problem from
_affect! as far as I can tell.
The only route I could come up with, is terminating the integration when the condition hits, remake the problem with adjusted rates and final state as new initial condition, and keep integrating until the final time.
That works, yet feels a bit clunky and more importantly is not naturally compatible(?) with ensemble simulations.
Question is thus: How to change the rates of a jump process through callbacks?