Code Monkey home page Code Monkey logo

agent-based-model-virus's Introduction

Agent-based Model in Python Simulating Virus Spread

The model which I intend to build will simulate the spread of a virus through a community. The community will consist of a user-specified population of agents who move and encounter other agents in a stochastic manner. Initially, there will be a user-defined population of ‘infected’ agents and at each time step, a randomly selected cohort of agents will move and encounter other agents. The number of agents which move on each iteration is bounded by two parameters and a random value in this range is selected on each iteration. If an agent comes into contact with an agent who is infected (i.e. the agents are within a certain collision distance; another user-specified parameter), they themselves will become infected for a period of time. Currently, this period is set to 14 time steps but this is another parameter of the model which can be altered for experimental purposes.

There are a number of probabilities which will be associated with the model:

  • Susceptible probability: The probability that an agent is susceptible to the virus. Upon initialisation, some agents will be immune to the virus.
  • Immunity probability: The probability that an agent becomes immune to the virus after having been infected. In general, once infected, most agents become immune to a virus once they recover. However, this is not always the case.
  • Death probability: The probability that an agent who becomes infected dies from the virus.

Again, these probabilities are defined by the user so different configurations of these probabilities can be tested.

Running a simulation

To run a simulation, follow the below steps:

  1. Alter the parameters if desired in the abm-virus.py file. The CSV files which produce the time-based graphs of output results are produced after each simulation. The directory in which these CSV files are stored can be altered using the path_out variable in the abm-virus.py file.

  2. Simply run:

python abm-virus.py

while in the current directory.

agent-based-model-virus's People

Contributors

liamcarroll avatar

Watchers

 avatar

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.