Markov Jump Model¶
- class pints.toy.stochastic.MarkovJumpModel(x0, V, propensities)[source]¶
A general purpose Markov Jump model used for any systems of reactions that proceed through jumps.
A population of N different species is simulated, reacting through M different reaction equations.
Simulations are performed using Gillespie’s algorithm [1], [2]:
Sample values \(r_0\), \(r_1\), from a uniform distribution
\[r_0, r_1 \sim U(0,1)\]Calculate the time \(\tau\) until the next single reaction as
\[\tau = \frac{-\ln(r)}{a_0}\]where \(a_0\) is the sum of the propensities at the current time.
3. Decide which reaction, i, takes place using \(r_1 * a_0\) and iterating through propensities. Since \(r_1\) is a a value between 0 and 1 and :math`a_0` is the sum of all propensities, we can find \(k\) for which \(s_k / a_0 <= r_2 < s_(k+1) / a_0\) where \(s_j\) is the sum of the first \(j\) propensities at time \(t\). We then choose \(i\) as the reaction corresponding to propensity k.
Update the state \(x\) at time \(t + \tau\) as:
\[x(t + \tau) = x(t) + V[i]\]4. Return to step (1) until no reaction can take place or the process has gone past the maximum time.
Extends
pints.ForwardModel
,pints.toy.ToyModel
.- Parameters:
x_0 – An N-vector specifying the initial population of each of the N species.
V – An NxM matrix consisting of stochiometric vectors \(v_i\) specifying the changes to the state, x, from reaction i taking place.
propensities – A function from the current state, x, and reaction rates, k, to a vector of the rates of each reaction taking place.
References
- interpolate_mol_counts(time, mol_count, output_times)[source]¶
Takes raw times and inputs and mol counts and outputs interpolated values at output_times
- n_outputs()¶
Returns the number of outputs this model has. The default is 1.
- suggested_parameters()¶
Returns an NumPy array of the parameter values that are representative of the model.
For example, these parameters might reproduce a particular result that the model is famous for.
- suggested_times()¶
Returns an NumPy array of time points that is representative of the model