A pandemic simulator based on the SIR (Susceptible, Infectious, Recovered/Dead) compartmental model in epidemiology.
- Population shuffling
- Obtain people in contact with an individual
- Scalable from communities to cities
- Support for travellers
- R0s based on social distancing parameters
- Recovery time based on health care parameters
- Contact tracing
- Hotspots
To simulate a city of population 1000, create a City object. Currently the community size is fixed to 100.
blore = City("Bangalore", 1000, gdp=1e9, healthCare=1)Before calling the updateCity() method make sure there's at least one infected person in each community of the city.
for _ in range(len(blore.Communities)):
currentCommunity = blore.Communities[_]
pZero = random.randint(0, currentCommunity.grid.size - 1)
currentCommunity.people[pZero].state = 'I'You can call updateCity() a few times until everyone reaches state R. Other helpful methods such as getNumInfected() and getNumSusceptible() let you track infectious and susceptible people respectively during each iteration.