;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Data generation model. Landscapes are imported from ;the saved cost-surface file. ;Author C.E. Simpkins (30/11/2016) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Extensions extensions [ gis pathdir matrix shell ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Globals globals [ test ;;used for debugging bases.list ;;list of the four letters from which genomes were made cost.dataset ;; record of the cost values from the NLMpy landscape d-matrix10 ;;matrix that stores genetic distances for sample size 10 d-matrix25 ;;matrix that stores genetic distances for sample size 25 d-matrix50 ;;matrix that stores genetic distances for sample size 50 d-matrix100 ;;matrix that stores genetic distances for sample size 100 d-matrix200 ;;matrix that stores genetic distances for sample size 200 d-matrix500 ;;matrix that stores genetic distances for sample size 500 generations ;; end of the i number of steps at which stage breeding, mortality etc. occur genome.list habitatID.list ;; list of all the PIDs (patch IDs) maximum.cost ;; maximum cost value of the patches max.y ;; the maximum pycor n-populations ;;number of separately generated agent populations number.exported ;;number of agents who have exported tracking data PID.list ;; List of habitat patch cluster IDs steps ;; number of ticks that have occurred within a generation ;============================================================== ;Patches and agents lists agents.in.matrix agents.in.habitat average.cost ;; median cost value for all patches habitat.patches ;;all patches making up any habitat patch max/average.cost ;;maximum cost value / median cost value for all patches pop-list ] ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~; ;Patches own patches-own [ centroid? ;;indicates whether the patch is the centre of a habitat cluster or not cost.value ;;the actual cost of the patch before other it is used in other calculations done? ;; has centroid been used to label a habitat patch habitat.patch? ;;True if the patch is a habitat patch K ;; carrying capacity move.patch? ;;patch that has been chosen to be added to patch.list perceived.cost ;;the cost of a patch as perceived by an agent after directional bias is applied PID ;; ID for each habitat patch cluster radius ;; controls the size of the clusters ] ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~; ;Turtles own turtles-own [ avoid.patch ;;habitat patches visited but not settled in bred? ;;has the agent produced offspring in this step counter exported.data ;; has the turtle exported its tracking data export.home.patch ;;PID of home patch that is actually exported finish.patch ;; patch ID of the first new patch a turtle reached genome ;; the collection of 200 unique "bases" for each turtle home.patch ;;patch ID of the patch turtle started at ImDone ;;Has turtle reached a patch where we can then take a record KeepMoving ;;Turtle hasn't settled and now avoids the new patch my.start.x ;;x coordinates where turtle was sprouted my.start.y ;;y coordinates where turtle was sprouted population reached.patch? ;;has the turtle reached a new patch from the one it started at total.cost ;; cost accumulated to reach a new patch total.steps ;; number of steps taken to reach a new patch visited.patches ;; list of patches an agent has visited recently (i.e. within its memory) ] ;--------------------------------------------------------------------------------------------------------------------------------------------- ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ;============================================================================================================================================= ;||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ;============================================================================================================================================= ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ;--------------------------------------------------------------------------------------------------------------------------------------------- ;SETUP to setup let run.label run.id ;============================================================================= ;landscape resize.world import.landscape set max.y max[pycor] of patches create.patches set average.cost median [cost.value] of patches set max/average.cost (max [cost.value] of patches / average.cost) ;============================================================================= ;agent create.tracking.folder random-seed new-seed create.agents ask turtles [ let label.of.run run.id let turtle.ID who file-close-all if file-exists? (pad-relocation-list label.of.run turtle.ID) [ file-delete (pad-relocation-list label.of.run turtle.ID) ] ] ;Genetic distance code--------------------------------------------- set n-populations length habitatID.list set pop-list n-values n-populations [? + 1] ;; matrices that will store the distances set d-matrix10 matrix:make-constant n-populations n-populations 0 set d-matrix25 matrix:make-constant n-populations n-populations 0 set d-matrix50 matrix:make-constant n-populations n-populations 0 set d-matrix100 matrix:make-constant n-populations n-populations 0 set d-matrix200 matrix:make-constant n-populations n-populations 0 set d-matrix500 matrix:make-constant n-populations n-populations 0 ;============================================================================= ;outputs set maximum.cost max[cost.value] of patches export.patch.locations set genome.list [] set steps 0 set generations 0 set number.exported 0 end ;--------------------------------------------------------------------------------------------------------------------------------------------- ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ;============================================================================================================================================= ;||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ;============================================================================================================================================= ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ;--------------------------------------------------------------------------------------------------------------------------------------------- ;GO to go tick if generations >= (max.generations - 1) or any? turtles = FALSE [ build-pairwise export.genetic.distance ask turtles [ update.outputs die ] stop ] hard.borders if ticks mod cycle.length = 0 [ export.tracking.data ;set agents.in.matrix turtles with [pcolor != green] ;set agents.in.habitat turtles with [pcolor = green] ] move live if ticks mod cycle.length = 0 [ reproduce death replace ] end ;--------------------------------------------------------------------------------------------------------------------------------------------- ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ;============================================================================================================================================= ;||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ;============================================================================================================================================= ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ;--------------------------------------------------------------------------------------------------------------------------------------------- ;LANDSCAPE PROCEDURES ;; procedure to ensure world window is always a constant size to resize.world resize-world 0 ((99) - 1) 0 (99) - 1 ;;this resizes the world so it matches the imported landscape when drawn from Python set-patch-size 1 * (512 / 99 ) ;; this resizes the cells in the world window to make the world a useful size for visualisation end ;------------------------------------------------------------------------------------------------------------------------------------; ;------------------------------------------------------------------------------------------------------------------------------------; ;;Procedure makes a set number of habitat patches in which agents want to move and can breed ;;THIS IS THE PROCEDURE YOU WOULD CHANGE IF YOU WANTED A REGULAR GRID OF PATCHES to create.patches set PID.list 1 set habitatID.list [] ask patches [ set centroid? FALSE set habitat.patch? FALSE set done? FALSE ] let patch.success 0 let world.size 100 let centroid.list (patch-set patch 27 50 patch 30 70 patch 50 73 patch 70 70 patch 73 50 patch 70 30 patch 50 27 patch 30 30) while [PID.list <= 8] [ let centre.patch one-of centroid.list with [centroid? = FALSE] ask centre.patch [ set PID PID.list set habitatID.list lput PID habitatID.list set pcolor green set cost.value 1 set habitat.patch? TRUE set centroid? TRUE let random.size 4;random 10 set radius random.size if radius < 3 [set radius radius + 3] ;;make sure patches are not pointlessly small ask patches in-radius radius [ set pcolor green set cost.value 1 set habitat.patch? TRUE set PID PID.list ] set done? TRUE ] set PID.list PID.list + 1 ] ask patches with[pcolor != green] [ set centroid? FALSE ] set habitat.patches patches with [habitat.patch? = TRUE] let per.patch.capacity (maximum.agents / (count habitat.patches) + random 10) ask habitat.patches with [centroid? = TRUE] [ let carrying round(per.patch.capacity * (count patches with [PID = [PID] of myself]));;sets the carrying capacity of each cluster relative to its size ask patches with [PID = [PID] of myself] [ set K carrying ] ] end ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; ;; procedure to import a landscape from set of saved landscapes orginally generated in Python 2.7 using nlmpy to import.landscape ; Load NLM and colour patches set cost.dataset gis:load-dataset (word "SavedLandscapes/output/modelRun" run.id "/nlm.asc") gis:set-world-envelope gis:envelope-of cost.dataset gis:apply-raster cost.dataset cost.value ;gis:apply-raster gis:load-dataset (word nlm-type "/output/modelRun" model-run "/nlm.asc") patch-class ;ask patches [ set pcolor scale-color green patch-class 0 50 ] let min.cost gis:minimum-of cost.dataset let max.cost gis:maximum-of cost.dataset ask patches[ ; note the use of the "<= 0 or >= 0" technique to filter out ; "not a number" values, as discussed in the documentation. if (cost.value <= 0) or (cost.value >= 0) [set pcolor scale-color blue cost.value max.cost min.cost] ] end ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; to export.patch.locations let run.label run.id file-close-all if file-exists? (pad-habitat run.label) [file-delete (pad-habitat run.label)] file-open (pad-habitat run.label) file-print (word "patchID" " " "xCoord" " " "yCoord" ) foreach sort patches with [centroid? = TRUE][ ;; use foreach sort to maintain constant order ask ? [ file-print (word (PID) " " (pxcor) " " ((max.y - pycor) )) ;;need to reverse y to match output order ] ] file-close end ;--------------------------------------------------------------------------------------------------------------------------------------------- ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ;============================================================================================================================================= ;||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ;============================================================================================================================================= ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ;--------------------------------------------------------------------------------------------------------------------------------------------- ;AGENT PROCEDURES ;;create a set number of agents in each habitat patch to create.agents set bases.list ["a" "g" "c" "t"] let number.habitats count patches with [centroid? = TRUE] foreach habitatID.list [ let patch.DNA.strand [] repeat 200 [ set patch.DNA.strand lput (item random 3 bases.list) patch.DNA.strand ] ask patches with [centroid? = TRUE AND PID = ?] [ let PID.focal PID sprout round(number.agents / number.habitats) [ let natal.patch one-of patches with [PID = pid.focal and count neighbors with [PID != PID.focal] > 0] set xcor [pxcor] of natal.patch set ycor [pycor] of natal.patch face one-of neighbors with [PID != PID.focal] set my.start.x pxcor set my.start.y pycor set visited.patches [] set color (orange + (PID / 2)) set genome patch.DNA.strand if pen? = true [pen-down] set home.patch PID set export.home.patch PID set finish.patch -9999 set reached.patch? FALSE set exported.data FALSE set ImDone FALSE set bred? FALSE set KeepMoving FALSE set avoid.patch nobody ] ] ] end ;------------------------------------------------------------------------------------------------------------------------------------; ;------------------------------------------------------------------------------------------------------------------------------------; to move set steps (steps + 1) ask turtles with [ImDone = TRUE] [ let my.PID [PID] of patch-here let newHome one-of patches with [centroid? and PID = my.PID] move-to newHome ] ; ask turtles with [keepMoving = TRUE] ; [ ; let my.PID [PID] of patch-here ; set avoid.patch my.PID ; ; let this.patch one-of patches with [PID = my.PID and count neighbors with [PID != my.PID] > 0] ; set xcor [pxcor] of this.patch ; set ycor [pycor] of this.patch ; face one-of neighbors with [PID != my.PID] ; ] ask turtles with [ImDone = FALSE] [ gravitate.to.new.patches calculate.directional.bias avoid.backtracks avoid.home.patch let patch.behind patch-here patch.selection ifelse count neighbors with [move.patch? = TRUE] = 0 [ patch.selection][ ifelse random-float 1 <= best.pick [ move-to min-one-of neighbors with [move.patch? = TRUE] [perceived.cost] ] [ move-to one-of neighbors with [move.patch? = TRUE] ] ;; ] face patch.behind rt 180 ask neighbors [set perceived.cost cost.value] calculate.tracking.data ] end ;------------------------------------------------------------------------------------------------------------------------------------; ;------------------------------------------------------------------------------------------------------------------------------------; ;;adds a bias that makes turtles more likely to move forward and increasingly less likely to move backwards (called by move) to calculate.directional.bias ask patch-right-and-ahead 45 1 [set perceived.cost (cost.value * ((directional.bias) ^ 1) + (cost.value / 10))] ;forward side patches ask patch-left-and-ahead 45 1 [set perceived.cost (cost.value * ((directional.bias) ^ 1) + (cost.value / 10))] ;forward side patches ask patch-right-and-ahead 90 1 [set perceived.cost (cost.value * ((directional.bias) ^ 2) + (cost.value / 10))] ;side patches ask patch-left-and-ahead 90 1 [set perceived.cost (cost.value * ((directional.bias) ^ 2) + (cost.value / 10))] ;side patches ask patch-right-and-ahead 135 1 [set perceived.cost (cost.value * ((directional.bias) ^ 3) + (cost.value / 10))] ;back side patches ask patch-left-and-ahead 135 1 [set perceived.cost (cost.value * ((directional.bias) ^ 3) + (cost.value / 10))] ;back side patches ask patch-right-and-ahead 180 1 [set perceived.cost (cost.value * ((directional.bias) ^ 4) + (cost.value / 10))] ;back patch end ;------------------------------------------------------------------------------------------------------------------------------------; ;------------------------------------------------------------------------------------------------------------------------------------; ;; Psuedo memory which tracks which patches were entered recently and makes them appear more costly (called by move) to avoid.backtracks set visited.patches lput patch-here visited.patches if length visited.patches > 10 [ set visited.patches but-first visited.patches ] foreach visited.patches[set perceived.cost (maximum.cost * 10)] end ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; ;;selects which patch agent actually moves into (called by move) to patch.selection let current.patch.cost [cost.value] of patch-here; self ask neighbors [set move.patch? FALSE] ask n-of inquisitiveness neighbors [ ifelse perceived.cost < current.patch.cost [ set move.patch? TRUE ;;show perceived.cost ][ if abs(perceived.cost - current.patch.cost) < random (maximum.cost * 10)[ set move.patch? TRUE ] ] ] end ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; ;;kill turtles that reach the edge of the map assuming they are leaving the map to hard.borders ask turtles[ if count neighbors < 8 [ let my.genome genome ask patch my.start.x my.start.y[ ;;resprout an agent at the original agents start location let PID.focal PID sprout 1 [ let natal.patch one-of patches with [PID = pid.focal and count neighbors with [PID != PID.focal] > 0] set xcor [pxcor] of natal.patch set ycor [pycor] of natal.patch face one-of neighbors with [PID != PID.focal] set my.start.x pxcor set my.start.y pycor set visited.patches [] set color white if pen? = true [pen-down] set genome my.genome set home.patch PID set export.home.patch PID set finish.patch -9999 set reached.patch? FALSE set ImDone FALSE set exported.data FALSE set bred? FALSE set KeepMoving FALSE set avoid.patch nobody ] ] die ] ] end ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; ;;increase the perceived cost for patches which are closer to home (called by move) to avoid.home.patch let home.distance distancexy my.start.x my.start.y let home.x my.start.x let home.y my.start.y if home.distance > 20 [ ask neighbors [ if distancexy home.x home.y < home.distance [ set perceived.cost (perceived.cost * 2.5) ;150% increase ] ] ] end ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; ;;decrease the perceived cost for patches in the direction of a habitat patch once agents get close enough (called by move) to gravitate.to.new.patches let my.home home.patch let target.patches habitat.patches with [PID != my.home] if pcolor != green [ if any? target.patches in-radius 5 [ if random-float 1 > 0.3 [ move-to one-of target.patches in-radius 5 ] ] ] end ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; ;;Calculates the relocation data (number steps) and pathway data (total cost accumulated) for each pioneer (called by move) to calculate.tracking.data if reached.patch? = FALSE [ set total.steps total.steps + 1 set total.cost total.cost + cost.value if pcolor = green [ if PID != home.patch [ set reached.patch? TRUE set finish.patch [PID] of patch-here ifelse random-float 1 > 0.3 [ set ImDone TRUE ] [ set KeepMoving TRUE set home.patch PID ] ] ] ] end ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; ;;create a folder in which to save tracking data from each agent to create.tracking.folder ; Set run label run.id shell:setenv "model-run" (word run.id) ;;Run Python script to generate landscape carefully [print(shell:exec "cmd" "/c" "python MakeFolderTracking.py")] [print(shell:exec "python" "MakeFolderTracking.py")] end ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; ;; Resets ticks and counts up generations to live if steps >= cycle.length [ set steps 0 set generations (generations + 1) ] end ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; ;; Make agents breed THIS IS WHERE A LARGE CHUNK OF THE SOME BREED AND DIE SOME DON'T BIT WILL COME IN to reproduce foreach habitatID.list [ let focal.patch habitat.patches with [PID = ?] let focal.turtles turtles-on focal.patch let my.k one-of [K] of focal.patch ask focal.turtles [ set bred? FALSE ] let surplus.k my.k - count focal.turtles let surplus.total maximum.agents - count turtles let maximum.produced min (list surplus.k surplus.total) let n.reproduced 0 let n.produced 0 while [count focal.turtles with [not bred?] > 1 and n.produced < maximum.produced] [ let turtles.to.breed turtle-set focal.turtles with [bred? = FALSE] ask one-of turtles.to.breed [ set bred? TRUE if count focal.turtles with [bred? = FALSE] > 0 [ let mate min-one-of turtles.to.breed [distance myself] ask mate [ set bred? TRUE ] let parent1.genome [genome] of self let parent2.genome [genome] of mate repeat random-poisson 2 [ set n.produced n.produced + 1 let new.genome [] set counter 0 repeat 200 [ set new.genome lput (item counter parent1.genome) new.genome if random-float 1 <= 0.5 [ set new.genome replace-item counter new.genome item counter parent2.genome ] if random-float 1 <= mutation.rate [ set new.genome replace-item counter new.genome item random 3 bases.list ] set counter counter + 1 ] ask patch-here [ sprout 1 [ set xcor pxcor set ycor pycor set genome new.genome set my.start.x pxcor set my.start.y pycor set visited.patches [] set color (orange + (PID / 2)) if pen? = true [pen-down] set home.patch PID set export.home.patch PID set finish.patch -9999 set reached.patch? FALSE set exported.data FALSE set ImDone FALSE set bred? FALSE set KeepMoving FALSE set avoid.patch nobody ] ] ] ] ] set n.reproduced n.reproduced + 1 ] ] end ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; to death ;;remove a random proportion of agents due to background mortality which is higher in matrix than habitat but only if that patch is not going to go extinct ask turtles [ ifelse [pcolor] of patch-here = green [ if count turtles with [PID = [PID] of self] > 50 ;;50 is the minimum number of agents in a patch that can suffer mortality in this way [ if random-float 1 < (mortality * (cost.value / max/average.cost)) [ update.outputs die ] ] ] [ if random-float 1 < (mortality * (cost.value / max/average.cost)) [ update.outputs die ] ] ] ;;calculate if we have more agents than can be supported by the map and remove excess preferentially from the matrix if count turtles > maximum.agents [ let excess (count turtles - maximum.agents) ifelse excess < count agents.in.matrix ;;if the number of agents in the matrix is larger than excess kill the excess else kill all agents in matrix and recalculate the excess [ ask n-of excess agents.in.matrix [ update.outputs die ] ] ;else [ ask agents.in.matrix [ update.outputs die ] ] set excess (count turtles - maximum.agents) ;;recalculate excess now that the matrix agent's have been affected let sharing.agents turtles with [count turtles-here > 1] ;;kill agents which are in patches with other agents first ifelse excess < count sharing.agents [ ask n-of excess sharing.agents [ update.outputs die ] ] ;else [ ask sharing.agents [ update.outputs die ] ] set excess (count turtles - maximum.agents) ;;recalculate excess now that the matrix agent's have been affected ifelse excess < count agents.in.habitat [ ask n-of excess agents.in.habitat [ update.outputs die ] ] ;else [ ask agents.in.habitat [ update.outputs die ] ] ] end ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; to replace ask turtles with [ImDone = TRUE] [ ; let n.genome genome ; ; ask patch-here ; [ ; let PID.focal PID ; sprout 1 ; [ ; let natal.patch one-of patches with [PID = pid.focal and count neighbors with [PID != PID.focal] > 0] ; set xcor [pxcor] of natal.patch ; set ycor [pycor] of natal.patch ; face one-of neighbors with [PID != PID.focal] ; set genome n.genome ; set my.start.x pxcor ; set my.start.y pycor ; set visited.patches [] ; set color (orange + (PID / 2)) ; if pen? = true [pen-down] ; set home.patch PID ; set export.home.patch PID ; set finish.patch -9999 ; set reached.patch? FALSE ; set exported.data FALSE ; set ImDone FALSE ; set bred? FALSE ; set KeepMoving FALSE ; set avoid.patch nobody ; ] ; ] die ] end ;--------------------------------------------------------------------------------------------------------------------------------------------- ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ;============================================================================================================================================= ;||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ;============================================================================================================================================= ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ;--------------------------------------------------------------------------------------------------------------------------------------------- ;OUTPUT PROCEDURES ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; ;; build a matrix (d-matrix; using matrix extension) with string distance between each pair of populations to build-pairwise let local-populations [] let local-population-size [] ask turtles [set population PID] ;; make a list of: (i) agentsets for each population and (ii) size of each population foreach pop-list [ set local-populations lput turtles with [population = ?] local-populations set local-population-size lput count (item (? - 1) local-populations) local-population-size ] show item 0 local-populations let pop-i no-turtles let pop-j no-turtles ;; iterate over each pair (ij) of populations foreach pop-list [ let i (? - 1) set pop-i item i local-populations foreach pop-list [ let j (? - 1) ifelse i = j [ matrix:set d-matrix10 i j 0 matrix:set d-matrix25 i j 0 matrix:set d-matrix50 i j 0 matrix:set d-matrix100 i j 0 matrix:set d-matrix200 i j 0 matrix:set d-matrix500 i j 0 ] [ if i > j [ set pop-j item j local-populations ; let pop-j-n item j local-population-size let dij10 (get-pop-distance pop-i pop-j 10) let dij25 (get-pop-distance pop-i pop-j 25) let dij50 (get-pop-distance pop-i pop-j 50) let dij100 (get-pop-distance pop-i pop-j 100) let dij200 (get-pop-distance pop-i pop-j 200) let dij500 (get-pop-distance pop-i pop-j 500) ;;10 matrix:set d-matrix10 i j dij10 matrix:set d-matrix10 j i dij10 ;;25 matrix:set d-matrix25 i j dij25 matrix:set d-matrix25 j i dij25 ;;50 matrix:set d-matrix50 i j dij50 matrix:set d-matrix50 j i dij50 ;;100 matrix:set d-matrix100 i j dij100 matrix:set d-matrix100 j i dij100 ;;200 matrix:set d-matrix200 i j dij200 matrix:set d-matrix200 j i dij200 ;;500 matrix:set d-matrix500 i j dij500 matrix:set d-matrix500 j i dij500 ] ] ] ] end ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; ;;Export the genetic distance matrix (d-matrix) to export.genetic.distance let run.label run.id ;;10 file-close-all if file-exists? (pad-genetic 10 run.label) [file-delete (pad-genetic 10 run.label)] file-open (pad-genetic 10 run.label) file-print matrix:pretty-print-text d-matrix10 file-close ;;25 file-close-all if file-exists? (pad-genetic 25 run.label) [file-delete (pad-genetic 25 run.label)] file-open (pad-genetic 25 run.label) file-print matrix:pretty-print-text d-matrix25 file-close ;;50 file-close-all if file-exists? (pad-genetic 50 run.label) [file-delete (pad-genetic 50 run.label)] file-open (pad-genetic 50 run.label) file-print matrix:pretty-print-text d-matrix50 file-close ;;100 file-close-all if file-exists? (pad-genetic 100 run.label) [file-delete (pad-genetic 100 run.label)] file-open (pad-genetic 100 run.label) file-print matrix:pretty-print-text d-matrix100 file-close ;;200 file-close-all if file-exists? (pad-genetic 200 run.label) [file-delete (pad-genetic 200 run.label)] file-open (pad-genetic 200 run.label) file-print matrix:pretty-print-text d-matrix200 file-close ;;500 file-close-all if file-exists? (pad-genetic 500 run.label) [file-delete (pad-genetic 500 run.label)] file-open (pad-genetic 500 run.label) file-print matrix:pretty-print-text d-matrix500 file-close end ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; ;;procedure to generate a set of output data at each step to update.outputs set genome.list lput genome genome.list end ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; ;; Create a file containing the tracking data (start/finish PIDs total steps/costs) to export.tracking.data if number.exported <= 1500 [ ask turtles with [ImDone = TRUE AND exported.data != TRUE] [ let run.label run.id let turtle.ID who file-close-all if file-exists? (pad-relocation-list run.label turtle.ID) = FALSE [ file-open (pad-relocation-list run.label turtle.ID) file-print (word home.patch " " finish.patch " " total.steps " " total.cost) ] set exported.data TRUE ] set number.exported number.exported + 1 ] end ;--------------------------------------------------------------------------------------------------------------------------------------------- ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ;============================================================================================================================================= ;||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ;============================================================================================================================================= ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ;--------------------------------------------------------------------------------------------------------------------------------------------- ;REPORTER PROCEDURES ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; ;Reports the file address track.list to-report pad-relocation-list [run.tag turtle.ID] let run.string (word run.tag) let n.pad 5 - length run.string ifelse n.pad > 0 [ let pad reduce word n-values n.pad [0] report (word "saved.tracking.data/run" pad run.tag "/agent" pad turtle.ID ".txt") ] [ report (word "saved.tracking.data/run" run.tag "/agent" turtle.ID ".txt") ] end ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; ;Reports the file address for saved.patch.locations to-report pad-habitat [run.tag] let run.string (word run.tag) let n.pad 5 - length run.string ifelse n.pad > 0 [ let pad reduce word n-values n.pad [0] report (word "saved.patch.locations/patch.list" pad run.tag".txt") ] [ report (word "saved.patch.locations/patch.list" run.tag".txt") ] end ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; ;Reports the file address genetic distance to-report pad-genetic [proportion run.tag] let run.string (word run.tag) let n.pad 5 - length run.string ifelse n.pad > 0 [ let pad reduce word n-values n.pad [0] report (word "saved.genetics/genesMapSample" proportion "Run" pad run.tag ".txt") ] [ report (word "saved.genetics/genesMapSample" proportion "Run" run.tag ".txt") ] end ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; ;; this gets the average distance beween population i (pop1) and population j (pop2) sample.size is the proportion of the population sampled (called by build-pairwise) to-report get-pop-distance [pop1 pop2 sample.size] let sum-dij 0 let n 0 ifelse count(pop1) > sample.size [ ask n-of sample.size pop1 [ ifelse count(pop2) > sample.size [ ask n-of sample.size pop2 [ set n n + 1 set sum-dij sum-dij + get-pair-distance self myself ] ] [ ask pop2 [ set n n + 1 set sum-dij sum-dij + get-pair-distance self myself ] ] ] ifelse n > 0 [ report sum-dij / n ] [ report sum-dij / 1 show "was going to divide by 0" ] ] [ ask pop1 [ ifelse count(pop2) > sample.size [ ask n-of sample.size pop2 [ set n n + 1 set sum-dij sum-dij + get-pair-distance self myself ] ] [ ask pop2 [ set n n + 1 set sum-dij sum-dij + get-pair-distance self myself ] ] ] ifelse n > 0 [ report sum-dij / n ] [ report sum-dij / 1 show "was going to divide by 0" ] ] end ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; ;; this gets the distance between a pair of agents (called by get-pop-distance) to-report get-pair-distance [t1 t2] let g1 reduce sentence [genome] of t1 let g2 reduce sentence [genome] of t2 report hamming-dist g1 g2 end ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; ;---------------------------------------------------------------------------------------------------------------------------------------------------------------; ;; Reports the genetic distance (as Hamming's distance) for pair of agents (called by get-pop-distance) to-report hamming-dist [str1 str2] let h 0 ifelse length str1 = length str2 [ let idx 0 repeat length str1 [ ;show item idx str1 if item idx str1 != item idx str2 [ set h h + 1] set idx idx + 1 ] ] [ set h -999 ] report h end @#$#@#$#@ GRAPHICS-WINDOW 1289 10 1811 553 -1 -1 5.171717171717172 1 10 1 1 1 0 0 0 1 0 98 0 98 0 0 1 ticks 30.0 BUTTON 3 10 72 53 setup ca\nreset-ticks\nsetup NIL 1 T OBSERVER NIL NIL NIL NIL 1 BUTTON 72 10 148 53 NIL go T 1 T OBSERVER NIL NIL NIL NIL 1 BUTTON 148 10 223 53 step go NIL 1 T OBSERVER NIL NIL NIL NIL 1 BUTTON 223 10 297 53 Clear All ca\nreset-ticks NIL 1 T OBSERVER NIL NIL NIL NIL 1 INPUTBOX 400 10 471 70 run.id 0 1 0 Number SLIDER 187 107 359 140 maximum.agents maximum.agents 0 10000 2500 10 1 NIL HORIZONTAL SLIDER 187 139 359 172 number.agents number.agents 0 10000 1500 10 1 NIL HORIZONTAL SWITCH 476 10 579 43 pen? pen? 0 1 -1000 TEXTBOX 188 84 338 102 AGENT SETTINGS 13 0.0 1 SLIDER 187 172 359 205 directional.bias directional.bias 1 5 1.4 0.1 1 NIL HORIZONTAL SLIDER 187 204 359 237 inquisitiveness inquisitiveness 1 8 8 1 1 NIL HORIZONTAL SLIDER 187 237 359 270 best.pick best.pick 0 1 0.5 .01 1 NIL HORIZONTAL TEXTBOX 367 88 517 106 STOP CONTROLS 13 0.0 1 SLIDER 365 107 537 140 max.generations max.generations 0 200 20 1 1 NIL HORIZONTAL TEXTBOX 556 88 706 106 OUTPUTS 13 0.0 1 MONITOR 554 107 644 160 NIL generations 0 1 13 SLIDER 365 140 537 173 cycle.length cycle.length 0 100 52 1 1 NIL HORIZONTAL SLIDER 8 107 180 140 mutation.rate mutation.rate 0 1 0.2 0.01 1 NIL HORIZONTAL SLIDER 8 140 180 173 mortality mortality 0 1 0.05 0.01 1 NIL HORIZONTAL PLOT 555 167 849 439 plot 1 NIL NIL 0.0 10.0 0.0 10.0 true false "" "" PENS "default" 1.0 0 -16777216 true "" "plot count turtles" @#$#@#$#@ ## WHAT IS IT? Model generates simulated genetic, relocation, and pathway data. This data is produced from agents with simplistic (yet realistic) movement rules. ## HOW IT WORKS (what rules the agents use to create the overall behavior of the model) ## HOW TO USE IT A number of folders are required in which to save the data produced. These are: SavedLandscapes/output/ #Which must contain an .asc cost surface produced using NLMpy and labelled modelRunX.asc where X is a run number saved.patch.locations saved.tracking.data/run0000X where X is a run number saved.genetics ## THINGS TO NOTICE (suggested things for the user to notice while running the model) ## THINGS TO TRY (suggested things for the user to try to do (move sliders, switches, etc.) with the model) ## EXTENDING THE MODEL (suggested things to add or change in the Code tab to make the model more complicated, detailed, accurate, etc.) ## NETLOGO FEATURES (interesting or unusual features of NetLogo that the model uses, particularly in the Code tab; or where workarounds were needed for missing features) ## RELATED MODELS (models in the NetLogo Models Library and elsewhere which are of related interest) ## CREDITS AND REFERENCES (a reference to the model's URL on the web if it has one, as well as any other necessary credits, citations, and links) @#$#@#$#@ default true 0 Polygon -7500403 true true 150 5 40 250 150 205 260 250 airplane true 0 Polygon -7500403 true true 150 0 135 15 120 60 120 105 15 165 15 195 120 180 135 240 105 270 120 285 150 270 180 285 210 270 165 240 180 180 285 195 285 165 180 105 180 60 165 15 arrow true 0 Polygon -7500403 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150 box false 0 Polygon -7500403 true true 150 285 285 225 285 75 150 135 Polygon -7500403 true true 150 135 15 75 150 15 285 75 Polygon -7500403 true true 15 75 15 225 150 285 150 135 Line -16777216 false 150 285 150 135 Line -16777216 false 150 135 15 75 Line -16777216 false 150 135 285 75 bug true 0 Circle -7500403 true true 96 182 108 Circle -7500403 true true 110 127 80 Circle -7500403 true true 110 75 80 Line -7500403 true 150 100 80 30 Line -7500403 true 150 100 220 30 butterfly true 0 Polygon -7500403 true true 150 165 209 199 225 225 225 255 195 270 165 255 150 240 Polygon -7500403 true true 150 165 89 198 75 225 75 255 105 270 135 255 150 240 Polygon -7500403 true true 139 148 100 105 55 90 25 90 10 105 10 135 25 180 40 195 85 194 139 163 Polygon -7500403 true true 162 150 200 105 245 90 275 90 290 105 290 135 275 180 260 195 215 195 162 165 Polygon -16777216 true false 150 255 135 225 120 150 135 120 150 105 165 120 180 150 165 225 Circle -16777216 true false 135 90 30 Line -16777216 false 150 105 195 60 Line -16777216 false 150 105 105 60 car false 0 Polygon -7500403 true true 300 180 279 164 261 144 240 135 226 132 213 106 203 84 185 63 159 50 135 50 75 60 0 150 0 165 0 225 300 225 300 180 Circle -16777216 true false 180 180 90 Circle -16777216 true false 30 180 90 Polygon -16777216 true false 162 80 132 78 134 135 209 135 194 105 189 96 180 89 Circle -7500403 true true 47 195 58 Circle -7500403 true true 195 195 58 circle false 0 Circle -7500403 true true 0 0 300 circle 2 false 0 Circle -7500403 true true 0 0 300 Circle -16777216 true false 30 30 240 cow false 0 Polygon -7500403 true true 200 193 197 249 179 249 177 196 166 187 140 189 93 191 78 179 72 211 49 209 48 181 37 149 25 120 25 89 45 72 103 84 179 75 198 76 252 64 272 81 293 103 285 121 255 121 242 118 224 167 Polygon -7500403 true true 73 210 86 251 62 249 48 208 Polygon -7500403 true true 25 114 16 195 9 204 23 213 25 200 39 123 cylinder false 0 Circle -7500403 true true 0 0 300 dot false 0 Circle -7500403 true true 90 90 120 face happy false 0 Circle -7500403 true true 8 8 285 Circle -16777216 true false 60 75 60 Circle -16777216 true false 180 75 60 Polygon -16777216 true false 150 255 90 239 62 213 47 191 67 179 90 203 109 218 150 225 192 218 210 203 227 181 251 194 236 217 212 240 face neutral false 0 Circle -7500403 true true 8 7 285 Circle -16777216 true false 60 75 60 Circle -16777216 true false 180 75 60 Rectangle -16777216 true false 60 195 240 225 face sad false 0 Circle -7500403 true true 8 8 285 Circle -16777216 true false 60 75 60 Circle -16777216 true false 180 75 60 Polygon -16777216 true false 150 168 90 184 62 210 47 232 67 244 90 220 109 205 150 198 192 205 210 220 227 242 251 229 236 206 212 183 fish false 0 Polygon -1 true false 44 131 21 87 15 86 0 120 15 150 0 180 13 214 20 212 45 166 Polygon -1 true false 135 195 119 235 95 218 76 210 46 204 60 165 Polygon -1 true false 75 45 83 77 71 103 86 114 166 78 135 60 Polygon -7500403 true true 30 136 151 77 226 81 280 119 292 146 292 160 287 170 270 195 195 210 151 212 30 166 Circle -16777216 true false 215 106 30 flag false 0 Rectangle -7500403 true true 60 15 75 300 Polygon -7500403 true true 90 150 270 90 90 30 Line -7500403 true 75 135 90 135 Line -7500403 true 75 45 90 45 flower false 0 Polygon -10899396 true false 135 120 165 165 180 210 180 240 150 300 165 300 195 240 195 195 165 135 Circle -7500403 true true 85 132 38 Circle -7500403 true true 130 147 38 Circle -7500403 true true 192 85 38 Circle -7500403 true true 85 40 38 Circle -7500403 true true 177 40 38 Circle -7500403 true true 177 132 38 Circle -7500403 true true 70 85 38 Circle -7500403 true true 130 25 38 Circle -7500403 true true 96 51 108 Circle -16777216 true false 113 68 74 Polygon -10899396 true false 189 233 219 188 249 173 279 188 234 218 Polygon -10899396 true false 180 255 150 210 105 210 75 240 135 240 house false 0 Rectangle -7500403 true true 45 120 255 285 Rectangle -16777216 true false 120 210 180 285 Polygon -7500403 true true 15 120 150 15 285 120 Line -16777216 false 30 120 270 120 leaf false 0 Polygon -7500403 true true 150 210 135 195 120 210 60 210 30 195 60 180 60 165 15 135 30 120 15 105 40 104 45 90 60 90 90 105 105 120 120 120 105 60 120 60 135 30 150 15 165 30 180 60 195 60 180 120 195 120 210 105 240 90 255 90 263 104 285 105 270 120 285 135 240 165 240 180 270 195 240 210 180 210 165 195 Polygon -7500403 true true 135 195 135 240 120 255 105 255 105 285 135 285 165 240 165 195 line true 0 Line -7500403 true 150 0 150 300 line half true 0 Line -7500403 true 150 0 150 150 pentagon false 0 Polygon -7500403 true true 150 15 15 120 60 285 240 285 285 120 person false 0 Circle -7500403 true true 110 5 80 Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90 Rectangle -7500403 true true 127 79 172 94 Polygon -7500403 true true 195 90 240 150 225 180 165 105 Polygon -7500403 true true 105 90 60 150 75 180 135 105 plant false 0 Rectangle -7500403 true true 135 90 165 300 Polygon -7500403 true true 135 255 90 210 45 195 75 255 135 285 Polygon -7500403 true true 165 255 210 210 255 195 225 255 165 285 Polygon -7500403 true true 135 180 90 135 45 120 75 180 135 210 Polygon -7500403 true true 165 180 165 210 225 180 255 120 210 135 Polygon -7500403 true true 135 105 90 60 45 45 75 105 135 135 Polygon -7500403 true true 165 105 165 135 225 105 255 45 210 60 Polygon -7500403 true true 135 90 120 45 150 15 180 45 165 90 sheep false 15 Circle -1 true true 203 65 88 Circle -1 true true 70 65 162 Circle -1 true true 150 105 120 Polygon -7500403 true false 218 120 240 165 255 165 278 120 Circle -7500403 true false 214 72 67 Rectangle -1 true true 164 223 179 298 Polygon -1 true true 45 285 30 285 30 240 15 195 45 210 Circle -1 true true 3 83 150 Rectangle -1 true true 65 221 80 296 Polygon -1 true true 195 285 210 285 210 240 240 210 195 210 Polygon -7500403 true false 276 85 285 105 302 99 294 83 Polygon -7500403 true false 219 85 210 105 193 99 201 83 square false 0 Rectangle -7500403 true true 30 30 270 270 square 2 false 0 Rectangle -7500403 true true 30 30 270 270 Rectangle -16777216 true false 60 60 240 240 star false 0 Polygon -7500403 true true 151 1 185 108 298 108 207 175 242 282 151 216 59 282 94 175 3 108 116 108 target false 0 Circle -7500403 true true 0 0 300 Circle -16777216 true false 30 30 240 Circle -7500403 true true 60 60 180 Circle -16777216 true false 90 90 120 Circle -7500403 true true 120 120 60 tree false 0 Circle -7500403 true true 118 3 94 Rectangle -6459832 true false 120 195 180 300 Circle -7500403 true true 65 21 108 Circle -7500403 true true 116 41 127 Circle -7500403 true true 45 90 120 Circle -7500403 true true 104 74 152 triangle false 0 Polygon -7500403 true true 150 30 15 255 285 255 triangle 2 false 0 Polygon -7500403 true true 150 30 15 255 285 255 Polygon -16777216 true false 151 99 225 223 75 224 truck false 0 Rectangle -7500403 true true 4 45 195 187 Polygon -7500403 true true 296 193 296 150 259 134 244 104 208 104 207 194 Rectangle -1 true false 195 60 195 105 Polygon -16777216 true false 238 112 252 141 219 141 218 112 Circle -16777216 true false 234 174 42 Rectangle -7500403 true true 181 185 214 194 Circle -16777216 true false 144 174 42 Circle -16777216 true false 24 174 42 Circle -7500403 false true 24 174 42 Circle -7500403 false true 144 174 42 Circle -7500403 false true 234 174 42 turtle true 0 Polygon -10899396 true false 215 204 240 233 246 254 228 266 215 252 193 210 Polygon -10899396 true false 195 90 225 75 245 75 260 89 269 108 261 124 240 105 225 105 210 105 Polygon -10899396 true false 105 90 75 75 55 75 40 89 31 108 39 124 60 105 75 105 90 105 Polygon -10899396 true false 132 85 134 64 107 51 108 17 150 2 192 18 192 52 169 65 172 87 Polygon -10899396 true false 85 204 60 233 54 254 72 266 85 252 107 210 Polygon -7500403 true true 119 75 179 75 209 101 224 135 220 225 175 261 128 261 81 224 74 135 88 99 wheel false 0 Circle -7500403 true true 3 3 294 Circle -16777216 true false 30 30 240 Line -7500403 true 150 285 150 15 Line -7500403 true 15 150 285 150 Circle -7500403 true true 120 120 60 Line -7500403 true 216 40 79 269 Line -7500403 true 40 84 269 221 Line -7500403 true 40 216 269 79 Line -7500403 true 84 40 221 269 wolf false 0 Polygon -16777216 true false 253 133 245 131 245 133 Polygon -7500403 true true 2 194 13 197 30 191 38 193 38 205 20 226 20 257 27 265 38 266 40 260 31 253 31 230 60 206 68 198 75 209 66 228 65 243 82 261 84 268 100 267 103 261 77 239 79 231 100 207 98 196 119 201 143 202 160 195 166 210 172 213 173 238 167 251 160 248 154 265 169 264 178 247 186 240 198 260 200 271 217 271 219 262 207 258 195 230 192 198 210 184 227 164 242 144 259 145 284 151 277 141 293 140 299 134 297 127 273 119 270 105 Polygon -7500403 true true -1 195 14 180 36 166 40 153 53 140 82 131 134 133 159 126 188 115 227 108 236 102 238 98 268 86 269 92 281 87 269 103 269 113 x false 0 Polygon -7500403 true true 270 75 225 30 30 225 75 270 Polygon -7500403 true true 30 75 75 30 270 225 225 270 @#$#@#$#@ NetLogo 5.3.1 @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ default 0.0 -0.2 0 0.0 1.0 0.0 1 1.0 0.0 0.2 0 0.0 1.0 link direction true 0 Line -7500403 true 150 150 90 180 Line -7500403 true 150 150 210 180 @#$#@#$#@ 0 @#$#@#$#@