Gillespie Algorithm
Gillespie Algorithm
Gillespie Algorithm
Dr Rich Bingham
Gillespie Algorithm
In previous practicals, you have used Poisson processes to model birth/death processes. While these
can be useful, when multiple events overlap, the approximations used to justify them break down.
A powerful & popular alternative to the Poisson process simulation is the Gillespie algorithm, or the
stochastic simulation algorithm.
Idea
If we can calculate the probabilities of every event that can happen in a system, we can know what is
most likely to happen next. By randomly picking the next event weighted according to the
probabilities, we can reconstruct likely trajectories of the system while still allowing for variation.
System states
Sampling frequencies
Gillespie Algorithm
The algorithm is deceptively simple.
Setting up the number of each constituents & setting rates & time.
Using the description of the model we can evaluate the ‘probability’ of every process.
3 – Pick Reaction
Using the probabilities to weight the choice, randomly pick a process to run.
[1]
[2]
[3]
=
T_P P(1) P(2) P(3)
Step 3
Pick a random number (r) & scale by the probability
r * T_P =
This means we are going to fire reaction 3
P(1) P(2) P(3)
Running the algorithm
The timestep scaling ensures that your simulation happens at the correct speed. The random
reaction selection ensures proper sampling.
Step 4
We are firing reaction 3
P(3)
Iterate the populations
n_t = n_t -1 n_v = n_v -1 n_i = n_i + 1
Give it a go yourself!