MikeHatchi / py-propagsim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This is the implementation in Python of a propagation model that we propose to call CAST as Cell Agent State Transitions.

Model description

Basic objects

Basically, this model considers three types of object:

  1. Cell. A cell can contain 0, 1 or many agents at any time. It has also a position (Euclidean coordinates on a plan)
  2. Agent. An agent has one (and only one) state at a given moment, and is also in one (and only one) cell. The cell where an agent is initially is considered to be its home_cell.
  3. State. A state has a predefined severity, contagiousity and sensitivity, all in (0, 1)

Contagion

A contagion happens within a cell, when it contains several agents at the same time and one of them is contagious. When an agent has a state with contagiousity > 0, then the other agents in the same cell can get infected. The probability of Agent_1 to contaminate Agent_2 in cell is given by:

NB:

  • The highest contagiousity in the cell is taken to compute p.
  • The unsafety of a cell measures how a cell is unsafe for contagion (social distancing respected or not inside etc.)

If Agent_2 gets infected, it gets to its own state having the least strictly positive severity (it can't jump directly to a more severe state).

State transition

A state transition matrix and state durations are attached to each agent. The state transition matrix is a Markovian matrix describing the transition probabilities between the states an agent can take. The state durations are the duration of each state. If a agent is in a given state, it will switch to another one sampled according to its state transition matrix

NB: Different agents can share the same states and the same state transition matrix but have different state durations, or have have the same state, the same state durations but a different state transition matrix, or etc.

Moves

A move consists in moving agents to other cells. When a move is done, all agents are concerned. It happens it two steps:

  1. Selecting agents that will move
  2. moving the selected agents to their new cells

Agent selection

The probability of an agent to be selected for a move is:

The first factor represents the mobility of the agent so to say. The second factor represents the fact that the more severe the state of an agent, the less the probability that it will move.

Cell selection

The cell where to move a selected agent is sampled according to a probability

NB:

  • a limitation of this model is that the attractivity of each cell is the same for all agent. An extension / refinement of this model would be to have cell attractivities personalized by agent.
  • The distance is always computed from the home_cell of an agent, not from its current_cell. An agent is considered wandering around its home_cell
  • The agents not selected for a move will be moved to their home_cell afterward

About


Languages

Language:Python 100.0%