Friday, January 29, 2010

Simple Evacuation Model in Netlogo

After talking with some colleagues about the problem I decided to construct a simple model that simulates how people in a city who are told to evacuate might make the decision to leave or stay. It is documented that many people either choose not to evacuate after being warned while many others simply can't because they lack the means (transportation, social network outside of their neighborhood, etc.).

The model is straight forward - a user specified number of agents are chosen to receive the evacuation notice. Every cell is randomly assigned a decision value that represents the likelihood that they'll actually leave. If that value is above some threshold, then the cell decides to evacuate (represented by green), otherwise they'll stay (red). The blue cells haven't heard one way or the other about the evacuation.


Next all the cells look at their neighbors and see if they've received the evacuation notice - if they haven't nothing changes. If their neighbors have made a decision it will affect the previous mentioned decision value either positively (if their neighbor is evacuating) or negatively (if their neighbor is staying put).

What we see is that there are random cells throughout the region that decide to stay - and also larger clusters (neighborhoods).



It is a very simple model - but I think it captures some of the dynamics of this process. Here is a link to the model: http://www.acsu.buffalo.edu/~mjwidene/evacmodel.nlogo (NOTE: Right click and save as - otherwise you'll get text. Also you need Netlogo to run the program).

And for those interested here is the code:

patches-own [aware? prob-evac evacuate? influence no!]

to setup
  ca
  ask patches[
    set aware? 0
    set pcolor blue
    set prob-evac random-normal .5 .3]
  repeat num-initial[
    ask one-of patches[
      set aware? 1
      set pcolor orange]]
  setup-initial-decision
end

to setup-initial-decision
  ask patches with [aware? = 1] [
    ifelse (prob-evac > .5)
      [set evacuate? 1
       set pcolor green]
      [set evacuate? 0
       set pcolor red]
      ]
end

to go
  display
  ask patches[
  if (prob-evac < .1)
    [set no! 1
     set pcolor red]
  look-at-neighbors
  make-decision
  ]
end

to look-at-neighbors
  set influence (count neighbors with [evacuate? = 1])
  if (no! = 0)[
  set prob-evac (prob-evac + .3 * (influence / 8))]
 


end

to make-decision
  ifelse (count neighbors with [evacuate? = 1] != 0)
    [ifelse (prob-evac > .5)
      [set evacuate? 1
       set pcolor green]
      [set evacuate? 0
       set pcolor red]]
    [if (prob-evac > 0.1)
      [set prob-evac (prob-evac - .1)]]

end

1 comment: