epymorph.simulator.world
The World
represents the simulation state at a given point in time.
World
implementations keep track of how many locations are being simulated,
and the compartmental breakdown of individuals in each of those locations.
They also keep track of groups of individuals which have moved between locations
and will eventually be returning or moving to another location.
Cohort
Bases: Protocol
A group of individuals who may be home or traveling.
If they are traveling, they may have a location to which they'll return and knowledge of when to do so.
compartments
instance-attribute
The group membership by compartment. A (C,)-shaped array.
return_location
instance-attribute
return_location: int
The location to which this cohort will return, or if they are home, the location where they currently are.
return_tick
instance-attribute
return_tick: int
The simulation tick on which they will return. -1 implies never.
World
Bases: ABC
An abstract world model.
get_cohorts
abstractmethod
get_cohort_array
abstractmethod
get_local_array
abstractmethod
apply_cohort_delta
abstractmethod
Apply a transition delta for all cohorts at the given location, updating the populations in each compartment.
Parameters:
apply_travel
abstractmethod
Apply travel flows to the entire world, updating the cohorts at each location.
Parameters:
apply_return
abstractmethod
Apply return-home flows to the entire world, updating the cohorts at each location. This finds cohorts which should return home (by looking at their return tick) and does so.
Parameters:
-
tick
(Tick
) –The current simulation tick.
-
return_stats
(bool
) –True to collect movement statistics and provide them as the function's return value.
Returns: