How law decrees influence the world of restaurants

How law decrees influence the world of restaurants preview image

1 collaborator

Default-person alberto gavazzi (Author)

Tags

covid-19, epidemiology, social distancing, 

"covid, spread"

Tagged by alberto gavazzi over 3 years ago

Visible to everyone | Changeable by the author
Model was written in NetLogo 6.2.0 • Viewed 435 times • Downloaded 53 times • Run 0 times
Download the 'How law decrees influence the world of restaurants' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


WHAT IS IT?

This paper, through the use of NetLogo software, aims to analyse the effects of the law decrees applied regarding the COVID-19 pandemic and how these affect the economy of a virtual restaurant system. We, therefore, want to highlight the economic aspect of the world of catering which must face fixed costs and which is heavily damaged by the harsh but necessary restrictions imposed by the government to face the pandemic. More measurements will be made, it will be possible to see through this study the consequences on the economy of the catering world before and after the introduction of vaccines, increasing the number of vaccinated people using the appropriate slider, increasing or decreasing the probability of state terminal of patients also on the basis of the evolution of knowledge on how to deal with the course of the disease, which was initially totally unknown and therefore defines the probability of subsequent immunization. All these values will influence the infection index which will determine the colour of the area and the consequent activity of the restaurateurs. In fact, as the contagion index increases, based on the sum between sick and infected divided by the total number of the population, the "white", "yellow", "orange" or "red" areas will be imposed, which lead to decreases in the availability of seats available in each restaurant, aimed at simulating the organization implemented by the restaurants in order to maintain social distance. In this regard, a contagion system is also implemented that predicts contagion every time a person is on the same patch as that of an infected or sick person. The program also provides the possibility both to define the initial number of sick, vaccinated and healthy people and graphs that allow the readers to follow live the trend of both the infections and how this influence the population and the costbenefit analysis connected to it which represents the fulcrum of my work. All this work to answer the two research questions that will be the leitmotif of the entire work: The first will compare two Runs with identical initial parameters which, however, will change in the threshold that determines the passage from one "Coloured Zone" to another, with parameters calculated on the population or with fixed parameters increased by 30%. The second concerns the influence of immunization, therefore the number of vaccinated people, how it can contribute to the resumption or delay of economic restrictions.

INTRODUCTION

For the past two years, the world has been under the attack of an invisible enemy, the Coronavirus, which has brought the entire globe to its knees by attacking every aspect: from the economy to health, from education to sociality12 . COVID-19 represented an unexpected threat that caught man unprepared and highlighted his weaknesses and frailties. Among the many wounds caused by this pandemic, one of the biggest has been inflicted on the world economy and in particular on those sectors that make their gain from the presence of customers. Among these, the world of catering has been strongly affected because closeness between people is the first means of spreading the virus and the consequent social distancing has prevented the normal development of activities, especially those indoors3 . The world population, however, did not stand by and tried to react in every area and with innovative and short-term proposals that however project on future results. Following the measures taken by the government, the restaurants adapted because they had to. Now that the sector's lived with these adjustments for some time, their long-term potential is more apparent. Restaurants have learned that in order to survive they must be ready to face sudden crises or radical changes, innovate and reinvent themselves. Some measures, like wearing masks and mandating a six-foot distance between seats, will likely fade with the virus. Others, like frequent hand washing, hand sanitizer stations for guests and regular disinfection, will persist. Restaurant health and safety protocols may reach a scientific level. On the evening of November 3, 2020, the fourth DPCM of the second wave is signed4 . The ministerial decree, in force from 6 November to 3 December 2020, provides for a curfew throughout the national territory from 22.00 to 5.00 the next morning, with movements allowed in this time slot only for work needs or proven health and necessity reasons and the suspension of all other activities already provided for in the previous decrees. To manage the pandemic in Italy, the government has decided to adopt a differentiated regime between the Regions, each of which by order of the Ministry of Health is assigned one of the three differentiated bands for the danger of contagion, calculating the Rt index. This index, however, has always been too late to photograph the real situation of the infections and therefore inadequate to determine the colour of the Regions accordingly. For this reason, now, the scenarios are also parameterized to the incidence of infections in the region together with the percentage of occupancy of beds in the medical area and in intensive care for Covid patients, defining an Infection Index that will be represented in this model with a simpler version. The following model wants to be an example of a model-based problem for the representation of a virtual environment in which there is a catering system consisting of 4 restaurants, a population with many healthy, sick, infected and immunized people and an economic system which shows, net of fixed costs and revenues, the effective weight of the legislative restrictions. This will be represented through the NetLogo software to see the different settings of the threshold (calculated in proportion or in a predefined way) and how vaccination can help economic recovery.

MANAGERIAL PROBLEM

The managerial problems that will be analysed will be two: the first will concern the changes in the threshold relating to the various areas, whether this occurs in a proportional manner to the population or in a defined manner. The second will instead deal with how immunization and vaccines can help the economy in general and specifically that of catering. -How the data vary as the thresholds vary: proportional vs defined As previously defined, the Italian government has signed decree-laws which provide for the division of Italy into zones of different colours, initially defined by the contagion indexes Rt or R0. These areas provided for the limitation of various aspects of normal life, in fact there are: - red zone: movement into and out of the regions prohibited, commercial activities except for food delivery. -orange zone: similar to the red one but allows movement in the yellow and didactic zone in presence. - yellow zone: activities such as bars, restaurants, shopping centers reopen. -white zone: total resumption of all activities without limitations. To further highlight the study of our interest, we will limit the consequences of the various areas to a halving of the places available in restaurants. Belonging to one area or another is currently defined basing on new parameters that take into account, among the most important factors, the weekly incidence of infections per 100 thousand inhabitants . This situation is reported in the model to always have a proportion between the threshold and the number of the population considering, in real-time, the number of infected and the number of healthy people. It is possible to see the calculation of the rti (infection index) which will be given by the sum of the infected and the sick on the total population. Subsequently 3 parameters "q", "w" and "r" are defined which represent the 3 thresholds updated interactively and calculated proportionally as the total population for one of the 3 parameters initially defined as: - w-par (white parameter) = 50 - y-par (yellow parameter) = 150 - o-par (orange parameter) = 250. These three parameters are fundamental for this part under examination and we will compare them with a run in which these parameters are increased by 30% to see what effects a higher threshold would have in the economy and in infections. We define the starting data that will be the same for both runs except for the transition parameters of the zones. -Initial-healthy 100 -Initial-infected 4 -disease period 8 -6 vaccinated -15% terminal-chance -Initial infection index 0.05 The first Run will be performed with the infection thresholds calculated in proportion to the population. The second run will keep the same initial data but the transition threshold will have a value defined at the start and increased by 30%. This variation will involve changes in a double aspect, on one side the improvement, albeit temporary in the economic aspect, on the other side a worsening of the spread of the virus. These results will be discussed later in the appropriate section. -How an increase in the number of vaccinated can affect the economic aspects. The second research question analyses how the increase in the number of vaccinated people can delay the passage from one area to another, thus decreasing the economic income, and how this is therefore linked to the lowest possible number of infections. With the COVID-19 pandemic that began in early 2020, numerous research centers around the world have launched a trial process aimed at creating an effective and safe vaccine against SARS-CoV-2. Initially, the prospectus for waiting times for the first vaccines was more than a year. However, some pharmaceutical and biotechnology companies involved in the trial have forged ahead and managed to distribute the first vaccine preparations approved already between the end of December 2020 and January 2021. In April 2021, there were four anti-COVD-19 vaccines approved by the FDA and EMA and in distribution, and several are still undergoing clinical trials or awaiting approval. A decisive effect on the trend of the economy in the year that is about to close was first the generalized lockdown of last spring, then the closures of entire production sectors determined by the new surge in infections from October onwards. Only in the presence of a significant lowering of the contagion curve, it will be possible to avoid the use of new restrictive measures. In the immediate future, the slowdown in GDP in the last quarter of the year can only be recorded, with its negative "drag" on the first months of the new year. If the vaccination campaign actually follows the pre-established timing smoothly (and indeed can be further strengthened by the arrival of new vaccines), it is possible that a much more sustained growth rate can be achieved in the next year than the "worst scenario" expected by the Government itself. Two runs will also be carried out this time in which the number of people vaccinated will vary, increasing it by 30%. The initial data of the first run will therefore be: -Initial-healthy 100 -Initial-infected 6

-disease period 8 -10 (13 in the second run) vaccinated -15% terminal-chance - Initial infection index 0.08

MODEL DESCRIPTION

In this section we will explain the parameters and functions that allowed the development of the model. The model shows an interface with which the user can interact to modify the initial parameters. As is possible within the virtual environment there are turtles identified by various colours to define their state of health, which randomly choose one of the 4 restaurants where to go to spend their money. During their virtual life, marked by ticks, they will go from one restaurant to another and whenever a healthy person is in the same patch as an infected or an immune one, the infection will occur. Following the infection there will be an incubation period followed by a period of illness that may end with the immunization from the virus or with the death of the turtle. As the number of infections increases, the observer will communicate various information including: the value of the contagion index, the colour of the area, the number of seats available and the number of people in each restaurant, thus calculating the relative profit based on attendance. The health classes are divided into: -Healthy (blue) -Infected (red) -Sick (yellow) -Immune (green) -Dead (grey) Each turtles present is equipped with a wallet containing 20 coins to spend (identified by the cash variable) in one of the 4 restaurants (red, brown, magenta and turquoise), an incubation period settable in range 1 to 1410, a period defining the course of the disease, settable in range 5 to 1614. It is also possible, through a slider in the main interface, to define the chances of death in an interval ranging from 3 to 15%.19 Each restaurant, represented with an house shape, has fixed costs, randomized within a defined range, and available seats that will be halved in the passage from one area to another. Within the environment there is also a hospital that will welcome all sick people during the course of their illness. Healthy people have an initial probability of being immune through the reactivity of T cells which will be represented by a random variable in the range [0; 10]. At the end of the disease the probability of obtaining an immunization will be about 83%. Inside the interface there are two Plots: the first shows the trend of the infection over time (ticks) showing in the Y axis the numbers that represent the health condition of the population. At the same time, the second Plot shows the sum of the fixed costs (random) of the various restaurants, through the constant red line, and the sum of the profits of the restaurants. The profit of each restaurant is calculated as the product of the people in each business for the money they spend there. Each restaurant will therefore take into account the number of people present and the number of seats available. If the first exceeds the seats then the restaurant will calculate the profit as the product between money of each person ( settled at 20 for simplicity) for the maximum number of seats available at that time. These seats, as said before, will be decreased according to the colour of the area by a factor of 2. The spread of the infection is implemented through the "infect" function, which checks, once a healthy person is in the same box as an infected person, whether he is immune and if not, sets a timer defining the incubation period. This mode of infection simulates the spread of the virus due to non-compliance with the rules governing social distance. At each tick the healthy turtles will search for a restaurant using the "goal" function, choosing the one that, after walking randomly, is farthest from their position. Once there, they will spend their money if possible, and on the next tick they will repeat this operation by refilling their money with the "restore" function.

COMMENTS AND RESULTS

We will first analyze the results of how the contagion thresholds influence the economic trend with the same initial conditions but with a different calculation of the thresholds. Starting with the thresholds defined on a proportional basis every 50 - 150 - 250 infected per 100,000 inhabitants, after a period of 5 ticks we can see the transition from white to yellow zone with a contagion index equal to 0.063 with 6 infected and 1 sick person . At this moment it is possible to notice the decreasing trend of the profit curve after a period of more or less constant but which is still above the total fixed costs. No significant data emerges from the contagion graph up to 7 tick where we find an increase in the infected now at 13 and the overcoming of their curve compared to the immune. At the next tick, the number 8, we have the passage to the orange area which only allows the take away service and which further reduces the profits available for each restaurant. It is possible to note that at this moment the revenue curve crosses the cost curve in a descending manner, starting a loss period for the assets. After only 3 ticks the red zone is passed with a total of 33 infected, 9 sick and a contagion index of 0.38. The next tick presents a small economic recovery that corresponds to the momentary decrease in the infected curve and the increase in the immune curve that accompanies a short flat period of the still healthy curve. Around tick 23 the curve of the infected begins to decline while the curve of the sick people is continuously increasing accompanied by the green curve of the immune until tick 25 where we see a crossing of most of the lines and the definitive growth of the immune corresponds to a decrease of the sick. However, this is also accompanied by the data relating to deaths that begin to grow around the 28th tick. Now with the same initial data but with a 30% increase in the thresholds for the contagion imposed in input we will have the following situation. Also this time the transition from yellow zone to white zone occurs at 5 tick but this continues until the tenth tick, thus gaining two more ticks of yellow zone that show a more constant trend in the profit chart with a lower percentage of forfeiture. Even here, in the transition from yellow to orange, we have the point of contact between the profit curve and the cost curve The transition to the red zone occurs at tick 13, which has a contagion index of 0.39, 33 infected and 19 sick. At this moment the profit curve is slightly below the cost curve and at the same time we have an increase in the infected in an inversely proportional way to the healthy people while the curves of the immune and the sick go almost the same trend. This situation remains almost unchanged, net of small peaks up to tick 24 where there is the crossing of the lines of contagion that sees the sick above, a decrease in the number of infected and at the same time an increase in the number of immune. Up to tick 28 which sees the number of immunized people higher than all the other curves that will bring back to yellow zone again after about 70 ticks. Both runs were performed for a total number of 80 ticks. The data that can be extrapolated from the examination of the two runs are that a preset increase in the infection thresholds delays the passage of the zones, and therefore of the restrictions, except for the white zone. This implies a more stable economic performance with a less steep descent which could have a less severe impact on the economy of a real system. The negative side that is highlighted, however, can be followed in the contagion plot where we have a delay in the decrease of the infected and the sick that occurs at about tick 24 in the first run and only at tick 28 in the second run. This can be explained by the fact that greater freedom involves a greater number of people present in environments that force them to stay in close contact and facilitate the spread of the virus and this will therefore lead to an increase in profits at first but a period of prolonged restrictive zone which would lead to losses that would cancel the profits earned previously. Now two runs will be re-examined but the number of initial vaccines will be increased by 30%. We will therefore have a number of people immune at the start of the simulation equal to 13 and we will analyse the impacts of this change. 1° run The first run, which presents an initial number of vaccinated people equal to 10, makes the transition from the white area to the yellow area at the third tick with a contagion index of 0.06, from here begins the decline of the total profit but which at the moment remains still above the fixed cost line. The number of infected is equal to 5, still below the immune threshold. Around tick 6 there is a small economic recovery but the threshold of the infected crosses that of the immune, with a gradual decline of healthy people. At tick 8 the profit curve falls precipitously, in correspondence with this event the curve of the infected increases and exceeds the curve of the immune which is also reached by the curve of the sick, we are now in the orange zone. At tick 10 there is the passage in the red zone and the approach of the curve of the infected to that of healthy people, while the profit continues to remain well below the cost threshold continuing its descent. Only at tick 21 there is the intersection between the various curves, with the curve of the sick that dominates the others and the curve of the immune which is close to that of the infected. At the final tick, the thirtieth, the immune curve will be detached from the others with immune and infected decreasing, the profit line remains constantly negative even if with some recovery peak for an medium period, only after increasing the number of immunes there is a total recovery of profits. 2° run In this run the number of initial vaccinations will be 13 and it is possible to notice a difference at the start, the contagion index is already lower, equal to 0.051. Here, too, the transition to the yellow zone occurs at the third tick, here there is a waning phase of total profit. The transition to the orange zone occurs at tick 16, about double compared to the first run. Here there is a very marked negative slope of the profit curve which crosses and falls below the fixed cost curve, and the immune, albeit in a slightly increasing phase, are reached by the infected curve. The transition to the red zone occurs around tick 23, a good 7 ticks later than the 2 ticks of the previous run. There is still a greater number of immune than infected. What can be seen by comparing these two runs is that an increase of 30% in the initial immunity has led to several improvements, confirming that the vaccination campaign is of fundamental importance for the economic recovery. In fact, the restrictions imposed by the orange and red zones occur with a delay of about twice the time in the second run, which therefore allows the economy to function more efficiently and to have the reopening of activities and the recovery of profit as shown from the profit graph in the second run, after a first peak phase of infections, following the immunization of the population. It is therefore obvious that a greater number of the initial immunes therefore reduces the possibility of contagion.

MODEL'S LIMITS

The model tries to represent people's social life simply by making them wander around the virtual environment but without a real life, with other hobbies than going to the restaurant. Relational networks, developments and normal life course (workplaces, schools, etc.) which could be places of further contagion are not taken into consideration. Furthermore, it would be better to be able to examine the results of runs on a number of people who can most closely resemble reality, then work with thousands and millions of people. This however, due to computational limitations of the resources available to me, is not currently possible

Comments and Questions

Click to Run Model

breed [healthies healthy] ;;Different breeds of turtles to show heatlh state.
breed [infecteds infected]
breed [sicks sick]
breed [immunes immune]
breed [deads dead]
breed [restaurants rest]
breed [hospitals hosp]

globals [ ;; Global variables.
  total-healthy
  total-sick
  total-infected
  total-immune
  total-dead
  total-wealth
  total-cost
  Cost
  rti
  check-seats
  total-income
  seats0
  seats1
  seats2
  seats3
  flag
  immune-chance-after
  immune-chance-before
]

turtles-own [  ;; Turtle variables.

  incubate
  sickness
  terminal-check
  immune-check
  money
  x
  y

  turn-check
]
restaurants-own [  ;; patches variables.

  max-people
  fixed-cost1
  fixed-cost2
  fixed-cost3
  fixed-cost4
  income0
  income1
  income2
  income3

]

to setup  ;; Initialize the model.
  clear-all
  clear-turtles
  reset-ticks
  set immune-chance-after 83
  set immune-chance-before random 10
  create-restaurants 1 [setxy -12 14 set size 3 set shape "house" set color magenta set fixed-cost1 random-float 200 set seats0 22]
  create-restaurants 1 [setxy -13 -8 set size 3 set shape "house" set color turquoise set fixed-cost2 random-float 450 set seats1  38 ]
  create-restaurants 1 [setxy 12 14 set size 3 set shape "house" set color brown  set fixed-cost3 random-float 300 set seats2  22]
  create-restaurants 1 [setxy 15 -10  set size 3 set shape "house" set color red set fixed-cost4 random-float 675 set seats3  52 ]
  create-hospitals 1 [setxy 1 -14 set size 8 set shape "hospital" set color white ]
  set w-par 50
  set y-par 150
  set o-par 250

  update-plot1

  setup-agents
  set Cost total-cost


  update-globals
  first-plot
end 

to go  ;; Run the model.
   disease-check

   repeat 7 [ ask healthies [ fd 1 ] display ]
   repeat 7 [ ask infecteds [ fd 1 ] display ]

   repeat 7 [ ask immunes [ fd 1 ] display ]
  goal
  update-plot1

  rt-index
  places

  tick

  update-globals
  first-plot

  randomize
end 

to-report tot
  report sum [fixed-cost1 + fixed-cost2 + fixed-cost3 + fixed-cost4] of restaurants
end 

to update-plot1
  set total-cost tot
end 

to places
  ask rest 0 [
    show "number of clients "
    show count turtles-here - 1
    show "available seats"
    show seats0
 set check-seats count turtles-here - 1
  ifelse check-seats > seats0
  [show "available seats limit exceeded, calculating the maximum possible profit ..."
    set income0 seats0 * 20
      show "income of restaurant is -->"
    show income0 ]
  [show "seats still available"
    set income0 check-seats * 20
        show "income of restaurant is -->"
    show income0]
  stop]

   ask rest 1 [
    show "number of clients "
    show count turtles-here - 1
    show "available seats"
    show seats1
 set check-seats count turtles-here - 1
  ifelse check-seats > seats1
  [show "available seats limit exceeded, calculating the maximum possible profit ..."
    set income1 seats1 * 20
      show "income of restaurant is -->"
    show income1 ]
  [show "seats still available"
    set income1 check-seats * 20
        show "income of restaurant is -->"
    show income1]
  stop]

   ask rest 2 [
    show "number of clients "
    show count turtles-here - 1
    show "available seats"
    show seats2
 set check-seats count turtles-here - 1
  ifelse check-seats > seats2
  [show "available seats limit exceeded, calculating the maximum possible profit ..."
    set income2 seats2 * 20
      show "income of restaurant is -->"
    show income2 ]
  [show "seats still available"
    set income2 check-seats * 20
        show "income of restaurant is -->"
    show income2]
  stop]

   ask rest 3 [
    show "number of clients "
    show count turtles-here - 1
    show "available seats"
    show seats3
 set check-seats count turtles-here - 1
  ifelse check-seats > seats3
  [show "available seats limit exceeded, calculating the maximum possible profit ..."
    set income3 seats3 * 20
      show "income of restaurant is -->"
    show income3 ]
  [show "seats still available"
    set income3 check-seats * 20
        show "income of restaurant is -->"
    show income3]
  stop]
  set total-income sum [income0 + income1 + income2 + income3 ] of restaurants
  show total-income
end 

to setup-agents  ;;  Setup the begining number of agents and their initial states.
  set-default-shape healthies "person"

  set-default-shape infecteds "person"
  set-default-shape sicks "person"
  set-default-shape immunes "person"
  set-default-shape deads "person"

  ask n-of initial-healthy patches
     [ sprout-healthies 1
      [ set color blue
        set money 20] ]

  ask n-of initial-infecteds patches
    [ sprout-infecteds 1
      [ set color red
        set incubate random 14
        set money 20] ]

   ask n-of  vaccinated patches
     [ sprout-immunes 1
      [ set color green
        set money 20] ]
end 

to disease-check ;;  Check to see if an infected or sick turtle occupies the same patch.
  ask healthies [
    if any? other turtles-here with [color = yellow]
    [infect]
    if any? other turtles-here with [color = red]
    [infect]
    wander
  ]

  ask sicks [
    if any? other turtles-here with [color = blue]
    [infect]

    set sickness sickness - 1
    if sickness < 1
    [live-or-die]
  ]

  ask infecteds [
    if any? other turtles-here with [color = blue]
    [infect]
    wander
    set incubate incubate - 1
    if incubate = 0
    [get-sick]
  ]

 ask immunes [wander]
end 

to goal

  ask turtles with[ shape = "person" and color != grey and color != yellow][


    set x max-one-of turtles with [shape = "house" and color != white  ][distance myself]
    face x
    set y distance x
    while [y  > 1]
     [
        fd   1 display
        set y y - 1
        ]
    if y < 1 [
      eat

      ]


  ]
  ask turtles with [ shape = "person" and color = yellow][
    set x max-one-of turtles with [shape = "hospital" and color = white   ][distance myself]
     face x
    set y distance x
    while [y  > 1]
     [
        fd   1 display
        set y y - 1
        ]

  ]
end 

to rt-index
  set rti((count sicks + count infecteds) / (count healthies + count immunes + count sicks + count infecteds))

  let q  (count healthies + count immunes + count sicks + count infecteds) * w-par / 100000
  let w   (count healthies + count immunes + count sicks + count infecteds) * y-par  / 100000
  let r  (count healthies + count immunes + count sicks + count infecteds) * o-par  /  100000
    if rti >= 0 and rti < q
  [
    show "WHITE ZONE"
     ask rest 0 [  set seats0 22]
    ask rest 1 [set seats1 38]
    ask rest 2 [set seats2 22]
    ask rest 3 [set seats3 52]
  set flag 1]

 if  rti >= q and rti <= w
  [ ask rest 0 [  set seats0 22]
    ask rest 1 [set seats1 38]
    ask rest 2 [set seats2 22]
    ask rest 3 [set seats3 52]
  set seats0 seats0 / 2
  set seats1 seats1 / 2
  set seats2 seats2 / 2
    set seats3 seats3 / 2

    if flag < 2 [
    show "YELLOW ZONE"
    ask rest 0 [  set seats0 22]
    ask rest 1 [set seats1 38]
    ask rest 2 [set seats2 22]
    ask rest 3 [set seats3 52]
  set seats0 seats0 / 2
  set seats1 seats1 / 2
  set seats2 seats2 / 2
    set seats3 seats3 / 2


    set flag 2] show "YELLOW ZONE" ]

  if rti > w and rti <= r  [
   if flag < 3 [
    show "ORANGE ZONE"
    show "only take away."
   set seats0 seats0 / 2
  set seats1 seats1 / 2
  set seats2 seats2 / 2
      set seats3 seats3 / 2
  set flag 3]
    show "ORANGE ZONE"
    show "only take away." ]

  if rti > r  [
    show "INDEX GREATER THAN MAX "

    show "---->"
    show "RED ZONE"
  show "only take away"]
  show ((count sicks + count infecteds) /  (count healthies + count immunes + count sicks + count infecteds))
end 

to randomize
   ask turtles with[ shape = "person" and color != grey and color != yellow][
    face  patch 0 0
   repeat 2 [ ask healthies [ fd 0.2 ] display ]
   repeat 2 [ ask infecteds [ fd 0.2 ] display ]

   repeat 2 [ ask immunes [ fd 0.2 ] display ]
    fd random-float 20
    rt random-float 20
    lt random-float 20
    restore

 ]
end 

to eat
  while [money > 0][

    show " at the restaurant"
    set money money - 1 ]
end 

to restore
  set money 20
end 

to infect ;;  Infect a healthy turtle, test if it is immune and set the incubation timer if it isn't.
  set immune-check random 100
  ifelse immune-check < immune-chance-before
  [recover]
  [ask healthies-on patch-here[
    set breed infecteds
    set incubate random 14]
  ask infecteds-on patch-here [set color red]]
end 

to get-sick ;;  Change an infected turtle into an sick turtle and set the disease progression timer.
   set breed sicks
   set color yellow
   set sickness disease-period
end 

to terminate ;;  Kill a sick turtle who reaches the end of the disease progression and fails the terminal check.
  set breed deads
  set color grey
  fd -1
end 

to live-or-die ;; Test if the turtle dies from the disease.
  set terminal-check random 100
  ifelse terminal-check < terminal-chance
  [terminate]
  [recover]
end 

to recover  ;;  Change turtle breed to immune.
  set immune-check random 100
  if immune-chance-after > immune-check
  [set breed immunes
  set color green]
  if immune-chance-after < immune-check
  [set breed healthies set color blue]
end 

to update-globals ;;Set globals to current values for reporters.
  set total-healthy (count healthies)
  set total-infected (count infecteds)
  set total-sick (count sicks)
  set total-immune (count immunes)
  set total-dead (count deads)
end 

to wander ;; Random movement for agents.
    set turn-check random 20
    if turn-check > 15
    [right-turn]
    if turn-check < 5
    [left-turn]
end 

to right-turn ;;Generate a random degree of turn for the wander sub-routine.
  rt random-float 20
  fd random-float 20
end 

to left-turn   ;;Generate a random degree of turn for the wander sub-routine.
  lt random-float 20
  fd random-float 20
end 

to first-plot ;; Update graph.
  set-current-plot "Population Totals"
  set-current-plot-pen "Healthy"
  plot total-healthy
  set-current-plot-pen "Infected"
  plot total-infected
  set-current-plot-pen "Sick"
  plot total-sick
  set-current-plot-pen "Immune"
  plot total-immune
  set-current-plot-pen "Dead"
  plot total-dead
end 

There are 2 versions of this model.

Uploaded by When Description Download
alberto gavazzi over 3 years ago descrpitions Download this version
alberto gavazzi over 3 years ago Initial upload Download this version

Attached files

File Type Description Last updated
How law decrees influence the world of restaurants.png preview Preview for 'How law decrees influence the world of restaurants' over 3 years ago, by alberto gavazzi Download
how the law decrees influence the world of restaurants.pdf pdf Description of the work over 3 years ago, by alberto gavazzi Download

This model does not have any ancestors.

This model does not have any descendants.