Tsunami evacuation
Model was written in NetLogo 5.0.5
•
Viewed 1217 times
•
Downloaded 113 times
•
Run 0 times
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
Comments and Questions
Please start the discussion about this model!
(You'll first need to log in.)
Click to Run Model
turtles-own [group speed cooperation initSpeed flight EP_knowledge chosenEP direction rescue_attempt initXcor initYcor newInformation my_EP] patches-own [EvacuationPoint] globals [saved cooperativeCitizen safeSpot time10 time30 time50 time80 time95 time_final survivors tempXcor tempYcor meanXcor10 meanYcor10 meanXcor30 meanYcor30 meanXcor50 meanYcor50 meanXcor80 meanYcor80 meanXcor95 meanYcor95 meanXcor_final meanYcor_final stdXcor10 stdYcor10 stdXcor30 stdYcor30 stdXcor50 stdYcor50 stdXcor80 stdYcor80 stdXcor95 stdYcor95 stdXcor_final stdYcor_final coo10 coo30 coo50 coo80 coo95 coo_final] ;;Environment setup to mapa ca import-pcolors "map.png" crt citizens [set color black setxy random-xcor random-ycor set group random group_count set speed (random-normal 0.14 0.015) * 5 set initSpeed speed set EP_knowledge random-poisson av_EP_knowledge set my_EP patch 100 -100 set newInformation 0 set direction heading ] ask turtles [ move-to one-of patches with [pcolor = 67.4 and not any? other turtles-here] ] ask n-of (count turtles * cooperative_citizens / 100) turtles [set cooperation true] let safePlace (list (patch -80 38) (patch -63 33) (patch -62 62) (patch -30 77) (patch -7 86) (patch 5 52) (patch 17 45) (patch 30 51) (patch 60 57) (patch 78 20)) foreach safePlace [ask ?[set pcolor white set EvacuationPoint 1]] set safeSpot patches with [EvacuationPoint = 1] ;;main street, business center where should be more people than in other places ask n-of (count turtles * 0.4) turtles [ move-to one-of patches with [pcolor = 67.4 and distance patch -18 5 < 35 and not any? other turtles-here] ] ask turtles [set initXcor xcor set initYcor ycor ] reset-ticks end ;;Main loop to go ask turtles [ look_for_a_safe_spot form_a_group run_away rescue go_arround move stop_here die_here ] ifelse saved >= citizens * 0.1 and time10 = 0 [set time10 ticks * 5 if length tempXcor >= 2 [set meanXcor10 mean tempXcor set meanYcor10 mean tempYcor set stdXcor10 standard-deviation tempXcor set stdYcor10 standard-deviation tempYcor] set coo10 cooperativeCitizen / saved * 100 set tempXcor (list) set tempYcor (list) ] [ifelse saved >= citizens * 0.3 and time30 = 0 [set time30 ticks * 5 if length tempXcor >= 2 [set meanXcor30 mean tempXcor set meanYcor30 mean tempYcor set stdXcor30 standard-deviation tempXcor set stdYcor30 standard-deviation tempYcor] set coo30 cooperativeCitizen / saved * 100 set tempXcor (list) set tempYcor (list)] [ifelse saved >= citizens * 0.5 and time50 = 0 [set time50 ticks * 5 if length tempXcor >= 2 [set meanXcor50 mean tempXcor set meanYcor50 mean tempYcor set stdXcor50 standard-deviation tempXcor set stdYcor50 standard-deviation tempYcor] set coo50 cooperativeCitizen / saved * 100 set tempXcor (list) set tempYcor (list)] [ifelse saved >= citizens * 0.8 and time80 = 0 [set time80 ticks * 5 if length tempXcor >= 2 [set meanXcor80 mean tempXcor set meanYcor80 mean tempYcor set stdXcor80 standard-deviation tempXcor set stdYcor80 standard-deviation tempYcor] set coo80 cooperativeCitizen / saved * 100 set tempXcor (list) set tempYcor (list)] [ifelse saved >= citizens * 0.95 and time95 = 0 [set time95 ticks * 5 if length tempXcor >= 2 [set meanXcor95 mean tempXcor set meanYcor95 mean tempYcor set stdXcor95 standard-deviation tempXcor set stdYcor95 standard-deviation tempYcor] set coo95 cooperativeCitizen / saved * 100 set tempXcor (list) set tempYcor (list)] [if count turtles = 0 [set time_final ticks * 5 if length tempXcor >= 2 [set meanXcor_final mean tempXcor set meanYcor_final mean tempYcor set stdXcor_final standard-deviation tempXcor set stdYcor_final standard-deviation tempYcor] set coo_final cooperativeCitizen / saved * 100 set survivors saved / citizens * 100 stop] ] ] ] ] ] tsunami tick end ;; Agents look fot the closest one of the evacuation points that they know to look_for_a_safe_spot set heading direction ;let my_EP one-of patches in-cone 400 1 with [EvacuationPoint = 1] let my_safeSpot min-one-of n-of EP_knowledge safeSpot [distance myself] let other_one one-of other turtles in-cone (radius / 10) 360 if (my_safeSpot != nobody and flight = 0 and chosenEP = 0) or ( my_safeSpot != nobody and newInformation = 1 and distance my_safeSpot < distance my_EP) [face my_safeSpot set chosenEP 1 set my_EP my_safeSpot set newInformation 0 set direction heading] if EP_knowledge = 0 and other_one != nobody and not any? other turtles-here [face other_one set direction [heading] of other_one] end ;; Agents may try to form groups. In this case they obtain knowledge about EP locations from the best ;; informed gropu member to form_a_group if (cooperation = true) and (count other turtles in-cone 1 360) < min_group_members and [pcolor] of patch-here > 64 [let groupCenter max-one-of other turtles in-cone (radius / 10) 120 [count other turtles in-cone 1 360] let my_knowledge EP_knowledge if groupCenter != nobody and [cooperation] of groupCenter = true [face groupCenter ask groupCenter [set color blue set speed mean [speed] of turtles in-cone 1 360 let max_knowledge max-one-of turtles in-cone 1 360 [EP_knowledge] if my_knowledge < [EP_knowledge] of max_knowledge [set EP_knowledge [EP_knowledge] of max_knowledge set newInformation 1] ] ] ] end to run_away let dryPatch one-of patches in-cone 1 360 with [pcolor < 75] ifelse one-of patches in-cone 1 360 != nobody and [pcolor] of one-of patches in-cone 3 120 = 95.1 and dryPatch != nobody [ face dryPatch set flight 1 set speed speed + 0.2 ] [set flight 0] end ;; Agents may try to rescue other ones that are related with them (relation is determined by group number difference) to rescue let my_direction direction lt 180 let my_group group let my_knowledge EP_knowledge let my_speed speed let friend one-of turtles in-cone 1.5 180 with [abs(group - my_group) < max_group_diff and (distance myself > 0.6)] ifelse friend != nobody and [rescue_attempt] of friend = 0 [face friend set color pink ifelse [EP_knowledge] of friend > my_knowledge [set EP_knowledge [EP_knowledge] of friend set newInformation 1] [ask friend [set EP_knowledge my_knowledge] set rescue_attempt 1 set direction my_direction set newInformation 1 ] ifelse [speed] of friend > my_speed [set speed [speed] of friend] [ask friend [set speed my_speed]] ] [rt 180 set color black] end ;; Agents turn around when they reach inacessible terrain to go_arround if (patch-ahead 2 != nobody and [pcolor] of patch-ahead 2 = 74.4) or patch-ahead 2 = nobody [lt 180 set direction heading] end to move fd speed end to stop_here if [pcolor] of patch-here < 27 [set saved saved + 1 if cooperation = true [set cooperativeCitizen cooperativeCitizen + 1] ifelse not is-list? tempXcor or empty? tempXcor [set tempXcor (list initXcor) set tempYcor (list initYcor)] [set tempXcor lput initXcor tempXcor set tempYcor lput initYcor tempYcor] die] end to die_here if [pcolor] of patch-here = 95.1 [die] end to tsunami if ticks > 180 [ask patches with [pcolor = 95.1] [ask patches in-radius 3.5 with [pcolor > 64] [set pcolor 95.1] ] ] if (count patches with [pcolor > 64 and pcolor < 70]) = 0 and random-float 0.9 < 0.3 [ask patches with [pcolor = 95.1] [ask neighbors with [pcolor > 40] [set pcolor 95.1] ] ] end
There are 3 versions of this model.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
map.png | png | model world | over 10 years ago, by Adam Slucki | Download |
Tsunami evacuation.png | preview | Preview for 'Tsunami evacuation' | over 10 years ago, by Adam Slucki | Download |
This model does not have any ancestors.
This model does not have any descendants.