Add RSwM0 algorithm for state-dependent noise processes (tau-leaping) #248
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a new RSWM algorithm variant
:RSwM0that addresses the bias issue when using adaptive tau-leaping with compound Poisson processes that have state-dependent rates.The Problem
When doing tau-leaping with post-hoc corrections (bridging/rejection), the standard RSwM algorithms (RSwM1/2/3) store rejected noise values for later reuse. This works correctly for Brownian motion because the noise is independent of the solution. However, for Poisson processes with state-dependent rates:
λ(X_n, t)for interval[t, t+dt][t, t+dt/2][t+dt/2, t+dt]is stored in the stackλ(X_n, t), which may be incorrect for the new trajectoryAs David Anderson notes in the referenced paper, you should use the Poisson bridge to pull back, but you shouldn't store the future value because it was generated with the wrong λ.
The Solution
:RSwM0algorithm variant that uses bridging but discards future valuesreject_step!: Uses bridging for interpolation but doesn't push to S₁/S₂ stackssetup_next_step!: Always recalculates fresh noise (doesn't use stored values)CompoundPoissonProcessnow defaults to:RSwM0Changes
src/rswm.jl: Add documentation for:RSwM0src/noise_interfaces/noise_process_interface.jl: Handle:RSwM0inreject_step!andsetup_next_step!src/compoundpoisson.jl: Default toRSWM(adaptivealg = :RSwM0), addrswmkeyword argumentBehavior Comparison
Test Results
Reference
Anderson, D.F. "Incorporating postleap checks in tau-leaping"
J. Chem. Phys. 128, 054103 (2008); https://doi.org/10.1063/1.2819665
Test plan
CompoundPoissonProcessdefaults to:RSwM0reject_step!with:RSwM0keeps S₁ emptysetup_next_step!with:RSwM0recalculates fresh noiserswm = RSWM(adaptivealg = :RSwM3)if desired🤖 Generated with Claude Code