Term Paper 1


This work is a submission for the course Modelling Complex Systems(IDC-621) for the year 2020-21 Spring (Even) Semester by Dhruva Sambrani, MS18163
9.1 μs

Abstract

This paper looks at the effect of a Lockdown on the spread of a pathogen. This setup is modelled via a Probabilisitic/Non Deterministic 2D cellular automaton.

This paper first introduces some working definitions along with the same definitions in code. Then features are added, and parallelly introduced to the reader, layer upon layer with logical reasoning for their implementations. Following this, the actual topic of the paper is introduced with some results that show the efficiency of Lockdowns. Finally, future scope of this work is also discussed.

Note to Evaluator

The author believes that papers which involve a lot of simulation and code should also be accompanied with the code they use so that readers can gain deeper insight into the processes described in the paper. Hence, the author has attempted to create a paper which interlaces the information with the corresponding code.

The coding language used is Julia[julia] and following document is made with Pluto.jl [pluto].

11.4 μs
5.2 μs
41.5 μs

Code Setup

763 μs

Include packages

5.3 μs

CellularBase[cellularbase] is a package written by the author themselves to abstract out certain repetitive funcitions for all Cellular Automata.

7.8 μs
23.5 ms

The Plots.jl[plots] and Images.jl[images] packages are used for plotting and the Statistics[stats] Package for some statistical analysis. PlutoUI.jl[plutoui] is used for some UI elements such as the ToC

17.1 μs
6.4 ms

Define Structures and Functions

13.3 μs

Define LifeGrid

7.0 μs

This is the basic structure that defines all the parameters of a particular "grid". The name LifeGrid was given by mistake but was not changed as it would entail too many other changes

16.0 μs
2.6 ms

Define method of evolution

6.3 μs

The method of evolution follows the following algorithm -

  1. If the agent is susceptible, infect the agent depending on neighborhood and return. The exact dependacy is discussed later in Non Deterministic runs

  2. Otherwise, the state is increased by 1

  3. If the state is recovered, set it to 0

Mathematically this can be written as

si+1={1,si=0 and ρ(neighbours)0,si=0 and 1ρ(neighbours)(si+1)mod(τi+τr+1)otherwise

12.2 μs
201 μs

Define States

3.5 μs

States are defined in the following way

  1. Susceptible 0

  2. Infected i[1,τi]

  3. Refactory i[τi+1,τi+τr]

  4. Recovered i=(τi+τr+1)

65.0 μs
recovered (generic function with 1 method)
145 μs

Define helper functions

3.4 μs
53.1 μs
169 μs
278 μs
90.4 μs

Deterministic Case - A First Run

2.8 μs

Introduction

As a first trial, we can try to run the simulation for the deterministic case, where the infection can spread even if 1 neighbor is infected. We also verify that the results observed are very similar to results obtained in [Moitra2019]

4.3 μs

Grid Type: LifeGrid

τi: 4

τr: 9

Max neighbors for probabilistic spread: 1

Possible States: 0:13

Boundary Condition: FixedMax

Size: (100, 100)

Neighborhood:

Type: VonNeumannNeighborhood

Radius: 1

List of Neighbors: [(0, 0), (1, 0), (-1, 0), (0, 1), (0, -1)]


240 ms

state(center patient) = 1

4.4 μs
4.0 s
6.6 s

Random states from 0 to τi

3.0 μs
1.2 s
2.0 s

state(center agent) = τᵢ; τᵢ=τᵣ

5.2 μs
958 ms
2.3 s

Observations in the deterministic case

We can see that the infection spreads outward and then dies off.

The refactory agents act as a buffer between the leading edge of infected agents and the recovered(susceptible) agents inside the wave. This is similar to how a batch of burnt material doesn't allow the fire to move back in.

Spread Back

The infection can spread back into the wave only if either -

    1. the radius of the neighborhood is larger than the refactory period

    2. if τiτr and state(patient zero)τr

4.9 μs

Non Deterministic Case

5.2 μs

Why?

Mainly because determinism is so 1900s.

Seriously though, the reason why we don't see too many interesting things in the deterministic case is because of the refactory buffer separating the infected leading edge and the recovered members.

Allowing some agents to escape the infection wave allows breaks in the refactory buffer allowing the infection to come back into the recovered agents. It seems very sadistic to play for the pathogen, but what's the fun otherwise.

6.3 μs

How is it implemented?

In code, obviously. Oh you mean what's the logic behind it?

If the spread is probabilistic, one way to do it would be to set a non zero probability if the number of infected neighbors is non-negative. While this does make the spread probabilistic, it doesn't model real life very well. In real life, one's chances of infection increases with the increase in infected neighbors. While the exact distribution is unknown, we can model the spread by assuming that the chance of spreading follows

ρinfect(count)={countmax0countmax1maxcount

where max is a parameter of the simulation. This basically means that for every infected neighbour, the chance of infection is linear, until a limit, after which the agent will always get infected.

This definition has the added benefit of being independent on the definition of the neighbourhood, and can be attributed only to the pathogen in question.

Every LifeGrid has a critical limit of infected neighbors, denoted by max. For every agent, ρ is calculated and infection is done by a Bernoulli trial.

High values of max

Hence, it also makes sense to set max higher than the size of the neighbourhood itself, for that would allow us to set the highest possible probability to be lesser than 1.

After all, what if the neighborhood changes during the run? How? Keep reading

1.8 ms

Max = 4

5.7 μs
8.0 s
11.4 s

Max = 9

3.0 μs
2.3 s
5.0 s

Max = 2

3.1 μs
3.4 s
3.8 s

Observations

Evidently, higher max values imply smaller probability of spreading. This is evident in the run with max = 9, where very few infected cases are seen at any point in time, and agents often recover before they spread it on, leading to the pathogen dying out.

On the flip side, if max is too close to 1, then there it acts very similar to the deterministic case most of the time. This is also evident in the fact that the case where max is 1, it is exactly the deterministic case which we've seen also dies out.

Relevant Quote

It is possible to have too much of a good thing

- Aesop

6.8 μs

Lockdown

Introduction

The word lockdown seems to have taken over our lives and completely changed the way that we go about our daily lives. But why are we doing this? And how effective are these lockdowns? We explore this question by looking at how we can simulate a lockdown period for our agents and see how this affects the infection spread.

9.2 μs

The logic behind lockdowns

Definition

A lockdown is a restriction policy for people or community to stay where they are, usually due to specific risks to themselves or to others if they can move and interact freely - Wikipedia

From the definition, it is clear that the intent is to prevent people from interacting and hence hopefully reducing the spread of the disease. If an agent interacts with fewer people, they have a lower chance of getting infected.

3.8 μs

Neighborhoods, Virulence and Infection Rate

Neighbourhood size and intrinsic virulence of a pathogen together decide the pathogen's spreading capabilities.

Neighbourhood size is a representation of the amount of inter-agent interactions. Due to the way the model is defined, it also shows how far the agent can influence. It defines the number of agents one agent can meet.

Intrinsic virulence of a pathogen is how well it spreads given that two agents meet. There is sufficient discussion regarding this in the above section.

If both these parameters define, in some sense, the same thing, why not just club them together into a single parameter which gives the net spread?

The reason is 3 fold-

  1. The neighborhood is a function of the agents' behavior, the virulence is a function of the pathogen's behaviour. It makes sense to keep them separate to deal with different cases of spread changes.

  2. The model is such that there are geometric differences that arise by changing the neighborhood radius. The buffering action of the refactory line is reduced by a larger neighborhood. It is not possible to increase the infection rate without also reducing this phenomenon if both were clubbed together.

  3. The code would need too many changes.

Relevant quote

Any sufficiently advanced bug is indistinguishable from a feature.

- Rich Kulawiec

2.5 ms

Lockdowns and Neighborhoods

From the above discussion, it must be clear that a lockdown can be simulated pretty easily by varying the size of the neighborhood. The lockdown must also start at some predetermined point during the simulation. The size of the neighbourhood is changed by changing grid.neighborhood and the in-simulation change of the neighborhood can be executed by using the postrunhook of the simulate! function

4.7 μs
lockdown (generic function with 1 method)
63.8 μs

200 → 1

2.8 μs
22.5 s
14.4 s
4.1 s

50 → 2; 150 → 1; 300 → 3

2.4 μs
28.2 s
17.0 s
177 ms

100 → 2; 300 → 3

2.7 μs
28.0 s
15.1 s
310 ms

Observations

Apart from being very flashy, we see an interesting phenomenon. When the radius of the neighbourhood is changed, it takes about 25-30 steps for the grid to find a new equilibrium. During this transient phase, the distribution of states can vary wildly.

Further, the equilibrium fractions of the states averaged over a few cycles is nearly equal, but the exact variation may vary on the basis of initial conditions (See 100 → 2; 300 → 3). This can be attributed to the geometry of the neighborhood, the refactory buffer and the distribution of infected agents.

Because most large scale structures don't last for long times, we can assume that the final state distribution is memoryless or has only short-term memory. Thus our study of the effectiveness of a lockdown can be reduced to a simpler study of equilibrium infection as a function of neighborhood radius and grid.max, which, as you probably guessed it, is our next section.

14.9 μs

Equilibrium infection distribution

As a function of Neighbourhood Radius and Virulence of pathogen

18.2 μs

Introduction

This section is mainly computational. With the functionalities we have built up in the previous sections, we simply simulate a random 200X200 grid for 200 steps for different values of neighbourhood radius and virulence, find the average(over 5 cycle-lenghts) infected fraction then plot a scatter plot to see the distribution.

10.1 μs
ss (generic function with 1 method)
71.5 μs
equilibrium_infection (generic function with 1 method)
84.2 μs

Verification

We verify that the function is working correctly by checking for the case nhradius = 3, p_max = 3 against the run 100 → 2; 300 → 3

452 μs

Success!

0.35<equilibrium_infection(3, 9)=0.37<0.4

10.0 s

Long running Code!

The following cell takes a long time (≈ 400 secs) to run. Be careful! You may want to reduce nhs and maxs, or skip some elements.

8.4 μs

Results

28.4 μs
316 s
100 ns
1.3 ms
1.5 ms
2.6 ms

Observations

  1. As expected, runs with low virulence and low radius (bottom-right) have very low equilibrium infection levels.

  2. For very virulent pathogens, even very strong lockdowns do not have much of an effect.

  3. Even for mid-level virulence pathogens, weak lockdowns are only able to reduce the infection probability, but are unable to completely kill off the pathogen.

  4. As we have seen before, even very low initial viral load can quickly explode in high interaction neighborhoods, so when the lockdown is removed, the infection quickly increases to pre-lockdown levels

Discussion on the effectiveness of lockdowns

Given that lockdowns don't help in killing off the pathogen, was the whole last year a waste? Was it all just a government hoax to install 5G towers?

While the author can't say much about government plans to install 5G towers, it is clear that lockdowns have a dampening effect in the number of active cases. This decrease in cases allow the society to focus on combating the disease by spending more efforts into research for vaccines, treatments and preventive steps, along with building infrastructure and materials which are necessary to combat the recurrence of the pathogen. It also gives epidemologists and people working in Complex Systems time to make pretty plots and animations.

13.3 μs

Further scope of this work

While this work has largely focused on the case of pathogen spread, the same work can be extended within the same topic and to other related topics.

Things within the same topic

  1. Fitting a mathematical model of the effect of lockdown and pathogen spread to data obtained by this work, then fitting it for other real life pathogens

  2. Verification of model reflecting real pathogens via case studies

  3. More extended statistical analysis to quantify equilibrium

  4. Search for multi-equilibrium states

  5. Contact tracing and quarantine simulations and comparing effectiveness of blanket lockdowns with more surgical methods.

Other topics which can gain from this work

While we have called agents as people and the spread as a pathogen, any system which relaxes after some time can be modelled with a similar setup. Accordingly the meaning of lockdown can change. Some examples include -

  1. Spread of radioactivity with lockdown as shielding.

  2. Complex web of processors which heat up after a while. There, the lockdown would be the tradeoff between a less complex web but a less efficient system of workload balancing.

  3. Spread of algae and lockdown being the speed of flow of water.

31.1 μs

References

Moitra2019

Moitra, P., Sinha, S. Localized spatial distributions of disease phases yield long-term persistence of infection. Sci Rep 9, 20309 (2019). https://doi.org/10.1038/s41598-019-56616-3

julia

Julia: A Fresh Approach to Numerical Computing. Jeff Bezanson, Alan Edelman, Stefan Karpinski, Viral B. Shah. (2017) SIAM Review, 59: 65–98. doi: 10.1137/141000671

plots

Plots - powerful convenience for visualization in Julia. Thomas Breloff. docs.juliaplots.org

images

JuliaImages: image processing and machine vision for Julia. https://juliaimages.org/stable/

pluto

Pluto - Reactive Notebooks for Julia. Fons van der Plas and Mikołaj Bochenski. https://github.com/fonsp/Pluto.jl

plutoui

PlutoUI. Fons van der Plas. https://github.com/fonsp/PlutoUI.jl

stats

Statistics - Julia stdlib for Statistics. https://docs.julialang.org/en/v1/stdlib/Statistics/

cellularbase

CellularBase.jl: Abstract definitions for Cellular Automaton. Dhruva Sambrani. https://dhruvasambrani.github.io/idc621/CellularBase

7.8 μs