Simulation
BioSimulator.parse_model
— Functionparse_model(network::Network)
Construct a state <: Vector{Int}
and model <: ReactionSystem
from a Network
object.
Use this in simulate
to avoid constructing internal data structures over multiple samples.
BioSimulator.simulate
— Functionsimulate(network::Network, algname::SimulationAlgorithm;
[tfinal = 0.0],
[rates_cache = HasRates],
[save_points = nothing],
[save_function = __extract])
Simulate a Network
of interacting populations. Note that simulations may terminate early if the cumulative intensity reaches 0
(that is, reaching an absorbing state).
Keyword Arguments
tfinal
: The final simulation time.rates_cache
: Indicates the type of information stored in arates
cache. IfHasRates
is chosen, store the actual rates. IfHasSums
is chosen, store partial sums of therates
. This effectively toggles between linear and binary searches, provided the algorithm supports the option.save_points
: An indexable collection indicating time points to sample and record system state. The defaultnothing
forces saving after every reaction event.save_function
: A three argument function that maps the three arguments(simulator, state, model)
to data recorded in aSamplePath
. Default behavior is to record each species.
simulate(state, model, algname::SimulationAlgorithm;
[tfinal = 0.0],
[rates_cache = HasRates],
[save_points = nothing],
[save_function = __extract])
Simulate a model
with the given initial state
. Note that simulations may terminate early if the cumulative intensity reaches 0
(that is, reaching an absorbing state).
Arguments
For well-mixed systems:
state
: AVector{Int}
constructed byparse_model
.model
: AReactionSystem
type constructed byparse_model
.
For lattice-based systems:
state
: ALattice
type whose topology comptabile is compatible withmodel
.model
: AnInteractingParticleSystem
type built from@enumerate_with_sclass
.
Keyword Arguments
tfinal
: The final simulation time.rates_cache
: Indicates the type of information stored in arates
cache. IfHasRates
is chosen, store the actual rates. IfHasSums
is chosen, store partial sums of therates
. This effectively toggles between linear and binary searches, provided the algorithm supports the option.save_points
: An indexable collection indicating time points to sample and record system state. The defaultnothing
forces saving after every reaction event.save_function
: A three argument function that maps the three arguments(simulator, state, model)
to data recorded in aSamplePath
. Default behavior is to store population counts for well-mixed systems orConfiguration
objects for lattice-based systems.