SynchronousDynamics: Synchronous process dynamics

class epydemic.SynchronousDynamics(g=None)

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.

Creating a dynamics class


Create a dynamics, optionally initialised to run on the given prototype network.

Parameters:g – prototype network to run over (optional)

Extra metadata

The synchronous dynamics records extra metadata.

SynchronousDynamics.TIMESTEPS_WITH_EVENTS = ‘timesteps_with_events’

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

Running a dynamics

To run a process’ dynamics we need to define two things: the event distribution, and the overall experimental control that runs the experiment and packages-up some key common results. The event distribution is inherited from the Dynamics.eventDistribution() method.

Synchronous dynamics. We apply dynamics() at each timestep and then check for completion using at_equilibrium().

Parameters:params – the parameters of the simulation
Returns:a dict of experimental results