turtles-own [ role ;; current role: "coordinator", "subordinate" or "autonomous" food ;; the amount of food this turtle has metabolism ;; the amount of food that each turtles loses each tick vision ;; the distance that this turtle can see maxchildren ;; the maximum amount of children a turtle can have. Default 10 pubertyage ;; the Age from which turtles are able to reproduce. Default 10 maxgather ;; the maximum amount of food a turtle can gather in one tick. Default 50 childfood ;; the amount of food a new born turtle receives from its parent. Default 40 life-expectancy ;; the amount of ticks a turtle will live. Default 50-100 birthday ;; the tick the turtle was born children ;; the amount of children a turtle has planning-range ;; the range that is used to evaluate neighbor patches. Default 5 survivaldef ;; the result of the survival-def Procedure survivalm ;; the result of the survival-m Procedure curiositydef ;; the result of Curiositydef (located in basefoodvalueforfield-alternative) curiositym ;; the result of the curiosity-m Procedure curiositysc ;; the result of the curiosity when becoming a coordinator curiosityec ;; the result of the curiosity when stop being a coordinator bfood ;; the result of the basefoodvalueforfield-alternative Procedure bfoodg ;; the result of the basefoodvalueforfield-alternativeg Procedure bfoodm ;; the result of the basefoodvalueforfield-alternativem Procedure wealthdef ;; the result of the wealth-def Procedure wealthm ;; the result of the wealth-m Procedure wealthb ;; the result of the wealth-b Procedure wealthg ;; the result of the wealth-g Procedure wealthsc ;; the result of the wealth-sc Procedure wealthec ;; The result of the wealth-ec Procedure wealthsub ;; The result of the wealth-sub Procedure wealthunsub ;; The result of the wealth-unsub Procedure resultsaturation ;; the result of Saturation (foodagent,avwealth) resultsaturationg ;; the result of Saturation-g (foodagent + gatheramount,avwealth) resultsaturationb ;; the result of Saturation-b (foodagent - childfood, avwealth) resultsaturationsc ;; the result of Saturation-sc (subspot, avsubs) breedingdef ;; the result of breedingdef Procedure breedingb ;; the value of satisfaction for breed when the action breed is chosen (1) mem-pos ;; the memory of the turtles. Contains the pxcor/pycor values of their neighbor patches mem-ts ;; the second part of the turtle memory. Contains the tick and the amount of food of the neighbor patches survivalg ;; the result of the survival-g Procedure survivalb ;; the result of the survival-b Procedure survivalsc ;; the result of the survival-sc Procedure survivalec ;; The result of the survival-ec Procedure survivalsub ;; The result of the survival-sub Procedure survivalunsub ;; Result of the survival-unsub Procedure coords ;; a list with the pxcor/pycor values of the patches that surround the 8 neighbors of a turtle. bestfieldx ;; the coordinates to which an not-coordinated turtle will move if he moves. bestfieldy ;; the coordinates to which an not-coordinated turtle will move if he moves. action ;; the number of the action that shall be executed coordFoodPRFactor ;; the amount of which the metabolism of a turtle is elevated when he is a coordinator. Default 2 fsc ;; the result of saturation-sc0(subspot,avsubs,coordinatorBStrength) fec ;; Result of the saturation-ec Procedure (subsagent, avsubs, end-coordinating-malus) fsub ;; Result of sat-subord funsub ;; Result of sat-unsubord taxes ;; Amount a subordinated turtle pays to his coordinator probationStart ;; The tick at which the turtle started his job as coordinator/subordinator probationTime ;; Default 25. The amount of ticks that a coordinator/subordinator is unable to quit the relationship after the beginning influencedef ;; The result of the saturation-i Procedure (subsagent, avsubs) influenceec ;; The result of the influence-ec Procedure influencesc ;; The result of the influence-sc Procedure duration-sublinks ;; The duration of subordinator links gatherrest ;; The amount of food an agent lets untouched on the patch action-taken sum-sats ] globals [ roundstosurvive ;; Default 20 coordi-account subord-account normal-account totalfood last-500-agents last-500-food agents-amplitude agents-max food-for-agents-max agents-min food-for-agents-min food-amplitude food-max agents-for-food-max food-min agents-for-food-min mean-duration-of-sublinks vision-range ;; the range in which possible coordinators can be seen. Default 4 interface-filename result-filename ] patches-own [ pfood ;; the amount of food on this patch max-pfood ;; the maximum amount of food that can be on a patch Default 20 growth-rate ;; the amount of food that regrows every tick Default 1 ] directed-link-breed [ sub-to-coord sublink ] directed-link-breed [ coord-to-sub coordlink ] sub-to-coord-own [ start-value ; foodvalue of the turtle at the beginning of the relationship current-value ; the actual foodvalue of the subordinated turtle coord-value ; evaluation of the coordinator (current-value - start-value) range ; the range of the turtle. The quotient of current-value and metabolism active ; tells if a link is active or not. 0 = inactive, 1 = active start-date ; saves the tick in which the link was created ] coord-to-sub-own [ targetx targety ] ;; ;; Setup Procedures ;; to setup ;; (for this model to work with NetLogo's new plotting features, ;; __clear-all-and-reset-ticks should be replaced with clear-all at ;; the beginning of your setup procedure and reset-ticks at the end ;; of the procedure.) __clear-all-and-reset-ticks set normal-account 0 set coordi-account 0 set subord-account 0 create-turtles initial-population [ turtle-setup ] setup-patches my-update-plots set vision-range 4 set interface-filename ( word "result_" rectify-date "_sub_" ( subordCoordValuesInfluence ) "_unsub" ( unsubordCoordValuesInfluence ) ".png" ) set result-filename ( word "result_" rectify-date "_#_" behaviorspace-run-number "_sub_" ( subordCoordValuesInfluence ) "_unsub" ( unsubordCoordValuesInfluence ) ".csv" ) file-open result-filename set last-500-agents [] set last-500-food [] end to turtle-setup ;; turtle procedure ; If set to ON, the same random values are used. In this case 4711. if random-seed? [ random-seed 4711 ] set gatherrest 0 set probationTime 100 set taxes 0 set breedingb 1 set role "autonomous" set shape "circle" set normal-account normal-account + 1 set mem-pos (list) set mem-ts (list) set coordFoodPRFactor 1.25 set duration-sublinks 1 set birthday ticks set influenceec 0 set planning-range 5 set maxgather 50 set children 0 set maxchildren max-children set life-expectancy random (101 - 50) + 50 ;; Random value between 50 and 100 ticks set childfood 100 set pubertyage puberty-age set color red move-to one-of patches with [not any? other turtles-here] set food initial-food ; the amound of food every turtle starts with set metabolism random (5 - 1) + 1 ; random value between 1 and 4 set vision vision-range run visualization end to setup-patches ask patches ; at first all patches are set to white [ set pcolor (white)] ask n-of (count patches * (patch-fertile-percentage / 100)) patches ; second step: take 25% of all patches and give them special properties [ set max-pfood 20 set pfood random (21 - 1) + 1 ; sets the amount of food on a patch between 1 and 20 set pcolor (green + 5.9 - pfood) set growth-rate food-regrow ] end ;; ;; Runtime Procedures ;; to go ask turtles [ ifelse show-food? [ set label food set label-color black] [ set label "" ] if (count my-out-sub-to-coord = 0) and role = "subordinate" [ set-role "subordinate" ] memory-fill baseValueFoodForField baseValueFoodForField-g baseValueFoodForField-m coordinates metabolise memory-delete if role = "coordinator" [ coordinate ] survival-def survival-g survival-b survival-m survival-sc survival-sub survival-unsub saturation saturation-g saturation-b saturation-i saturation-ec saturation-sc saturation-sc0 saturation-sub saturation-unsub wealth-def wealth-b wealth-g wealth-m wealth-sc wealth-sub wealth-unsub breeding-def influence-sc decide execution if role = "coordinator" [ collectTaxes ] if role = "subordinate" [subordrelations] ifelse die-of-old-age? [ if ((ticks - birthday) > life-expectancy) or (food <= 0) [ if role = "coordinator" [ set coordi-account coordi-account - 1] if role = "subordinate" [ set subord-account subord-account - 1 ] if role = "autonomous" [ set normal-account normal-account - 1] die ] ] [ if (food <= 0) [ if role = "coordinator" [ set coordi-account coordi-account - 1] if role = "subordinate" [ set subord-account subord-account - 1 ] if role = "autonomous" [ set normal-account normal-account - 1] die ] ] run visualization ] ask patches [ ifelse show-pfood? [set plabel pfood set plabel-color black] [ set plabel "" ] patch-growback patch-recolor ] set totalfood 0 ask patches [ set totalfood totalfood + pfood ] set last-500-agents lput count turtles last-500-agents if length last-500-agents > 500 [ set last-500-agents but-first last-500-agents ] set last-500-food lput totalfood last-500-food my-update-plots if length last-500-food > 500 [ set last-500-food but-first last-500-food ] set agents-max max last-500-agents let food-for-agents-max-position position agents-max last-500-agents set food-for-agents-max item food-for-agents-max-position last-500-food set agents-min min last-500-agents let food-for-agents-min-position position agents-min last-500-agents set food-for-agents-min item food-for-agents-min-position last-500-food set agents-amplitude agents-max - agents-min set food-max max last-500-food let agents-for-food-max-position position food-max last-500-food set agents-for-food-max item agents-for-food-max-position last-500-agents set food-min min last-500-food let agents-for-food-min-position position food-min last-500-food set agents-for-food-min item agents-for-food-min-position last-500-agents set food-amplitude food-max - food-min ifelse any? turtles [ set mean-duration-of-sublinks mean [ duration-sublinks ] of turtles ] [ set mean-duration-of-sublinks -1 ] tick file-write count turtles file-type ";" file-write count turtles with [ role = "coordinator" ] file-type ";" file-write count turtles with [ role = "subordinate" ] file-type ";" file-write count turtles with [ role = "autonomous" ] file-type ";" file-write totalfood / 100 file-print "" if ( ticks mod 500 ) = 2 [ file-flush ] if ( not any? turtles ) or ( ticks > 1500 ) [ if export-interface? [ export-interface interface-filename show word "interface exported to " interface-filename ] file-close show word "results written to " result-filename stop ] end to-report sat-breed report ((survivalb * survival-weight) + (wealthb * wealth-weight) + (breedingb * breed-weight) + (influencedef * influence-weight) + (curiositydef * influence-weight)) end to-report sat-move report ((survivalm * survival-weight) + (wealthm * wealth-weight) + (breedingdef * breed-weight) + (influencedef * influence-weight) + (curiositym * influence-weight)) end to-report sat-coord report ((survivalsc * survival-weight) + (wealthsc * wealth-weight) + (breedingdef * breed-weight) + (influencesc * influence-weight) + (curiositysc * influence-weight)) end to-report sat-endcoord report ((survivalec * survival-weight) + (wealthec * wealth-weight) + (breedingdef * breed-weight) + (influenceec * influence-weight) + (curiosityec * influence-weight)) end to-report sat-subord report ((survivalsub * survival-weight) + (wealthsub * wealth-weight) + (breedingdef * breed-weight) + (influencedef * influence-weight) + (curiositydef * influence-weight)) end to-report sat-unsubord report ((survivalunsub * survival-weight) + (wealthunsub * wealth-weight) + (breedingdef * breed-weight) + (influencedef * influence-weight) + (curiositydef * influence-weight)) end to-report sat-gather report ((survivalg * survival-weight) + (wealthg * wealth-weight) + (breedingdef * breed-weight) + (influencedef * influence-weight) + (curiositydef * influence-weight)) end to-report sat-rest report ((survivaldef * survival-weight) + (wealthdef * wealth-weight) + (breedingdef * breed-weight) + (influencedef * influence-weight) + (curiositydef * influence-weight)) end to-report cumulate [ s ] let c s foreach [ 1 2 3 4 5 6 7 ] [ set c replace-item ? c ( item ( ? - 1 ) c + item ? c ) ] report c end to decide ifelse enable-hierachy? [ let satisfactions ( list sat-gather sat-move sat-breed sat-coord sat-endcoord sat-subord sat-unsubord sat-rest ) let tempMin min satisfactions let summe 0 let tempSumme 0 let actionlist (list) ( foreach [ 0 1 2 3 4 5 6 7] satisfactions [set satisfactions replace-item ?1 satisfactions (?2 - tempMin)] ) ;; remove satisfactions for impossible actions if role = "coordinator" [ set satisfactions replace-item 3 satisfactions 0 set satisfactions replace-item 5 satisfactions 0 set satisfactions replace-item 6 satisfactions 0 ] if role = "subordinate" [ set satisfactions replace-item 3 satisfactions 0 set satisfactions replace-item 4 satisfactions 0 set satisfactions replace-item 5 satisfactions 0 ] if role = "autonomous" [ set satisfactions replace-item 4 satisfactions 0 set satisfactions replace-item 6 satisfactions 0 ] set sum-sats sum satisfactions foreach satisfactions [ let replace-position position ? satisfactions set satisfactions replace-item replace-position satisfactions (? / sum-sats) ] foreach satisfactions [ set summe (summe + ?) ] if summe = 0 [ turtle-eat ] let ran ( random-float summe ) foreach satisfactions [ let old-temp-summe tempSumme set tempSumme tempSumme + ? if ( old-temp-summe < ran ) and ( ran <= tempSumme ) [ set action position ? satisfactions set action-taken action stop ] ] ] [ let satisfactions ( list sat-gather sat-move sat-breed sat-rest ) let tempMin min satisfactions let summe 0 let tempSumme 0 let actionlist (list) ( foreach [ 0 1 2 3 ] satisfactions [set satisfactions replace-item ?1 satisfactions (?2 - tempMin)] ) set sum-sats sum satisfactions foreach satisfactions [ let replace-position position ? satisfactions set satisfactions replace-item replace-position satisfactions (? / sum-sats) ] foreach satisfactions [ set summe (summe + ?) ] if summe = 0 [ turtle-eat ] let ran ( random-float summe ) foreach satisfactions [ set tempSumme tempSumme + ? if ran <= tempSumme [ set action position ? satisfactions if action = 3 [ set action 7 ] stop ] ] ] end to execution if action = 0 [ turtle-move turtle-eat stop] if action = 1 [ turtle-move stop] if action = 2 and (children < 10) and (food > childfood) and ((ticks - birthday) >= pubertyage) [ reproduce set breedingdef 1 stop] if action = 3 and role = "autonomous" and enable-hierachy? = true [ set-role "coordinator" set probationStart ticks stop] if action = 4 and role = "coordinator" and enable-hierachy? = true [ set-role "autonomous" end-coordinate stop] if action = 5 and role = "autonomous" and enable-hierachy? = true [ start-subordinate set-role "subordinate" stop ] if action = 6 and role = "subordinate" and enable-hierachy? = true [ end-subordinate set-role "subordinate" stop ] if action = 7 [ turtle-eat stop ] turtle-move turtle-eat end to turtle-move let tempx 0 let tempy 0 ifelse role = "subordinate" [ ask my-in-coord-to-sub [ set tempx targetx set tempy targety ] if not any? other turtles-on patch tempx tempy [setxy tempx tempy] ] [ if not any? turtles-on patch bestfieldx bestfieldy [ setxy bestfieldx bestfieldy ] ] end to subordrelations set duration-sublinks duration-sublinks + 1 end to reproduce if (children < max-children) and (food > childfood) and ((ticks - birthday) >= pubertyage) [ set food (food - childfood) hatch 1 [ set food childfood set birthday ticks set life-expectancy random (101 - 50) + 50 set maxgather 50 set gatherrest 0 set maxchildren max-children set metabolism random (5 - 1) + 1 set children 0 set shape "circle" set role "autonomous" set normal-account normal-account + 1 ] set children children + 1 set breedingdef 1 ] end to turtle-eat ifelse ((pfood - gatherrest) <= maxgather) [ set food (food + (pfood - gatherrest)) set pfood gatherrest ] [ set food (food + maxgather) set pfood (pfood - maxgather) ] end to patch-recolor ;; color patches based on the amount of food they have if (pcolor != white) [ set pcolor (green + 5.9 - pfood) ] end to patch-growback ;; gradually grow back all of the food for the patch if (pfood < max-pfood) [ set pfood (pfood + growth-rate)] end to metabolise ifelse role = "coordinator" [ set food (food - (coordFoodPRFactor * metabolism)) ] [ set food food - metabolism ] end to-report mutation [ minimum maximum value width ] let width2 width * (maximum - minimum) let min2 value - width2 / 2 let max2 value + width2 / 2 if min2 < minimum [ set min2 minimum set max2 min2 + width2 ] if max2 > maximum [ set max2 maximum set min2 max2 - width2 ] set minimum min2 set maximum max2 let h 2 / (maximum - minimum) let D_1 h * minimum * minimum / (2 *(value - minimum)) let E_1 h * minimum / (value - minimum) let F_1 h / (2 * (value - minimum)) let D_2 h * (minimum * maximum - minimum * value + maximum * value) / (2 * (value - maximum)) let E_2 h * maximum / (value - maximum) let F_2 h / (2 * (value - maximum)) let x (value - minimum) / (maximum - minimum) let r random-float 1.0 ifelse r < x [ report (E_1 + sqrt(E_1 * E_1 - 4 * F_1 * (D_1 - r))) / (2 * F_1)] [ report (E_2 + sqrt(abs(E_2 * E_2 - 4 * F_2 * (D_2 - r)))) / (2 * F_2)] end to start-subordinate if role != "autonomous" [ show word "non-autonomous tries to subordinate, role is " role stop ] let me who let bestCoordValue 0 let myBoss 0 let startV food let rangeV (food / metabolism) let Coordinator 0 let subordination? false ifelse (count my-out-sub-to-coord >= 1 ) [ set myBoss max-one-of my-out-sub-to-coord [coord-value] ask myBoss [ ask other-end [set Coordinator who] ] ask turtle Coordinator [ if role = "coordinator" [ create-sublink-from turtle me [ set start-value startV set range rangeV set active 1 set start-date ticks ]] ; Create an subordinated-link from me to my coordinator set subordination? true ] ] [ if 0 < count turtles with [ role = "coordinator" ] in-radius vision [ ask one-of turtles with [ role = "coordinator" ] in-radius vision [ create-sublink-from turtle me [ set start-value startV set range rangeV set active 1 set start-date ticks ] ; Subordinate to the first Coordinator I find. After that STOP. This prevents multiple coordinated turtles and multiple hierachies. set subordination? true ] ] ] if subordination? [ set-role "subordinate" set probationStart ticks ] end to end-subordinate if (ticks - probationStart < probationTime) [stop] if role != "subordinate" [ show "non-subordinate tries to unsubordination" stop ] let tempfood food ask my-out-sub-to-coord with [active = 1] [ set active 0 set current-value tempfood set coord-value (current-value - start-value) ] set-role "autonomous" set duration-sublinks 0 end to survival-def set roundstosurvive 20 let tempErg 0 let temp 0 let resultsurvivaldef 0 set temp (food / (metabolism * roundstosurvive)) ifelse (temp > 1) [ set tempErg 1 ] [ set tempErg temp ] set resultsurvivaldef ((( 1 - food-weight ) * tempErg) + (food-weight * bfood)) ifelse (resultsurvivaldef > 1) [ set survivaldef 1] [ set survivaldef resultsurvivaldef] set survivalec (survivaldef * (1 - fec)) end to survival-b set roundstosurvive 20 let tempErg 0 let temp 0 let resultsurvivaldef 0 set temp (food - childfood / (metabolism * roundstosurvive)) ifelse (temp > 1) [ set tempErg 1 ] [ set tempErg temp ] set resultsurvivaldef ((( 1 - food-weight ) * tempErg) + (food-weight * bfood)) ifelse (resultsurvivaldef > 1) [ set survivalb 1] [ set survivalb resultsurvivaldef] end to survival-g set roundstosurvive 20 let tempErg 0 let temp 0 let resultsurvivaldef 0 ifelse role = "subordinate" [ set temp (food + maxgather * (1 - taxes) / (metabolism * roundstosurvive)) ] [ set temp (food + maxgather / (metabolism * roundstosurvive)) ] ifelse (temp > 1) [ set tempErg 1 ] [ set tempErg temp ] set resultsurvivaldef ((( 1 - food-weight ) * tempErg) + (food-weight * bfoodg)) ifelse (resultsurvivaldef > 1) [ set survivalg 1] [ set survivalg resultsurvivaldef] end to survival-m set roundstosurvive 20 let tempErg 0 let temp 0 let resultsurvivaldef 0 set temp (food / (metabolism * roundstosurvive)) ifelse (temp > 1) [ set tempErg 1 ] [ set tempErg temp ] set resultsurvivaldef ((( 1 - food-weight ) * tempErg) + (food-weight * bfoodm)) ifelse (resultsurvivaldef > 1) [ set survivalm 1] [ set survivalm resultsurvivaldef] end to survival-sc set roundstosurvive 20 let tempErg 0 let temp 0 let resultsurvivalsc 0 let survivalsc0 0 set temp (food / ((metabolism * coordFoodPRFactor) * roundstosurvive)) ifelse (temp > 1) [ set tempErg 1 ] [ set tempErg temp ] set resultsurvivalsc ((( 1 - food-weight ) * tempErg) + (food-weight * bfood)) ifelse (resultsurvivalsc > 1) [ set survivalsc0 1] [ set survivalsc0 resultsurvivalsc] set survivalsc (survivalsc0 + (1 - survivalsc0) * fsc) end to survival-sub ifelse fsub >= 0 [ set survivalsub (survivaldef + (1 - survivaldef)) * fsub ] [ set survivalsub (survivaldef * (1 + fsub)) ] end to survival-unsub ifelse funsub < 0 [ set survivalunsub (survivaldef + (1 - survivaldef) * (- funsub)) ] [ set survivalunsub (survivaldef * (1 - funsub)) ] end to wealth-def let resultwealthdef 0 set resultwealthdef ((( 1 - food-weight ) * resultsaturation) + (food-weight * bfood)) ifelse (resultwealthdef > 1) [set wealthdef 1] [set wealthdef resultwealthdef] set wealthec (wealthdef * (1 - fec)) end to wealth-b let resultwealthdef 0 set resultwealthdef ((( 1 - food-weight ) * resultsaturationb) + (food-weight * bfood)) ifelse (resultwealthdef > 1) [set wealthb 1] [set wealthb resultwealthdef] end to wealth-g let resultwealthdef 0 set resultwealthdef ((( 1 - food-weight ) * resultsaturationg) + (food-weight * bfoodg)) ifelse (resultwealthdef > 1) [set wealthg 1] [set wealthg resultwealthdef] end to wealth-m let resultwealthdef 0 set resultwealthdef ((( 1 - food-weight ) * resultsaturation) + (food-weight * bfoodm)) ifelse (resultwealthdef > 1) [set wealthm 1] [set wealthm resultwealthdef] end to wealth-sc let wealthsc0 0 let resultwealthdef 0 set resultwealthdef ((( 1 - food-weight ) * resultsaturation) + (food-weight * bfood)) ifelse (resultwealthdef > 1) [set wealthdef 1] [set wealthdef resultwealthdef] set wealthsc0 wealthdef * (1 - coordinator-malus) set wealthsc (wealthsc0 + (1 - wealthsc0) * fsc) end to wealth-sub ifelse (fsub >= 0) [ set wealthsub (wealthdef + (1 - wealthdef) * fsub) ] [ set wealthsub (wealthdef * (1 + fsub)) ] end to wealth-unsub ifelse funsub < 0 [ set wealthunsub (wealthdef + (1 - wealthdef) * (- funsub)) ] [ set wealthunsub (wealthdef * (1 - funsub)) ] end to breeding-def set birthrecreationfactor 0.999 ifelse ((ticks - birthday) < pubertyage) [ set breedingdef 1 ] [ ifelse ((ticks - birthday) = pubertyage) [ set breedingdef random-float 1.0 ] [ set breedingdef breedingdef * birthrecreationfactor ] ] end to-report normalise-saturation [ x norm gamma ] let result 0 ifelse gamma < 1 [ set result ( atan x norm ) * gamma / 180 ] [ set result ( atan ( x * gamma ) norm ) / 180 ] report result end to saturation set resultsaturation 0 set resultsaturation normalise-saturation food avwealth 1 end to saturation-g let foodmaxgather 0 ifelse role = "subordinate" [set foodmaxgather (food + maxgather * (1 - taxes))] [set foodmaxgather (food + maxgather) ] set resultsaturationg 0 set resultsaturationg normalise-saturation foodmaxgather avwealth 1 end to saturation-b set resultsaturationb 0 set resultsaturationb normalise-saturation ( food - childfood ) avwealth 1 end to saturation-ec let subsagent 0 set fec 0 set subsagent (count my-out-coord-to-sub) set fec normalise-saturation subsagent avsubs end-coordinating-malus end to saturation-sc let subsc 0 let subsnc 0 let subspot 0 ifelse role != "coordinator" [ set subsnc count other turtles with [ role != "coordinator" ] in-radius vision set subsc count turtles with [ role = "coordinator" ] in-radius vision + 1 ] [ set subsnc count turtles with [ role != "coordinator" ] in-radius vision set subsc count turtles with [ role = "coordinator" ] in-radius vision ] ifelse subsc = 0 or subsnc = 0 [ set subspot 0 ] [ set subspot subsnc / subsc ] set resultsaturationsc normalise-saturation subspot avsubs coordinator-bonus-strength end to saturation-sc0 let subsc 0 let subsnc 0 let subspot 0 ifelse role != "coordinator" [ set subsnc count other turtles with [ role != "coordinator" ] in-radius vision set subsc count turtles with [ role = "coordinator" ] in-radius vision + 1 ] [ set subsnc count turtles with [ role != "coordinator" ] in-radius vision set subsc count turtles with [ role = "coordinator" ] in-radius vision ] ifelse subsc = 0 or subsnc = 0 [ set subspot 0 ] [ set subspot subsnc / subsc ] set fsc normalise-saturation subspot avsubs coordinator-bonus-strength ;; ifelse coordinator-bonus-strength < 1 ;; [ set fsc ( atan ( subspot * coordinator-bonus-strength ) avsubs ) / 180 ] ;; [ set fsc ((atan subspot avsubs) / 180) * coordinator-bonus-strength ] end to saturation-i let subsagent 0 set subsagent (count my-out-coord-to-sub) set influencedef normalise-saturation subsagent avsubs 1 ;; set influencedef ((atan subsagent avsubs) / 180) end to saturation-sub let coordeval 0 ifelse ([coord-value] of my-out-sub-to-coord = [] ) [ set coordeval random-float-in-range 10.0 20.0 ] [ set coordeval (max [coord-value] of my-out-sub-to-coord) ] let resultsaturationsub 0 set fsub 0 set fsub ( ifelse-value ( coordeval > 0 ) [ -1 ] [ 1 ] ) * normalise-saturation abs coordeval avwealth subordCoordValuesInfluence ;; set resultsaturationsub ((atan coordeval avwealth) / 180) * subordCoordValuesInfluence ;; set fsub (abs coordeval) * resultsaturationsub end to saturation-unsub let coordeval 0 let tempfood food ask my-out-sub-to-coord with [active = 1] [ set current-value tempfood set coord-value (current-value - start-value) set coordeval coord-value ] let resultsaturationunsub 0 set funsub ( ifelse-value ( coordeval > 0 ) [ -1 ] [ 1 ] ) * normalise-saturation abs coordeval avwealth unsubordCoordValuesInfluence ;; set resultsaturationunsub ((atan coordeval avwealth) / 180) * unsubordCoordValuesInfluence ;; set funsub (abs coordeval) * resultsaturationunsub end to memory-fill let pxpy (list) let ts (list) ask patches in-radius vision [ set pxpy lput list pxcor pycor pxpy set ts lput list ticks pfood ts ] (foreach pxpy ts [ ifelse member? ?1 mem-pos [ let insert-position position ?1 mem-pos set mem-pos replace-item insert-position mem-pos ?1 ifelse (any? turtles-on patch first ?1 last ?1 = true) [ set mem-ts replace-item insert-position mem-ts list first ?2 ((last ?2) / 2) ] [ set mem-ts replace-item insert-position mem-ts ?2 ] ] [ set mem-pos lput ?1 mem-pos ifelse (any? turtles-on patch first ?1 last ?1 = true) [ set mem-ts lput list first ?2 ((last ?2) / 2) mem-ts] [ set mem-ts lput ?2 mem-ts] ] ] ) end to memory-delete (foreach mem-pos mem-ts [ if (ticks - (first ?2)) >= memory-lifetime [ let remove-position position ?2 mem-ts set mem-pos remove-item remove-position mem-pos set mem-ts remove-item remove-position mem-ts ] ] ) end to baseValueFoodForField let sumUnknown 0 let sumFood 0 let count-known 0 let known-places mem-pos let known-food mem-ts let my-current-x pxcor let my-current-y pycor ask patches in-radius planning-range [ ifelse member? list pxcor pycor known-places [ let dist distancexy my-current-x my-current-y let pos position list pxcor pycor known-places let currentfood last item pos known-food if currentfood >= 0 [set sumFood sumFood + currentfood / (2 ^ dist)] set count-known count-known + 1 ] [ let dist distancexy my-current-x my-current-y set sumUnknown sumUnknown + 1 / (2 ^ dist) ] ] set sumFood sumFood / count-known if (sumFood > 1) [ set sumFood 1] set bfood sumFood if (sumUnknown > 1) [ set sumUnknown 1] set curiositydef sumUnknown set curiositysc (curiositydef + (1 - curiositydef) * fsc) set curiosityec (curiositydef * (1 - fec)) end to baseValueFoodForField-g let ownFood 0 let sumFood 0 let count-known 0 let known-places mem-pos let known-food mem-ts let my-current-x pxcor let my-current-y pycor let debug? who = 0 ask patches in-radius planning-range [ if member? list pxcor pycor known-places [ let dist distancexy my-current-x my-current-y let pos position list pxcor pycor known-places let currentfood last item pos known-food if currentfood >= 0 [ ifelse dist = 0 [set ownFood (currentfood / 2)] [set sumFood sumFood + currentfood / (2 ^ dist)] ] set count-known count-known + 1 ] ] set sumFood ownFood + SumFood set sumFood sumFood / count-known if (sumFood > 1) [ set sumFood 1] set bfoodg sumFood end to coordinate if role != "coordinator" [ show "non-coordinator starts coordination actions" stop ] let myID who let sumfood 0 let points 0 let mySubordinate (list) let my-current-x 0 let my-current-y 0 let tempRange 0 let tempTS (list) let tempXY (list) let tempErg 0 let disttofield 0 let maxValue 0 let temptargetx 0 let temptargety 0 let Ergebnis 0 ask my-in-sub-to-coord with [active = 1] [ set tempRange range ask other-end [set mySubordinate lput who mySubordinate] ] foreach mySubordinate [ ask turtle ? [ set tempXY mem-pos set my-current-x pxcor set my-current-y pycor set maxValue 0 set temptargetx 0 set temptargety 0 ask patches in-radius tempRange [ if member? list pxcor pycor tempXY [ let dist distancexy my-current-x my-current-y ifelse (dist = 0) [set sumfood ((sumfood + pfood) * 2)] [set sumfood sumfood + pfood] ifelse (pfood > 0 and not any? turtles-here) [set points points + 2] [ ifelse (pfood > 0 and any? turtles-here) [ set points points + 1 ] [ ifelse (pfood <= 0 and any? turtles-here) [ set points points - 2 ] [ set points points + 0 ] ] ] set tempErg sumfood * points set disttofield (tempRange / (dist + 1)) set Ergebnis (tempErg * disttofield) if Ergebnis > maxValue [ set maxValue Ergebnis set temptargetx pxcor set temptargety pycor ] ] ] ask my-in-coord-to-sub [die] ] create-coordlink-to turtle ? [ set targetx temptargetx set targety temptargety] ] end to end-coordinate if (ticks - probationStart < probationTime) [stop] let mySubordinate (list) let tempfood 0 ask my-in-sub-to-coord with [active = 1] [ ask other-end [set mySubordinate lput who mySubordinate] ] foreach mySubordinate [ ask turtle ? [ set tempfood food ask my-out-sub-to-coord with [active = 1] [ set current-value tempfood set coord-value (current-value - start-value) set active 0 ] set-role "autonomous" set duration-sublinks 0 ] ] ask my-out-coord-to-sub [die] set-role "coordinator" end to coordinates let tempcoords (list) set coords (list) ask neighbors [set tempcoords lput list pxcor pycor tempcoords] set coords tempcoords end to collectTaxes let local-sum-food 0 let mySubordinate (list) if role != "coordinator" [ show "non-coordinators tries to collect taxes" stop ] ask my-in-sub-to-coord with [active = 1] [ ask other-end [set mySubordinate lput who mySubordinate] ] foreach mySubordinate [ ask turtle ? [ let coordinatorContribution 0.1 set taxes (food * coordinatorContribution) set local-sum-food local-sum-food + taxes set food food - taxes ] ] set food food + local-sum-food end to baseValueFoodForField-m set bestfieldx 0 set bestfieldy 0 set bfoodm 0 set curiositym 0 let bfoodmErg 0 let sumFood 0 let count-fields 0 let tempErg 0 let Erglist (list) let pos 0 let maxfood 0 let coordslist (list) let pfoodlist (list) let known-places mem-pos let sumUnknown 0 let my-current-x pxcor let my-current-y pycor let templist (list) let neighborlist (list) let tempvision vision let tempsatmove 0 let maxvalue 0 let tmpcuriositym 0 let me who let tmprange planning-range ask neighbors [ set neighborlist lput list pxcor pycor neighborlist ] foreach neighborlist [ ask patch first ? last ? [ ask patches in-radius tempvision [ ifelse member? list pxcor pycor known-places [ let dist distancexy first ? last ? set coordslist lput ? coordslist ask self [ set pfoodlist lput (pfood / (2 ^ dist)) pfoodlist if pfood >= 0 [set sumFood sumFood + pfood / (2 ^ dist)] ] set count-fields count-fields + 1 ] [ let dist distancexy first ? last ? set coordslist lput ? coordslist ask self [ set pfoodlist lput (pfood / (2 ^ dist)) pfoodlist if pfood >= 0 [set sumFood sumFood + pfood / (2 ^ dist)] ] set sumUnknown sumUnknown + 1 / (2 ^ dist) set count-fields count-fields + 1 ] if (sumFood > 1) [ set sumFood 1] if (sumUnknown > 1) [ set sumUnknown 1 ] set tmpcuriositym sumUnknown set tempErg sumFood set bfoodmErg tempErg set Erglist lput bfoodmErg Erglist ] ask turtle me [ set tempsatmove ((survivalm * survival-weight) + (wealthm * wealth-weight) + (breedingdef * breed-weight) + (influencedef * influence-weight) + (tmpcuriositym * curiosity-weight)) if tempsatmove > maxValue [ set maxValue tempsatmove set curiositym tmpcuriositym ] ] ] ] set bfoodm max Erglist set maxfood max pfoodlist set pos position maxfood pfoodlist set bestfieldx first item pos coordslist set bestfieldy last item pos coordslist end to influence-sc ifelse role != "coordinator" ;; this is questionable, look-up in König necessary [ set influencesc 0 ] [ set influencesc resultsaturationsc] end ;; ;;plotting Procedures ;; to my-update-plots let time (list) set-current-plot "Population" set-current-plot-pen "coordinators" plotxy ticks count turtles with [ role = "coordinator" ] set-current-plot-pen "subordinated" plotxy ticks count turtles with [ role = "subordinate" ] set-current-plot-pen "isolated" plotxy ticks count turtles with [ role = "autonomous" ] set-current-plot "food" plotxy ticks totalfood set-current-plot "Whole population" plotxy ticks count turtles set-current-plot "Average food per agent" if any? turtles [ plotxy ticks totalfood / count turtles ] set-current-plot "Average duration of sublinks" if any? turtles [ plotxy ticks mean [duration-sublinks] of turtles ] set-current-plot "Phase diagram" ifelse ticks < 5 [ plot-pen-up ][ plot-pen-down ] plotxy count turtles totalfood end ;; ;; Utilities ;; to set-role [ new-role ] ifelse role = "coordinator" [ set coordi-account coordi-account - 1 ] [ ifelse role = "subordinate" [ set subord-account subord-account - 1 ] [ set normal-account normal-account - 1 ] ] ifelse new-role = "coordinator" [ set shape "triangle" set coordi-account coordi-account + 1 ] [ ifelse new-role = "subordinate" [ set shape "top-down-triangle" set subord-account subord-account + 1 ] [ set shape "circle" set normal-account normal-account + 1 ] ] set role new-role end to-report random-float-in-range [ low high ] report low + random-float ( high - low ) end ;; ;; Visualization Procedures ;; to no-visualization ;; turtle procedure set color red end to color-agents-by-metabolism ;; turtle procedure set color red + (metabolism - 2.5) end ;; ;; Output procedures ;; to-report rectify-date let date-string date-and-time let colon position ":" date-string set date-string replace-item colon date-string "-" set colon position ":" date-string set date-string replace-item colon date-string "-" set colon position "." date-string set date-string replace-item colon date-string "-" let year substring date-string 23 27 let month substring date-string 19 22 let day substring date-string 16 18 let AMPM substring date-string 13 15 let hour substring date-string 0 2 let minsec substring date-string 2 12 let month-number ( 1 + ( position month ( list "Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov" "Dec" ) ) ) ifelse month-number < 10 [ set month ( word "0" month-number ) ] [ set month ( word month-number ) ] let num-hour read-from-string hour if AMPM = "PM" [ set hour ( word ( num-hour + 12 ) ) ] set date-string ( word year "-" month "-" day " " hour minsec ) report date-string end @#$#@#$#@ GRAPHICS-WINDOW 315 15 1125 646 -1 -1 10.0 1 10 1 1 1 0 1 1 1 0 79 0 59 1 1 1 ticks 30.0 BUTTON 10 20 90 60 NIL setup NIL 1 T OBSERVER NIL NIL NIL NIL 1 BUTTON 100 20 190 60 NIL go T 1 T OBSERVER NIL NIL NIL NIL 1 BUTTON 200 20 290 60 go once go NIL 1 T OBSERVER NIL NIL NIL NIL 1 CHOOSER 315 650 595 695 visualization visualization "no-visualization" "color-agents-by-metabolism" 1 PLOT 1135 10 1450 195 Population NIL NIL 0.0 10.0 0.0 10.0 true true "" "" PENS "coordinators" 1.0 0 -5825686 true "" "" "subordinated" 1.0 0 -1184463 true "" "" "isolated" 1.0 0 -13345367 true "" "" SLIDER 5 125 175 158 initial-population initial-population 1 300 150 50 1 NIL HORIZONTAL SWITCH 5 590 137 623 show-pfood? show-pfood? 1 1 -1000 SWITCH 5 625 135 658 show-food? show-food? 1 1 -1000 TEXTBOX 20 575 80 593 World 11 0.0 1 SWITCH 180 440 315 473 die-of-old-age? die-of-old-age? 0 1 -1000 SWITCH 140 590 275 623 random-seed? random-seed? 1 1 -1000 SLIDER 180 160 315 193 initial-food initial-food 1 100 25 25 1 NIL HORIZONTAL TEXTBOX 20 100 170 118 Turtle parameters: 11 0.0 1 SWITCH 140 625 275 658 enable-hierachy? enable-hierachy? 0 1 -1000 SLIDER 5 195 175 228 puberty-age puberty-age 1 50 10 1 1 NIL HORIZONTAL SLIDER 5 230 175 263 max-children max-children 1 100 100 1 1 NIL HORIZONTAL TEXTBOX 25 480 175 498 Patch parameters: 11 0.0 1 SLIDER 5 500 180 533 patch-fertile-percentage patch-fertile-percentage 0 100 100 1 1 % HORIZONTAL SLIDER 5 535 180 568 food-regrow food-regrow 0 1 0.125 0.025 1 NIL HORIZONTAL PLOT 1135 195 1370 350 Food NIL NIL 0.0 10.0 0.0 10.0 true false "" "" PENS "default" 1.0 0 -16777216 true "" "" PLOT 1375 195 1610 350 Average duration of sublinks NIL NIL 0.0 10.0 0.0 10.0 true false "" "" PENS "default" 1.0 0 -16777216 true "" "" PLOT 1135 350 1370 500 Whole population NIL NIL 0.0 10.0 0.0 10.0 true false "" "" PENS "default" 1.0 0 -16777216 true "" "" PLOT 1375 350 1695 650 Phase diagram NIL NIL 0.0 10.0 0.0 10.0 true false "" "" PENS "default" 1.0 0 -7500403 true "" "" PLOT 1135 500 1370 650 Average food per agent NIL NIL 0.0 10.0 0.0 10.0 true false "" "" PENS "default" 1.0 0 -16777216 true "" "" PLOT 1460 10 1660 160 Histogram of actions taken NIL NIL 0.0 8.0 0.0 10.0 true false "set-plot-pen-mode 1\nset-histogram-num-bars 8" "" PENS "default" 1.0 0 -16777216 true "" "histogram [ action-taken ] of turtles" MONITOR 1400 655 1532 700 Population distribution ( list coordi-account subord-account normal-account ( coordi-account + subord-account + normal-account )) 0 1 11 MONITOR 1535 655 1695 700 Current balance coord/subord list ( count turtles with [ action-taken = 3 ] - count turtles with [ action-taken = 4 ] ) ( count turtles with [ action-taken = 5 ] - count turtles with [ action-taken = 6 ] ) 17 1 11 SLIDER 180 125 315 158 avwealth avwealth 0 100 50 25 1 NIL HORIZONTAL SLIDER 5 160 175 193 birthrecreationfactor birthrecreationfactor 0.8 1 0.999 0.001 1 NIL HORIZONTAL SLIDER 180 265 315 298 breed-weight breed-weight 0 1 0.1 0.1 1 NIL HORIZONTAL SLIDER 180 195 315 228 survival-weight survival-weight 0 1 0.5 0.1 1 NIL HORIZONTAL SLIDER 180 230 315 263 wealth-weight wealth-weight 0 1 0.1 0.1 1 NIL HORIZONTAL SLIDER 180 300 315 333 influence-weight influence-weight 0 1 0.2 0.1 1 NIL HORIZONTAL SLIDER 180 335 315 368 curiosity-weight curiosity-weight 0 1 0.1 0.1 1 NIL HORIZONTAL SLIDER 180 370 315 403 food-weight food-weight 0 1 0.1 0.1 1 NIL HORIZONTAL SLIDER 5 335 175 368 coordinator-malus coordinator-malus 0 1 0.1 0.1 1 NIL HORIZONTAL SLIDER 5 370 175 403 end-coordinating-malus end-coordinating-malus 0 1 0.5 0.1 1 NIL HORIZONTAL SLIDER 5 265 175 298 coordinator-bonus-strength coordinator-bonus-strength 0 1 0.5 0.1 1 NIL HORIZONTAL SLIDER 5 300 175 333 avsubs avsubs 0 20 10 1 1 NIL HORIZONTAL SLIDER 180 405 315 438 memory-lifetime memory-lifetime 0 40 40 10 1 NIL HORIZONTAL SLIDER 5 405 175 438 subordCoordValuesInfluence subordCoordValuesInfluence 0 20 20 1 1 NIL HORIZONTAL SLIDER 5 440 175 473 unsubordCoordValuesInfluence unsubordCoordValuesInfluence 0 20 10 1 1 NIL HORIZONTAL MONITOR 625 650 722 695 Agents max at: list agents-max precision food-for-agents-max 1 17 1 11 MONITOR 730 650 817 695 Food max at: list agents-for-food-max precision food-max 1 17 1 11 MONITOR 820 650 912 695 Agents min at: list agents-min precision food-for-agents-min 1 17 1 11 MONITOR 915 650 1005 695 Food min at: list agents-for-food-min precision food-min 1 17 1 11 PLOT 1495 185 1695 335 Histogram of overall satisfactions NIL NIL -2.0 2.0 0.0 10.0 true false "set-plot-pen-mode 1\nset-histogram-num-bars 10" "" PENS "default" 1.0 0 -16777216 true "" "histogram [ ln sum-sats ] of turtles" SWITCH 5 660 157 693 export-interface? export-interface? 1 1 -1000 @#$#@#$#@ ## ## WHAT IS IT? Much like Epstein & Axtell's Sugarscape, this virtual world is populated with agents which move around on a grid on whose patches food grows and grows back constantly, and over-harvested patches can regrow when seed floats in from neighbouring patches. Agents harvest and either eat or add the harvested food to their "wealth". Agents have a limited lifetime, and they can die from starving. Besides they reproduce. All of these actions satisfy their needs of survival, wealth, reproduction and information. Moreover they have a need of being influential which is an incentive to co-ordinate other agents. Co-ordination means that co-ordinating agents collect information from their (volunteer) subordinates and forward this information back to all their current subordinates which gives both co-ordinators and subordinates a wider range of vision such that their chance to move to more promising patches increases. The decision to co-ordinate, subordinate, end co-ordinating or end subordinating and all other decisions (to eat, to harvest, to move, to reproduce) depend on the expected utility of the respective action which in turn is calculated as a weighted sum of degrees of satisfaction of the needs mentioned above. The decision is probabilistic, such that the action with the least utility is never taken whereas the other actions are taken with a probability proportional to the expected utility. ## ## HOW IT WORKS Each patch contains some food, the maximum amount of which is predetermined. At each tick, the food on each patch grows at a fixed rate, until it reaches the maximum amount. The amount of food a patch currently contains is indicated by its color; the darker the green, the more food. At setup, agents are placed at random within the world. Each agent can only see a certain square neighbourhood around itself which it copies into its memory. When moving, the memory is updated, and older information is forgotten after some time, apart from the fact that it becomes obsolete when other agents harvest or move around in the part of the world which is still remembered but not visible any longer. At each tick, each agent can decide to move to the nearest unoccupied location within their vision range with the most food, and collect all or part of the food there, or it decides to take one of the other possible actions, depending their respective utilities. Agents also eat as much food as they need in each tick, based on their metabolism rates. If an agent runs out of food, it dies. If an agents has decided to subordinate to an agent which has signalised that it feels fit to co-ordinate other agents, it reports its memory to the co-ordinator, receives the content of the memory of the latter and gives part of its wealth to the co-ordinator. ## ## HOW TO USE IT Set the INITIAL-POPULATION slider before pressing SETUP. This determines the number of agents in the world. Press SETUP to populate the world with agents. GO will run the simulation continuously, while GO ONCE will run one tick. The VISUALIZATION chooser gives different visualization options and may be changed while the GO button is pressed. When NO-VISUALIZATION is selected all the agents will be red. When COLOR-AGENTS-BY-METABOLISM is selected the agents with the lowest metabolism will be darkest. The four plots show the world population over time including the numbers of agents who are currently co-ordinators, subordinates and autonomous, the average food per agent, the average duration of subordination relations and the phase diagram of amount of food and number of agents. ## ## THINGS TO NOTICE Usually there is no stable population size and no stable worldwide food amount. Rather these two output parameters oscillate with an decreasing amplitude in a generalised Lotka-Volterra manner. Under certain input parameter combinations agents will die out when the carrying capacity is exceeded or when the remaining food cannot be reached early enough by the remaining agents. ## ## THINGS TO TRY To which extent does the sustainability of the model depend on the feature that agents can co-ordinate and subordinate, respectively? Switch "enable hierarchy" off and see what happens. ## ## EXTENDING THE MODEL ## ## NETLOGO FEATURES ## ## RELATED MODELS This model uses a small part of the code of: - Li, J. and Wilensky, U. (2009). NetLogo Sugarscape 2 Constant Growback model. http://ccl.northwestern.edu/netlogo/models/Sugarscape2ConstantGrowback. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL. and the NetLogo software: - Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL. ## ## CREDITS AND REFERENCES Epstein, J. and Axtell, R. (1996). Growing Artificial Societies: Social Science from the Bottom Up. Washington, D.C.: Brookings Institution Press. The original (JAVA) version of this model was first published in: König, A., Möhring, M., & Troitzsch, K. G. (2003). Agents, Hierarchies and Sustainability. In F. Billari, & A. Prskawetz, Agent-Based Computational Demography (S. 197–210). Heidelberg: Physica. DOI: 10.1007/978-3-7908-2715-6_11 The NetLogo replication was first written by Florian Zink in his master thesis (http://kola.opus.hbz-nrw.de/frontdoor.php?source_opus=774&la=de) and finished by Klaus G. Troitzsch for his paper "Analysing Simulation Results Statistically: Does Significance Matter?" in Diana Francisca Adamatti, Graçaliz Pereira Dimuro, Helder Coelho (eds.): Interdisciplinary Applications of Agent-Based Social Simulation and Modeling. Hershey PA (IGI Global) 2014, pp. 85--104, DOI: 10.4018/978-1-4666-5954-4.ch006 ## ## HOW TO CITE Klaus G. Troitzsch 2013: http://ccl.northwestern.edu/netlogo/models/community/CoordinationAndSustainability ## ## COPYRIGHT NOTICE (c) 2013 Klaus G. Troitzsch @#$#@#$#@ 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 top-down-triangle false 0 Polygon -7500403 true true 150 270 285 45 15 45 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.3.1 @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ setup go mean-duration-of-sublinks agents-amplitude agents-max food-for-agents-max agents-min food-for-agents-min food-amplitude food-max agents-for-food-max food-min agents-for-food-min ticks "##" setup go agents-amplitude food-amplitude ticks "##" setup go initial-population food-regrow agents-max agents-min food-max food-min ticks "##" @#$#@#$#@ @#$#@#$#@ 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 @#$#@#$#@ 1 @#$#@#$#@