I have been wanting to experiment with virus infection simulations for a while now, so now is the time.
Simulation Version 1
This version is a blatant ripoff the Washington Post simulation but allows more settings to be tweaked and larger population sizes to be experimented with. People (shown as circles) move around in random directions bouncing off each other.
The simulation starts with all the people healthy (not infected) and a single person set as infected in the middle of the world. These are the settings for the simulation that can be tweaked.
The above default parameters result in the following run. The virus spreads quickly to the entire population. The 50% recovery probability results in roughly half the population dying with the other half recovering from infection.
Now let’s take a look at modifying some parameters.
The next run had increased population density so people are much closer together. The virus now spreads much faster and ends the same as the previous run with a 50/50 dead/recovered ratio.
Now with the density lowered so people are not as packed together. This time the virus does not infect all healthy people. This is a good example of “social distancing” helping.
Lowering the speed at which people move. If infected and healthy people move slower then the virus has less chances to spread. In the end about a third of al people never get infected and another third recover from infection.
Lowering the probability that people will move each step of the simulation to 10%. This could represent the majority of the population staying home and people only going out for essentials. With this change the virus dies out and the impact on the population is minimal.
If the probability of movement is 0 then the initial virus cannot spread and it dies out.
Simulation Version 2
This time I used an even simpler model. People live on a square grid and only move randomly in a north, south, east or west direction.
Here are the default settings this time
Using those parameters gives the following result
Again a higher density population allows the virus to spread much faster
Social distancing can be simulated by lowering the population density to 10%. People are still freely moving around but keeping their distance from each other due to lower density. The virus spreads much more slowly and not all people get infected.
The original settings are run again, but this time there is only a 5% chance people move around each step of the simulation. This models people who are isolating themselves at home. The fewer people who do move around can be thought of as the people who have to go out for food or medicine. This results in the virus barely spreads at all before dying out.
Both of these very simplistic models show clearly that the best way to stop or severely limit a virus spreading is social distancing and self isolation.
If you want to play with these simulations yourself and try tweaking other parameters they are now included in Visions of Chaos.