Pandemic’s simulation

Eugen Fedchenko
5 min readApr 2, 2020

--

Firstly, I have to tell I’m not a biologist and don’t know anything about viruses and epidemics. I just read some good articles about Covid-19 simulations, I had time because of quarantine and I’ve decided to create another one. Also, I like cellular automata.

My model is pretty simple for a reason. It’s impossible to simulate the real world. Too complex models have a high noise level, in different words, they simulate more their own behavior than things should be simulated.

So, there is a grid, each cell is a person. This is a “zero patient” (carrier) in the center. He can infect neighbors with some probability. They, in turn, become carriers and can infect neighbors and so on.

After incubation period the disease is moved to the active phase and the patient can die (with some probability). The sick can be hospitalized if hospitals have the capacity. Hospitalized patients die and infect other people with much less probability. The sick get well after some period of time. The cured can be infected again, but with low probability. Also, the model supports quarantine. When quarantine started, the probability to infect neighbors becomes less.

That’s it. Yes, the model is very simple. I was trying to create more complex models, however, at the end, I always got pretty similar results, but it needed more time.

Starting parameters for the model I will operate with (each parameter can be changed, you are able to run your own simulations if you want).

  • total cells 2500
  • incubation & active phase: 6 turns each
  • infection probability: 13%
  • repeated infection probability: 1%
  • death probability: 5%
  • hospital factor 0.3 (the probability to die or infect somebody is 70% less)

The first simulation will be simplest but illustrative. No quarantine, no medical system — just the disease (set quarantine start in 500, hospitals capacity 0).

The first graphic is the total infected/dead amount.

Second infected/dead per days.

Very familiar graphics, yes? It’s an exponential growth. We live in a weird time, everybody today knows what does it means, but I’m not so happy about it.

Now we are sure that our model’s behavior (in general) looks similar to the other models from real science magazines, at least. BTW, but 94.5% were infected and 5% dead. Pretty bad.

Ok, lets add medical system. Set hospitals capacity in 3% of the population.

The result is almost the same. Hospitals were slowing growth on the beginning and reduced the total death amount (3% now) but didn’t change the overall situation. The red line on the graphic means the point when hospitals’ capacity is exhausted.

Ok, let’s add a quarantine. Quarantine here is just something that reduce infection probability, it isn’t the quarantine, it’s something, I said quarantine just because I need the word for it.

Our quarantine decreases infection probability by 35%.

24% infected, 0.3% dead. It looks pointedly enough, isn’t it?

But why it doesn’t work in reality? Let’s try to figure out. For getting the graphic above we provide strict quarantine and good medical system capacity. Also we started quarantine at the early stage.

New experiment

80% of the population infected, 2.48% dead. The quarantine parameters were the same with previous modeling. But the difference in the hospitals’ capacity. It’s a very important fact. The quarantine works. The quarantine is flattening the curve as should be. But what for? If the medical system sucks, you are in trouble. And also, that perhaps more important, the epidemic, in this case, takes much longer than before.

“Medical system” in this model is only reducing probabilities — nothings else (because it’s a model, not the real-life). So, in another words, if you don’t isolate infected people when the disease is in the active state (dramatically reducing of probability to infect somebody), quarantine (means reducing infection probability globally) will not work.

I must say one more time, it is not about Covid-19 or any other real-life disease. It’s just a toy, a simple model. But I’ve found specifically this consequence quite interesting.

You can try to play the model and observe the results. Please remember, it’s a probability model, results will be different each time. But if you run simulation 10–20 times you will see some patterns.
It isn’t a real-life model based on some real data. It’s the just cellular automat that produces some patterns closes to the pandemic growths. It’s a toy, no more.

Link to the working model: https://pandemic.onrender.com

You can change any parameters but only before starting. Run — run continuously simulation. Step — move on one turn. Clear — reset the model and unlock model parameters for editing.

The source code (Typescript): https://github.com/gavrilaf/pandemic/tree/master

And these two articles were my inspiration.

These simulations show how to flatten the coronavirus growth curveHealth By Warning: This graphic requires JavaScript. Please enable JavaScript for the best experience. PLEASE NOTE The…www.washingtonpost.com

OutbreakA playable disease simulationmeltingasphalt.com

--

--