An FPMAS implementation of the classical SIR epidemiological model. An agent behavior for one time step can be described as follows:
- Propagate infection to agents in the Moore neighborhood. Each agent has a probability infection_rate to infect other agents.
- If infected, recover with a probability recover_rate.
- If still infected, die with a probability mortality_rate.
- If alive, move to a random cell in the Moore neighborhood.
Compared to the classical SIR notations:
- recover_rate is equivalent to gamma.
- infection_rate is equivalent to beta / contact_count. In this Multi-Agent System model, the average contact count can't be controlled directly, since it is determined at each time step by the size of the grid and the agent counts.
- mortality_rate is equivalent to mu.
The execution scheme is such as agents independently execute the 4 behaviors in a row, and a global synchronization is applied only when all agents have executed all the behaviors, marking the end of the current time step. How the infection propagates might depend on the selected infection and synchronization modes.
Ensures that the FPMAS platform is properly
installed. An additional -DCMAKE_PREFIX_PATH=custom/installation/path/
might
be specified to cmake
if FPMAS
is not installed in a standard directory
(the installation path corresponds to the -DCMAKE_INSTALL_PREFIX
eventually
specified when building FPMAS
).
git clone https://github.com/FPMAS/fpmas-virus
cd fpmas-virus
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make
Model parameters are described in the config.yml
file. Here we focus on the infection_mode
and sync_mode
parameters.
infection_mode
: Defines the infection behaviorWRITE
: each infected agent acquires its neighbors and infect them with a probability infection_rate. Only works with theHARD_SYNC
mode.READ
: read only infection. Each agent performsN
Bernoulli experiments of parameter infection_rate, whereN
it the count ofINFECTED
agents in its neighborhood: if at least one experiment succeeds, the agent getsINFECTED
. Works withHARD_SYNC
,GHOST
andGLOBAL_GHOST
synchronizations.
sync_mode
: Synchronization mode used to perform read/write operations.HARD_SYNC
: strongest synchronization, all read/acquire are performed on the fly, during the time step, even across processes. Each run is not reproducible.GHOST
: onlydistant
agents are read from a ghost copy updated at each time step. Reproducible between executions, but dependent on the process count.GLOBAL_GHOST
: all agents,distant
andlocal
, are read from a ghost copy. All runs are reproducible, independently of the process count.
The model can be run with the following command:
mpiexec -n <N> ./fpmas-virus <config_file> [-s seed]
N
: processes countconfig_file
: a.yml
configuration fileseed
(optional): a random seed
The ./seed N
utility command can also be used to deterministically generate a
set of N
seeds that can be passed to the model.
The generated output.csv
file contains the following fields:
T | S | I | R | D |
---|---|---|---|---|
Time | SUSCEPTIBLE |
INFECTED |
RECOVERED |
DEAD |
Python script used to plot results is not provided in this repository any more, as it was heavily dependent on the experimental context. Here is however an example plot that can be obtained from the CSV output of a model simulated with the default config.yml file and the default seed:
For more information about this model or its implementation, please contact:
- Paul Breugnot (developer): paul.breugnot@univ-fcomte.fr
- Laurent Philippe (supervisor): laurent.philippe@univ-fcomte.fr
- Bénédicte Herrmann (supervisor): benedicte.herrmann@univ-fcomte.fr
- Christophe Lang (supervisor): christophe.lang@univ-fcomte.fr