Class SIR

All Implemented Interfaces:
Runnable, IBS.HasIBS, MilestoneListener, Model.HasDE, Model.HasDE.ODE, Model.HasDE.PDE, Model.HasDE.SDE, Features, HasHistogram, HasHistogram.Degree, HasHistogram.StatisticsProbability, HasHistogram.StatisticsStationary, HasHistogram.StatisticsTime, HasMean, HasMean.Traits, HasPop2D, HasPop2D.Traits, HasPop3D, HasPop3D.Traits, HasS3, CLOProvider

The SIR module implements the classic Susceptible-Infected-Recovered (SIR) model of disease dynamics. It simulates the spread of an infectious disease through a population divided into three cohorts: susceptible (S), infected (I), and recovered (R). The model is defined by transition probabilities/rates between these cohorts:
  • S -> I: Susceptible individuals become infected with a certain probability/rate
  • I -> R: Infected individuals recover with a certain probability/rate
  • I -> S: Infected individuals can become susceptible again (optional)
  • R -> S: Recovered individuals can become susceptible again with a certain probability/rate
Author:
Christoph Hauert
  • Field Details

    • S

      static final int S
      The index of the susceptible trait/cohort.
      See Also:
    • I

      static final int I
      The index of the infected trait/cohort.
      See Also:
    • R

      static final int R
      The index of the recovered trait/cohort.
      See Also:
    • pSI

      double pSI
      The transition probability/rate for susceptibles to infected, S -> I.
    • pIR

      double pIR
      The transition probability/rate for infected to recovered, I -> R.
    • pIS

      double pIS
      The transition probability/rate for infected to susceptible, I -> S.
    • pRS

      double pRS
      The transition probability/rate for recovered to susceptible, R -> S.
    • cloInfect

      public final CLOption cloInfect
      Command line option to set the transition probability for S -> I.
    • cloRecover

      public final CLOption cloRecover
      Command line option to set the transition probability for I -> R.
    • cloResist

      public final CLOption cloResist
      Command line option to set the transition probability for R -> S.
  • Constructor Details

    • SIR

      public SIR(EvoLudo engine)
      Create a new SIR module with the given pacemaker.
      Parameters:
      engine - the pacemaker for running the model
  • Method Details

    • getTitle

      public String getTitle()
      Description copied from interface: Features
      Returns title of active module, e.g. 2x2 games in TBT returns "2x2 Games".
      Specified by:
      getTitle in interface Features
      Returns:
      the title of active module
    • load

      public void load()
      Description copied from class: Module
      Load new module and perform basic initializations.
      Overrides:
      load in class Discrete
      See Also:
    • getDependent

      public int getDependent()
      Description copied from interface: Model.HasDE
      For replicator dynamics the frequencies of all traits must sum up to one. Hence, for nTraits traits there are only nTraits-1 degrees of freedom. The index returned by getDependent() marks the one rate of change that is derived from all the others.

      Notes:

      • Dependent traits are used by models where the frequencies of all types must sum up to one.
      • Density modules do not have dependent traits and getDependent() should return -1.
      • Currently differential equations implementations are only provided for Discrete modules.
      Specified by:
      getDependent in interface Model.HasDE
      Returns:
      the index of the dependent trait (or -1 if there is none)
    • collectCLO

      public void collectCLO(CLOParser parser)
      Description copied from interface: CLOProvider
      All providers of command line options must implement this method to collect their options.

      Each command line option is (uniquely) identified by it's name (see CLOption.getName()), which corresponds to the long version of the option. If an attempt is made to add an option with a name that already exists, the parser issues a warning and ignores the option. Thus, in general, implementing subclasses should first register their options and call super.collectCLO(CLOParser) at the end such that subclasses are able to override command line options specified in a parental class.

      Override this method in subclasses to add further command line options. Subclasses must make sure that they include a call to super.

      Specified by:
      collectCLO in interface CLOProvider
      Overrides:
      collectCLO in class Discrete
      Parameters:
      parser - the reference to parser that manages command line options
      See Also:
    • getDerivatives

      void getDerivatives(double t, double[] state, double[] unused, double[] change)
      The SIR model is defined by the following equations:

      \begin{align*} \frac{dS}{dt} =& R \cdot p_{RS} + I \cdot p_{IS} - S \cdot I \cdot p_{SI} \\ \frac{dI}{dt} =& S \cdot I \cdot p_{SI} - I \cdot (p_{IR} + p_{IS}) \\ \frac{dR}{dt} =& I \cdot p_{IR} - R \cdot p_{RS} \end{align*}

      where \(S\), \(I\), and \(R\) are the densities of susceptible, infected, and recovered cohorts of individuals and \(p_{SI}, p_{IR}, p_{RS}\), and \(p_{IS}\) are the transition rates between the different cohorts.

      Parameters:
      t - the current time (not used in this model)
      state - the current state of the system, an array containing the densities of the susceptible, infected, and recovered cohorts
      unused - an unused array (for compatibility with the Features.Payoffs interface)
      change - the array to store the changes in the densities of the cohorts
    • createModel

      public Model createModel(Type type)
      Description copied from class: Module
      Creates a model of type type for module.

      Note: Override to provide custom model implementations.

      Important: any custom model implementations that involve random numbers, must use the shared random number generator for reproducibility

      Overrides:
      createModel in class Module
      Parameters:
      type - the type of Model to create
      Returns:
      the model for module or null if the module does not support the requested model type
      See Also:
    • createIBSPop

      public IBSDPopulation createIBSPop()
      Description copied from class: Module
      Opportunity to supply custom individual based simulations.
      Overrides:
      createIBSPop in class Module
      Returns:
      the custom IBSPopulation or null to use default.