Skip to contents

Aggregators choose the next jump of the constant rate and mass action jumps of a JumpProblem(), as in JumpProcesses.jl; all simulate the exact law of the jump process. Direct() is Gillespie's direct method and SortingDirect() the direct method with the jumps searched in order of how often they fire. NRM() is Gibson and Bruck's next reaction method and DirectCR() the composition rejection direct method. RSSA() and RSSACR() are the rejection SSA methods, which bracket each population in an interval (see BracketData()) and assume that the rates are monotone in the populations. Coevolve() is a next reaction method that also handles variable rate jumps with rate bounds (urate, rateinterval and optionally lrate of VariableRateJump()) by thinning. FRM() is Gillespie's first reaction method, RDirect() the direct method with rejection sampling of the jump, and CCNRM() the next reaction method with a constant complexity priority queue. DirectFW() and FRMFW() are Julia's function wrapper variants of Direct() and FRM(); in R they are the same algorithms. NullAggregator(), the default of JumpProblem(), selects one of them from the number and kind of jumps as JumpProcesses' select_aggregator.

Usage

Direct()

SortingDirect()

NRM()

DirectCR()

RSSA()

RSSACR()

Coevolve()

FRM()

FRMFW()

DirectFW()

RDirect()

CCNRM()

NullAggregator()

SSAStepper()

reset_aggregated_jumps(integ)

add_tstop(integ, t)

Arguments

integ

The integrator passed to a callback.

t

A time.

Value

An aggregator or solver object; reset_aggregated_jumps() and add_tstop() return NULL invisibly.

Details

SortingDirect, NRM, CCNRM, RDirect, DirectCR and Coevolve need a dependency graph (for each jump, the jumps whose rates change when it fires) and RSSA and RSSACR the maps from unknowns to the jumps whose rates depend on them and from jumps to the unknowns they change. For systems they are built as ModelingToolkit builds them (asgraph(), variable_dependencies(), eqeq_dependencies()); problems without a system pass them as dependencies = list(dep_graph = , vartojumps_map = , jumptovars_map = ).

SSAStepper() steps from jump to jump in pure jump problems and is their default solver. reset_aggregated_jumps(integ) recomputes the rates and next jump times inside a callback that changed the state or parameters (affects of the system's own events call it). add_tstop(integ, t) adds a time the solver must stop at; a time behind the current time is an error, as in OrdinaryDiffEq.

Examples

t <- t_nounits
variables("X(t)"); parameters("lam = 10", "mu = 1")
birth <- SymbolicMassActionJump(lam, list(), list(X ~ 1))
death <- SymbolicMassActionJump(mu, list(X ~ 1), list(X ~ -1))
js <- complete(JumpSystem(list(birth, death), t, list(X), list(lam, mu), name = "bd"))
jprob <- JumpProblem(js, list(X ~ 0), c(0, 5), aggregator = NRM())
sol <- solve(jprob, SSAStepper(), seed = 1)
tail(sol[X], 1)
#> [1] 12