2 Apr 2020

Agent-based simulation model applied to social behaviors determining the dynamics of pandemics

Authors of the study:

Federico Cecconi – CSO QBT Sagl

Alessandro Barazzetti – Head of R&D, QBT sagl – Professor in Data analysis and advanced forecasting techniques, UCM Higher Education Institution Malta and Swiss Campus Ludes – Gen. Dir. Science Adventure sagl Switzerland


We have created a model based on artificial agents that describes some aspects of the diffusion dynamics of COVID-19, especially aspects related to the link between social behavior and contagion dynamics. There are two specificities in the socio-economic structure of the areas in northern Italy initially affected by the pandemic: the spread of small and medium sized companies, organized in territorial clusters (by superimposing maps of the location of the companies and maps of COVID 19 spread, the relationship is clear) and the presence of working men’s aggregations, typical of those areas.

Agent-based simulation models

 An agent-based model (ABM) belongs to a class of computational models to simulate the actions and interactions of autonomous agents (individual or collective entities such as organizations or groups) in order to assess their effects on the system as a whole. [1] It combines elements of game theory, complex systems, emergencies, computational sociology, multi-agent systems and evolutionary programming. Monte Carlo methods are used to introduce randomness. ABMs are used on non-computer science domains including biology, ecology and social sciences.  Agent-based models are a kind of microscale model [2] that simulates the simultaneous operations and interactions of multiple agents trying to recreate and predict the appearance of complex phenomena.

Current situation

Coronavirus infection has spread throughout Italy with clear anomalies in the distribution of infected people in the area. There is an extraordinary concentration of cases in the northern regions, particularly in Lombardy where, to date (1/4/2020), there are 43.208 cases, according to official sources.

Studies carried out in the last few days [3] confirm that, in fact, the number of infected people is much higher and equal to about 9.8% of the resident population, i.e. 5.9 million individuals. This brings the mortality rate of the disease back to that 1.14% [4] in line with considerations about population type and general trend of the virus.

Goals to be achieved

Our aim is to identify the reasons why we have seen such a rapid and extensive spread of the virus in Lombardy compared to other regions [5]. In particular, we believe that there are essentially behavioral and social structure reasons. To do this, we are going to use an ABM model, described below, which will be applied to the different territorial contexts.

The validity of such a model can be confirmed by the actual data of virus spread and the same model can be used to generate predictions of spread also for the subsequent waves of infection, allowing operators to act selectively on social distancing measures.

Description of our model

 We took into consideration a population of 5.000 agents representing Lombard society by age group, gender and belonging to three distinct social groups: “family group”, “work group” and “leisure group”. The distribution has been normalized by drawing on ISTAT data [6] The groups are dynamically populated at each simulation according to composition parameters.

In the family group, families are simulated according to age groups and number of members: of course, families composed of a single agent are also simulated, thus covering the social cases of single elderly people and single people. In the work group, we find the workers of individual companies according to the specification that increasing the number of agents within the work group, the number of operators decreases, so we go towards a model of small and medium enterprise. Similarly, in the leisure group, as the number of leisure groups increases, the number of participants decreases (at the limit, if the leisure group increases considerably, we are assuming that each agent performs activities independently, i.e. everyone goes for a jog; on the contrary, if the number of leisure groups decreases, it means that a large number of agents go to the gym).

The simulation takes place within the 24 hours of the day in which the social interactions of agents and groups of agents are simulated for a total of 1200 hours equal to 50 days.

Therefore, we have described how the disease is spread through social interactions using the data available to date [5] assigning, for each agent according to the status it is in (infected, sick, deceased or healed) the group to which it belongs (or no group), the age group and at a precise time, the probability that it will change status according to the predetermined sequence used in the SIR model [7].

The possible sequence is a probability matrix described as follows:

For each age group I belong to Then
If I am I get sick Contagion, for each age group, according to the time of day       I recover I die
infected P1 P2 P3 P4
sick P5 P6 P7
healed ND ND ND ND
deceased ND ND ND ND

The model was developed using R: the data input files are in csv format while the population composition parameters are entered in the code.

Processing results

We have carried out simulations using our model by setting different parameters that represent the areas of Lombardy assuming that there are high concentrations of agents even in older age groups in work and leisure contexts with strong integration between professional social relations and leisure time. Typical cases are post-retirement consulting activities, the phenomenon of grandparents caring for grandchildren, the high number of elderly people in hospitals for examinations and, in general, less elderly people meeting, for example, in the gyms and post-work recreation.

Therefore, we have set two numerical parameters described as follows:

Solution A

Few companies with a high number of agents per company and many meeting places with fewer agents per place.

 Solution B

Many companies with low number of employees per company and few meeting places but with more agents per meeting place.

The two simulations give the following result:

We notice how Solution B is far ahead of Solution A with a higher number of infected in the peak.


 The two simulations show the rapidity of spread in just 50 days and how the parameters of work social relations and leisure have an impact on the spread. The model would seem to demonstrate that no assumptions about the nature of the virus or the characteristics of the environment are necessary to have steep curves and high peaks of contagion. Simply the socio-economic characteristics of a region determine behaviour that facilitates the spread of the pandemic.

Thus, even more so we expect that social distancing measures, in the absence of preventive vaccines or curative drugs, are necessary and enough to stop the spread of the virus.

Next steps forward

 We will now proceed with the extension of the model according to the following scheme:

  • Extension to other regions by simulating different social behaviors
  • Age group modelling to detail the social behavior of older people most affected by the pandemic
  • Widening of the probability matrix considering new cases; this is only possible when new data will be available in order to better determine the probabilities.
  • Social distancing simulation: application of social distancing solutions to the model to test changes in curves.


 [1].  Niazi, Muaz; Hussain, Amir (2011). “Agent-based Computing from Multi-agent Systems to Agent-Based Models: A Visual Survey” (PDF). Scientometrics. 89 (2): 479–499. arXiv:1708.05872. doi:10.1007/s11192-011-0468-9. Archived from the original (PDF) on October 12, 2013.

[2] Gustafsson, Leif; Sternad, Mikael (2010). “Consistent micro, macro, and state-based population modelling”. Mathematical Biosciences. 225 (2): 94–107. doi:10.1016/j.mbs.2010.02.003. PMID 20171974.

[3] 30 March 2020 Imperial College COVID-19 Response Team Estimating the number of infections and the impact of non-pharmaceutical interventions on COVID-19 in 11 European countries.


[5] Ministero della Salute www.salute.gov.it; Worldmeters.info https://worldmeters.info

[6] ISTAT istituto Nazionale di Statistica www.istat.it

[7] Hethcote H (2000). “The Mathematics of Infectious Diseases”. SIAM Review. 42 (4): 599–653. Bibcode:2000 SIAMR..42..599H. doi:10.1137/s0036144500371907














Leave a Reply

one × 4 =