Skip to content

A simple implementation of an epidemic model based on SIR and cellular automatons with graphics

Notifications You must be signed in to change notification settings

Nicola-Taddei/Cellular-Automaton

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 

Repository files navigation

Cellular-Automaton

A simple implementation of an epidemic model based on SIR and cellular automatons with graphics. The model attemps to predict the geographical evolution of an epidemic through time on the base of a some parameters (basically SIR model parameters) and a simple map of population density among a certain area. The model has not been tested against real world cases yet. So, for now, it's only made for fun :)

⚠️

Since the project is still undergoing improvement work, it's not user friendly at all. It was originally designed to be used only by me, with the single purpose of trying to put in practice some knowledge. Feel free to take part of the code, readapt it and maybe make it look a little bit more human 😉 (By the way in the next future I will develope a nicer UI and improve the underlying model. I will be vary glad of any help you could give me)

How does it work?

The model on which this software is based is built as follows: a square geographical map divided in smaller squares (cells) which represent areas with uniform population density and frequency of contacts between people. They can be used to model on the map things as cities, streets, agricoltural landscape or other inhabited areas.

Map

The map consists of a 50x50 (measured in cells) area. For now the dimensions are hardcoded and can be changed by modifying the parameters of the CellularAutomaton class (see comments in the code). Every turn (an arbitrary amount of time which acquires sense in relation to the other parameters) each cell of the map exchanges some inhabitants with the adjacent ones. The numer of elements exchanged depends on the population of both the cells interested in the operation.

Cell

The Cell class is the basic unit of the model. It has a predefined and fixed population which evolves through time on the base of a SIR model. Despite the class is very flexible in the definition of population density, number of subjects exchanged with the neighbours on each turn and number of contacts of each inhabitant per turn (which are in fact arbitrary) I've thought of 3 standard environments, each represented by a function of the CellularAutomaton class:

Cities 🏙️

Population: 1000
Exchanges: 30
Contacts: 10

This cell type models a metropolitan environment with many people living in close contact to each other.

Streets 🚋

Population: 100
Exchanges: 24
Contacts: 10

This cell type models a generic transportation route.

Inhabited areas 🌵

Population: 30
Exchanges: 1
Contacts: 2

This cell type models a rural or inhabited area, with very low population and exchanges to the other cells.


Here is an example

This is a gif of a specific simulation (the one with the paramenters currently hardcoded in the source). In this simulation there were 3 cities, 2 of which were linked by a street and the other was isolated. As you can see the epidec spreads from the epicenter (the city in the bottm left part to the linked city in the upper left part. The isolated city remains instead preserved from the contagion.

simulation

About

A simple implementation of an epidemic model based on SIR and cellular automatons with graphics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages