11# FAQ
22
33## My simulation is really slow and/or using a lot of memory, what can I do?
4- To reduce memory use, use ` save_positions=(false,false) ` in the ` JumpProblem `
5- constructor as described [ earlier] (@ref save_positions_docs) to turn off saving
6- the system state before and after every jump. Combined with use of ` saveat ` in
7- the call to ` solve ` this can dramatically reduce memory usage.
4+ Exact methods simulate every jump, and by default save the state before and
5+ after each jump. To reduce memory use, use ` save_positions = (false, false) ` in
6+ the ` JumpProblem ` constructor as described [ earlier] (@ref save_positions_docs)
7+ to turn off saving the system state before and after every jump. Combined with
8+ use of ` saveat ` in the call to ` solve ` , to specify the specific times at which
9+ to save the state, this can dramatically reduce memory usage.
810
911While ` Direct ` is often fastest for systems with 10 or less ` ConstantRateJump ` s
10- or ` MassActionJump ` s, if your system has many jumps or one jump occurs most
11- frequently, other stochastic simulation algorithms may be faster. See [ Constant
12- Rate Jump Aggregators] ( @ref ) and the subsequent sections there for guidance on
13- choosing different SSAs (called aggregators in JumpProcesses).
12+ and/or ` MassActionJump ` s, if your system has many jumps or one jump occurs most
13+ frequently, other stochastic simulation algorithms may be faster. See [ Jump
14+ Aggregators for Exact Simulation] ( @ref ) and the subsequent sections there for
15+ guidance on choosing different SSAs (called aggregators in JumpProcesses). For
16+ systems with bounded ` VariableRateJump ` s using ` Coevolve ` with ` SSAStepper `
17+ instead of an ODE/SDE time stepper can give a significant performance boost.
1418
1519## When running many consecutive simulations, for example within an ` EnsembleProblem ` or loop, how can I update ` JumpProblem ` s?
1620
@@ -22,8 +26,9 @@ internal aggregators for each new parameter value or initial condition.
2226## How can I define collections of many different jumps and pass them to ` JumpProblem ` ?
2327
2428We can use ` JumpSet ` s to collect jumps together, and then pass them into
25- ` JumpProblem ` s directly. For example, using the ` MassActionJump ` and
26- ` ConstantRateJump ` defined earlier we can write
29+ ` JumpProblem ` s directly. For example, using a ` MassActionJump ` and
30+ ` ConstantRateJump ` defined in the [ second tutorial] (@ref ssa_tutorial), we can
31+ write
2732
2833``` julia
2934jset = JumpSet (mass_act_jump, birth_jump)
@@ -42,8 +47,8 @@ vj1 = VariableRateJump(rate3, affect3!)
4247vj2 = VariableRateJump (rate4, affect4!)
4348vjtuple = (vj1, vj2)
4449
45- jset = JumpSet (; constant_jumps= cjvec, variable_jumps= vjtuple,
46- massaction_jumps= mass_act_jump)
50+ jset = JumpSet (; constant_jumps = cjvec, variable_jumps = vjtuple,
51+ massaction_jumps = mass_act_jump)
4752```
4853
4954## How can I set the random number generator used in the jump process sampling algorithms (SSAs)?
@@ -66,16 +71,19 @@ default. On versions below 1.7 it uses `Xoroshiro128Star`.
6671## What are these aggregators and aggregations in JumpProcesses?
6772
6873JumpProcesses provides a variety of methods for sampling the time the next
69- ` ConstantRateJump ` or ` MassActionJump ` occurs, and which jump type happens at
70- that time. These methods are examples of stochastic simulation algorithms
71- (SSAs), also known as Gillespie methods, Doob's method, or Kinetic Monte Carlo
72- methods. In the JumpProcesses terminology we call such methods "aggregators", and
73- the cache structures that hold their basic data "aggregations". See [ Constant
74- Rate Jump Aggregators] ( @ref ) for a list of the available SSA aggregators.
74+ ` ConstantRateJump ` , ` MassActionJump ` , or ` VariableRateJump ` occurs, and which
75+ jump type happens at that time. These methods are examples of stochastic
76+ simulation algorithms (SSAs), also known as Gillespie methods, Doob's method, or
77+ Kinetic Monte Carlo methods. These are all names for jump (or point) processes
78+ simulation methods used across the biology, chemistry, engineering, mathematics,
79+ and physics literature. In the JumpProcesses terminology we call such methods
80+ "aggregators", and the cache structures that hold their basic data
81+ "aggregations". See [ Jump Aggregators for Exact Simulation] ( @ref ) for a list of
82+ the available SSA aggregators.
7583
7684## How should jumps be ordered in dependency graphs?
7785Internally, JumpProcesses SSAs (aggregators) order all ` MassActionJump ` s first,
78- then all ` ConstantRateJumps ` . i.e. in the example
86+ then all ` ConstantRateJumps ` and/or ` VariableRateJumps ` . i.e. in the example
7987
8088``` julia
8189using JumpProcesses
@@ -99,15 +107,15 @@ The four jumps would be ordered by the first jump in `maj`, the second jump in
99107` maj ` , ` cj1 ` , and finally ` cj2 ` . Any user-generated dependency graphs should
100108then follow this ordering when assigning an integer id to each jump.
101109
102- See also [ Constant Rate Jump Aggregators Requiring Dependency Graphs] ( @ref ) for
110+ See also [ Jump Aggregators Requiring Dependency Graphs] ( @ref ) for
103111more on dependency graphs needed for the various SSAs.
104112
105- ## How do I use callbacks with ` ConstantRateJump ` or ` MassActionJump ` systems ?
113+ ## How do I use callbacks with jump simulations ?
106114
107- Callbacks can be used with ` ConstantRateJump ` s and ` MassActionJump ` s. When
108- solving a pure jump system with ` SSAStepper ` , only discrete callbacks can be
109- used (otherwise a different time stepper is needed). When using an ODE or SDE
110- time stepper any callback should work.
115+ Callbacks can be used with ` ConstantRateJump ` s, ` MassActionJump ` s, and
116+ ` VariableRateJump ` s. When solving a pure jump system with ` SSAStepper ` , only
117+ discrete callbacks can be used (otherwise a different time stepper is needed).
118+ When using an ODE or SDE time stepper any callback should work.
111119
112120* Note, when modifying ` u ` or ` p ` within a callback, you must call
113121[ ` reset_aggregated_jumps! ` ] ( @ref ) after making updates.* This ensures that the
0 commit comments