patches-own [ pheromone-walking ; amount of pheromone on this patch, which is dropped when ants walk here pheremone-carrying-food ; amount of pheromone on this patch, which is dropped when carrying food. pheromone-network ; amount of pheromone on this patch emitted by the network nest? ; true on nest patches, false elsewhere nest-scent ; number that is higher closer to the nest food-source ; if this patch is a foodsource, the number identifies which one food-capacity ; if this patch is a foodsource, the number identifies what capacity connection is required network? ; true on patches that are part of the network network-capacity ; the capacity of the network in this location, initially all zero network-cost-factor ; the costs for this patch to build additional network capacity go? ; whether we're allowed to go here ] turtles-own [ path ; turtles record the path they are taking from the food source to the nest food-source-found ; ants register which food-source they found (if any) carrying-food? ; is this ant carrying food? ] globals [ pheromone-network-power ; strength of the pull of the existing network min-cost-list ; this list will record the cost of the current cheapest path min-paths-list ; list of the current paths with the lowest cost min-path-counter-list ; list will keep track of the number of expensiver paths received, will be used to set permanent path after a treshold network-foods ; is a list of foodsources added to the network total-network-cost ; costs of the total network number-of-food-sources ; the total number of food-sources nest-X ; locations of nest source nest-Y ; locations of nest source food-X ; locations of food sources food-Y ; locations of food sources food-capacities ; the capacities of the food sources food-source-number ; number of the food source food-sources-connected ; list of the food sources that are connected stop-condition? ; is the simulation finished speed ; the speed in ticks per second turtle-concentration ; concentration of turtles near each other ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;; Setup procedures ;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;; to setup reset-timer ;Reset clear-all reset-ticks set stop-condition? false set food-X [] set food-Y [] set food-capacities [] ;Load the experiment from disk setup-experiments if(randomize?) [ ;Setup parameters which are uniformly distributed withing ranges set patience random 451 + 50 ; 50-500 set population random 6000 + 1 ; 1-6000 set wiggle-probability random-float .8 + .2 ; 0.2-1 set wiggle-angle random 45 + 1 ; 1-45 set diffusion-rate random-float 51 + 5 ; 5-55 set evaporation-rate random-float 31 + 5 ; 5-35 set pheromone-carrying-power random-float 20 ; 0-20 set pheromone-walking-power random-float 15 ; 0-15 set pheromone-network-multiplier random-float 1 ; 0-1 ] set pheromone-network-power calculate-network-pheromone-power ; strength of the pull of the network ;Setup lists set network-foods n-values length food-X [0] ; initially none of the foodsources are added to the network set min-cost-list n-values length food-X [0] ; initialize min-cost-list with large numbers set min-path-counter-list n-values length food-X [0] ; initialize min-path-counter-list from 0 set food-sources-connected [] ; initialize food-source-connected set min-paths-list [] set food-source-number [] let i 1 foreach food-X [ set min-paths-list lput [] min-paths-list set food-source-number lput i food-source-number set i i + 1 ] ; Setup patches setup-patches ; Create turtles setup-turtles recolor-all-patches false end ; Setup experiment based on a number to setup-experiments let file-terminals "rotterdam-co2-sources.txt" let file-area "rotterdam.gif" print (word "Loading terminals from " file-terminals) print (word "Loading area from " file-area) let locations-from-file [] ; We check to make sure the file exists first ifelse(file-exists? file-terminals and file-exists? file-area) [ ; Read in all the data from the file-area ask patches [ set pcolor white ] import-pcolors file-area ask patches [ ifelse pcolor = white [ set network-cost-factor no-go-area-cost ; no-go area is more expensive set go? false ] [ set network-cost-factor 1 ; go area has the default marginal cost of additional capacity set go? true ] ] ; Read in all the data in the file-terminals file-open file-terminals while [ not file-at-end? ] [ ; file-read gives you variables. In this case numbers and booleans ; We store them in a double list (ex [[1 1 9.9999] [1 2 9.9999] ... ; Each iteration we append the next four-tuple to the current list set locations-from-file sentence locations-from-file (list (list file-read file-read file-read)) ] ; Done reading in information. Close the file. file-close ; Process the information on the network capacity factor (first element from the first line) set network-capacity-factor item 0 first locations-from-file ; Process the information on the nest (x, y, second line) let nest-coordinates first (butfirst locations-from-file) set nest-X item 0 nest-coordinates * 1;TODO multiplied by 2 for the higher resolution of this example set nest-Y item 1 nest-coordinates * 1;TODO multiplied by 2 for the higher resolution of this example ; Process the information on the food sources (x, y and capacity, starting from line 3) foreach but-first (but-first locations-from-file) [ set food-X lput (item 0 ?) food-X set food-Y lput (item 1 ?) food-Y set food-capacities lput (item 2 ?) food-capacities ] set food-capacities [] set food-capacities lput capacity-1 food-capacities set food-capacities lput capacity-2 food-capacities set food-capacities lput capacity-3 food-capacities set food-capacities lput capacity-4 food-capacities set food-capacities lput capacity-5 food-capacities set number-of-food-sources length food-X ] [ user-message "Files missing!" stop ] end ; Setup the basic properties of the patches to setup-patches ask patches [ setup-nest setup-food set network? false set network-capacity 0 ] end ; Setup the nest patch and spread the nest scent to setup-nest set nest? (distancexy nest-X nest-Y) < 1 if go? [ set nest-scent nest-scent-power - distancexy nest-X nest-Y ] ; spread a nest-scent over the whole world -- stronger near the nest, no scent at no-go areas end ; Setup food patches to setup-food (foreach food-X food-Y food-source-number [ if (distancexy (1 * ?1) (1 * ?2)) < 1 [ set food-source ?3 ] ]);TODO multiplied by 2 for the higher resolution of this example (foreach food-X food-Y food-source-number [ if (distancexy (1 * ?1) (1 * ?2)) < 1 [ set plabel ?3 ] ]);TODO multiplied by 2 for the higher resolution of this example (foreach food-X food-Y food-capacities [ if (distancexy (1 * ?1) (1 * ?2)) < 1 [ set food-capacity ?3 ] ]);TODO multiplied by 2 for the higher resolution of this example end ; Setup basic properties of the turtles to setup-turtles set-default-shape turtles "bug" crt population [ reset-ant true] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;; Go procedures ;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Go to go ; Turtle GO ask turtles [ ifelse carrying-food? [ return-to-nest ] ; carrying food? take it back to nest [ look-for-food ] ; not carrying food? look for it ] ; Patch GO diffuse-pheromones evaporate-pheromones if display? [ recolor-all-patches see-pheromone? ;TODO dispable updates in colors for speed ] ; Proceed tick ; Check whether we're done if (length food-sources-connected >= length food-X) [ set stop-condition? true print "Simulation finished" stop ] end ; Diffuse pheromones to diffuse-pheromones if pheromone-walking? [ diffuse pheromone-walking (diffusion-rate / 100) ] if pheromone-carrying? [ diffuse pheremone-carrying-food (diffusion-rate / 100) ] if pheromone-network? [ diffuse pheromone-network (diffusion-rate / 100) ] end ; Evaporate pheromones to evaporate-pheromones ask patches [ ; Go area ifelse pheromone-walking? [ set pheromone-walking pheromone-walking * (100 - evaporation-rate) / 100 ] [ set pheromone-walking 0 ] ; slowly evaporate pheromone-walking ifelse pheromone-carrying? [ set pheremone-carrying-food pheremone-carrying-food * (100 - evaporation-rate) / 100 ] [ set pheremone-carrying-food 0 ] ; slowly evaporate pheremone-carrying-food ifelse pheromone-network? [ set pheromone-network pheromone-network * (100 - evaporation-rate) / 100 ] [ set pheromone-network 0 ] ; slowly evaporate pheromone-network if network? [set pheromone-network pheromone-network-power * network-capacity] ; keep up the pheromone network on the network, based on capacity if not go? [ set pheromone-walking 0 set pheremone-carrying-food 0 set pheromone-network 0 ] ] end ; Walk towards the nest to return-to-nest set path lput patch-here path ; add current coordinates to the path ifelse jump-to-nest? [ ; do not wait and go to the nest while [not nest? AND length path < 500] ; until ant reaches nest (but limit the length of the path to 500 in case it doesn't reach it) [ if pheromone-carrying? [set pheremone-carrying-food pheremone-carrying-food + pheromone-carrying-power ] ; drop some pheremone-carrying-food ifelse network? [uphill-nest-scent-on-network] ; Already on the network, just go towards the nest. [uphill-nest-scent ] ; Not yet on the network, go to find the nest, but go first to where other ants go, and go in the direction of the network. set path lput patch-here path ; add current coordinates to the path ] ifelse nest? [ has-returned-to-nest ] [ reset-ant relocate-at-reset? ] ; If the ant returns to the nest, record the path. If it doesn't get there, reset it. ] [if pheromone-carrying? [set pheremone-carrying-food pheremone-carrying-food + pheromone-carrying-power ] ; drop some pheremone-carrying-food ifelse network? [uphill-nest-scent-on-network] ; Already on the network, just go towards the nest. [uphill-nest-scent ] ; Not yet on the network, go to find the nest, but go first to where other ants go, and go in the direction of the network. set path lput patch-here path ; add current coordinates to the path if nest? [ has-returned-to-nest ] ; If returned to nest, process the path ] end ; When turtle has returned to nest the observer determines whether this is the lowest so far and sends the ant out again. to has-returned-to-nest set path remove-duplicates path ; remove duplicates in my path let additional-capacity item (food-source-found - 1) food-capacities ; determine the network capacity that should be added let cost cost-of-path path additional-capacity ; determine the additional cost of this path to the existing network ; If this is the first path coming back ifelse length item (food-source-found - 1) min-paths-list = 0 ; if an earlier path exists [ set min-cost-list replace-item (food-source-found - 1) min-cost-list cost ; then change the current minimum cost to the new one set min-paths-list replace-item (food-source-found - 1) min-paths-list path set min-path-counter-list replace-item (food-source-found - 1) min-path-counter-list 0 ; and start counting again until the patience value ] [ ; If this is the lowest found so far ifelse cost < item (food-source-found - 1) min-cost-list ; if the cost of this path is lower than the current minimum for that food-source-found... [set min-cost-list replace-item (food-source-found - 1) min-cost-list cost ; then change the current minimum cost to the new one set min-paths-list replace-item (food-source-found - 1) min-paths-list path set min-path-counter-list replace-item (food-source-found - 1) min-path-counter-list 0 ; and start counting again until the patience value ] [let oldcount item (food-source-found - 1) min-path-counter-list ; otherwise getting impatient and continue counting set min-path-counter-list replace-item (food-source-found - 1) min-path-counter-list (oldcount + 1) ] ; Should we build the best path found for this food source? if item (food-source-found - 1) min-path-counter-list > patience ; we have found an acceptable path, so... [ let additional-cost-for-path item (food-source-found - 1) min-cost-list add-to-network (item (food-source-found - 1) min-paths-list) additional-capacity ; add the best path found to the network set min-path-counter-list n-values length food-X [0] ; reset all the min path counters to 0. set network-foods replace-item (food-source-found - 1) network-foods 1 ; record this food-source-found as part of the network set food-sources-connected lput (food-source-found - 1) food-sources-connected ; record that the food source is found set total-network-cost total-network-cost + additional-cost-for-path ; record the total cost of the network print (word "Connected source " food-source-found " at capacity " additional-capacity ". " food-sources-connected " food sources are now connected. Additional cost: " additional-cost-for-path ". Total network costs: " total-network-cost ". Time so far: " timer ". Tick count: " ticks " and speed: " speed " ticks/second" ) let fs food-source-found ask turtles with [food-source-found = fs] ; ask all the turtles who carry food from that source to drop it [ set path [] ; reset the path list when dropping food set carrying-food? false ; I'm looking for food again. set color red ] ] ] ; Go out again set path [] ; reset the path list when dropping food set carrying-food? false ; drop food set color red ; change color to indicate to be looking for food again walk ; walk a step end to walk if not can-move? 1 [ rt 180 ] ; turn around if I cannot go ahead ifelse can-move? 1 [ ; go ahead, but if I cannot go there either move randomly ifelse move-to-center? [ move-to patch-ahead 1 ] [ fd 1 ] ; depending on the setting, go forward one, or move to center of the patch ahead. ] [ move-to one-of patches with [go?] ] end to reset-ant [relocate?] ; Go out again set path [] ; reset the path list when dropping food set carrying-food? false ; drop food set color red ; change color to indicate to be looking for food again if relocate? [ move-to one-of patches with [go?]] end ; Go looking for food to look-for-food ifelse food-source > 0 and not member? (food-source - 1) food-sources-connected ; Found food that is not yet connected to the main souce. [ set carrying-food? true ; pick up food set color magenta ; mark with yellow color set food-source-found food-source ; register the food source rt 180 ; turn around ] [ if pheromone-walking? [ set pheromone-walking pheromone-walking + pheromone-walking-power ]; drop pheromone if (pheremone-carrying-food >= 0.05) and (pheremone-carrying-food < 2) [ uphill-pheremone-carrying-food ] ;TODO why these numbers (0.05 and 2)? if (random-float 1 < wiggle-probability) [ wiggle ] walk ] end ; Go towards the strongest smell of the picking-up food pheromone. to uphill-pheromone-walking let scent-ahead pheromone-walking-scent-at-angle 0 let scent-right pheromone-walking-scent-at-angle 45 let scent-left pheromone-walking-scent-at-angle -45 if (scent-right > scent-ahead) or (scent-left > scent-ahead) [ ifelse scent-right > scent-left [ rt 45 ] [ lt 45 ] ] end ; Go towards the strongest smell of the carrying food pheromone. to uphill-pheremone-carrying-food let scent-ahead pheremone-carrying-food-scent-at-angle 0 let scent-right pheremone-carrying-food-scent-at-angle 45 let scent-left pheremone-carrying-food-scent-at-angle -45 if (scent-right > scent-ahead) or (scent-left > scent-ahead) [ ifelse scent-right > scent-left [ rt 45 ] [ lt 45 ] ] end ; Go to the network if the network is in reach. Otherwise, go towards the strongest smell of the network. to uphill-pheromone-network ifelse count neighbors with [network?] > 0 ; If the network is within reach [uphill-nest-scent-on-network] ; go uphill on the network. [let scent-ahead pheromone-network-scent-at-angle 0 let scent-right pheromone-network-scent-at-angle 45 let scent-left pheromone-network-scent-at-angle -45 if (scent-right > scent-ahead) or (scent-left > scent-ahead) [ ifelse scent-right > scent-left [ rt 45 ] [ lt 45 ] ] ] end ; Go to the nest if the nest is in reach. Otherwise, go towards the strongest smell of the nest. to uphill-nest-scent ifelse count neighbors with [nest?] > 0 ; If the nest is within reach [move-to one-of neighbors with [nest?]] ; move to the nest. [ifelse count neighbors with [network?] > 0 ; if the network is in reach [move-to max-one-of neighbors with [network?] [nest-scent]] ; move to the network. [let scent-ahead nest-scent-at-angle 0 ; else go towards the nest. let scent-right nest-scent-at-angle 45 let scent-left nest-scent-at-angle -45 if (scent-right > scent-ahead) or (scent-left > scent-ahead) [ifelse scent-right > scent-left [rt 45] [lt 45] ] uphill-pheromone-walking uphill-pheromone-network walk ] ] end ; Go where the strongest smell is of the nest but only go to network and nest patches to uphill-nest-scent-on-network ifelse count neighbors with [nest?] > 0 ; if the nest is within reach [move-to one-of neighbors with [nest?]] ; move to the nest [let neighbors-with-network sort-on [nest-scent] neighbors with [network?] ; else, make a list of the neighboring patches with existing network, sorted on nest scent (low to high) let best-patch one-of neighbors-with-network ; if none exist, select a random neighbor patch with network foreach (neighbors-with-network) [ if (not member? ? path) [ set best-patch ? ] ] ; for each of the neighbor patches with network, select it if it is not on my path. The last one that matches is the best face best-patch move-to best-patch ; go to the center of the best patch ] end ; Wiggle randomly within a given angle to wiggle set heading heading + random-normal 0 wiggle-angle if not can-move? 1 [ rt 180 ] end ; Add path p to the network to add-to-network [p additional-capacity] foreach p [ move-to ? ;go to each of the patches set network? true ;make this patch part of the network set network-capacity network-capacity + additional-capacity ;update the current capacity with the additional capacity if pheromone-network? [ set pheromone-network pheromone-network-power ] ;leave a permanent pheromonep-network ] end to show-hide-turtles ask turtles [ set hidden? not hidden? ] end to recolor-all-patches [display-pheromones?] ifelse display-pheromones? [ ask patches [ set pcolor scale-color red (pheremone-carrying-food + pheromone-network + pheromone-walking) 0 display-pheromone-sensitivity ] ] [ ask patches [ set pcolor black ] ] if see-best-paths? [ foreach min-paths-list [ let min-path-list ? foreach min-path-list [ let thispatch ? ask thispatch [ set pcolor cyan ] ]] ] ask patches with [network?] [ set pcolor green ;set plabel network-capacity ;TODO do not show capacity ] if see-no-go-area? [ ask patches with [not go?] [set pcolor 108] ] ask patches with [food-source > 0] [ ifelse member? (food-source - 1) food-sources-connected [set pcolor red] [set pcolor orange] set plabel food-source ] ask patches with [nest?] [ set pcolor yellow] end ; Recolor a patch with or without displaying pheromones to recolor-patch [pheromones] ; scale color to show chemical concentration ifelse pheromones[ ifelse pheremone-carrying-food > 0.1 ; if all pheromones are present, then green comes first, cyan second, red third [set pcolor scale-color (green) pheremone-carrying-food 0.1 5] [ifelse pheromone-network > 0.1 [set pcolor scale-color cyan pheromone-network 0.1 10] [set pcolor scale-color red pheromone-walking 0.1 15] ] ] [ set pcolor black ] if see-no-go-area? and not go? [set pcolor 108] if network? [ set pcolor green set plabel network-capacity ] if food-source > 0 [ ifelse member? (food-source - 1) food-sources-connected [set pcolor red] [set pcolor orange] set plabel food-source ] if nest? [ set pcolor yellow] end ; Report the additional cost for path p if it would be added to the existing network with a certain additional capacity to-report cost-of-path-old [p additional-capacity] let cost 0 let old patch 0 0 foreach p [ move-to ? ; go over the patches in the path let lengthmuliplier sqrt(2) if member? old (neighbors4) [ set lengthmuliplier 1 ] set old ? set cost cost + lengthmuliplier * (calculate-network-cost(network-capacity + additional-capacity) - calculate-network-cost(network-capacity)) ; add the cost for an additional element of capacity ] report cost end ; Report nest scent at angle to-report nest-scent-at-angle [angle] let p patch-right-and-ahead angle 1 if p = nobody [ report 0 ] report [nest-scent] of p end ; Report picking-up food scent at angle to-report pheromone-walking-scent-at-angle [angle] let p patch-right-and-ahead angle 1 if p = nobody [ report 0 ] report [pheromone-walking] of p end ; Report carrying food scent at angle to-report pheremone-carrying-food-scent-at-angle [angle] let p patch-right-and-ahead angle 1 if p = nobody [ report 0 ] report [pheremone-carrying-food] of p end ; Report network scent at angle to-report pheromone-network-scent-at-angle [angle] let p patch-right-and-ahead angle 1 if p = nobody [ report 0 ] report [pheromone-network] of p end ; Report the network cost for a patch for capacity to-report calculate-network-cost [capacity] ifelse capacity > 0 [ let meuro-per-km 1 let width-on-map-in-km 37.2 ; based on the horizontal distance on the Rotterdam map let meuro-per-patch meuro-per-km * width-on-map-in-km / world-width report (meuro-per-patch * network-cost-factor * (capacity ^ network-capacity-factor)) ] [ report 0 ] end ; Report the total cost of the existing network to-report cost-of-path [the-path additional-capacity] let tc 0 let itemnr 0 foreach the-path [ask ? [ let n4 0 let n8 0 ask neighbors4 [ if member? self the-path [ set n4 n4 + 1]] ask neighbors [ if member? self the-path [ set n8 n8 + 1 ]] let lengthmultiplier (0.5 * n4) + (sqrt(2) * 0.5 * (n8 - n4)) ; the length of this piece is determined by what is surrounding. If there is a diagonal link, it is larger. Half is added, because every element is counted twice --> 0.5 = 1/2 and 0.2 = (sqrt(2)-1)/2 set tc tc + lengthmultiplier * (calculate-network-cost (network-capacity + additional-capacity) - calculate-network-cost (network-capacity)) ] ] report tc end ; Report the network pheromone power on the basis of the network capacity factor and the nest scent to-report calculate-network-pheromone-power report pheromone-network-multiplier * (nest-scent-power * (1 - network-capacity-factor)) ; the network pheromone power is based on the network capacity factor and the nest strength to balance the pull of the nest and the network. end ; to-report cost-best-paths ifelse is-list? min-cost-list [report sum min-cost-list] [report 0] end @#$#@#$#@ GRAPHICS-WINDOW 6 20 767 352 -1 -1 1.5 1 10 1 1 1 0 0 0 1 0 500 0 200 1 1 1 ticks 30.0 SLIDER 19 945 190 978 population population 0 10000 3000 1 1 NIL HORIZONTAL SLIDER 19 1015 191 1048 diffusion-rate diffusion-rate 0 100 35 1 1 NIL HORIZONTAL BUTTON 566 65 656 98 NIL Setup NIL 1 T OBSERVER NIL S NIL NIL 1 BUTTON 662 65 746 98 Go go T 1 T OBSERVER NIL G NIL NIL 1 SWITCH 16 1344 188 1377 see-no-go-area? see-no-go-area? 0 1 -1000 SLIDER 19 1051 191 1084 evaporation-rate evaporation-rate 1 20 15 1 1 NIL HORIZONTAL SLIDER 196 386 368 419 patience patience 1 1000 50 1 1 NIL HORIZONTAL SLIDER 18 1088 190 1121 wiggle-angle wiggle-angle 0 90 45 1 1 NIL HORIZONTAL MONITOR 562 743 670 788 cost of network built total-network-cost 2 1 11 MONITOR 460 646 767 691 minimum cost of path map [precision ? 1] min-cost-list 2 1 11 MONITOR 460 695 767 740 cost has not improved min-path-counter-list 2 1 11 MONITOR 459 743 559 788 sources connected length food-sources-connected 0 1 11 SWITCH 19 572 191 605 see-pheromone? see-pheromone? 0 1 -1000 MONITOR 672 743 767 788 cost of best paths cost-best-paths 2 1 11 SLIDER 196 425 366 458 nest-scent-power nest-scent-power 0 500 400 1 1 NIL HORIZONTAL TEXTBOX 29 555 179 573 Display 11 124.0 1 TEXTBOX 196 361 346 379 Parameters 11 124.0 1 SLIDER 18 1127 188 1160 pheromone-network-multiplier pheromone-network-multiplier 0 50 3 .5 1 NIL HORIZONTAL SLIDER 18 1163 188 1196 pheromone-carrying-power pheromone-carrying-power 0 500 10 .1 1 NIL HORIZONTAL SLIDER 18 1199 187 1232 pheromone-walking-power pheromone-walking-power 0 25 4.3 0.1 1 NIL HORIZONTAL PLOT 461 513 768 641 Sources connected NIL NIL 0.0 1.0 0.0 1.0 true true "" "" PENS "Connected" 1.0 0 -16777216 true "" "if is-list? food-sources-connected [ plot length food-sources-connected]" "Total" 1.0 0 -7500403 true "" "plot number-of-food-sources" SLIDER 19 980 191 1013 wiggle-probability wiggle-probability 0 1 0.1 .01 1 NIL HORIZONTAL SWITCH 17 1236 166 1269 randomize? randomize? 1 1 -1000 SWITCH 16 1272 164 1305 move-to-center? move-to-center? 1 1 -1000 SWITCH 19 384 169 417 jump-to-nest? jump-to-nest? 0 1 -1000 SWITCH 17 1381 167 1414 relocate-at-reset? relocate-at-reset? 0 1 -1000 TEXTBOX 24 363 174 381 Main settings 11 124.0 1 SLIDER 19 645 191 678 display-pheromone-sensitivity display-pheromone-sensitivity 1 100 12 1 1 NIL HORIZONTAL SWITCH 19 608 191 641 see-best-paths? see-best-paths? 0 1 -1000 SWITCH 15 1308 188 1341 display? display? 0 1 -1000 SWITCH 19 422 170 455 pheromone-network? pheromone-network? 0 1 -1000 SWITCH 19 497 169 530 pheromone-walking? pheromone-walking? 1 1 -1000 SWITCH 19 459 169 492 pheromone-carrying? pheromone-carrying? 0 1 -1000 PLOT 462 358 768 508 Costs (Meuro) NIL NIL 0.0 10.0 0.0 10.0 true true "" "" PENS "best paths" 1.0 0 -16777216 true "" "if is-list? min-cost-list [ plot sum min-cost-list]" "network" 1.0 0 -7500403 true "" "plot total-network-cost" SLIDER 196 502 368 535 no-go-area-cost no-go-area-cost 0 50 10 .5 1 NIL HORIZONTAL INPUTBOX 359 104 434 164 capacity-1 1 1 0 Number INPUTBOX 437 104 513 164 capacity-2 1 1 0 Number INPUTBOX 516 104 592 164 capacity-3 1 1 0 Number INPUTBOX 595 104 670 164 capacity-4 1 1 0 Number INPUTBOX 673 104 747 164 capacity-5 1 1 0 Number SLIDER 196 463 367 496 network-capacity-factor network-capacity-factor 0 1 0.6 0.05 1 NIL HORIZONTAL BUTTON 436 65 564 98 Show/hide turtles show-hide-turtles NIL 1 T OBSERVER NIL H NIL NIL 0 @#$#@#$#@ ## ## ## WHAT IS IT? This section could give a general understanding of what the model is trying to show or explain. ## ## ## HOW IT WORKS This section could explain what rules the agents use to create the overall behavior of the model. ## ## ## HOW TO USE IT This section could explain how to use the model, including a description of each of the items in the interface tab. ## ## ## THINGS TO NOTICE This section could give some ideas of things for the user to notice while running the model. ## ## ## THINGS TO TRY This section could give some ideas of things for the user to try to do (move sliders, switches, etc.) with the model. ## ## ## EXTENDING THE MODEL This section could give some ideas of things to add or change in the procedures tab to make the model more complicated, detailed, accurate, etc. ## ## ## NETLOGO FEATURES This section could point out any especially interesting or unusual features of NetLogo that the model makes use of, particularly in the Procedures tab. It might also point out places where workarounds were needed because of missing features. ## ## ## RELATED MODELS This section could give the names of models in the NetLogo Models Library or elsewhere which are of related interest. ## ## ## CREDITS AND REFERENCES This section could contain a reference to the model's URL on the web if it has one, as well as any other necessary credits or references. @#$#@#$#@ 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 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 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.0.4 @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ setup go total-network-cost patience population diffusion-rate evaporation-rate wiggle-angle wiggle-probability nest-scent-power pheromone-network-multiplier pheromone-network-power pheromone-walking-power pheromone-carrying-power food-sources-connected timer speed stop-condition? @#$#@#$#@ @#$#@#$#@ 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 @#$#@#$#@