Skip to content

Namespace epimodels

Namespace List > epimodels

Namespace containing predefined epidemiological models and related functions. More...

Classes

Type Name
class Agent <typename TSeq>
Agent (agents).
class AgentIdsView
Read-only view of a contiguous run of agent ids.
class AgentsSample <typename TSeq>
class ContactMatrix
class ContactRecord
Represents a single contact relationship for an agent.
class ContactTracing
Class for tracing contacts between agents.
class DataBase <typename TSeq>
Statistical data about the process.
class Entities <typename TSeq>
class Entity <typename TSeq>
struct Event <typename TSeq>
Event data for update an agent.
class GlobalEvent <typename TSeq>
Template for a Global Event .
class Model <typename TSeq>
Core class of epiworld.
class ModelDiffNet <typename TSeq>
Template for a Network Diffusion Model .
class ModelSEIR <typename TSeq>
Template for a Susceptible-Exposed-Infected-Removed (SEIR) model.
class ModelSEIRCONN <typename TSeq>
Template for a Susceptible-Exposed-Infected-Removed (SEIR) model with connected population.
class ModelSEIRD <typename TSeq>
Template for a Susceptible-Exposed-Infected-Removed-Deceased (SEIRD) model.
class ModelSEIRDCONN <typename TSeq>
Template for a Susceptible-Exposed-Infected-Removed-Deceased (SEIRD) model with connected population.
class ModelSEIRMixing <typename TSeq>
class ModelSEIRMixingQuarantine <typename TSeq>
SEIR model with mixing, quarantine, and contact tracing.
class ModelSEIRNetworkQuarantine <typename TSeq>
SEIR model with network-based contacts, quarantine, and contact tracing.
class ModelSIR <typename TSeq>
Template for a Susceptible-Infected-Removed (SIR) model.
class ModelSIRCONN <typename TSeq>
Template for a Susceptible-Infected-Removed (SIR) model with connected population.
class ModelSIRD <typename TSeq>
Template for a Susceptible-Infected-Removed-Deceased (SIRD) model.
class ModelSIRDCONN <typename TSeq>
Template for a Susceptible-Infected-Removed-Deceased (SIRD) model with connected population.
class ModelSIRLogit <typename TSeq>
Template for a Susceptible-Infected-Removed (SIR) model.
class ModelSIRMixing <typename TSeq>
class ModelSIS <typename TSeq>
Template for a Susceptible-Infected-Susceptible (SIS) model.
class ModelSISD <typename TSeq>
Template for a Susceptible-Infected-Susceptible-Deceased (SISD) model.
class ModelSURV <typename TSeq>
Template for a Surveillance model.
class NeighborsView <typename TSeq>
Non-allocating range over an agent's neighbors.
class PersonTools <typename TSeq>
struct PostSamplingScratch
Model-local storage used to batch sampled contacts.
class Queue <typename TSeq>
Controls which agents are verified at each step.
class SampledContactsView
Read-only view of the agents one infectious agent was in contact with.
class Tool <typename TSeq>
Tools for defending the agent against the virus.
class UserData <typename TSeq>
class Virus <typename TSeq>
Virus .
class Viruses <typename TSeq>
Set of viruses (useful for building iterators).
class Viruses_const <typename TSeq>
Set of Viruses (const) (useful for iterators).

Public Types

Type Name
typedef std::shared_ptr< Entity< TSeq > > EntityPtr
typedef std::function< void(Entity< TSeq > &, Model< TSeq > *)> EntityToAgentFun
Decides how to distribute entities at initialization.
enum uint8_t EventAction
typedef std::function< void(Event< TSeq > &, Model< TSeq > *)> EventFun
typedef std::shared_ptr< GlobalEvent< TSeq > > GlobalEventPtr
typedef std::function< void(Model< TSeq > *)> GlobalFun
typedef std::function< epiworld_double(Agent< TSeq > *, VirusPtr< TSeq > &, Model< TSeq > *)> MixerFun
typedef std::function< bool(Agent< TSeq > *, Virus< TSeq > &, Model< TSeq > *)> MutFun
typedef std::function< void(Agent< TSeq > *, Virus< TSeq > &, Model< TSeq > *)> PostRecoveryFun
typedef std::function< void(Agent< TSeq > *, const SampledContactsView &, Model< TSeq > *) > PostSamplingFun
Callback run after the contacts of a step were sampled.
typedef std::function< epiworld_double(Tool< TSeq > &, Agent< TSeq > *, VirusPtr< TSeq > &, Model< TSeq > *)> ToolFun
typedef std::shared_ptr< Tool< TSeq > > ToolPtr
typedef std::function< void(Tool< TSeq > &, Model< TSeq > *)> ToolToAgentFun
Decides how to distribute tools at initialization.
enum uint8_t TransmissionMode
How network transmission is sampled each step.
typedef std::function< void(Agent< TSeq > *, Model< TSeq > *)> UpdateFun
typedef std::function< epiworld_double(Agent< TSeq > *, Virus< TSeq > &, Model< TSeq > *)> VirusFun
typedef std::shared_ptr< Virus< TSeq > > VirusPtr
typedef std::function< void(Virus< TSeq > &, Model< TSeq > *)> VirusToAgentFun
Decides how to distribute viruses at initialization.

Public Functions

Type Name
std::function< void(size_t, Model< TSeq > *)> make_save_run (std::string fmt="%03lu-episimulation.csv", bool total_hist=true, bool virus_info=false, bool virus_hist=false, bool tool_info=false, bool tool_hist=false, bool transmission=false, bool transition=false, bool reproductive=false, bool generation=false, bool active_cases=false, bool outbreak_size=false, bool hospitalizations=false)

Detailed Description

This namespace provides a collection of epidemiological models commonly used in disease simulation and modeling. It includes various compartmental models such as SIS, SIR, SEIR, and their variations, as well as specialized models for specific scenarios like connected populations, quarantine measures, and school environments.

The namespace also contains initialization functions, global event handlers, and surveillance mechanisms that can be used across different epidemiological models.

Available model categories include:

  • Basic compartmental models (SIS, SIR, SEIR)
  • Models with death compartments (SIRD, SISD, SEIRD)
  • Connected population models (SIRConnected, SEIRConnected, SIRDConnected, SEIRDConnected)
  • Logistic regression models (SIRLogit)
  • Mixing population models (SEIRMixing, SIRMixing)
  • Quarantine models (SEIRMixingQuarantine)
  • School-specific models (MeaslesSchool)
  • Disease-specific models (MeaslesMixing, MeaslesMixingRiskQuarantine)
  • Diffusion network models (DiffNet)
  • Surveillance systems

Public Types Documentation

typedef EntityPtr

using epimodels::EntityPtr =  std::shared_ptr< Entity< TSeq > >;

typedef EntityToAgentFun

Decides how to distribute entities at initialization.

using epimodels::EntityToAgentFun =  std::function<void(Entity<TSeq>&,Model<TSeq>*)>;


enum EventAction

enum epimodels::EventAction {
    AddVirus,
    AddTool,
    AddEntity,
    RemoveVirus,
    RemoveTool,
    RemoveEntity,
    ChangeState
};

typedef EventFun

using epimodels::EventFun =  std::function<void(Event<TSeq>&,Model<TSeq>*)>;

typedef GlobalEventPtr

using epimodels::GlobalEventPtr =  std::shared_ptr< GlobalEvent< TSeq > >;

typedef GlobalFun

using epimodels::GlobalFun =  std::function<void(Model<TSeq>*)>;

typedef MixerFun

using epimodels::MixerFun =  std::function<epiworld_double(Agent<TSeq>*,VirusPtr<TSeq>&,Model<TSeq>*)>;

typedef MutFun

using epimodels::MutFun =  std::function<bool(Agent<TSeq>*,Virus<TSeq>&,Model<TSeq>*)>;

typedef PostRecoveryFun

using epimodels::PostRecoveryFun =  std::function<void(Agent<TSeq>*,Virus<TSeq>&,Model<TSeq>*)>;

typedef PostSamplingFun

Callback run after the contacts of a step were sampled.

using epimodels::PostSamplingFun =  std::function<
    void(Agent<TSeq> *, const SampledContactsView &, Model<TSeq> *)
>;

Called once per infectious agent that had at least one sampled contact in the step, in ascending order of the agent's id, after all the susceptible agents were updated and right before the events are applied. The agents still have the state they had when the contacts were sampled; events the callback queues are applied in the same step.

Arguments: the infectious agent, the ids of the agents it was in contact with (see SampledContactsView), and the model.


typedef ToolFun

using epimodels::ToolFun =  std::function<epiworld_double(Tool<TSeq>&,Agent<TSeq>*,VirusPtr<TSeq>&,Model<TSeq>*)>;

typedef ToolPtr

using epimodels::ToolPtr =  std::shared_ptr< Tool< TSeq > >;

typedef ToolToAgentFun

Decides how to distribute tools at initialization.

using epimodels::ToolToAgentFun =  std::function<void(Tool<TSeq>&,Model<TSeq>*)>;


enum TransmissionMode

How network transmission is sampled each step.

enum epimodels::TransmissionMode {
    automatic,
    push,
    pull
};

Susceptible agents whose update function is default_update_susceptible or sampler::make_update_susceptible() can acquire a virus in two ways that give the same distribution of outcomes:

  • pull: each susceptible agent scans its neighbors and draws its infector with roulette() (the approach of epiworld <= 0.15).
  • push: each agent carrying a virus adds its infection odds to its susceptible neighbors, and each of those then makes one draw. Its cost scales with the carriers' ties rather than with the susceptibles'.
  • automatic (the default): picks whichever of the two is cheaper at each step.

Only the stream of random numbers differs between the modes; pull reproduces the streams of earlier versions. See Model::set_transmission_mode().


typedef UpdateFun

using epimodels::UpdateFun =  std::function<void(Agent<TSeq>*,Model<TSeq>*)>;

typedef VirusFun

using epimodels::VirusFun =  std::function<epiworld_double(Agent<TSeq>*,Virus<TSeq>&,Model<TSeq>*)>;

typedef VirusPtr

using epimodels::VirusPtr =  std::shared_ptr< Virus< TSeq > >;

typedef VirusToAgentFun

Decides how to distribute viruses at initialization.

using epimodels::VirusToAgentFun =  std::function<void(Virus<TSeq>&,Model<TSeq>*)>;


Public Functions Documentation

function make_save_run

template<typename TSeq>
inline std::function< void(size_t, Model < TSeq > *)> epimodels::make_save_run (
    std::string fmt="%03lu-episimulation.csv",
    bool total_hist=true,
    bool virus_info=false,
    bool virus_hist=false,
    bool tool_info=false,
    bool tool_hist=false,
    bool transmission=false,
    bool transition=false,
    bool reproductive=false,
    bool generation=false,
    bool active_cases=false,
    bool outbreak_size=false,
    bool hospitalizations=false
) 


The documentation for this class was generated from the following file include/epiworld/models/models.hpp