ABM for Covid
Agent Based Modeling

Modeling the Spread and Control of COVID-19.

Social networks are complex. An individual impacts the society not only by her own independent behavior and choices, but also by her interactions. Therefore, within a society, there is an individual outcome, and a macro outcome for the society. These outcomes results from the combined effect of all the possible choices made by all the individuals. There are multiple attributes, reasons, choices and factors that impact the result of this interaction . The society is dynamic, evolving, learning and prone to making errors. One impacts the whole and the whole impacts one. Simplicity gives rise to complexity.

For example, when a society is fighting with the spread of a disease, at an individual level - one’s health, immunity, hygiene level etc. impact the chance contracting the disease. At the same time, the number of people she come in contact with, and their hygiene level also matters at a collective societal level. Classical models of prediction are neither capable of embracing this complexity, nor are they suitable to factor in the adaptations that might result from such complexity. In such situations, Agent based models plays an important role in understanding the impact of both — an individual behavior and their interaction with the environment.

Let’s understand an Agent. An agent is a software created entity, which represents or mimics an individual and their choices. These agent move around in a virtual space are heterogeneous and can differ in myriad ways (e.g., age, disease state, behavioral rules).[1] They are ‘autonomous’, i.e they make their choices independently. They can have attributes of an individual, i.e age, health etc. That is, they represent an individual within a software environment, complete with attributes, as well as decision making frameworks.

Agent Parameters

Each agent has an attribute which represents age of an individual. This age is randomly sampled from a population distribution. We are using triangular distribution where the minimum age, maximum age and the peak of the distribution can be set according to the experiment. This allows to model different populations according to age.
Hygiene refers to conditions and practices that help to maintain health and prevent the spread of diseases. This is a sum total of personal, medical, culinary, home & everyday hygiene observed by a society. It is randomly distributed and an agent is assigned a random value between 0(Lowest level of hygiene) to 1(Highest level of hygiene). The distribution parameters can be modified for an experiment.

Overall health
For this modeling, health is defined as a state of ‘physical well-being’. It has been divided into 4 levels(Between 0 &3), with each level representing a particular state of health. On this scale ‘3’ represents peak health condition, being free from any disease and ‘0’ represents poor health condition. An agent is randomly assigned a number between 0 to 3.
Comorbidity refers to one or more diseases or conditions that occur along with another condition in the same person at the same time. For the experiment, they have been assigned 3 levels 0 and -2, both inclusive. A co-morbidity value of zero corresponds to an agent with no co-morbid conditions, and a lower value corresponds to prevalence of more serious co-morbid conditions.

It is defined as the capability of body to fight foreign infections. It has been assigned value of either 0 or 1, where 0 represent an immunosuppressed individual and 1 represent perfectly normal state of immunity.


Many policies can be applied for a period of time of the total simulation run. These policies change and control agent behavior. Some policies also have dynamic parameters which can be set for a specific period of time. These policies are also used to update the environmental resources..


A lockdown is an emergency protocol that prevents people from leaving a given area. In this simulation, the lockdown controls the movement of the agents by making them static. It is dynamic policy parameter and can be applied for varying number of days , at varying intervals and at number of times.

For example a lockdown could be applied from 10th day to 30th day, followed by a relaxation till 35th day. The second lockdown could be applied from 35th day to 60th day.During lockdown only essential agents are permitted to move. This percentage of essential workers could be assigned as an initial parameter before any experiment

Age Based Lockdown

It is a lockdown defined on the basis of the age of an agent. This age is known as the ‘threshold age’. All the agents below threshold age are permitted to move, and all the agents above threshold age become static. It can be dynamically defined on the age-based lockdown timeline.

For example, Age based lockdown can be implemented on Day 50, with threshold age of 65. This means, agents below the age of 65 can interact and move, while agents above the age of 65 are static & under lockdown.


It is defined as the special policy in which special protocols(patient isolation, safety measures etc) are implemented in treating the affected agents. At the implementation, it isolates the agents (from the environment) that get very sick and have occupied a hospital bed.

This policy is different from the general hospitalization, as invoking this policy would be proceeded by special treatment protocols specific for the pandemic. These hospitalized agents don’t interact with other agents in the system. Hospitalization of an agent is also subject to availability of the hospital bed. We can define start date and duration of hospitalization policy. We can also set the number of hospital and ICU beds in the simulation environment ( set as initial parameter).

Social Distancing

Designed to replicate the ‘physical’ social distancing intervention, this policy controls the movement of agents by maintaining a minimum distance between the agents. This allows agents to stay outside the infection radius of other agents. Social Distancing Efficiency is defined as the success rate of practicing Social Distancing measures.

For example, let’s say social distancing is defined as keeping a minimum distance of 6 ft from another individual(agent). If we have 100 agents with minimum 100 interactions, this will have 100,000 opportunities of practicing social distancing. If a minimum distance of 6ft was maintained in at-least 70,000 of these interactions, we will have a 70% Social Distancing Efficiency for the environment.

Border Close

In real life, closing the border refers to closing the airports and other means of transportation across states or countries to control the movement of individuals. Before the closure of border, there may be free movement of individuals, who may or may not be infectious.

This is simulated in the similar manner in the model, where everyday, a random number of ‘infectious traveler‘ agents enter the environment before the ‘border close’ policy is implemented. Post policy implementation, the inflow of new infectious ‘traveler agents’ to the environment is completely stopped.

Daily Testing

Testing for a disease is very critical in identifying the rate and spread of the disease. This parameter provides essential actionable insights to the governments agencies for understanding the spread, severity, attributes, demographics as well as infection, recovery and death rate . At the same time, help in crafting the response best suited for the dynamically evolving situation.

When this policy is applied in the simulation , random agents are sampled from the environment and tested as per the defined testing capacity . This capacity can be dynamically set at various levels during the application of policy. Accuracy of each test result is also critical. We can set the efficiency in the initial parameters which indicate the false negative(individuals who are infected, but their results show they are not infected) percentage of the tests.

Contact Tracing

It is the process of identification of persons who may have come into contact with an infected person ("contacts") and subsequent collection of further information about these contacts.

Modeling this, when an agent is tested positive, it traces back certain number of contacts of the agent it had come in contact with earlier. The number of contacts to be traced can be set in the initial parameters.


It is defined as restricting the movement of individuals with certain attributes(like exposure to virus) for a given time period to prevent the spread of disease. Upon it’s application, the policy removes the affected agents (positively tested) from the environment for a given time period( till recovery or mandatory 21 days) and re-introduces them(post recovery or mandatory isolation) into the environment.


In the possible event of shortfall of present healthcare capacity, governments agencies may need to add reinforcements of makeshift hospitals and critical care units. In this scenario, the questions, such as - “How many of such hospital beds to be prepared?” and “When do we need certain number of hospitals beds?” etc. become very critical. With this policy, we can set the amount of reinforcements to be added to the existing capacity of hospital beds and ICU beds. We can define the initial capacity in the initial parameters.

This would help in understanding if capacity & the timing of reinforcements would be sufficient to handle the upcoming situation. For example, Is adding 100 additional ICUs & 500 hospital beds on 30th day would be sufficient?

Other Visualizations

Here's a Agent Based Model visualization based on a 3Blue1Brown video.


Initial Parameters

Number of Agents  200
Number of agents in the simulation
Agent Density  0.0001
How many agent per sq of pixel in our simulation
Hospital bed per agent  0.1
Set the factor at which hospitals are available in the env/agent
ICU bed per hospital bed  0.05
How many ICU beds are available per hospital bed.
Infection percent  0.0
% of agents are infectious at the start of simulation
Age Distribution
(Triangular Distribution)  
Distribution age minimum  1
Distribution age maximum   90
Distribution age peak  25
Hygiene Distribution
Distribution Hygiene mean  0.5
Distribution Hygiene Var  1
Essential Agent percent  0.05
What % of agents are essentials? ( They will be mobile under the lockdown)
Testing Efficiency  0.3
Percentage of false negatives in testing
Contact Tracing Capacity  5
Tracing extent factor
Social Distancing Efficiency  0.6
Recovered Agent percent  0
These agents would be recovered already with the start of the simulation.
Dynamic Parameters   |   Policies
Time (Days)

Social Distancing
Daily Testing
Tests per day
Age based lockdown
Lockdown Age Threshold
Contact Tracing
Border Closing
Additional ICU Beds
Additional Hospital Beds

Graph Plot
Various results plotted with the time


This tool uses an agent based model to simulate effect of different policies on virus spread. This output of the model depends on model assumptions and parameter choices.
The model is not quantitatively correct, rather it should be used for qualitative comparison of different strategies by invoking policies at different timeline. It should be used for informational and research purposes only. Please carefully consider the parameters you choose. Interpret and use the simulated results responsibly.