Code Monkey home page Code Monkey logo

agent-based-epidemic-sim's Introduction

Agent Based Epidemic Simulator

Build Status

This repository hosts an open source agent-based simulator for modeling epidemics at large scale (nation-scale) using parallel and distributed computation.

At a high level, the simulator enables users to model the movement of simulated agents between different locations, and computes the spread of disease based on the interactions between agents who are colocated. The simulator also has interfaces to model the impact of social distancing policies, contact tracing mechanisms, and testing regimens on disease spread.

All aspects of the simulation are parameterized. The user of the simulation is able to define distributions which dictate simulation behavior such as:

  • The size of the population
  • The size and number of locations to visit
  • The length of visits to the locations
  • The between-host transmissibility of the disease
  • The state transition diagram and dwell times of the disease

These parameters can be configured to apply to particular scenarios and can be calibrated against real world data for use in experiments. Please note that this simulator is meant to explore the relative impact and sensitivity of various conditions and interventions and its results must not be interpreted as definitive about exact real world outcomes.

Specific applications of the simulator can be found in the applications subdirectory:

Home Work

This is a simple application where communities are created from pre-specified distributions. The individual agents in these communities spend some portion of every day at their places of work interacting with colleagues, and the rest of their day at home interacting with household members. You can build and run the example as follows.

Native build (Linux)

bazel build -c opt agent_based_epidemic_sim/applications/home_work:main

bazel-bin/agent_based_epidemic_sim/applications/home_work/main \
  --simulation_config_pbtxt_path=agent_based_epidemic_sim/applications/home_work/config.pbtxt \
  --output_file_path=$HOME/output.csv

Docker

docker build -t $USER/abesim .

docker run -t --rm -w /root/agent_based_epidemic_sim \
  -v $PWD:/root/agent_based_epidemic_sim:cached \
  -v /tmp/output:/tmp/output:delegated \
  -v /tmp/bazel_output:/tmp/bazel_output:delegated \
  $USER/abesim \
  bazel run -c opt agent_based_epidemic_sim/applications/home_work/main -- \
  --simulation_config_pbtxt_path=/root/agent_based_epidemic_sim/agent_based_epidemic_sim/applications/home_work/config.pbtxt \
  --output_file_path=/tmp/output/output.csv

Contact Tracing

The contact tracing application is designed to investigate the effects of different contact tracing strategies, including digital complements to contact tracing, on the spread of disease. Work on this application is ongoing and it is not yet ready to run.

Configuration Generator

There is a configuration generator which pulls data from the COVID-19 Open Data repository to seed the simulations with empirical data for a given time and location. For example, to generate a config file for the home-work application using the known number of infections, recovered and deceased persons from Spain on May 1, run the following command:

python3 agent_based_epidemic_sim/configuration_generator/config.py \
  --region-code ES --date 2020-05-01 --sim home_work config.pbtxt

Tests

Native build (Linux)

bazel test agent_based_epidemic_sim/...

Docker

docker build -t $USER/abesim .

docker run -t --rm -w /root/agent_based_epidemic_sim \
  -v $PWD:/root/agent_based_epidemic_sim:cached  \
  -v /tmp/bazel_output:/tmp/bazel_output:delegated \
  $USER/abesim bazel test agent_based_epidemic_sim/...

Configuration Generator

The tests must be run from within the configuration_generator folder:

cd agent_based_epidemic_sim/configuration_generator
python3 -m unittest

Risk Score Learning

Jupyter Notebooks for learning risk score models on data sampled from a discrete grid on [Infectiousness x Distance x Duration] are available under agent_based_epidemic_sim/learning. Notebook to reproduce the experiments in Murphy et al, Risk score learning for COVID-19 contact tracing apps, 2021 is available at agent_based_epidemic_sim/learning/MLHC_paper_experiments.ipynb.

Acknowledgements

The computational model used by the simulator is inspired in part by the EpiSimdemics simulator. We also took a great deal of inspiration from the OpenABM simulator.

EpiSimdemics and its extensions were built by a team of researchers, the core team members are now at UVA, UMD, UIUC, and LLNL. All the members that contributed to EpiSimdemics and its extensions include: Ashwin Aji, Christopher L. Barrett, Abhinav Bhatele, Keith R. Bisset, Ali Butt, Eric Bohm, Abhishek Gupta, Stephen G. Eubank, Xizhou Feng, Wu Feng, Nikhil Jain, Laxmikant V. Kale, Tariq Kamal, Chris Kuhlman, Yarden Livnat, Madhav Marathe, Dimitrios S. Nikolopoulos, Martin Schulz, Lukasz Wesolowski, Jae-Seung Yeom. Madhav Marathe is the corresponding scientist for EpiSimdemics and can be reached at [email protected].

agent-based-epidemic-sim's People

Contributors

abhishekk-ml avatar aradhya-tech avatar cpatrick avatar groeney avatar luyang1125 avatar mattr-google avatar mdikovsky avatar mkruskal-google avatar murphyk avatar nitag avatar owahltinez avatar rajpratik71 avatar rickeylev avatar syshafi avatar yilei avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

agent-based-epidemic-sim's Issues

Output agent-level information

Hi,

would it be possible to output agent-level adjacency matrices (capturing contacts between agents) and SEIR status per time point?
This would be super useful to check advanced testing schemes that have appeared in the literature.

Thanks a lot!
Ingmar

Compilation error

Hi team,

I wanted to try our this simulator (and figure out how to integrate https://github.com/zalandoresearch/CRISP for COVID-19 infection risk score estimation) but I am getting the following error when running bazel build -c opt agent_based_epidemic_sim/applications/home_work:main

ERROR: /Users/rherbrich/src/agent-based-epidemic-sim/agent_based_epidemic_sim/port/BUILD:81:11: C++ compilation of rule '//agent_based_epidemic_sim/port:executor' failed (Exit 1) cc_wrapper.sh failed: error executing command external/local_config_cc/cc_wrapper.sh -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -fcolor-diagnostics -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG ... (remaining 26 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
agent_based_epidemic_sim/port/executor.cc:38:28: error: implicit instantiation of undefined template 'std::__1::vector<std::__1::thread, std::__1::allocator<std::__1::thread> >'
  std::vector<std::thread> threads_;
                           ^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/iosfwd:217:28: note: template is declared here
class _LIBCPP_TEMPLATE_VIS vector;
                           ^
agent_based_epidemic_sim/port/executor.cc:40:39: error: implicit instantiation of undefined template 'std::__1::vector<std::__1::function<void ()>, std::__1::allocator<std::__1::function<void ()> > >'
  std::vector<std::function<void()> > work_ GUARDED_BY(mu_);
                                      ^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/iosfwd:217:28: note: template is declared here
class _LIBCPP_TEMPLATE_VIS vector;
                           ^
agent_based_epidemic_sim/port/executor.cc:40:45: warning: attribute guarded_by ignored, because it is not attached to a declaration [-Wignored-attributes]
  std::vector<std::function<void()> > work_ GUARDED_BY(mu_);
                                            ^
external/com_google_absl/absl/base/internal/thread_annotations.h:64:63: note: expanded from macro 'GUARDED_BY'
#define GUARDED_BY(x) THREAD_ANNOTATION_ATTRIBUTE__(guarded_by(x))
                                                              ^
agent_based_epidemic_sim/port/executor.cc:117:10: error: no viable conversion from returned value of type 'unique_ptr<pandemic::(anonymous namespace)::StdThreadExecutor>' to function return type 'unique_ptr<pandemic::Executor>'
  return absl::make_unique<StdThreadExecutor>(max_parallelism);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/memory:2401:28: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'typename __unique_if<StdThreadExecutor>::__unique_single' (aka 'unique_ptr<pandemic::(anonymous namespace)::StdThreadExecutor>') to 'const std::__1::unique_ptr<pandemic::Executor, std::__1::default_delete<pandemic::Executor> > &' for 1st argument
class _LIBCPP_TEMPLATE_VIS unique_ptr {
                           ^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/memory:2466:13: note: candidate constructor template not viable: no known conversion from 'typename __unique_if<StdThreadExecutor>::__unique_single' (aka 'unique_ptr<pandemic::(anonymous namespace)::StdThreadExecutor>') to 'std::nullptr_t' (aka 'nullptr_t') for 1st argument
  constexpr unique_ptr(nullptr_t) noexcept : __ptr_(pointer()) {}
            ^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/memory:2494:3: note: candidate constructor not viable: no known conversion from 'typename __unique_if<StdThreadExecutor>::__unique_single' (aka 'unique_ptr<pandemic::(anonymous namespace)::StdThreadExecutor>') to 'std::__1::unique_ptr<pandemic::Executor, std::__1::default_delete<pandemic::Executor> > &&' for 1st argument
  unique_ptr(unique_ptr&& __u) noexcept
  ^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/memory:2503:3: note: candidate template ignored: requirement 'is_convertible<pandemic::(anonymous namespace)::StdThreadExecutor *, pandemic::Executor *>::value' was not satisfied [with _Up = pandemic::(anonymous namespace)::StdThreadExecutor, _Ep = std::__1::default_delete<pandemic::(anonymous namespace)::StdThreadExecutor>]
  unique_ptr(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT
  ^
1 warning and 3 errors generated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.