## File: SimulationFirst.htd

package info (click to toggle)
cain 1.10+dfsg-2
• area: main
• in suites: stretch
• size: 29,856 kB
• sloc: cpp: 49,612; python: 14,988; xml: 11,654; ansic: 3,644; makefile: 133; sh: 2
 file content (50 lines) | stat: -rw-r--r-- 1,922 bytes parent folder | download | duplicates (4)
 `1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950` `````` First Reaction Method

First Reaction Method

Gillespie's first reaction method generates a uniform random deviate for each reaction at each time step. These uniform deviates are used to compute exponential deviates which are the times at which each reaction will next fire. By selecting the minimum of these times, one identifies the time and the index of the first reaction to fire. The algorithm for a single step is given below.

1. for m in [1..M]:
1. Compute am from X.
2. Generate a unit, uniform random number r.
3. τm = -ln(r) / am
2. τ = minm τm
3. μ = index of the minimum τm
4. t = t + τ
5. X = X + Vμ

As with the direct method, using an efficient exponential deviate generator will improve the performance. But with the first reaction method an exponential deviate is generated for each reaction, so using a good generator is critical. One can also improve the efficiency by only computing those propensities that have changed. For this one needs a reaction influence data structure. The implementation of the first reaction method in Cain uses these optimizations.

The first reaction method is not as efficient as the direct method. Taking a step has linear complexity in the number of reactions and it requires more random numbers than the direct method. For small problems it has acceptable performance, but it is not efficient for large problems. The first reaction method may be adapted to re-use the reaction times instead of regenerating them at each step. This method is introduced next.

``````