Skip to content
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

variable rate jump support #1015

Merged
merged 5 commits into from
Aug 12, 2024
Merged

Conversation

isaacsas
Copy link
Member

@isaacsas isaacsas commented Aug 10, 2024

Needs SciML/ModelingToolkit.jl#2946 and an MTK release before merging.

Adds a JumpInputs class to auto-select the problem type (i.e. ODEProblem for systems that would have VariableRateJumps and otherwise DiscreteProblem). This now works:

using Catalyst, OrdinaryDiffEq, JumpProcesses, Plots
rn = @reaction_network begin
    k*(1 + sin(t)), 0 --> A
end
jinput = JumpInputs(rn, [:A => 0], (0.0, 10.0), [:k => .5])
@assert jinput.prob isa ODEProblem
jprob = JumpProblem(jinput)
sol = solve(jprob, Tsit5())
plot(sol, idxs = :A)

rn = @reaction_network begin
    k, 0 --> A
end
jinput = JumpInputs(rn, [:A => 0], (0.0, 10.0), [:k => .5])
@assert jinput.prob isa DiscreteProblem
jprob = JumpProblem(jinput)
sol = solve(jprob)
plot(sol, idxs = :A)

Note that plot(sol) does not yet work in the variable rate case, but indexing and plotting of subsets of variables via idxs seems to work ok.

@isaacsas isaacsas closed this Aug 11, 2024
@isaacsas isaacsas reopened this Aug 11, 2024
@isaacsas isaacsas merged commit adde7ff into SciML:master Aug 12, 2024
3 of 4 checks passed
@isaacsas isaacsas deleted the variable_rate_jumps branch August 12, 2024 01:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant