Effect of relaxing lockdown measures
No preview image
Model was written in NetLogo 6.0.4
•
Viewed 227 times
•
Downloaded 13 times
•
Run 0 times
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
Info tab cannot be displayed because of an encoding error
Comments and Questions
Please start the discussion about this model!
(You'll first need to log in.)
Click to Run Model
turtles-own [ status ;; either: healthy, contact-infected, contact-healthy, sick or immune ;; infectious-time ;; after being infetious for 14 days, become sick remaining-immunity ;; how many days of immunity the turtle has left contact-time ;; how long since last contact sick-time ;; this determines the point in time when the agent recovers age ;; how old is the turtle quarantined? ;; whether the person is quarantined number-of-links ;; number of links each turtle has day-with-no-new-sick ;; count number of days with no new sick people ] globals [ %infected ;; what % of the population is infectious max%infected ;; what was the max infected ever %immune ;; what % of the population is immune maximum-population ;; keep it the same as the number of people who started. lifespan ;; the lifespan of a turtle initial-ave-links ;; initial average number of links immunity-duration ;; turtle being immune in number of days total-died ;; total number of people died from the virus total-sick ;; total number of people who became sick max-sick ;; the highest number at one time hospitalised number-sick ;; number of sick people at any one moment new-positive ;; number newly tested positive days-number=criteria ;; how many days have we got no new cases number-infected ;; number of infeccted people but not sick at any one moment, ie contact-infected status max-number-sick-at-one-time ;;the maximum sick at any one moemnt, hence the max in hospital remove-lockdown? ;; to start considering removing lock-down max-number-of-links ;; in previous versions, this is a slider value ] to setup clear-all resize-world 0 (size-of-world - 1) 0 (size-of-world - 1) set new-positive 0 set days-number=criteria 0 set max%infected 0 set-patch-size (500 / max-pxcor) set-default-shape turtles "person" set maximum-population number-people ;; this is to keep the total populace constant even though some will die set max-number-of-links initial-max-number-of-links ;; ================================================== set lifespan 80 * 365.25 ;; life expectancy set to 80 ;; set immunity-duration immunity-duration-yr * 365 ;; remain immune for number of years in days as indicated by immunity-duration-yr set max-number-sick-at-one-time 0 set total-died 0 ;; =================================================== create-turtles number-people [ set status "healthy" set age random lifespan set color green set sick-time 0 set contact-time 0 set remaining-immunity 0 set size 1.5 ;; easier to see set quarantined? false setxy random-xcor random-ycor ] ;; code for number of links ask turtles [make-links] set initial-ave-links count links / count turtles ;; ======================================================================= ;; the next two line is to get the mean of number-of-links of turtles with high number of links ; let max-links-turtles max-n-of 1000 turtles [number-of-links] ; show mean [number-of-links] of max-links-turtles ;; ======================================================================== ask n-of initial-infectious-number turtles [ set status "contact-infected" set infectious-time 1 set color magenta ] reset-ticks ask links [hide-link] end to go set new-positive 0 ;; with each new tick = one day, set new-positive to zero to check how many new positive we have for each day ask turtles [ get-older ;; everybody gets older if status = "healthy" [ reproduce ;; this is to keep population number constant when peole dies ] if status = "contact-healthy" and quarantined? = true [set contact-time contact-time + 1 if contact-time > 14 [ set status "healthy" set quarantined? false ;; since he is healthy, can be released from quarantine make-links ;; after 14 days, and shown to be not sick, can form links agai. set color green set contact-time 0] ] ;; if a contact has not been qurantined, depending on the efficiency in contact tracing and the delay (as measured by contact-time) in qurantine ;; he might be or might not be quarantine. that is determined by a raondom number. if status = "contact-healthy" and quarantined? = false [set contact-time contact-time + 1 if contact-time >= to-quarantine [ if random 100 < contact-tracing [getting-quarantine]] if contact-time > 14 [ set status "healthy" set color green ;; no need to make links as links are still intact since it is not quarantined set contact-time 0] ] if status = "contact-infected" and quarantined? = true [set infectious-time infectious-time + 1 if infectious-time > random 14 [ set status "sick" ;; if infectious-time > max incubation time of 14, but can be shorter set color yellow ask [my-links] of self [die] ;; hospitalised, no longer have links to infect set total-sick total-sick + 1 set sick-time sick-time + 1 ] ] ;; any newly infected agent might not be identified yet, and therefore quarantined? = false. ;; if it is then identified, it will be a new case and then quarantined? set to true. ;; if can also become sick and thereofore identified, and that would turn it into a new case if status = "contact-infected" and quarantined? = false [infect ;; these are the agents who were not quarantined, though infectious. set infectious-time infectious-time + 1 set contact-time contact-time + 1 if contact-time >= to-quarantine [if random 100 < contact-tracing [getting-quarantine] ;; agent tested positive therefore quarantined set new-positive new-positive + 1] ;; set counter to note additional new positive if infectious-time > random 14 [ set status "sick" ;; if infectious-time > max incubation time of 14, but can be shorter set new-positive new-positive + 1 set color yellow ask [my-links] of self [die] ;; hospitalised, no longer have links to infect set total-sick total-sick + 1 set sick-time sick-time + 1 ] ] if status = "sick" [ infect ;; this line of code comes before severing links, as he might infect other first before identified and go to hospital ;; if links are cut already in the previous round, he won't be able to infect others. (See procedure on "to infect" set sick-time sick-time + 1 ask [my-links] of self [die] ;; with links severed, it cannot infect anyone - equivalent of going to hospital if sick-time > random-exponential 14 [recover-or-die] ;; average sick time is 14 days, beween 6 to 42 days. ] if status = "immune" [set color grey ask [my-links] of self [die] ;; life long immunity ; set remaining-immunity remaining-immunity - 1 ; if remaining-immunity <= 0 [get-normal] ;; no longer immune, and becomes like normal ] ] set number-sick count turtles with [status = "sick"] ;; this show the number sick at any ONE time set %infected (count turtles with [status = "sick"] + count turtles with [status = "contact-infected"]) / count turtles * 100 set %immune count turtles with [status = "immune"] / count turtles * 100 if number-sick > max-number-sick-at-one-time [set max-number-sick-at-one-time number-sick] if %infected > max%infected [set max%infected %infected] if %infected / max%infected < (1 - (lift-lockdown-point / 100)) [set max-number-of-links post-lockdown-max-links ;; when number of cases starts to fall ask turtles with [status = "health"] [make-links] set chance-infected post-lockdown-chance-infected ;; this comes about by reducing social distancing, not wearing mask etc. ] ;; if the trend of infection going down to a new cases only for a number of days, can lift lockdown if count turtles with [status = "sick"] + count turtles with [status = "contact-infected"] = 0 [stop] tick end to get-older set age age + 1 end to make-links ifelse max-number-of-links = 0 [let K exp(ln(random-float 1) / (- gamma)) if K > count turtles with [quarantined? = false] [ set K count turtles with [quarantined? = false] - 1] ;; only those not with quarantined? = true can form links set K round K create-links-with n-of K other turtles set number-of-links K] [let K exp(ln(random-float 1) / (- gamma)) if K > max-number-of-links [ set K max-number-of-links] ;; this will set the upper limit of links set K round K create-links-with n-of K other turtles set number-of-links K] end to reproduce if count turtles < number-people [hatch (number-people - count turtles) [set status "healthy" set age random lifespan set sick-time 0 set remaining-immunity 0 set size 1.5 ;; easier to see set quarantined? false make-links setxy random-xcor random-ycor] ] ask links [hide-link] end to infect ask link-neighbors [ifelse random 100 <= chance-infected [set status "contact-infected" ;; though the agent is infected, he is not yet identified as such. set color magenta set contact-time 1] ;; contact time is set as marker for when he is detected to be a contact [set status "contact-healthy" set color pink - 3 set contact-time 1 ] ;; contact time is set as market for when he is detected to be a contact ] end to getting-quarantine set quarantined? true ask [my-links] of self [die] ;; once the agentis quarantined, he is not linked to anyone end to recover-or-die ifelse random 100 > chance-recover [set total-died total-died + 1 die print total-died] [set status "immune" set color grey set sick-time 0 set contact-time 0 set quarantined? true set remaining-immunity immunity-duration-yr * 365 ] end ;to get-normal ; set status "healthy" ; set color green ; set sick-time 0 ; set contact-time 0 ; set quarantined? false ; make-links ;end
There is only one version of this model, created over 4 years ago by Ronald Paul Ng.
Attached files
No files
This model does not have any ancestors.
This model does not have any descendants.