Agent-based model for Covid-19 transmission in supermarkets
Project description
Agent-based model for COVID-19 transmission in supermarkets.
This code accompanies the paper "Modelling COVID-19 transmission in supermarkets using an agent-based model".
Install
> pip install covid19-supermarket-abm
Example
In the example below, we use the example data included in the package to simulate a day in the fictitious store given the parameters below.
from covid19_supermarket_abm.utils.load_example_data import load_example_store_graph, load_example_paths
from covid19_supermarket_abm.path_generators import get_path_generator
from covid19_supermarket_abm.simulator import simulate_one_day
# Set parameters
config = {'arrival_rate': 2.55, # Poisson rate at which customers arrival
'traversal_time': 0.2, # mean wait time per node
'num_hours_open': 14, # store opening hours
'infection_proportion': 0.0011, # proportion of customers that are infectious
}
# load synthetic data
zone_paths = load_example_paths()
G = load_example_store_graph()
# Create a path generator function which feeds our model with customer paths
path_generator_function, path_generator_args = get_path_generator(G, zone_paths)
# Simulate a day and store results in results
results_dict = simulate_one_day(config, G, path_generator_function, path_generator_args)
We can examine the results that are stored in results_dict
.
> print(list(results_dict.keys()))
['num_cust', 'num_S', 'num_I', 'total_time_with_infected', 'num_contacts_per_cust', 'num_cust_w_contact', 'mean_num_cust_in_store', 'max_num_cust_in_store', 'num_contacts', 'shopping_times', 'mean_shopping_time', 'num_waiting_people', 'mean_waiting_time', 'store_open_length', 'df_num_encounters', 'df_time_with_infected', 'total_time_crowded']
See below for their description.
Key | Description |
---|---|
num_cust |
Total number of customers |
num_S |
Number of susceptible customers |
num_I |
Number of infected customers |
total_time_with_infected |
Total exposure time |
num_contacts_per_cust |
Number of contacts with infectious customers per susceptible customer |
num_cust_w_contact |
Number of susceptible customers which have at least one contact with an infectious customer |
mean_num_cust_in_store |
Mean number of customers in the store during the simulation |
max_num_cust_in_store |
Maximum number of customers in the store during the simulation |
num_contacts |
Total number of contacts between infectious customers and susceptible customers |
df_num_encounters |
Dataframe which contains the the number of encounters with infectious customers for each node |
shopping_times |
Array that contains the length of all customer shopping trips |
mean_shopping_time |
Mean of the shopping times |
num_waiting_people |
Number of people who are queueing outside at every minute of the simulation (when the number of customers in the store is restricted) |
mean_waiting_time |
Mean time that customers wait before being allowed to enter (when the number of customers in the store is restricted) |
store_open_length |
Length of the store's opening hours |
df_time_with_infected |
Dataframe containing the exposure time per node |
total_time_crowded |
Total time that nodes were crowded (when there are more than thres number of customers in a node. Default value of thres is 3) |
Questions?
This is work in progress, but feel free to ask any questions by raising an issue or contacting me directly under fabian.m.ying@gmail.com.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for covid19-supermarket-abm-0.0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7735e530fb47a4bf2d5e8dcd752bdc56dec5057469e88c0a39f10086229b749b |
|
MD5 | 994a0eb5adc566be901ebbc53be6526c |
|
BLAKE2b-256 | 188cfb4cb34ff6339eae1a28a01870ec4c3ce99e5fee3ae90cb05b85c1b31e4d |
Close
Hashes for covid19_supermarket_abm-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f641d141fed7190023935ffbacb0f13536fde196fa9a97bab9a4d668890f325 |
|
MD5 | 4db5af3089005ae696bfb76fd55610dc |
|
BLAKE2b-256 | deec2a9aa8e766c8ddf05a0c6adb9b2f551b0eb3cf0e0fc962c1775310eec604 |