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

[v14 ready] RDME and graph SSAs #737

Merged
merged 9 commits into from
May 31, 2024
Merged

Conversation

TorkelE
Copy link
Member

@TorkelE TorkelE commented Dec 2, 2023

To avoid rebasing hell this is simply a new version of #663. You might have some input on simpler ways to compute the (non-spatial) mass action Jumps @isaacsas, but otherwise, this is good to go. Currently vertex parameters must be uniform across the grid (and this is enforced). Once @Vilin97 have his PRs merged over at JumpProcesses, this requirement can be lightened.

I have added support for spatial jumps. Creating and solving a problem is relatively easy:

using Catalyst, Graphs, JumpProcesses

# Make model.
SIR_system = @reaction_network begin
    α, S + I --> 2I
    β, I --> R
end
trS = @transport_reaction dS S
trI = @transport_reaction dI I
lattice = Graphs.grid([2, 2])
lrs = LatticeReactionSystem(SIR_system, [trS, trI], lattice)

# Parameter values and initial conditions.
u0 = [:S => [999, 1000, 1000, 1000], :I => [1, 0, 0, 0], :R => 0]
pV = [ => 0.1 / 1000,  => 0.01]
pE = [:dS => [0.1, 0.1, 0.1, 0.2], :dI => [0.01, 0.01, 0.01, 0.02]]

# Create the problem.
dprob = DiscreteProblem(lrs, u0, (0.0,100.0), (pV,pE))
jprob = JumpProblem(lrs, dprob, NSM())
sol = solve(jprob, SSAStepper())

Current limitations:

  • Cartesian grids are not supported, only Graphs.
  • Of the 5 forms of the hopping rates, we now convert to the most general one (D_{s,i,j}). Once this is merged, I will introduce a routine which detects which is the most compact form that can be provided, and uses that one. To keep this PR short, I am currently holding of on uploading those changes,
  • Currently, the constant rate jumps in each compartment must have the same parameter values. Once this is supported in JumpProcesses I will add support for it here as well.

@TorkelE TorkelE mentioned this pull request Dec 2, 2023
@TorkelE
Copy link
Member Author

TorkelE commented Dec 2, 2023

This one shoudl also have better formatting and comments as compared to the previous PR.

@isaacsas
Copy link
Member

isaacsas commented Dec 2, 2023

I thought spatially varying mass action jump rates are already supported? That is what a SpatialMassActionJump encodes.

@isaacsas isaacsas changed the title init. RDME and graph SSAs Dec 2, 2023
@TorkelE TorkelE changed the title RDME and graph SSAs Redo spatial SSA PR Dec 2, 2023
@TorkelE TorkelE changed the title Redo spatial SSA PR RDME and graph SSAs Dec 2, 2023
@TorkelE
Copy link
Member Author

TorkelE commented Dec 2, 2023

I thought spatially varying mass action jump rates are already supported? That is what a SpatialMassActionJump encodes.

Ahh, didn't know that that was supported already.

@TorkelE TorkelE force-pushed the new_spatial_jump_implementation branch from ba3dac7 to 0227018 Compare December 4, 2023 15:31
@TorkelE TorkelE closed this Dec 4, 2023
@TorkelE TorkelE reopened this Dec 4, 2023
Copy link
Contributor

@Vilin97 Vilin97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Coveralls report that all the new lines added are not covered. I don't understand why that is. Is the test accidentally calling some other functions instead of the newly added ones?
  2. We should add a correctness test.

@TorkelE
Copy link
Member Author

TorkelE commented Dec 30, 2023

I have renamed the "Correctness Tests" header. Good point of the coverage, the file wasn't being run but added now, thanks!

@TorkelE TorkelE force-pushed the new_spatial_jump_implementation branch from 2fc7ccf to f094dc7 Compare January 25, 2024 21:46
@TorkelE TorkelE changed the base branch from master to Catalyst_version_14 January 25, 2024 21:46
@TorkelE TorkelE closed this Jan 26, 2024
@TorkelE TorkelE reopened this Jan 26, 2024
@isaacsas
Copy link
Member

Won’t that run CI on the branch for all PRs and merges forever now?

@TorkelE
Copy link
Member Author

TorkelE commented Jan 26, 2024

It will until we remove it, which we will do with the v14 release. And all PRs until then will be for the v14 branch anyway.

This is what we want right, and it is not like there is another way?

@TorkelE TorkelE force-pushed the new_spatial_jump_implementation branch 3 times, most recently from 2bec547 to 9f63d30 Compare February 1, 2024 22:04
@TorkelE TorkelE changed the title RDME and graph SSAs [v14 ready] RDME and graph SSAs Feb 1, 2024
@TorkelE TorkelE force-pushed the new_spatial_jump_implementation branch from 9f63d30 to c14dc10 Compare February 2, 2024 13:40
@TorkelE TorkelE force-pushed the new_spatial_jump_implementation branch 3 times, most recently from 276f54e to 23ee006 Compare May 15, 2024 12:53
@TorkelE TorkelE changed the base branch from Catalyst_version_14 to master May 15, 2024 13:47
@TorkelE TorkelE force-pushed the new_spatial_jump_implementation branch from 23ee006 to 1bb2b08 Compare May 16, 2024 12:41
@TorkelE TorkelE force-pushed the new_spatial_jump_implementation branch from 1bb2b08 to 09bd10a Compare May 31, 2024 18:28
@TorkelE TorkelE merged commit 46ea95d into master May 31, 2024
5 of 7 checks passed
@TorkelE TorkelE deleted the new_spatial_jump_implementation branch June 8, 2024 18:29
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.

3 participants