Continuous Time Discrete Event Module for Julia - adolgert/CTDE.jl GitHub Wiki

This module creates stochastic simulations in continuous time suitable for discrete event simulation.

  • Stochastic - Uses a random number generator to create a sequence of events whose probability distribution is well-defined but whose values change each time it is run.
  • Continuous time - There isn't a clock-tick to the simulation, so events happen at the rate with which they are prescribed to happen. No two events happen at the same time. No events happen immediately after another event.
  • Gillespie-type algorithm - This can perform chemical simulations using Gillespie algorithms, or any other kind of simulation where the rate for each transition is specified by a hazard rate.
  • Non-constant hazard rates - Most Gillespie-type simulations specify each reaction with an exponential distribution, but these simulations can use Weibull, Gamma, or other distributions, including estimators of distributions measured in the field. They still fire correctly, according to Gillespie's algorithm.

How do I create a simulation?

  1. Create a physical state for the system.
  2. Create transitions which change that state.
    1. Each transition has a hazard rate.
    2. Each transition has a firing operator.
  3. Make an observer for the simulation.
  4. Tell it to run.

Examples

  • Well-mixed SIR as a test of Ball and Nasell's predictions of SIR final size distributions.
  • Bouncing Rabbits which move on a two-dimensional board, without stepping on each other, but they infect each other, sadly.
  • Susceptible-Infectious-Susceptible This is a good test of the samplers because results are well-known. It plots the master probabilities for a regenerative process.
  • Object-based Simulation This doesn't use dictionary keys in order to access substates of the physical state. It uses the objects themselves, which lends it to more free-form simulation.