This model strives to simulate the COVID-19 pandemic with testing implemented as a M|M|s-queue.
When a person shows symptoms he or she is queued for a test. When the queue is empty the person is tested and after a set number of days the test result arrives. At this point the infected individual is isolated. This total time is denoted Expected Waiting Time and the purpose of this project is to evaluate how this number affects out control of the pandemic.
The project is a part of the course SF2866 Applied Systems Engineering at KTH Royal Institute of Science.
- Install Python 3
- Install dependencies
numpy
pandas
matplotblib
seaborn
- Clone or download this repo
from SIR_model import Model
model = Model()
model.run()
model.plot()
Generates
Switching model.plot()
for model.queueDistributionPlot()
generates
# ------- Import -------
from SIR_model import Model
/.../
# ------- Simulate -------
model1 = Model(servers=1)
model1.run()
model2 = Model(servers=2)
model2.run()
# ------- Plot -------
# /.../
-
The
Model
contains four public plot-helpers:plotExpectedWaitTime(ax)
plotQueueDistribution(ax)
plotInfected(ax)
plotSIR(ax)
-
Example 1: Only SIR-plot
-
Example 2: All-plots
-
from SIR_model import Model model = Model() model.run() fig, axs = model.subplots(2, 2) model.plotExpectedWaitTime(axs[0][0]) model.plotQueueDistribution(axs[0][1]) model.plotInfected(axs[1][0]) model.plotSIR(axs[1][1]) model.removeTicksX(axs[0][0]) model.removeTicksX(axs[0][1]) fig.tight_layout() fig.savefig('all_plots.png', dpi=300)
-
- This implementation uses the default SIR-implementation for the flow from S to I. However, the differential-equation-flow from I to R is replaced.
- Instead, a person is assumed to recover after a Poisson-distributed number of days.
- This implementation uses the default-M|M|s-implementation for the death-process. However, the Poisson-birth-process is replaced.
- Instead:
- A person is infected accurding to the SIR-model above.
- That person shows symptoms after after a Poisson-distributed number of days.
- People are placed in the queue the day they start showing symptoms. False symptoms can occur for Susceptibles