gillepsie.md 1.64 KB
Newer Older
Victor's avatar
Victor committed
1
2
3
4
5
6
7
8
# Gillepsie algorithm

## Mathematical foundations

- The original article by Gillepsie:
[**A general method for numerically simulating the stochastic time evolution of coupled chemical reactions**](https://www.sciencedirect.com/science/article/pii/0021999176900413?via%3Dihub)


Victor's avatar
Victor committed
9
10
### Update Rates
 `` b_i `` and `` d_i `` represent respcetively birth and death rates of agents ``i``. The total rate is given by the sum of all individual rates
Victor's avatar
Victor committed
11
12
13
```math
R(t) = \left[ \sum_i b_i(t) + d_i(t) \right]
```
Victor's avatar
Victor committed
14
A particular event, birth or death, is chosen at random with a probability equal to the rate of this event divided by the total rate ``R``
Victor's avatar
Victor committed
15
16

### Time steps
Victor's avatar
Victor committed
17
An event is exponentiallly distributed in time, with parameter ``\lambda = U(t)``. This makes events memoryless, meaning that the probability of having a birth or death event is always the same, no matter when (``P(X > s_t | X > t) = P(X > s) ``.
Victor's avatar
Victor committed
18

Victor's avatar
Victor committed
19
20
!!! tip "Inversion method"
    Let ``B(t) = \sum_i b_i(t)`` and  ``D(t) = \sum_i d_i(t)``. Let ``T_b, T_d`` the time for a birth or death event to occur. Then we have ``P(T_b < T_d) = \frac{B(t)}{B(t) + D(t)}``  (competing exponentials).
Victor's avatar
Victor committed
21

Victor's avatar
Victor committed
22
23
24
25
    Let ``U`` be an ``\mathcal{U}_{(0,1)}``-distributed random variable and ``F \colon \R \to [0,1]`` be a distribution function. Then we have
    ```math
    P(I_F(U) \leq x ) = P(U \leq F(x)) = F(x)
    ```
Victor's avatar
Victor committed
26
27


Victor's avatar
Victor committed
28
    Thanks to the ***inversion method*** we get the incremental time step ``dt``, exponentially distributed with parameter ``\lambda = R(t)``, as
Victor's avatar
Victor committed
29

Victor's avatar
Victor committed
30
31
32
    ```math
        dt(\omega) = -\frac{\log(U(\omega))}{R(t)} \iff X(\omega) = \exp(-U(t)dt(\omega))
    ```
Victor's avatar
Victor committed
33
34
35
36
37

```@autodocs
Modules = [ABMEv]
Pages   = ["ABMEv_Gillepsie.jl"]
```