# An Agent-Based Model of Crowd Evacuation: Combining Individual, Social and Technological Aspects

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

## WHAT IS IT?

Development of crowd evacuation systems is a challenge due to involvement of complex interrelated aspects, diversity of involved individuals and/or environment, and lack of direct evidence. Evacuation modeling and simulation is used to analyze various possible outcomes as different scenarios unfold, typically when the complexity of scenario is high. However, incorporation of different aspect categories in a unified modeling space is a challenge. In this paper, we addressed this challenge by combining individual, social and technological models of people during evacuation, while pivoting all these aspects on a common agent-based modeling framework and a grid-based hypothetical environment. By simulating these models, an insight into the effectiveness of several interesting evacuation scenarios is provided. Based on the simulation results, a couple of useful recommendations are also given.

## HOW IT WORKS

Our model explores relationship of panic (or not panic) with decision-making while agents are exiting from one of the two exits.

## HOW TO USE IT

SETUP: Sets up the environment, and generates two types of agents (persons). GO: Let the persons exit using one of the two exits, left or right, based on one of the three strategies used.

## THINGS TO NOTICE

Exit usage graph. Panic graph.

## THINGS TO TRY

Use different environment types, difffernt population densities and % of rational agents and three exit behavior strategies.

## EXTENDING THE MODEL

Try other extensions.

## NETLOGO FEATURES

## RELATED MODELS

## CREDITS AND REFERENCES

To appear: "An Agent-Based Model of Crowd Evacuation: Combining Individual, Social and Technological Aspects" in ACM SIGSIM PADS 2020 scheduled on June 2020 (https://www.acm-sigsim-pads.org/).

## Comments and Questions

extensions [table] breed [ persons person ] ; agents that need to exit globals[ tleft tright ; total number of persons exitting from left and right speed using-left using-right last-left last-right max-agents-in-panic-rational max-agents-in-panic-emotional max-panic-value ] patches-own [structure-type walkable? exit-id doms steps-to-exits patch-value-left patch-value-right ; variables representing environment updated? initial-target-exit dom spread-update-left? spread-update-right? ; helping environment varaibles ] persons-own [curr-dir curr-exit state in-panic-for moving-for waiting-for rational? has-changed?] to setup create-env ; creates environment with 2 exits (left and right), environment type: can be 1, 2 or 3; 1 is symmetric, 2 is asymmetric, and 3 is (one exit) invisible, and floor field setup-agents ; sets up persons, based on ; 1: number of persons ; 2: rational persons % InitializeGlobals ; initialies global parameters end to go ask persons [ if (strategy = 1) [set curr-exit str1] if (strategy = 2) [str2] if (strategy = 3) [str3] set curr-dir get-direction-to-dest curr-exit set heading curr-dir move-now ] set-globals if (strategy = 3) [spread decay setup-exits] tick if (count persons < 2) [stop] end to-report str1 let exitsel "" let dist 9999 let patch-ste [steps-to-exits] of patch-here let allf table:keys patch-ste foreach allf[ [z] -> let d table:get patch-ste z if (d < dist) [ set dist d set exitsel z ] ] report exitsel end to str2 let cnt count turtles-on neighbors if (cnt > 0) [ let ag one-of turtles-on neighbors let exit_ag [curr-exit] of ag let exit_a curr-exit let payoff -1 let prob -1 let r random 10 if (not rational?) [ ifelse (exit_ag = exit_a) [ ;set prob (1 / (9 + (0.644 ^ -0))) ; no change CHANGE WITH with prob 0 ;set prob int (prob * 10) ;if (prob = r) [set curr-exit exit_ag] ] [ if (in-panic-for > 0) [ set prob (1 / (9 + (0.644 ^ -0))) ; ; no change CHANGE WITH with prob 0.1 set prob int (prob * 10) if (prob = r) [set curr-exit exit_ag] ] ] ] if (rational? and in-panic-for <= 0) [ ifelse (exit_ag = exit_a) [ if (not has-changed?)[ set prob (1 / (9 + (0.644 ^ -0))) ; ; no change CHANGE WITH with prob 0.1 ;set prob 1 - (1 / (1 + 0.644 ^ -5)) ; definately change with prob 0.9] set prob int (prob * 10) if (prob = r) [ifelse (curr-exit = "left") [set curr-exit "right" if (allow-one-change) [set has-changed? true]][set curr-exit "left" if (allow-one-change) [set has-changed? true]]] ] ] [ if (not has-changed?)[ set prob 1 - (1 / (1 + 0.644 ^ -5)) ; definately change with prob 0.9] set prob int (prob * 10) if (prob = r) [ifelse (curr-exit = "left") [set curr-exit "right" if (allow-one-change) [set has-changed? true]][set curr-exit "left" if (allow-one-change) [set has-changed? true]]] ] ] ] if (rational? and in-panic-for > 0 and not has-changed?) [ ifelse (exit_ag = exit_a) [ ifelse (curr-exit = "left") [set curr-exit "right" if (allow-one-change) [set has-changed? true]][set curr-exit "left" if (allow-one-change) [set has-changed? true]] ] [ ;set prob (1 / (9 + (0.644 ^ -0))) ; no change CHANGE with prob 0 ] ] if (rational? and in-panic-for > 0 and has-changed?) [ ifelse (exit_ag = exit_a) [ ifelse (curr-exit = "left") [set curr-exit "right" if (allow-one-change) [set has-changed? true]][set curr-exit "left" if (allow-one-change) [set has-changed? true]] ] [ set prob sensitivity ; ; sensitivity set prob int (prob * 10) if (prob = r) [set curr-exit exit_ag] ] ] ] end to str3 let cnt count turtles-on neighbors if (cnt > 0) [ let ag one-of turtles-on neighbors let exit_ag [curr-exit] of ag let exit_a curr-exit let payoff -1 let prob -1 let r random-float 1 let pvl patch-value-left ;of patch-here let pvr patch-value-right ;of patch-here let exit-value "" if (pvl > pvr) [set exit-value "left"] if (pvr > pvl) [set exit-value "right"] if (rational? and in-panic-for <= 0) [ ifelse (exit_ag = exit_a) [ ifelse(exit_a = exit-value) [] [ set prob (1 / (1 + 0.644 ^ 2.5)) if (prob >= r) [ifelse (curr-exit = "left") [set curr-exit "right"][set curr-exit "left"]] ;do with prob 0.75 ] ] [ ifelse(exit_a = exit-value) [] [ set prob (1 / (1 + 0.644 ^ -2.5)) if (prob >= r) [ifelse (curr-exit = "left") [set curr-exit "right"][set curr-exit "left"]] ;do with prob 0.25 ] ] ] if (rational? and in-panic-for > 0) [ ifelse (exit_ag = exit_a) [ ifelse(exit_a = exit-value) [ set prob (1 / (1 + 0.644 ^ -2.5)) if (prob >= r) [ifelse (curr-exit = "left") [set curr-exit "right"][set curr-exit "left"]] ;do with prob 0.25 ] [ ifelse (curr-exit = "left") [set curr-exit "right"][set curr-exit "left"] ] ] [ ifelse(exit_a = exit-value) [] [ set prob (1 / (1 + 0.644 ^ 2.5)) if (prob >= r) [ifelse (curr-exit = "left") [set curr-exit "right"][set curr-exit "left"]] ;do with prob 0.75 ] ] ] ] end to-report get-direction-to-dest [dest] let patch-dom [doms] of patch-here report table:get patch-dom dest end to move-now if (state = "start" or state = "walk")[set color green - 2 move-forward] if (state = "wait") [set color blue move-forward] if (state = "panic") [set color red move-forward] if (state = "end") [ ifelse (strategy = 3) [ ifelse (curr-exit = "left") [announce "left" set using-left using-left + 1 set last-left ticks] [announce "right" set using-right using-right + 1 set last-right ticks] die ] [ ifelse (curr-exit = "left") [set using-left using-left + 1 set last-left ticks] [set using-right using-right + 1 set last-right ticks] die ] ] end to move-forward ifelse not any? other turtles-on patch-ahead speed [fd speed set in-panic-for 0 set waiting-for 0 set moving-for moving-for + 1 set state "walk"] [ ifelse scan-neighbor-right 45 [rt 45 fd speed set in-panic-for 0 set waiting-for 0 set moving-for moving-for + 1 set state "walk"] [ ifelse scan-neighbor-left 45 [lt 45 fd speed set in-panic-for 0 set waiting-for 0 set moving-for moving-for + 1 set state "walk"] [ ifelse scan-neighbor-right 90 [rt 90 fd speed set in-panic-for 0 set waiting-for 0 set moving-for moving-for + 1 set state "walk"] [ ifelse scan-neighbor-left 90 [lt 90 fd speed set in-panic-for 0 set waiting-for 0 set moving-for moving-for + 1 set state "walk"] [ ifelse scan-neighbor-right 135 [rt 135 fd speed set in-panic-for 0 set waiting-for 0 set moving-for moving-for + 1 set state "walk"] [ ifelse scan-neighbor-left 135 [lt 135 fd speed set in-panic-for 0 set waiting-for 0 set moving-for moving-for + 1 set state "walk"] [ set waiting-for waiting-for + 1 set moving-for 0 set state "wait" if (waiting-for > 5) [set state "panic" set in-panic-for in-panic-for + 1 if (max-panic-value < in-panic-for) [set max-panic-value in-panic-for] set moving-for 0] ] ] ] ] ] ] ] if [structure-type] of patch-here = "exit" [set state "end"] end to-report scan-neighbor-right [angle] let return? false let praa patch-right-and-ahead angle speed ;if ([structure-type] of praa = "wall") [report return?] ;let c count other turtles-on praa ;ifelse praa = nobody [][if (c <= 3) [set return? true]] ifelse praa = nobody [][if not any? other turtles-on praa [set return? true]] report return? end to-report scan-neighbor-left [angle] let return? false let plaa patch-left-and-ahead angle speed ;if ([structure-type] of plaa = "wall") [report return?] ifelse plaa = nobody [][if not any? other turtles-on plaa [set return? true]] report return? end to announce [ex] let ph patch-here ask ph [ ask neighbors [ifelse ex = "left" [set patch-value-left patch-value-left + 1] [set patch-value-right patch-value-right + 1]] ] end to set-globals let c count persons with [in-panic-for > 0 and rational?] if (c > max-agents-in-panic-rational) [set max-agents-in-panic-rational c] let d count persons with [in-panic-for > 0 and not rational?] if (d > max-agents-in-panic-emotional) [set max-agents-in-panic-emotional d] end to spread ask patches [set spread-update-left? false set spread-update-right? false] ask patches [ if (patch-value-left > 0) [ let pvl patch-value-left ask neighbors [ if not spread-update-left? [ if (patch-value-left < pvl) [set patch-value-left (pvl - (pvl / 10)) set spread-update-left? true] set pcolor orange + patch-value-right ] ] ] if (patch-value-right > 0) [ let pvr patch-value-right ask neighbors [ if not spread-update-right? [ if (patch-value-left < pvr) [set patch-value-right (pvr - (pvr / 10)) set spread-update-right? true] set pcolor yellow + patch-value-right ] ] ] if (patch-value-left = 0 and patch-value-right = 0) [set pcolor white] ] end to decay ask patches [ let dl patch-value-left / 10 let dr patch-value-right / 10 ifelse (patch-value-left > 0.1) [set patch-value-left patch-value-left - dl] [set patch-value-left 0] ifelse (patch-value-right > 0.1) [set patch-value-right patch-value-right - dr] [set patch-value-right 0] ] end ;;;;;;;;;;;;;;;;;;;; INITIALIZE GLOBALS ;;;;;;;;;;;;;;;;;;;;; to InitializeGlobals set speed 1 set using-left 0 set using-right 0 set last-left 0 set last-right 0 set max-agents-in-panic-rational 0 set max-agents-in-panic-emotional 0 set max-panic-value 0 end ;;;;;;;;;;;;;;;;;;;; PERSONS SETUP ;;;;;;;;;;;;;;;;;;;;;;;;;;; to setup-agents clear-turtles reset-ticks create-persons num-agents [ move-to one-of patches with [structure-type = "floor" and (not any? other turtles-here)] set color black set state "start" set in-panic-for 0 set moving-for 0 set waiting-for 0 set rational? false set has-changed? false set curr-exit str1 ;ifelse (strategy = 1) [] [ifelse (strategy = 2) [set curr-exit find-nearest-exit][set curr-exit set-a-random-exit]] ] setrational end to setrational let r rational * num-agents / 100 let i 0 while [i < r] [ ask one-of turtles with [rational? = false] [set rational? true set shape "circle"] set i i + 1 ] end to-report set-a-random-exit let r random 2 ifelse (r = 0) [report "left"] [report "right"] end ;;;;;;;;;;;;;;;;;;;;;; ENVIRONMENT SETUP ;;;;;;;;;;;;;;;;;;;;;;;;;;; to create-env clear-all ask patches [set pcolor gray set walkable? true set doms table:make set steps-to-exits table:make set updated? false set structure-type "floor" set patch-value-left 0.0 set patch-value-right 0.0] ;setup-exterior-walls setup-exits set-doms-ste-default setup-potential-map end to setup-exterior-walls let walls patches with [((pxcor >= min-pxcor and pxcor <= max-pxcor) and (pycor = max-pycor))] ask walls [set structure-type "wall" set walkable? false set pcolor black] set walls patches with [((pxcor >= min-pxcor and pxcor <= max-pxcor) and (pycor = min-pycor))] ask walls [set structure-type "wall" set walkable? false set pcolor black] set walls patches with [((pycor >= min-pycor and pycor <= max-pycor) and (pxcor = max-pxcor))] ask walls [set structure-type "wall" set walkable? false set pcolor black] set walls patches with [((pycor >= min-pycor and pycor <= max-pycor) and (pxcor = min-pxcor))] ask walls [set structure-type "wall" set walkable? false set pcolor black] end to setup-exits if (env-type = 1) [setup-exit 0 26 0 3 "left" setup-exit 50 26 0 3 "right"] if (env-type = 2) [setup-exit 0 26 0 3 "left" setup-exit 50 3 0 3 "right"] if (env-type = 3) [setup-exit 0 26 0 3 "left" setup-exit 50 3 0 3 "right" setup-obstacles] end to setup-obstacles let obstacles patches with [(pxcor >= 25 and pycor <= 5) and (pxcor >= 25 and pycor >= 4)] ask obstacles [set walkable? false set structure-type "obstacle" set pcolor gray] end to setup-exit [startx starty len wid id] let exits patches with [(pxcor >= startx and pycor <= starty) and (pxcor <= startx + len and pycor >= starty - wid)] ask exits [set walkable? true set structure-type "exit" set exit-id id set pcolor red] end to setup-potential-map ask patches with [structure-type = "exit"][ let gx pxcor let gy pycor let te exit-id let neigh-patches neighbors with [structure-type != "exit" and walkable?] ask neigh-patches[ let o towardsxy gx gy let d table:get doms te if (d = -1) [table:put doms te o set initial-target-exit te table:put steps-to-exits te 1 set dom o set updated? true] ] ] while [count patches with [structure-type = "floor" and updated? = false] > 0][update-patchleft] ask patches with [structure-type = "floor" and initial-target-exit != "right"] [set updated? false] while [count patches with [structure-type = "floor" and updated? = false] > 0][update-patchright] ask patches with [structure-type = "floor"] [set pcolor white] end to update-patchleft ask patches with [structure-type = "floor" and table:get doms "left" != -1][ let gx pxcor let gy pycor let x table:get steps-to-exits "left" let neigh-patches neighbors with [structure-type != "exit" and walkable? and table:get doms "left" = -1] ask neigh-patches[ let o towardsxy gx gy if (table:get doms "left" = -1) [ table:put doms "left" o table:put steps-to-exits "left" x + 1 ] set pcolor gray set updated? true ] ] end to update-patchright ask patches with [structure-type = "floor" and table:get doms "right" != -1][ let gx pxcor let gy pycor let x table:get steps-to-exits "right" let neigh-patches neighbors with [structure-type != "exit" and walkable? and table:get doms "right" = -1] ask neigh-patches[ let o towardsxy gx gy if (table:get doms "right" = -1) [ table:put doms "right" o table:put steps-to-exits "right" x + 1 ] set pcolor black set updated? true ] ] end to set-doms-ste-default ask patches[ table:put doms "left" -1 table:put doms "right" -1 table:put steps-to-exits "left" 0 table:put steps-to-exits "right" 0 ] end

There is only one version of this model, created 4 months ago by Kashif Zia.

## Attached files

File | Type | Description | Last updated | |
---|---|---|---|---|

An Agent-Based Model of Crowd Evacuation: Combining Individual, Social and Technological Aspects.png | preview | Preview for ' An Agent-Based Model of Crowd Evacuation: Combining Individual, Social and Technological Aspects' | 4 months ago, by Kashif Zia | Download |

This model does not have any ancestors.

This model does not have any descendants.