-
-
Notifications
You must be signed in to change notification settings - Fork 211
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
Problems for VariableRateJumps #383
Comments
Could you explain that part a little bit more? |
For using ModelingToolkit, DiffEqJump, OrdinaryDiffEq
@parameters β γ t
@variables S I R
rate₁ = β*S*I
affect₁ = [S ~ S - 1, I ~ I + 1]
rate₂ = γ*I*exp(-t/20)
affect₂ = [I ~ I - 1, R ~ R + 1]
j₁ = ConstantRateJump(rate₁,affect₁)
j₂ = VariableRateJump(rate₂,affect₂)
js = JumpSystem([j₁,j₂], t, [S,I,R], [β,γ])
u₀ = [999,1,0]; p = (0.1/1000,0.01); tspan = (0.,250.)
u₀map = [S => 999, I => 1, R => 0]
parammap = [β => .1/1000, γ => .01] How does one run a pure SSA simulation now? oprob = ODEProblem((du,u,p,t) -> du .= u, u₀, tspan, p) but then jprob = JumpProblem(js, oprob, Direct())
sol = solve(jprob, Tsit5()) fails. Similarly though one can't do oprob = ODEProblem(js, u₀map, tspan, parammap) or oprob = ODEProblem((du,u,p,t) -> du.=u, u₀map, tspan, parammap)
jprob = JumpProblem(js, oprob, Direct())
sol = solve(jprob, Tsit5()) It seems like if the input is through arrays of pairs we need a way to make dummy problems that handle the pair appropriately. |
|
It doesn't need a whole system though, since it should just be the equations using the same variable/parameter list. |
Hey, I'm currently trying to to exactly this (using the SSA with |
I think this still needs an updated version of the JumpProblem call here. |
I’ll try to take a look on Thursday. |
@ChrisRackauckas I think this issue is related to the ODE solve function not working when the initial values are integers. using ModelingToolkit, DiffEqJump, OrdinaryDiffEq
@parameters β γ t
@variables S I R
rate₁ = β*S*I
affect₁ = [S ~ S - 1, I ~ I + 1]
rate₂ = γ*I*exp(-t/20)
affect₂ = [I ~ I - 1, R ~ R + 1]
j₁ = ConstantRateJump(rate₁,affect₁)
j₂ = VariableRateJump(rate₂,affect₂)
js = JumpSystem([j₁,j₂], t, [S,I,R], [β,γ])
u₀ = [999,1,0]; p = (0.1/1000,0.01); tspan = (0.,250.)
u₀map = [S => 999, I => 1, R => 0]
parammap = [β => .1/1000, γ => .01]
oprob = ODEProblem((du,u,p,t) -> du .= 0, u₀, tspan, p)
jprob = JumpProblem(js, oprob, Direct())
sol = solve(jprob, Tsit5()) with an error during using ModelingToolkit, DiffEqJump, OrdinaryDiffEq
@parameters β γ t
@variables S I R
rate₁ = β*S*I
affect₁ = [S ~ S - 1, I ~ I + 1]
rate₂ = γ*I*exp(-t/20)
affect₂ = [I ~ I - 1, R ~ R + 1]
j₁ = ConstantRateJump(rate₁,affect₁)
j₂ = VariableRateJump(rate₂,affect₂)
js = JumpSystem([j₁,j₂], t, [S,I,R], [β,γ])
u₀ = [999.0,1.0,0.0]; p = (0.1/1000,0.01); tspan = (0.,250.)
u₀map = [S => 999.0, I => 1.0, R => 0.0]
parammap = [β => .1/1000, γ => .01]
oprob = ODEProblem((du,u,p,t) -> du .= 0, u₀, tspan, p)
jprob = JumpProblem(js, oprob, Direct())
sol = solve(jprob, Tsit5()) @kaandocal can you try something like this using floating point initial values for your problem? |
Maybe we need a dedicated |
Is this something that can be specialized on? If the rate equations are continuously dependent and don't have an analytical solution, then you need an ODE solver. |
Maybe some type of default ODEFunction we use for such problems and the ODE timesteppers can detect? |
We need to handle problem setup for
JumpSystems
withVariableRate
jumps. (i.e. needODESystem
andSDESystem
dispatches that can takeJumpSystems
and construct "empty" systems). Right now onlyDiscreteProblem
s where we enforce the jumps are non-variable will work.The text was updated successfully, but these errors were encountered: