globals [ ;; MODEL PARAMETERS ticks-per-day patch-yield patch-nectar-handling-time-mean patch-nectar-handling-time-error nest-nectar-handling-time patch-quality-mean patch-quality-error flight-speed cost-joules-flight cost-joules-resting mortality-per-tick joules-per-microl joules-per-mol energy-penalty-recruit ;; MODEL VARIABLES (E.G.: EXPERIMENTAL STATES) day-counter experimental-state ;; MODEL VARIABLES FOR MONITORING daily-trip-returners total-trip-returners total-scout-returners total-forager-returners nest-energy daily-nest-energy nest-energy-scouts nest-energy-foragers daily-nest-energy-scouts daily-nest-energy-foragers daily-recruits foraging-distances forager-persistencies daily-prob-dancing-scouts daily-prob-dancing-foragers my-new-seed persistency-file ] patches-own [ patch-type patch-quality patch-age ] ;; Scouts breed [ idle-scouts idle-scout ] breed [ scouts scout ] breed [ loading-scouts loading-scout ] breed [ returning-scouts returning-scout ] breed [ returned-scouts returned-scout ] breed [ disappointed-returning-scouts disappointed-returning-scout ] ;; Foragers breed [ idle-foragers idle-forager ] breed [ idle-dancefloor-foragers idle-dancefloor-forager ] breed [ foragers forager ] breed [ loading-foragers loading-forager ] breed [ returning-foragers returning-forager ] breed [ returned-foragers returned-forager ] breed [ scouting-foragers scouting-forager ] breed [ disappointed-returning-foragers disappointed-returning-forager ] turtles-own [ energy ; turtles own energy, which they will use in-flight, and when resting, this is basically the amount of nectar-load in joules visited-food-patch ; the patch visited in previous round previously-visited-food-patch ; the food patch visited prior to the current one quality-visited-food-patch ; what molarity does the patch have distance-visited-food-patch ; what is the distance of the food patch from the nest learnt-food-patch ; taught by some other scout or forager moved-this-tick ; already moved this tick? flight-timer ; how long in-flight? loading-timer ; food handling time at food patch current-nectar-handling-time ; nectar-load ; how much food taken unloading-timer ; food handling time when unloading in nest; this could be probably 0 flight-length ; for levi flight levy-mu ; mu for levi flight daily-trip-counter ; how many trips were made on a day daily-energy-counter ; how much energy was collected on a day energy-per-trip ; daily-energy-counter / daily-trip-counter days-persistent-counter ; count how many days in a row an agent has visited the same patch patch-persistencies ; to store each of the patch persistencies ] to setup clear-all ifelse use-random-seed [ random-seed current-random-seed ][ set my-new-seed new-seed random-seed my-new-seed ] ;; SET MODEL PARAMS set ticks-per-day 8640 set experimental-state initial-non-switch-state ; set patch-yield 50 ; Nuñez 1966 set patch-nectar-handling-time-mean 180 set patch-nectar-handling-time-error 60 set nest-nectar-handling-time 6 set patch-quality-mean patch-mean-mol set patch-quality-error patch-mean-mol / 5 set flight-speed .7 ; corresponds to 0.07 km set cost-joules-resting 0.04861 ; 6.25 J / km, flight speed is 0.07km per tick, so per tick 0.07 * 6.25 J / 9 is the resting metabolism set cost-joules-flight cost-joules-resting * 9 set mortality-per-tick 0.000007 set joules-per-microl 5.819 set joules-per-mol 5645000 ; from http://books.google.co.uk/books?id=FRfcVwFr17IC&pg=PA282&lpg=PA282&dq=sucrose+joules+per+gram&source=bl&ots=PnsvJxMh2U&sig=Jz4WsIJiFkhX4VCd9gaRquV0urY&hl=de&sa=X&ei=iEMiUL7YHaGS0QXB84CQDA&ved=0CGkQ6AEwBDge#v=onepage&q=sucrose%20joules%20per%20gram&f=false set energy-penalty-recruit 325 ;; RESET COUNTERS set day-counter 0 set daily-trip-returners 0 set total-trip-returners 0 set total-scout-returners 0 set total-forager-returners 0 set nest-energy 0 set nest-energy-scouts 0 set daily-nest-energy-scouts 0 set nest-energy-foragers 0 set daily-nest-energy-foragers 0 set daily-nest-energy 0 set forager-persistencies [ ] set daily-prob-dancing-scouts [ ] set daily-prob-dancing-foragers [ ] ;; SETUP PATCHES AND TURTLES setup-patches set-default-shape turtles "bee" ; maybe you have to do Tools->Turtle Shapes Editor->Import From Library to get the bee. setup-turtles set persistency-file (word "persistencies_" (word my-new-seed) ".txt") file-open persistency-file file-print (word "id, " "days.persistent, " "day") file-close end to setup-patches ask patches [ set patch-type "blank" ] ask patches with [ distancexy 0 0 > distance-food ] [ if random 10000 / 10000 < density-food [ set patch-type "forage" set patch-quality random-normal patch-quality-mean patch-quality-error set pcolor scale-color red patch-quality 0 3 set patch-age -1 if patch-max-age > 0 [ set patch-age (one-of n-values (patch-max-age + 1) [?]) ] ] ] set-current-plot "Patch age" set-current-plot-pen "default" histogram [ patch-age ] of patches with [ patch-type = "forage" ] ask patches with [ pxcor = 0 and pycor = 0 ] [ set patch-type "nest" ; the nest, or hive patch set pcolor white ] end to setup-turtles create-idle-dancefloor-foragers initial-recruits ask idle-dancefloor-foragers [ set color white ] create-idle-scouts initial-scouts ask idle-scouts [ set color yellow ] ask turtles [ set energy 0 set flight-length 0 set levy-mu slider-levy-mu ; 2.4 should be the default (Reynolds et al) set nectar-load 0 set daily-trip-counter 0 set daily-energy-counter 0 set energy-per-trip 0 set days-persistent-counter 0 set patch-persistencies [] ] if pen-down-scout [ let pen-turtle one-of idle-scouts if ( pen-turtle != nobody )[ ask pen-turtle [ set color blue set pen-mode "down" ] ] ] if pen-down-forager [ let pen-turtle one-of idle-dancefloor-foragers if ( pen-turtle != nobody ) [ ask pen-turtle [ set color green set pen-mode "down" ] ] ] end to go if(day-counter - initial-non-switch-phase = 0 and ticks mod ticks-per-day = 0)[ set experimental-state initial-experimental-state ] if (day-counter - initial-non-switch-phase) mod experimental-time-frame-size = 0 and ticks mod ticks-per-day = 0 and switch-experimental-states and day-counter > initial-non-switch-phase [ ifelse experimental-state = "scouting" [ set experimental-state "dancing" ][ set experimental-state "scouting" ] ] ask turtles [ set moved-this-tick false ] ask idle-scouts with [ moved-this-tick = false ] [ set energy energy - cost-joules-resting set moved-this-tick true if ((random 1000)) / 1000 < exit-prob and flight-time [ set flight-timer 0 set breed scouts ] ] ask scouts with [ moved-this-tick = false ] [ set moved-this-tick true set flight-timer flight-timer + 1 move-levy-flight if [ patch-type ] of patch-here = "forage" and patch-discovery-chance > (random 1000 / 1000) [ set visited-food-patch patch-here set quality-visited-food-patch [ patch-quality ] of patch-here set distance-visited-food-patch [ distancexy 0 0 ] of patch-here set loading-timer 0 set breed loading-scouts set current-nectar-handling-time random-normal patch-nectar-handling-time-mean patch-nectar-handling-time-error ] if not flight-time [ set breed disappointed-returning-scouts ] ] ask loading-scouts with [ moved-this-tick = false ] [ set energy energy - cost-joules-resting set moved-this-tick true set flight-timer flight-timer + 1 set loading-timer loading-timer + 1 if loading-timer > current-nectar-handling-time [ set nectar-load nectar-load + patch-yield set breed returning-scouts ] ] ask returning-scouts with [ moved-this-tick = false ] [ set moved-this-tick true set flight-timer flight-timer + 1 facexy 0 0 set energy energy - cost-joules-flight fd flight-speed if [ patch-type ] of patch-here = "nest" [ set unloading-timer 0 set breed returned-scouts ] ] ask returned-scouts with [ moved-this-tick = false ] [ set energy energy - cost-joules-resting set moved-this-tick true set unloading-timer unloading-timer + 1 let taught-patch visited-food-patch let quality-taught-patch quality-visited-food-patch let distance-taught-patch distance-visited-food-patch if unloading-timer > nest-nectar-handling-time [ let probability-dance-yes dance-response quality-taught-patch distance-taught-patch ; distance here is in patches, will be in km later set probability-dance-yes probability-dance-yes * dance-response-influx (count returned-scouts + count returned-foragers) set daily-prob-dancing-scouts sentence daily-prob-dancing-scouts probability-dance-yes if (probability-dance-yes > (random 1000000) / 1000000) [ let max-num-recruits count idle-dancefloor-foragers-here let current-num-recruits 0 ifelse max-num-recruits < num-recruits-per-dance [ set current-num-recruits max-num-recruits ][ set current-num-recruits num-recruits-per-dance ] let recruits n-of current-num-recruits idle-dancefloor-foragers-here if ( recruits != nobody ) and flight-time [ set daily-recruits daily-recruits + count recruits ask recruits [ let proportion-dance-success 0 ifelse experimental-state = "scouting" [ set proportion-dance-success 1 ][ set proportion-dance-success prop-dance-success ] if proportion-dance-success > random 1000 / 1000 [ set moved-this-tick true set learnt-food-patch taught-patch set flight-timer 0 ifelse experimental-state = "scouting" [ set breed scouting-foragers ][ set energy energy - energy-penalty-recruit set breed foragers ] ] ] ] ] let energy-returned energy + joules-from-nectar nectar-load quality-visited-food-patch set daily-energy-counter daily-energy-counter + energy-returned set daily-trip-counter daily-trip-counter + 1 count-trip count-scout-trip energy-returned set nest-energy nest-energy + energy-returned set daily-nest-energy daily-nest-energy + energy-returned set energy 0 set nectar-load 0 ifelse flight-time [ set breed scouts ][ set breed idle-scouts ] ] ] ask disappointed-returning-scouts with [ moved-this-tick = false ] [ set flight-timer flight-timer + 1 facexy 0 0 fd flight-speed set energy energy - cost-joules-flight if [ patch-type ] of patch-here = "nest" [ let energy-returned energy + joules-from-nectar nectar-load quality-visited-food-patch set nest-energy nest-energy + energy-returned set daily-nest-energy daily-nest-energy + energy-returned set energy 0 set nectar-load 0 set breed idle-scouts ] ] ask idle-dancefloor-foragers with [ moved-this-tick = false ][ set energy energy - cost-joules-resting set moved-this-tick true if ((random 1000000)) / 1000000 < exit-prob-idle-dancefloor-foragers and flight-time [ set flight-timer 0 set breed scouting-foragers ] ] ask idle-foragers with [ moved-this-tick = false ] [ set energy energy - cost-joules-resting set moved-this-tick true if ((random 1000)) / 1000 < exit-prob and flight-time [ set flight-timer 0 set breed foragers ] ] ask foragers with [ moved-this-tick = false ] [ ; there got to be a more elegant way to do this set moved-this-tick true set flight-timer flight-timer + 1 let xTemp [ pxcor ] of learnt-food-patch let yTemp [ pycor ] of learnt-food-patch facexy xTemp yTemp forward flight-speed set energy energy - cost-joules-flight if patch-here = learnt-food-patch [ ifelse [ patch-type ] of patch-here = "forage" [ set previously-visited-food-patch visited-food-patch set visited-food-patch patch-here set quality-visited-food-patch [ patch-quality ] of patch-here set distance-visited-food-patch [ distancexy 0 0 ] of patch-here set loading-timer 0 set breed loading-foragers set current-nectar-handling-time random-normal patch-nectar-handling-time-mean patch-nectar-handling-time-error ] [ set breed disappointed-returning-foragers ; changed from set breed scouting-foragers ; do foragers that don't find the source return to hive or scout? set patch-persistencies sentence patch-persistencies days-persistent-counter set days-persistent-counter 0 ] ] ] ask scouting-foragers [ set moved-this-tick true set flight-timer flight-timer + 1 move-levy-flight if [ patch-type ] of patch-here = "forage" and patch-discovery-chance > (random 1000 / 1000) [ set previously-visited-food-patch visited-food-patch set visited-food-patch patch-here set quality-visited-food-patch [ patch-quality ] of patch-here set distance-visited-food-patch [ distancexy 0 0 ] of patch-here set loading-timer 0 set breed loading-foragers set current-nectar-handling-time random-normal patch-nectar-handling-time-mean patch-nectar-handling-time-error ] if not flight-time [ set breed disappointed-returning-foragers ] ] ask loading-foragers with [ moved-this-tick = false ] [ set energy energy - cost-joules-resting set moved-this-tick true set flight-timer flight-timer + 1 set loading-timer loading-timer + 1 if loading-timer > current-nectar-handling-time [ set nectar-load nectar-load + patch-yield ; [ patch-quality ] of patch-here set breed returning-foragers ] ] ask returning-foragers with [ moved-this-tick = false ] [ set moved-this-tick true set flight-timer flight-timer + 1 facexy 0 0 fd flight-speed set energy energy - cost-joules-flight if [ patch-type ] of patch-here = "nest" [ set unloading-timer 0 set breed returned-foragers ] ] ask returned-foragers with [ moved-this-tick = false ] [ set energy energy - cost-joules-resting set moved-this-tick true set unloading-timer unloading-timer + 1 let taught-patch visited-food-patch let quality-taught-patch quality-visited-food-patch let distance-taught-patch distance-visited-food-patch if unloading-timer > nest-nectar-handling-time [ let probability-dance-yes dance-response quality-taught-patch distance-taught-patch ; distance here is in patches, will be in km later set probability-dance-yes probability-dance-yes * dance-response-influx (count returned-scouts + count returned-foragers) set daily-prob-dancing-foragers sentence daily-prob-dancing-foragers probability-dance-yes if (probability-dance-yes > (random 1000000) / 1000000) [ let max-num-recruits count idle-dancefloor-foragers-here let current-num-recruits 0 ifelse max-num-recruits < num-recruits-per-dance [ set current-num-recruits max-num-recruits ][ set current-num-recruits num-recruits-per-dance ] let recruits n-of current-num-recruits idle-dancefloor-foragers-here if ( recruits != nobody ) and flight-time [ set daily-recruits daily-recruits + count recruits ask recruits [ let proportion-dance-success 0 ifelse experimental-state = "scouting" [ set proportion-dance-success 1 ][ set proportion-dance-success prop-dance-success ] if proportion-dance-success > random 1000 / 1000 [ set moved-this-tick true set learnt-food-patch taught-patch ifelse experimental-state = "scouting" [ set breed scouting-foragers ][ set energy energy - energy-penalty-recruit set breed foragers ] ] ] ] ] let energy-returned energy + joules-from-nectar nectar-load quality-visited-food-patch set daily-energy-counter daily-energy-counter + energy-returned set daily-trip-counter daily-trip-counter + 1 count-trip count-forager-trip energy-returned set nest-energy nest-energy + energy-returned set daily-nest-energy daily-nest-energy + energy-returned set energy 0 set nectar-load 0 set learnt-food-patch visited-food-patch set breed idle-foragers ] ] ask disappointed-returning-foragers with [ moved-this-tick = false ] [ set flight-timer flight-timer + 1 facexy 0 0 fd flight-speed set energy energy - cost-joules-flight if [ patch-type ] of patch-here = "nest" [ let energy-returned energy + joules-from-nectar nectar-load quality-visited-food-patch set nest-energy nest-energy + energy-returned set daily-nest-energy daily-nest-energy + energy-returned set energy 0 set nectar-load 0 set breed idle-dancefloor-foragers ] ] ask turtles [ turn-wiggle ifelse daily-trip-counter > 0 [ set energy-per-trip daily-energy-counter / daily-trip-counter ][ set energy-per-trip 0 ] if random 1000000 / 1000000 < mortality-per-tick [ set patch-persistencies sentence patch-persistencies days-persistent-counter let file-written write-persistencies-to-file self ; set forager-persistencies sentence forager-persistencies mean patch-persistencies set forager-persistencies sentence forager-persistencies patch-persistencies hatch 1 [ set xcor 0 set ycor 0 set visited-food-patch patch 0 0 set previously-visited-food-patch patch 0 0 set quality-visited-food-patch 0 set distance-visited-food-patch 0 set learnt-food-patch patch 0 0 set moved-this-tick true set flight-timer 0 set loading-timer 0 set current-nectar-handling-time 0 set nectar-load 0 set unloading-timer 0 set flight-length 0 set levy-mu slider-levy-mu set daily-trip-counter 0 set daily-energy-counter 0 set energy-per-trip 0 set days-persistent-counter 0 set patch-persistencies [] ] die ] ] if ticks mod ticks-per-day = 0 and day-counter = 51 [ ; = 8640 ticks ask turtles [ let file-written write-persistencies-to-file self ;; show (word file-written) ] ] if ticks mod ticks-per-day = 0 [ ; = 8640 ticks ; reset the daily counters set daily-recruits 0 set daily-trip-returners 0 set daily-nest-energy 0 set daily-nest-energy-scouts 0 set daily-nest-energy-foragers 0 set daily-prob-dancing-scouts [ ] set daily-prob-dancing-foragers [ ] set foraging-distances [ ] set day-counter day-counter + 1 ask turtles [ set daily-energy-counter 0 set daily-trip-counter 0 ] ; do patches stay food or become food sources? ask patches with [ patch-type = "forage" and distancexy 0 0 > distance-food ] [ set patch-age patch-age + 1 if patch-age > patch-max-age [ set patch-type "blank" set patch-quality 0 set patch-age 0 set pcolor black ask one-of patches with [ patch-type = "blank" and distancexy 0 0 > distance-food ] [ set patch-type "forage" set patch-quality random-normal patch-quality-mean patch-quality-error set pcolor scale-color red patch-quality 0 3 ] ] ] ask idle-foragers [ let probability-abandon-current-patch probability-abandoning quality-visited-food-patch distance-visited-food-patch ifelse probability-abandon-current-patch > random 1000000 / 1000000 or not persistency [ set breed idle-dancefloor-foragers set patch-persistencies sentence patch-persistencies days-persistent-counter set days-persistent-counter 0 ][ set days-persistent-counter days-persistent-counter + 1 ] ] ] ; get the foraging distances of the returned foragers let new-foraging-distances [( distancexy [ pxcor ] of visited-food-patch [ pycor ] of visited-food-patch) * 0.1 ] of returned-foragers if not empty? new-foraging-distances [ set foraging-distances sentence new-foraging-distances foraging-distances ] tick do-plotting end ;; http://groups.yahoo.com/group/netlogo-users/message/10534 ;; following Viswanathan et al. Nature 1999 to move-levy-flight set energy energy - cost-joules-flight if flight-length <= 0 [ rt random 360 set flight-length levy levy-mu ] ifelse flight-length < flight-speed [ fd flight-length set flight-length 0 ][ fd flight-speed set flight-length flight-length - flight-speed ] end to-report levy [ p-mu ] let result 0 ifelse p-mu <= 1 [ set result random-float 100000000000 ][ ifelse p-mu >= 3 [ set result abs random-normal 5 1;0 1 ][ let a random-float 1 set result exp ( ln (a) * (1 / 1 - p-mu)) ; this might need to be changed according to Reynolds. Mu should be alright now. ] ] report result end to turn-wiggle right random 40 left random 40 end to count-trip set daily-trip-returners daily-trip-returners + 1 set total-trip-returners total-trip-returners + 1 end to count-scout-trip [ p-joules ] set total-scout-returners total-scout-returners + 1 set nest-energy-scouts nest-energy-scouts + p-joules set daily-nest-energy-scouts daily-nest-energy-scouts + p-joules end to count-forager-trip [ p-joules ] set total-forager-returners total-forager-returners + 1 set nest-energy-foragers nest-energy-foragers + p-joules set daily-nest-energy-foragers daily-nest-energy-foragers + p-joules end to-report flight-time let result false if ( sin ((2 * pi * ticks / ticks-per-day) * (180 / pi )) ) > 0.1 [ set result true ] report result end to-report num-scouts let result 0 set result count idle-scouts + count scouts + count loading-scouts + count returning-scouts + count returned-scouts + count disappointed-returning-scouts report result end ; All dance and abandoning thresholds based on data from Bosch and Seeley to-report dance-response [ pMol pDistance ] let result 0 let deval-mol pMol + 1.02 - distance-factor pDistance if deval-mol <= 0.00001 [ set deval-mol 0.00001 ] set result 0.956937 / (1 + exp ((0.2721966 - ln deval-mol) / 0.2624014)) report result end ; have to re-calculate from distance in patches to distance in km ; should be distance in km, but this does only work for distances under 80 km to-report distance-factor [ pDistance ] let result 0 let tempDist pDistance * 100 set result 0.04915919 - 0.00002851457 * tempDist + 0.00000003174098 * (tempDist * tempDist) report result end ; compute the probability of dance depending on the influx of bees to-report dance-response-influx [ pInflux ] let result 0 ifelse influx-size-dependent [ ifelse pInflux <= 20 [ set result 1 - 0.035 * pInflux ][ set result 0.3 ] ][ let colony-size (initial-scouts + initial-recruits) let influx-growth-rate (100 / colony-size) let influx-limit 0.3 set result ((1 - influx-limit) * exp (influx-growth-rate * (- pInflux + colony-size / 30)) / ((1 - influx-limit) + exp (influx-growth-rate * (- pInflux + colony-size / 30)))) + influx-limit ] report result end to-report probability-abandoning [ pMol pDistance ] let result 0 let deval-mol pMol + 1.02 - distance-factor pDistance if deval-mol <= 0.00001 [ set deval-mol 0.00001 ] set result (1 - (0.956937 / (1 + exp ((0.2721966 - ln (deval-mol + 0.6687)) / 0.2624014)))) report result end ; provide volume in microlitre and the molarity to-report joules-from-nectar [ pVolume pMolarity ] let reslt 0 let volume-litre pVolume / 1000000 let mol-sugar volume-litre * pMolarity set reslt mol-sugar * joules-per-mol report reslt end to-report num-foragers let result 0 set result count idle-dancefloor-foragers + count idle-foragers + count foragers + count loading-foragers + count returning-foragers + count returned-foragers + count scouting-foragers + count disappointed-returning-foragers report result end to-report get-median-foraging-distance let result 0 if is-list? foraging-distances [ set result median foraging-distances ] report result end to-report get-mean-scout-yield let result 0 if count idle-scouts > 0 [ set result mean [ energy-per-trip ] of idle-scouts ] report result end to-report get-mean-forager-yield let result 0 let current-idle-foragers (turtle-set idle-foragers idle-dancefloor-foragers) if count current-idle-foragers > 0 [ set result mean [ energy-per-trip ] of current-idle-foragers ] report result end to-report get-mean-scout-dance-prob let result 0 if not empty? daily-prob-dancing-scouts [ set result mean daily-prob-dancing-scouts ] report result end to-report get-mean-forager-dance-prob let result 0 if not empty? daily-prob-dancing-foragers [ set result mean daily-prob-dancing-foragers ] report result end to-report get-mean-forager-persistencies let result 0 if not empty? forager-persistencies [ set result mean forager-persistencies ] report result end to-report write-persistencies-to-file [ which-turtle ] let result 0 file-open persistency-file ask which-turtle [ foreach patch-persistencies [ file-print (word who ", " ? ", " day-counter) ] ] file-close report result end to do-plotting set-current-plot "unloading-agents" let num-unloading-agents count returned-scouts + count returned-foragers set-current-plot-pen "default" plotxy ticks num-unloading-agents if ticks mod ticks-per-day = 0 [ set-current-plot "Daily returned foragers" set-current-plot-pen "default" plotxy day-counter daily-trip-returners set-current-plot "Daily honey gain" set-current-plot-pen "default" plotxy day-counter daily-nest-energy / 12719360 set-current-plot "Patch age" set-current-plot-pen "default" histogram [ patch-age ] of patches with [ patch-type = "forage" ] set-current-plot "Daily Energy Per Forager" set-current-plot-pen "recruit" plotxy ticks get-mean-forager-yield set-current-plot-pen "scout" plotxy ticks get-mean-scout-yield set-current-plot "Persistency" set-current-plot-pen "default" histogram forager-persistencies set-current-plot "Probability of Dances" set-current-plot-pen "scouts" plotxy ticks get-mean-scout-dance-prob set-current-plot-pen "foragers" plotxy ticks get-mean-forager-dance-prob ] set-current-plot "Energy brought in foragers / scouts" let load-foragers-plot 0 if total-forager-returners > 0 [ set load-foragers-plot nest-energy-foragers / total-forager-returners ] let load-scouts-plot 0 if total-scout-returners > 0 [ set load-scouts-plot nest-energy-scouts / total-scout-returners ] let load-total-plot 0 if total-forager-returners > 0 and total-scout-returners > 0 [ set load-total-plot (nest-energy-foragers + nest-energy-scouts) / (total-forager-returners + total-scout-returners); load-foragers-plot + load-scouts-plot ] set-current-plot-pen "foragers" plotxy ticks load-foragers-plot set-current-plot-pen "scouts" plotxy ticks load-scouts-plot set-current-plot-pen "total" plotxy ticks load-total-plot set-current-plot "Energy (kJ) stored in the hive" set-current-plot-pen "default" plotxy ticks nest-energy / 1000 set-current-plot "Foraging distances" set-current-plot-pen "default" histogram foraging-distances end @#$#@#$#@ GRAPHICS-WINDOW 733 68 1145 501 100 100 2.0 1 10 1 1 1 0 0 0 1 -100 100 -100 100 0 0 1 ticks SLIDER 47 32 219 65 initial-scouts initial-scouts 0 500 30 1 1 NIL HORIZONTAL SLIDER 33 684 205 717 density-food density-food 0 0.20 0.05 0.0001 1 NIL HORIZONTAL BUTTON 260 11 323 44 setup setup NIL 1 T OBSERVER NIL S NIL NIL BUTTON 360 10 423 43 go go T 1 T OBSERVER NIL NIL NIL NIL BUTTON 438 10 515 43 Go once go NIL 1 T OBSERVER NIL G NIL NIL SLIDER 44 178 216 211 exit-prob exit-prob 0 1 0.815 0.001 1 NIL HORIZONTAL PLOT 377 59 537 179 unloading-agents ticks no. unloading agents 0.0 10.0 0.0 10.0 true false PENS "default" 1.0 0 -16777216 true SLIDER 33 648 205 681 distance-food distance-food 1 150 1 1 1 NIL HORIZONTAL TEXTBOX 49 14 199 32 Number of agents in the hive 11 0.0 1 TEXTBOX 46 141 248 169 The probability with which idle scouts leave the hive 11 0.0 1 TEXTBOX 42 562 407 665 Parameters regarding the food source:\n- the distance of food from the hive\n- the density of the food (probability that any given patch bears forage)\n- whether food lasts for several days or perishes quickly (1) 11 0.0 1 MONITOR 256 58 370 103 Proportion of scouts num-scouts / (num-scouts + num-foragers) 2 1 11 MONITOR 257 113 372 158 NIL daily-trip-returners 17 1 11 SLIDER 382 504 593 537 experimental-time-frame-size experimental-time-frame-size 0 20 3 1 1 NIL HORIZONTAL MONITOR 257 170 371 215 NIL experimental-state 17 1 11 SLIDER 33 721 205 754 patch-max-age patch-max-age 0 51 1 1 1 NIL HORIZONTAL PLOT 542 62 702 182 Daily returned foragers NIL NIL 0.0 10.0 0.0 10.0 true false PENS "default" 1.0 0 -16777216 true "stores" 1.0 0 -11221820 true SWITCH 803 16 966 49 pen-down-scout pen-down-scout 1 1 -1000 SWITCH 977 17 1141 50 pen-down-forager pen-down-forager 1 1 -1000 MONITOR 734 642 894 687 Energy (kJ) stored in the nest nest-energy / 1000 2 1 11 MONITOR 1176 443 1399 488 Daily accumulation of energy (kJ) in the nest daily-nest-energy / 1000 2 1 11 INPUTBOX 48 485 176 545 initial-experimental-state dancing 1 0 String SWITCH 383 430 588 463 switch-experimental-states switch-experimental-states 0 1 -1000 TEXTBOX 55 386 205 416 can be \"dancing\" or \"scouting\" 11 0.0 1 MONITOR 1179 506 1397 551 mean energy borught back by scouts mean [ energy + joules-from-nectar nectar-load quality-visited-food-patch ] of returned-scouts 2 1 11 MONITOR 1180 559 1409 604 mean energy brought back by foragers mean [ energy + joules-from-nectar nectar-load quality-visited-food-patch ] of returned-foragers 2 1 11 TEXTBOX 52 75 202 93 Number of recruits 11 0.0 1 SLIDER 46 94 218 127 initial-recruits initial-recruits 0 1080 270 1 1 NIL HORIZONTAL MONITOR 1180 610 1261 655 NIL day-counter 0 1 11 SLIDER 197 428 377 461 num-recruits-per-dance num-recruits-per-dance 0 10 1 1 1 NIL HORIZONTAL BUTTON 528 12 623 45 Go one day repeat ticks-per-day [ go ] NIL 1 T OBSERVER NIL NIL NIL NIL SLIDER 198 466 377 499 prop-dance-success prop-dance-success 0 1 0.25 0.01 1 NIL HORIZONTAL PLOT 902 511 1146 631 Energy brought in foragers / scouts NIL NIL 0.0 10.0 0.0 1.0 true true PENS "foragers" 1.0 0 -955883 true "scouts" 1.0 0 -8630108 true "total" 1.0 0 -16777216 true SLIDER 33 799 206 832 patch-discovery-chance patch-discovery-chance 0 1 0.5 0.01 1 NIL HORIZONTAL SLIDER 382 468 562 501 initial-non-switch-phase initial-non-switch-phase 0 20 3 1 1 NIL HORIZONTAL SLIDER 45 303 284 336 exit-prob-idle-dancefloor-foragers exit-prob-idle-dancefloor-foragers 0 0.0001 9.0E-5 0.00001 1 NIL HORIZONTAL TEXTBOX 43 279 392 299 The probability that idle recruits will leave the hive and scout 11 0.0 1 PLOT 734 511 894 631 Energy (kJ) stored in the hive NIL NIL 0.0 10.0 0.0 10.0 true false PENS "default" 1.0 0 -16777216 true MONITOR 903 642 1065 687 ~ Honey (kg) nest-energy / 12719360 3 1 11 INPUTBOX 48 418 176 478 initial-non-switch-state dancing 1 0 String MONITOR 1269 611 1403 656 NIL daily-recruits 17 1 11 PLOT 377 189 701 400 Probability of Dances time prob 0.0 1.0 0.0 1.0 true false PENS "scouts" 0.01 0 -8630108 true "foragers" 1.0 0 -955883 true PLOT 736 692 1145 812 Daily honey gain NIL NIL 0.0 10.0 0.0 0.25 true false PENS "default" 1.0 0 -16777216 true PLOT 215 648 395 768 Patch age NIL NIL 0.0 28.0 0.0 10.0 true false PENS "default" 1.0 1 -16777216 true SLIDER 33 760 205 793 patch-mean-mol patch-mean-mol 0 2.5 1 0.1 1 NIL HORIZONTAL PLOT 1420 502 1620 652 Foraging distances NIL NIL 0.0 10.0 0.0 1.0 true false PENS "default" 0.1 1 -16777216 true SLIDER 44 220 216 253 slider-levy-mu slider-levy-mu 0 4 2.4 0.1 1 NIL HORIZONTAL SWITCH 199 505 375 538 influx-size-dependent influx-size-dependent 1 1 -1000 PLOT 1171 70 1371 220 Daily Energy Per Forager NIL NIL 0.0 10.0 0.0 10.0 true false PENS "recruit" 1.0 0 -955883 true "scout" 1.0 0 -8630108 true MONITOR 1176 231 1325 276 Mean recruit persistency get-mean-forager-persistencies 2 1 11 PLOT 1172 280 1372 430 Persistency NIL NIL 0.0 10.0 0.0 10.0 true false PENS "default" 1.0 1 -16777216 true TEXTBOX 52 357 371 375 Parameters for spatial information transfer (aka dance) 12 0.0 1 INPUTBOX 483 678 638 738 current-random-seed 3770773560223156 1 0 Number SWITCH 482 640 638 673 use-random-seed use-random-seed 1 1 -1000 SWITCH 591 431 719 464 persistency persistency 0 1 -1000 @#$#@#$#@ MODEL FOR SCHÜRCH AND GRÜTER (2014) DANCING BEES IMPROVE COLONY FORAGING SUCCESS AS LONG-TERM BENEFITS OUTWEIGH SHORT-TERM COSTS, PLOS ONE ---------------------------------------------------------------------------------------------------------------------------------------------- The present model is a spatially explicit agent-based simulation model (ABM) of two types of agents in a foraging context, scouts and recruits. We explored how potential long-term effects of spatial communication by means of waggle dances affect honeybee colony success in different environments. We tested how different experimental designs that were used previously to measure empirically the benefits of spatial communication affect foraging success of our virtual colonies in different environments (Please see Schürch and Grüter (2014), PloS ONE for more details). @#$#@#$#@ 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 bee true 0 Polygon -1184463 true false 152 149 77 163 67 195 67 211 74 234 85 252 100 264 116 276 134 286 151 300 167 285 182 278 206 260 220 242 226 218 226 195 222 166 Polygon -16777216 true false 150 149 128 151 114 151 98 145 80 122 80 103 81 83 95 67 117 58 141 54 151 53 177 55 195 66 207 82 211 94 211 116 204 139 189 149 171 152 Polygon -7500403 true true 151 54 119 59 96 60 81 50 78 39 87 25 103 18 115 23 121 13 150 1 180 14 189 23 197 17 210 19 222 30 222 44 212 57 192 58 Polygon -16777216 true false 70 185 74 171 223 172 224 186 Polygon -16777216 true false 67 211 71 226 224 226 225 211 67 211 Polygon -16777216 true false 91 257 106 269 195 269 211 255 Line -1 false 144 100 70 87 Line -1 false 70 87 45 87 Line -1 false 45 86 26 97 Line -1 false 26 96 22 115 Line -1 false 22 115 25 130 Line -1 false 26 131 37 141 Line -1 false 37 141 55 144 Line -1 false 55 143 143 101 Line -1 false 141 100 227 138 Line -1 false 227 138 241 137 Line -1 false 241 137 249 129 Line -1 false 249 129 254 110 Line -1 false 253 108 248 97 Line -1 false 249 95 235 82 Line -1 false 235 82 144 100 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 0 Rectangle -7500403 true true 151 225 180 285 Rectangle -7500403 true true 47 225 75 285 Rectangle -7500403 true true 15 75 210 225 Circle -7500403 true true 135 75 150 Circle -16777216 true false 165 76 116 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 4.1.3 @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ setup repeat ticks-per-day [ go ] nest-energy experimental-state day-counter get-median-foraging-distance get-mean-scout-yield get-mean-forager-yield get-mean-forager-persistencies get-mean-scout-dance-prob get-mean-forager-dance-prob my-new-seed setup repeat ticks-per-day [ go ] nest-energy experimental-state day-counter get-median-foraging-distance get-mean-scout-yield get-mean-forager-yield get-mean-forager-persistencies get-mean-scout-dance-prob get-mean-forager-dance-prob my-new-seed setup repeat ticks-per-day [ go ] nest-energy experimental-state day-counter get-median-foraging-distance get-mean-scout-yield get-mean-forager-yield get-mean-forager-persistencies get-mean-scout-dance-prob get-mean-forager-dance-prob my-new-seed setup repeat ticks-per-day [ go ] nest-energy experimental-state day-counter get-median-foraging-distance get-mean-scout-yield get-mean-forager-yield get-mean-forager-persistencies setup repeat ticks-per-day [ go ] nest-energy experimental-state day-counter get-median-foraging-distance get-mean-scout-yield get-mean-forager-yield get-mean-forager-persistencies setup repeat ticks-per-day [ go ] nest-energy experimental-state day-counter get-median-foraging-distance get-mean-scout-yield get-mean-forager-yield get-mean-forager-persistencies setup repeat ticks-per-day [ go ] nest-energy experimental-state day-counter get-median-foraging-distance get-mean-scout-yield get-mean-forager-yield get-mean-forager-persistencies setup repeat ticks-per-day [ go ] nest-energy experimental-state day-counter get-median-foraging-distance get-mean-scout-yield get-mean-forager-yield get-mean-forager-persistencies setup repeat ticks-per-day [ go ] nest-energy experimental-state day-counter get-median-foraging-distance get-mean-scout-yield get-mean-forager-yield get-mean-forager-persistencies setup repeat ticks-per-day [ go ] nest-energy experimental-state day-counter get-median-foraging-distance get-mean-scout-yield get-mean-forager-yield get-mean-forager-persistencies setup repeat ticks-per-day [ go ] nest-energy experimental-state day-counter get-median-foraging-distance get-mean-scout-yield get-mean-forager-yield get-mean-forager-persistencies setup repeat ticks-per-day [ go ] nest-energy experimental-state day-counter get-median-foraging-distance get-mean-scout-yield get-mean-forager-yield get-mean-forager-persistencies setup repeat ticks-per-day [ go ] nest-energy experimental-state day-counter get-median-foraging-distance get-mean-scout-yield get-mean-forager-yield get-mean-forager-persistencies setup repeat ticks-per-day [ go ] nest-energy experimental-state day-counter get-median-foraging-distance get-mean-scout-yield get-mean-forager-yield get-mean-forager-persistencies setup repeat ticks-per-day [ go ] nest-energy experimental-state day-counter get-median-foraging-distance get-mean-scout-yield get-mean-forager-yield get-mean-forager-persistencies setup repeat ticks-per-day [ go ] nest-energy experimental-state day-counter get-median-foraging-distance get-mean-scout-yield get-mean-forager-yield get-mean-forager-persistencies setup repeat ticks-per-day [ go ] nest-energy experimental-state day-counter get-median-foraging-distance get-mean-scout-yield get-mean-forager-yield get-mean-forager-persistencies setup repeat ticks-per-day [ go ] nest-energy experimental-state day-counter get-median-foraging-distance get-mean-scout-yield get-mean-forager-yield get-mean-forager-persistencies setup repeat ticks-per-day [ go ] nest-energy experimental-state day-counter get-median-foraging-distance get-mean-scout-yield get-mean-forager-yield get-mean-forager-persistencies get-mean-scout-dance-prob get-mean-forager-dance-prob my-new-seed setup repeat ticks-per-day [ go ] nest-energy experimental-state day-counter get-median-foraging-distance get-mean-scout-yield get-mean-forager-yield get-mean-forager-persistencies get-mean-scout-dance-prob get-mean-forager-dance-prob my-new-seed setup repeat ticks-per-day [ go ] nest-energy experimental-state day-counter get-median-foraging-distance get-mean-scout-yield get-mean-forager-yield get-mean-forager-persistencies get-mean-scout-dance-prob get-mean-forager-dance-prob my-new-seed @#$#@#$#@ @#$#@#$#@ default 0.0 -0.2 0 1.0 0.0 0.0 1 1.0 0.0 0.2 0 1.0 0.0 link direction true 0 Line -7500403 true 150 150 90 180 Line -7500403 true 150 150 210 180 @#$#@#$#@ 0 @#$#@#$#@