-
-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mass-action jumps and event handling #185
Comments
Yeah, this is doable but just not well documented. (We really need to make a helper function for it.) You can access the rates within the mass action jump via: integrator.cb.affect!.ma_jumps.scaled_rates This gives you access to the same vector as you can get at through the problem (as described in the docs you referenced, https://diffeq.sciml.ai/stable/types/jump_types/#Remaking-JumpProblems). Note, you'll also need to call |
I think we should have a style where the mass action jump takes in an index and then directly indexes |
This works perfectly as far as I can tell. But I agree that it is too hidden in the internals and ought to be exposed to the user more easily. In particular, I'm surprised this case doesn't come up more often. I was just playing around with an SEIR-type model and wanted to model effects on R0 when certain conditions hit. @ChrisRackauckas Could you give an example of what that would look like? |
We could make such a change throughout here, MT, and Catalyst, but I think we’d need to drop handling combinatorial rate scalings here and push that onto the user. Otherwise we’d have extra multiplications when evaluating rates and need to also store the scalings. This would also preclude users using parameter structures since they aren’t indexable (not sure if that is a concern). |
We could hoist such function calls to fill the mass action jumps to the start of the call so that it's done once, but still has a link to the new parameters?
Yeah, though I think moving forward I am going to try and do something more like SciML/ModelingToolkit.jl#1088 |
Fixed by #190 |
@skleinbo this will require some Catalyst/ModelingToolkit updates to take advantage of, but should hopefully be in them shortly. |
Is it possible to change the rates of mass-action jumps through callbacks? (see also this discourse thread)
I.e., how to make the following work
such that the rate is adjusted when
X
passes the threshold. Certainly this version of_affect!
is too naive.The text was updated successfully, but these errors were encountered: