Skip to main content

Table 2 The Hybrid Simulation Algorithm (Algorithm 1)

From: Fine-tuning anti-tumor immunotherapies via stochastic simulations

Require: (T0, E0, I0), t0, t stop .

1: set the initial state to (T0, E0, I(t0)) and the initial time t to t0;

2: while t < t stop do

3:    let x be the current state, for j∈S evaluate a j (x), define a 0 S = ∑ j ∈ S a j ( x ) ;

4:    let χ be a random number with distribution Exp(1), solve the transcendental equation

    A 4 ( Ï„ ) + a 0 S Ï„ + A 7 ( Ï„ ) = χ

   and then define a 0 = a 0 S + a 4 ( t + Ï„ ) + a 7 ( t + Ï„ ) ;

5:    let r be a random number U[0, 1], for the next event to fire find j by solving

    ∑ i = 1 j - 1 a i ( t + Ï„ ) < r â‹… a 0 ≤ ∑ i = 1 j a i ( t + Ï„ )

   where if i∈S then a i (t + Ï„ ) = a i (x);

6:    update (T, E, I(t)) to (T + νT,j, E + νE,j, I(t + Ï„ )) and change clock to t + Ï„ ;

7: end while

  1. Input: initial state (T0, E0, I0), start time t0, stop time t stop .