SynchronousDynamics: Synchronous process dynamics

class epydemic.SynchronousDynamics(p, g=None)

Bases: Dynamics

A dynamics that runs synchronously in discrete time, applying local rules to each node in the network. These are simple to understand and simple to code for many cases, but can be statistically inexact and slow for large systems.

Parameters:
  • p (Process) – the network process to run

  • g (Union[Graph, NetworkGenerator, None]) – prototype network to run over (optional)

Extra metadata

SynchronousDynamics.TIMESTEPS_WITH_EVENTS: Final[str] = 'epydemic.dynamics.timesteps_with_events'

Metadata element holding the number timesteps that actually had events occur within them

Running a dynamics

Synchronous dynamics works as follows:

  • Any events posted for (or before) the current simulation time are fired by calling Dynamics.runPendingEvents().

  • The dynamics accesses the underlying process to acquire the event distribution for per-element events by calling Process.perElementEventDistribution().

  • For each locus having elements, it selects each element in turn and fires an event on that element with the probability given for that event, and records this through the event tap.

  • The dynamics then accesses the fixed-rate event distribution of the process by calling Process.fixedRateEventDistribution()

  • For each non-empty locus, it fires at event with the probability given for that event and records this through the event tap.

  • The current simulation time is updated.

  • This continues until the process indicates that it has reached equilibrium, as determined by Process.atEqulibrium().

SynchronousDynamics.do(params)

Execute the process under synchronous dynamics.

Parameters:

params (Dict[str, Any]) – the parameters of the simulation

Return type:

Dict[str, Any]

Returns:

a dict of experimental results