;the following code was run in Netlogo 5.0.3 to collected the model data presented in the paper. ;Any text in a line following a semicolong (;) is a comment, and is not implemented in the code. ;Netlogo code makes extensive use of "primitives", which are built in functions, usually with an intuitive name ;(e.g. 'pcolor' refers to the color of a patch, 'right' makes an agent turn right by a certain amount of degrees) ;Netlogo code also makes extensive us of 'procedures'. A procedure is defined by beginning with 'to XXX' (where XXX is the name of the procudure) and ending in 'end'. ;If the procedure name is written somewhere, the program runs the code defined by the procedure ;;extensions add functionality to Netlogo. ;;Profiler is used for testing the processor requirements of various parts of the model, and is not used during data collection ;;array allows the use of arrays, as used by the ants when checking whether or not to change their memory extensions [profiler array] ;;The following defines a subset of agents called "ants". These are the main agents in the model/ breed [ants ant] ;;This defines a subset of agents called "feedermakers". ;;They are used during the setup procedure to create the feeders, and during the model to update the state of the feeders. ;;In effect, each 'feedermaker' controls the feeder centered around it. breed [feedermakers feedermaker] ants-own ;;this line defines variables which are used by the 'ant' agents [ state memory memX memY memstrength newfeedermemstrength crowding patience ] feedermakers-own ;;this line defines variables which are used by the 'feedermaker' agents [ feederfull? quality QualityDevidedByDoubleFeederdDistance ] patches-own ;;this line defines variables which are used by the patches, which make up the enviroment. [ patchtype feedernumber refill-rate time-to-refill full? pheromone ] to setup ;this procedure defines what happens when "setup" is called (either by pressing the setup button on the interface tab, or when automatically running the models. Note that it in turn calls two user-defined procedures: setup-agents and setup patches clear-all ;this resets the world to blank state setup-globals ;this defines many of the global variables setup-patches ;this calls the prodecure that makes the word setup-ants ;this calls the procedure that makes the ants reset-ticks ;this resets the tick counter to 0 end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; setup procedure;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to setup-patches ask patches [set patchtype "nothing"] ;defines all patches as having the patchtype "nothing" make-nest ;this calls the prodecure that makes the nest patch make-food ;this calls the prodecure that makes the feeders end to make-nest ask patches [ if distancexy NestXCoordinate NestYCoordinate < 1 [ set pcolor brown set patchtype "nest" ] ;;;makes the patch in the centre of the world brown, and sets its patchtype to "nest" ] end to make-food ;;;random feeders made using the feeder-turtles make-feeder-turtles ;;;this calls the prodecure that makes the feedermakers make-feeders ;;;this calls the prodecure that makes the feedermakers make the feeders end to make-feeder-turtles ;;; this makes random agents of breed feedermaker. These are used to spawn the feeders ifelse random-feeder-locations? ;;;this first option places the feeders randomly in the world, except not overlapping the nest entrance [ create-feedermakers feedercount + 1 [ set xcor random-xcor set ycor random-ycor set size 0.1 set shape "circle" set quality (random feedercount + 1) * 10 set QualityDevidedByDoubleFeederdDistance (FeederDistanceFromNest * 2) / quality ] ;;; a number of feedermakers are created and given random X and Y coordinates. Quality (which will later translate to feeder refill rate, is set randomly, but cannot be higher than the number of feeders +1 ;;; note: an extra one feedermaker is made, as we will remove the feedermaker with the identity (whonumber) 0 ask feedermakers [ if who = 0 [die] ;;; this removes the feedermaker with the identity 0 if distancexy NestXCoordinate NestYCoordinate < 5 [ right random 359 forward random max-pxcor + 5 ] ;;; this make feeders which appear on the nest move themselves away set label round quality; this makes a label on the world view showing the quality value of each feeder. Round rounds the number shown up or down to the nearest integer. ] ] ;;;this second option places feeders in a ring around the nest [ create-feedermakers feedercount + 1 [ set xcor 0 set ycor 0 set size 0.1 set shape "circle" set quality (random feedercount + 1) * 10 set QualityDevidedByDoubleFeederdDistance 150 / quality ] ;;;again feedermakers are made, but this time they are they all appear in the centre of the world ask feedermakers [ if who = 0 [die] facexy 0 1 ;;;all feedermakers face towards the top of the world right (360 / feedercount) * who ;;; each successive feedermaker turns right by a fraction of a full circle equal to the number of feeders jump FeederDistanceFromNest ; each feedermaker moves forward 75 patch widths set label round quality ] ] end to make-feeders ;;;this makes the feedermaker agents make a feeder ask feedermakers [ move-to patch-here ;;makes the feedermaker move to centre of the patch they are occupying let namegiver who ;; make a temporary variable with the identity (who number) of the feedermaker let qualgiver quality ask patches in-radius 3 [ set patchtype "food" set feedernumber namegiver set pcolor (5 + (namegiver * 10) - (namegiver / 5)) ;;I had to make this ugly instead of using a global, since it needs to use the 'let's in this procedure. set refill-rate qualgiver set full? "false" set time-to-refill 0 ] ;the line above makes the feeders. Each feedermaker makes a feeder of radius 3 patches around itself. The refill rate of the feeder is defined by its quality, which is defined by its identity ] end to setup-ants let tot-food-available sum [QualityDevidedByDoubleFeederdDistance] of feedermakers set ant-number int tot-food-available ;; total ants is related to the amount of food available from the feeders. ;; This means that in theory the feeders can be more or less fully exploited as they refill by the number of ants given. ;; Number rounded up to an integer. create-ants ant-number [ set state "scouting" set memory 0 set memX 0 set memY 0 setxy NestXCoordinate NestYCoordinate set patience 30 set color yellow set size 3 set shape "bug" ] ;this creates the ants at the centre of the map end ;;;global variables are variables which are general to the model, and not assigned to a perticular agent or patch. ;;;They are often used to monitor the state of the model. globals [ fullfeeders emptyfeeders propfeedersfull food-returned cumulative-prop-feeders-full prop-scouting-ants cuml-prop-ants-scouting avg-prop-ants-scouting avg-feeders-full memory-switches FeederDistanceFromNest NestXCoordinate NestYCoordinate cnf-discounter time1 time2 MemoryArray TotalDisappointments ] to setup-globals set FeederDistanceFromNest 75 set NestXCoordinate 0 set NestXCoordinate 0 set TotalDisappointments 0 ;;the following defines a linearised lookup table, which tells the ants with what ;;probability they should switch to a new food source, ;;depending on how many times they visited their preferred food source ;;and how many times they visited another food source ;;Data for this array stem from direct empirical observations (treatment 1 3 5 10 & 5) ;;or interpolation of direct empirical observations set MemoryArray array:from-list [ 0 0.469879518 0.759036145 0.879518072 0.88 0.9375 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0.3095 0.38 0.558255284 0.8145 0.8524 0.9204 0.913040429 0.9527 0.984 1 1 1 1 1 1 1 1 1 1 1 1 0 0.15942029 0.434782609 0.463768116 0.768115942 0.710144928 0.803030303 0.852459016 0.87037037 0.952380952 1 0.961538462 1 1 1 1 1 1 1 1 1 1 0 0.1849 0.2888 0.346276625 0.6193 0.7182 0.8176 0.843085381 0.8929 0.944 0.9638 0.9844 1 1 1 1 1 1 1 1 1 1 0 0.014492754 0.173913043 0.304347826 0.565217391 0.753623188 0.823529412 0.830769231 0.919354839 0.960784314 0.973684211 1 1 1 1 1 1 1 1 1 1 1 0 0 0.1274 0.261876361 0.4665 0.6048 0.7308 0.804676029 0.8451 0.912 0.9292 0.9694 0.99 1 1 1 1 1 1 1 1 1 0 0 0.083 0.235488639 0.406 0.5559 0.6934 0.790536967 0.8257 0.899 0.9134 0.9634 0.98 1 1 1 1 1 1 1 1 1 0 0 0.058 0.214789728 0.3561 0.5122 0.66 0.778490127 0.8093 0.888 0.8986 0.9584 0.97 1 1 1 1 1 1 1 1 1 0 0 0.0488 0.198047525 0.3168 0.4737 0.6306 0.768016533 0.7959 0.879 0.8848 0.9544 0.96 1 1 1 1 1 1 1 1 1 0 0 0.033333333 0.152542373 0.237288136 0.389830508 0.593220339 0.745762712 0.762711864 0.842105263 0.833333333 0.921568627 0.95 1 1 1 1 1 1 1 1 1 0 0 0.035 0.172473727 0.27 0.4123 0.5838 0.750495857 0.7781 0.867 0.8602 0.9494 0.95 1 1 1 1 1 1 1 1 1 0 0 0.036 0.162437625 0.2625 0.3894 0.5664 0.743023611 0.7737 0.864 0.8494 0.9484 0.95 1 1 1 1 1 1 1 1 1 0 0 0.037 0.153721828 0.2656 0.3717 0.553 0.736215526 0.7723 0.863 0.8396 0.9484 0.948 1 1 1 1 1 1 1 1 1 0 0 0.038 0.146069752 0.2793 0.3592 0.5436 0.729967851 0.7739 0.864 0.8308 0.9494 0.946 1 1 1 1 1 1 1 1 1 0 0.013157895 0.039473684 0.157894737 0.328947368 0.355263158 0.539473684 0.736842105 0.776315789 0.864864865 0.826086957 0.95 0.944444444 1 1 1 1 1 1 1 1 1 ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; go procudures;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;the go procedure is the main model procedure. This is run repeatedly until the model run ends to go ;;this procedure updates the feeders, filling them if empty and enough time has elapsed since being emptied fill-feeders ;;this procedure makes the ants check where they are, and act accordingly ;;(e.g. if they are scouting and find a food source, return to nest) check-ant-location ;;this procedure makes the ants carry out the instructions determained by their state ;;(e.g. if an ant is in the state "scouting" it follows pheromone or performs a random walk) check-ant-state ;;the "do-pheromone" procedure is only activated if pheromone is enabled. ;;The do-pheromone procedure makes ants deposit pheromone, makes pheromone decay, ;;and visualised pheromone if this feature is enabled if pheromone-on? [do-pheromone] ;;this procedure updates the global reporters used to collect data on the simulation run do-reporters ;;this checks whether its time to reshuffle the quality of the feeders. check-reshuffle ;;this command causes all ants to go to the centre of the patch they are on every 100 ticks. This debugs a problem of ants ;;in the random enviroment never precisely returning to the location their memory says, and so, gettig stuck. check-centre-ants ;;this increased the tick counter by 1 tick end to fill-feeders ask patches with [patchtype = "food"] ;;;this makes only patches with the patchtype "food" respond to the following commands ;;every time-step the feeders check if their time to refill is zero. ;;If it is they set their "full?" variable to "true". ;;If it is not they set their "full?" variable to false, and reduce their "time-to-refill" counter by 1 [ ifelse time-to-refill = 0 [set full? "true"] [ set full? "false" set time-to-refill (time-to-refill - 1) ] ] end to check-ant-location ask ants [ if patchtype = "nest" and state = "returning" [ ;;full ants returning to the nest start following their memory, and add 1 to the count of total food returned set state "following-memory" set crowding 0 set patience patience-level set food-returned food-returned + 1 ] if patchtype = "food" and full? = "true" and state != "returning" ;;ants reaching a full feeder return to nest and learn the location of the feeder (do-memstength). ;;Ants already returning from a feeder ignore other feeders [ set state "returning" move-to patch-here ;;added to make x and y memory coordinates always the centre of a patch. do-memstrength set color (5 + (feedernumber * 10) - (feedernumber / 5)) ;;the last complicated bit is simply to make the ants take the color of the feeder, ;;not colour of the patch they are on (for when phero trails are visualiseD) let fdnmr feedernumber ask patches with [feedernumber = fdnmr] [ set full? "false" set time-to-refill refill-rate ] ;;this makes all patches in a feeder which was just visited become empty, and begins their refill rate counter ] if patchtype = "food" and full? = "false" and state = "following-memory" [set state "waiting"] ; returning ants finding an empty feeder get disappointed, bounce off a bit, then go scouting. Bouncing off important to not get stuck ;;if the CNF effect is enabled counts ants on patch, and adds that to crowding. -1 because count turtles-here also includes the ant itself if CNF [set crowding (crowding + (count turtles-here - 1))] ] end to do-memstrength ;;when an ant first finds a full feeder it remembers it. If it comes there again it strengthens the memory by 1. ;;If it gets there but it's empty it starts scouting, but keeps its memory. ;;if it finds a different, productive feeder it sets newfeedermemstrength 1 higher. ;;The probability of memory switching is governed by the relationship between memstrength and newfeedermemstrength ;;The ants look up the probability in a lookup table called MemoryArray if memstrength > max-memory [set memstrength max-memory] ;sets a maximum memory strength, as defined by a slider in the interface tab if newfeedermemstrength > 23 [set newfeedermemstrength 22] ;prevents the newmemstrength to get above 22, as the look up table doesn't go higher than that if memstrength < 0 [set memstrength 0] ;prevents memory going lower than 0 ifelse memory != 0 ; ifelse makes it so the ants learn the first feeder they find. If they don't have a memory, they can gain one. [ ifelse memory = feedernumber [set memstrength memstrength + 1 ] [set newfeedermemstrength newfeedermemstrength + 1 SwitchNow?] ] [ set memstrength 1 set memX xcor set memY ycor set memory feedernumber ] if memory = 0 [set memory feedernumber] ;allows naive or switching ants to memorise new feeders end to SwitchNow? if random-float 1 > SwitchChance memstrength newfeedermemstrength [switch-memory] ;;;takes a random floating-point number between 0 and 1. If the number is bigger than the chance of memory switching, memory reset happens End to-report SwitchChance [CurrentMemStrength CurrentNewFeederMemStrength] report array:item MemoryArray (((CurrentMemStrength - 1) * 22) + CurrentNewFeederMemStrength) end to switch-memory ;;;this resets the ants memory: it now acts as if it is finding the new feeder it is on for the first time. In effect it switches its favoured feeder to this new feeder set memstrength 1 set newfeedermemstrength 0 set memory 0 set memX xcor set memY ycor set memory-switches memory-switches + 1 end to check-ant-state ;every round the ants check which state they are in and act appropriatly. ask ants [ if state = "scouting" [ants-scout] if state = "returning" [ants-return] ;;turns memory on or off. ;;If memory is off, when ants are in the "following-memory" state they behave identically to ants in the "scouting" state ifelse memory-on? [if state = "following-memory" [ants-follow-memory]] [if state = "following-memory" [ants-random-walk set state "scouting"]] if xcor = memX and ycor = memY and patchtype = "nothing" [set state "scouting"] if state = "waiting" [ants-wait] ] end to ants-scout ifelse pheromone-on? ;if pheromone is enabled the pheromone-following behaviour in the next lines several occurs. If it is disabled ants perform a correlated random walk [ if pheromone > 0 [facexy NestXCoordinate NestYCoordinate right 180] ;;makes ants that are on a pheromone trail start by looking away from the nest. Simulates ants knowing where the nest is, amd moving away from it. let pleft patch-left-and-ahead 45 1 ;these three lines make temporary variables which call the patches ahead, left and right let pright patch-right-and-ahead 45 1 let pjump patch-ahead 1 let pleft-phero [pheromone] of pleft ;these three lines make temporary variables containing the pheromone level of patches ahead, left and right let pright-phero [pheromone] of pright let pjump-phero [pheromone] of pjump ;the following lines compare the pheromone levels in the three patches ahead, ;and make the ant face the patch with the highest pheromone level and move jump 1 patch width if pleft-phero > pright-phero and pleft-phero > pjump-phero [face pleft jump 1] if pright-phero > pleft-phero and pright-phero > pjump-phero [face pright jump 1] if pjump-phero > pleft-phero and pjump-phero > pright-phero [jump 1] if pleft-phero > pright-phero and pleft-phero = pjump-phero [left random StDev jump 1] if pright-phero > pleft-phero and pright-phero = pjump-phero [right random StDev jump 1] if pleft-phero = pright-phero and pleft-phero = pright-phero [jump 1] if pleft-phero = pright-phero and pleft-phero = pjump-phero [ants-random-walk] ] [ants-random-walk] end to ants-random-walk ;;;this defines the correlated random walk ants perform when scouting right random-normal 0 StDev fd 1 ;;;Ants turn right a random amount drawn from a normal distribution with a mean of 0 and a standard deviation defined by StDev. ;;;StDev is a slider in the main tab. end to ants-return ;this defines the behaviour of ants returning from a successful visit to a feeder to the nest if pheromone-on? [deposit-pheromone] ;if pheromone is enabled, the ant deposits pheromone as defined by the 'deposit-pheromone' procedure ;;in the following lines the ant faces the nest (simulating that the ant knows where the nest is), ;;turns right by a random number of degrees drawn from a normal distribution ;;with a mean of 0 and a standard deviation of stDev/2 facexy NestXCoordinate NestYCoordinate right random-normal 0 (StDev / 2) fd 1 end to deposit-pheromone ;this describes how ants deposit pheromone ;;CNF refers to Crowding Negative Feedback - ;;a negative feedback effect which reduces pheromone deposition dependant on the number of ants an ant encountered since last visiting the nest. ;;This effect is only implemented in the stability analysis ifelse CNF [ set cnf-discounter (50 * 0.004 * crowding + 1);; cnf-discounter is the amount by which normal pheromone deposition (50) should be devided by if CNF is enabled. 50 is the "standard" strength of crowding negative feedback set pheromone pheromone + 50 / cnf-discounter ;;; 50 is both the "standard" amount of pheromone laid ask patch-left-and-ahead 180 1 [set pheromone pheromone + 25 / cnf-discounter] ;;;lays half the amount of pheromone just left of the turtle ask patch-right-and-ahead 180 1 [set pheromone pheromone + 25 / cnf-discounter] ;;; same but right ] [ set pheromone pheromone + 50 ; the ant deposits 50 units of pheromone on the patch it is occupying ask patch-left-and-ahead 90 1 [set pheromone pheromone + 25] ;the ant deposits 25 units of pheormone on the patch to the left of the patch it is occupying ask patch-right-and-ahead 90 1 [set pheromone pheromone + 25] ; same as above but right ] end to ants-follow-memory let mem memory ; makes a temporary variable with the name mem, with the value of the ants current memory facexy memX memY ;; makes the ant face the its preferred feeder jump 1 ;; ant takes a step forward end to ants-wait ;;the following makes the ants wait at an empty feeder they had followed their memory to reach. ;;Ants wait an amount set by the "patience level", by default set to 30 time steps. ;;If the feeder does not become full within that time they become scouts and wander off. if patience = 0 [set patience patience-level] set patience patience - 1 if patience = 0 [set state "scouting" set TotalDisappointments TotalDisappointments + 1] end to do-pheromone ;this procedure handles pheromone decay and visualisation ask patches with [pheromone > 0] ; only patches containing pheromone carry out the following instructions [ ;;this causes pheromone levels to drop over time at a rate dependant on phero-decay-rate, by default set at 0.00205. ;;at a rate of 0.00205 pheromone decays to zero in 2700 timesteps, or 45 minutes set pheromone pheromone - pheromone * phero-decay-rate ;;if pheromone gets below 0.01 the pheromone disappears completely. In this way after c.2700 time steps (=45 minutes) pheromone disappears. ;;this also has the side-effect of limiting the distance pheromone can diffuse. if pheromone < 0.01 [set pheromone 0] ;; show-pheromone is a toggle in the interface tab which is used to visualise pheromone. ;; It can be disabled to save processing power or make seeing the ants easier. if show-pheromone [if pheromone > 0 [set pcolor (grey * pheromone) / 1000] ; changes the colour of patches with pheromone on them to be related to the amount of pheromone on them if patchtype = "food" [set pcolor (5 + (feedernumber * 10) - (feedernumber / 5))]] ; prevents food patches from changing colour ] end to clear-shown-phero ;this procudure, called from a button on the interface tab, just clears the pheromone visualisation away ask patches [ if patchtype = "nothing" [set pcolor black] ] end to check-reshuffle set time1 ticks / shuffle-every-X-ticks set time2 int (ticks / shuffle-every-X-ticks) if time1 = time2 and ticks != 0 [reshuffle] end to reshuffle ;this remakes the model enviroment, but keeps the original ants ask feedermakers [die] ask patches with [patchtype = "food"] [ set patchtype "nothing" set feedernumber 0 set refill-rate 0 set time-to-refill 0 set full? "false" set pcolor black ] make-food end to do-reporters ;;this procedure enables data gathering about whether the food patches are full or not ask feedermakers [set feederfull? full?] ;;this makes the feedermaker agent at the centre of the patch report 1 if the patch it is on is fullh and 0 for an empty patch. do-monitors ;;this calls the monitoring procedure which gathers data about the model end to do-monitors ;;counts the number of full feeders. Saves it in the global variable "fullfeeders" set fullfeeders count feedermakers with [feederfull? = "true"] ;;counts the number of empty feeders. Saves it in the global variable "emptyfeeders" set emptyfeeders count feedermakers with [feederfull? = "false"] ;;calculates the proportion of full feeders. Saves it in the global variable "propfeedersfull" set propfeedersfull fullfeeders / (fullfeeders + emptyfeeders) if ticks > 0 [ ;;to prevent dividing by zero when the model starts. ;;calculates a running total of the proportion of full feeders set cumulative-prop-feeders-full cumulative-prop-feeders-full + propfeedersfull ;;devide the running total of the proportion of full feeders by ;;the number of time-steps in the model, to give an average proportion of full feeders. ;;Saves this value in the global variable"avg-feeders-full" set avg-feeders-full cumulative-prop-feeders-full / ticks ;;counts the number of ants with the state "scouting. Saves it in the global variable "prop-scounting-ants" set prop-scouting-ants count ants with [state = "scouting"] / count ants ;;ifelse used to stop dividing by zero when all ants are scouting. ;;Gives the proportion of ants scouting as 1 when this is the case ifelse count ants with [state != "scouting"] = 0 ;;adds 1 to the cumulative proportion of scouting ants if all ants are scouting [set cuml-prop-ants-scouting cuml-prop-ants-scouting + 1] ;;adds the proportion of scouting ants to the cumulative proportion of scouting ants. ;;Saves this in a global variable [set cuml-prop-ants-scouting cuml-prop-ants-scouting + (count ants with [state = "scouting"]) / count ants] ;;calculates the average proportion of scouting ants since the experimental run began. ;;Saves this in the global variable avg-propr-ants-scouting set avg-prop-ants-scouting cuml-prop-ants-scouting / ticks ] end to check-centre-ants if (ticks / 100) = (int (ticks / 100)) [ ask ants [move-to patch-here] ] end ;;;;;profiler instructions;;;;;;;; ;;the profiler is used to test how much processing time various parts of the model require. ;It is a developmental tool and is not used during normal modelling. to run-profiler setup ;; set up the model profiler:reset ;; clear the data profiler:start ;; start profiling repeat profiler-runs [ go ] ;; run something you want to measure profiler:stop ;; stop profiling print profiler:report ;; view the results end @#$#@#$#@ GRAPHICS-WINDOW 215 10 627 443 100 100 2.0 1 10 1 1 1 0 1 1 1 -100 100 -100 100 1 1 1 ticks 30.0 BUTTON 3 10 66 43 NIL setup NIL 1 T OBSERVER NIL NIL NIL NIL 1 BUTTON 68 10 131 43 NIL go T 1 T OBSERVER NIL NIL NIL NIL 1 SLIDER 7 413 179 446 StDev StDev 0 50 20 1 1 NIL HORIZONTAL INPUTBOX 4 46 159 106 ant-number 56 1 0 Number SWITCH 5 190 185 223 random-feeder-locations? random-feeder-locations? 1 1 -1000 SLIDER 4 113 184 146 feedercount feedercount 1 50 16 1 1 NIL HORIZONTAL MONITOR 703 22 839 67 Number of full feeders fullfeeders 17 1 11 MONITOR 842 22 990 67 Number of empty feeders emptyfeeders 17 1 11 MONITOR 994 22 1130 67 Proportion of full feeders propfeedersfull 17 1 11 PLOT 706 217 1126 436 average time feeders full NIL NIL 0.0 1.0 0.0 1.0 true true "" "" PENS "avg prop feeders full" 1.0 0 -2674135 true "" "plot avg-feeders-full" "avg prop ants scouting" 1.0 0 -14454117 true "" "plot avg-prop-ants-scouting" "prop scouting ants" 1.0 0 -10141563 true "" "plot prop-scouting-ants" MONITOR 842 70 987 115 proportion of scouting ants prop-scouting-ants 1 1 11 SWITCH 6 266 184 299 memory-on? memory-on? 0 1 -1000 SLIDER 6 151 185 184 max-memory max-memory 1 15 15 1 1 NIL HORIZONTAL MONITOR 703 70 837 115 Number of scouting ants count ants with [state = \"scouting\"] 0 1 11 SWITCH 5 227 185 260 pheromone-on? pheromone-on? 0 1 -1000 SWITCH 709 440 860 473 show-pheromone show-pheromone 0 1 -1000 BUTTON 1277 90 1371 123 NIL run-profiler NIL 1 T OBSERVER NIL NIL NIL NIL 1 INPUTBOX 1278 28 1365 88 profiler-runs 1000 1 0 Number BUTTON 865 440 1000 473 NIL clear-shown-phero NIL 1 T OBSERVER NIL NIL NIL NIL 1 MONITOR 993 73 1124 118 Total food returned food-returned 0 1 11 MONITOR 992 120 1123 165 Rate of food return food-returned / ticks 2 1 11 MONITOR 704 118 989 163 Number of times an ant changed its preferred feeder memory-switches 17 1 11 SWITCH 7 302 180 335 CNF CNF 1 1 -1000 SLIDER 7 375 180 408 phero-decay-rate phero-decay-rate 0 0.01 0.00205 0.00001 1 NIL HORIZONTAL BUTTON 126 451 207 510 NIL reshuffle NIL 1 T OBSERVER NIL NIL NIL NIL 1 SLIDER 7 338 179 371 patience-level patience-level 1 100 1 1 1 NIL HORIZONTAL INPUTBOX 7 450 120 510 shuffle-every-X-ticks 2000 1 0 Number BUTTON 134 10 210 44 go once go NIL 1 T OBSERVER NIL NIL NIL NIL 1 MONITOR 705 166 1131 211 Number of times an ant reached an empty feeder and walked away TotalDisappointments 0 1 11 TEXTBOX 1286 135 1436 219 These inputs control the profiler extension, which tests which procedures of the model require most time. They are for testing purpouses only, and are not used in the model 11 0.0 1 @#$#@#$#@ ## WHAT DOES THIS MODEL DO? This model models the collective foraging of an ant colony in an enviroment with multiple semi-permenant and replenishing food sources. This may, for example, aphid colonies, flowers, or extra-floral nectaries. The model is designed to explore how two types of information - social (in the form of pheromone trails) and private (in the form of route memories) affect colony level foraging. The model was used to provide the data for: Czaczkes TJ, Czaczkes B, Iglhaut C, Heinze J. 2015. Composite collective decision-making. Proceedings of the Royal Society B: Biological Sciences 282. ## HOW IT WORKS See the electronic supplementary material of the original paper for a complete ODD (overview, design, details) protocol of the model. ## HOW TO USE IT To the left of the world view (big black box) are the controls and settings: -Set up or reset the model by clickign the 'setup' button. -Start the model by clicking the 'go' button. To make the model take only one time step, click 'go-once' -feedercount sets the number of food sources -random-feeder-locations? sets whether the food sources are randomly or non-randomly placed -pheromone on? / memory on? activates/deactivates pheromone and memory respectivly -CNF? activates a crowding negative feedback effect, as used in Czaczkes (in prep). This effect causes ants which have met another ant to reduce their pheromone deposition. -patience-level - how many time-steps ants wait at an empty feeder before becoming disappointed and walking off -phero-decay-rate - how rapidly the pheromone decays -StDev - how 'curvy' the correlated random walk of the ants is - the higher, the curvier -shuffle-every-X-ticks - how often the enviroment changes. -click 'shuffle' to cause an enviromental change The the right of the word view are monitors and a plot, which allows the model to be examined. These are self explanatory. There is also a toggle which causes the pheromone to be visualised. ## EXTENDING THE MODEL One might consider making the enviroment change over time - perhaps the location or quality of feeders might change every so often. How do memory and pheromone trails enable ants to cope with such an enviroment? Why is there no down-side to having a less flexible memory? I reckon its because the negative and positive effects of long memories cancel out. negative = keep going back to overexploited food. Positive: don't immediately give up on underexploited food. two types of errors: give up when you shouldn't (type 1 error) and keep visiting an overexploited feeder (type 2 error). We can think of this as a tradeoff between type 1 and type 2 errors. We could test this by making one type of error more costly. For example, if every time a type 2 error is made the total amount of food the colony collected is reduced by one. We then expect colonies to have more total food when they make less type 2 errors, so when they avoid visiting empty feeders, so when they make more memory switches, so when max-memory = 1. ## RELATED MODELS The Crowding Negative Feedback effect used is based on one developed by T.J. Czaczkes. See: Czaczkes TJ. 2014. How to not get stuck – negative feedback due to crowding maintains flexibility in ant foraging. Journal of Theoretical Biology 360:172–180. ## CREDITS AND REFERENCES This model was written by T.J Czaczkes and B. I. Czaczkes In order to cite this model please cite the original paper @#$#@#$#@ default true 0 Polygon -7500403 true true 150 5 40 250 150 205 260 250 airplane true 0 Polygon -7500403 true true 150 0 135 15 120 60 120 105 15 165 15 195 120 180 135 240 105 270 120 285 150 270 180 285 210 270 165 240 180 180 285 195 285 165 180 105 180 60 165 15 arrow true 0 Polygon -7500403 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150 box false 0 Polygon -7500403 true true 150 285 285 225 285 75 150 135 Polygon -7500403 true true 150 135 15 75 150 15 285 75 Polygon -7500403 true true 15 75 15 225 150 285 150 135 Line -16777216 false 150 285 150 135 Line -16777216 false 150 135 15 75 Line -16777216 false 150 135 285 75 bug true 0 Circle -7500403 true true 96 182 108 Circle -7500403 true true 110 127 80 Circle -7500403 true true 110 75 80 Line -7500403 true 150 100 80 30 Line -7500403 true 150 100 220 30 butterfly true 0 Polygon -7500403 true true 150 165 209 199 225 225 225 255 195 270 165 255 150 240 Polygon -7500403 true true 150 165 89 198 75 225 75 255 105 270 135 255 150 240 Polygon -7500403 true true 139 148 100 105 55 90 25 90 10 105 10 135 25 180 40 195 85 194 139 163 Polygon -7500403 true true 162 150 200 105 245 90 275 90 290 105 290 135 275 180 260 195 215 195 162 165 Polygon -16777216 true false 150 255 135 225 120 150 135 120 150 105 165 120 180 150 165 225 Circle -16777216 true false 135 90 30 Line -16777216 false 150 105 195 60 Line -16777216 false 150 105 105 60 car false 0 Polygon -7500403 true true 300 180 279 164 261 144 240 135 226 132 213 106 203 84 185 63 159 50 135 50 75 60 0 150 0 165 0 225 300 225 300 180 Circle -16777216 true false 180 180 90 Circle -16777216 true false 30 180 90 Polygon -16777216 true false 162 80 132 78 134 135 209 135 194 105 189 96 180 89 Circle -7500403 true true 47 195 58 Circle -7500403 true true 195 195 58 circle false 0 Circle -7500403 true true 0 0 300 circle 2 false 0 Circle -7500403 true true 0 0 300 Circle -16777216 true false 30 30 240 cow false 0 Polygon -7500403 true true 200 193 197 249 179 249 177 196 166 187 140 189 93 191 78 179 72 211 49 209 48 181 37 149 25 120 25 89 45 72 103 84 179 75 198 76 252 64 272 81 293 103 285 121 255 121 242 118 224 167 Polygon -7500403 true true 73 210 86 251 62 249 48 208 Polygon -7500403 true true 25 114 16 195 9 204 23 213 25 200 39 123 cylinder false 0 Circle -7500403 true true 0 0 300 dot false 0 Circle -7500403 true true 90 90 120 face happy false 0 Circle -7500403 true true 8 8 285 Circle -16777216 true false 60 75 60 Circle -16777216 true false 180 75 60 Polygon -16777216 true false 150 255 90 239 62 213 47 191 67 179 90 203 109 218 150 225 192 218 210 203 227 181 251 194 236 217 212 240 face neutral false 0 Circle -7500403 true true 8 7 285 Circle -16777216 true false 60 75 60 Circle -16777216 true false 180 75 60 Rectangle -16777216 true false 60 195 240 225 face sad false 0 Circle -7500403 true true 8 8 285 Circle -16777216 true false 60 75 60 Circle -16777216 true false 180 75 60 Polygon -16777216 true false 150 168 90 184 62 210 47 232 67 244 90 220 109 205 150 198 192 205 210 220 227 242 251 229 236 206 212 183 fish false 0 Polygon -1 true false 44 131 21 87 15 86 0 120 15 150 0 180 13 214 20 212 45 166 Polygon -1 true false 135 195 119 235 95 218 76 210 46 204 60 165 Polygon -1 true false 75 45 83 77 71 103 86 114 166 78 135 60 Polygon -7500403 true true 30 136 151 77 226 81 280 119 292 146 292 160 287 170 270 195 195 210 151 212 30 166 Circle -16777216 true false 215 106 30 flag false 0 Rectangle -7500403 true true 60 15 75 300 Polygon -7500403 true true 90 150 270 90 90 30 Line -7500403 true 75 135 90 135 Line -7500403 true 75 45 90 45 flower false 0 Polygon -10899396 true false 135 120 165 165 180 210 180 240 150 300 165 300 195 240 195 195 165 135 Circle -7500403 true true 85 132 38 Circle -7500403 true true 130 147 38 Circle -7500403 true true 192 85 38 Circle -7500403 true true 85 40 38 Circle -7500403 true true 177 40 38 Circle -7500403 true true 177 132 38 Circle -7500403 true true 70 85 38 Circle -7500403 true true 130 25 38 Circle -7500403 true true 96 51 108 Circle -16777216 true false 113 68 74 Polygon -10899396 true false 189 233 219 188 249 173 279 188 234 218 Polygon -10899396 true false 180 255 150 210 105 210 75 240 135 240 house false 0 Rectangle -7500403 true true 45 120 255 285 Rectangle -16777216 true false 120 210 180 285 Polygon -7500403 true true 15 120 150 15 285 120 Line -16777216 false 30 120 270 120 leaf false 0 Polygon -7500403 true true 150 210 135 195 120 210 60 210 30 195 60 180 60 165 15 135 30 120 15 105 40 104 45 90 60 90 90 105 105 120 120 120 105 60 120 60 135 30 150 15 165 30 180 60 195 60 180 120 195 120 210 105 240 90 255 90 263 104 285 105 270 120 285 135 240 165 240 180 270 195 240 210 180 210 165 195 Polygon -7500403 true true 135 195 135 240 120 255 105 255 105 285 135 285 165 240 165 195 line true 0 Line -7500403 true 150 0 150 300 line half true 0 Line -7500403 true 150 0 150 150 pentagon false 0 Polygon -7500403 true true 150 15 15 120 60 285 240 285 285 120 person false 0 Circle -7500403 true true 110 5 80 Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90 Rectangle -7500403 true true 127 79 172 94 Polygon -7500403 true true 195 90 240 150 225 180 165 105 Polygon -7500403 true true 105 90 60 150 75 180 135 105 plant false 0 Rectangle -7500403 true true 135 90 165 300 Polygon -7500403 true true 135 255 90 210 45 195 75 255 135 285 Polygon -7500403 true true 165 255 210 210 255 195 225 255 165 285 Polygon -7500403 true true 135 180 90 135 45 120 75 180 135 210 Polygon -7500403 true true 165 180 165 210 225 180 255 120 210 135 Polygon -7500403 true true 135 105 90 60 45 45 75 105 135 135 Polygon -7500403 true true 165 105 165 135 225 105 255 45 210 60 Polygon -7500403 true true 135 90 120 45 150 15 180 45 165 90 sheep false 15 Circle -1 true true 203 65 88 Circle -1 true true 70 65 162 Circle -1 true true 150 105 120 Polygon -7500403 true false 218 120 240 165 255 165 278 120 Circle -7500403 true false 214 72 67 Rectangle -1 true true 164 223 179 298 Polygon -1 true true 45 285 30 285 30 240 15 195 45 210 Circle -1 true true 3 83 150 Rectangle -1 true true 65 221 80 296 Polygon -1 true true 195 285 210 285 210 240 240 210 195 210 Polygon -7500403 true false 276 85 285 105 302 99 294 83 Polygon -7500403 true false 219 85 210 105 193 99 201 83 square false 0 Rectangle -7500403 true true 30 30 270 270 square 2 false 0 Rectangle -7500403 true true 30 30 270 270 Rectangle -16777216 true false 60 60 240 240 star false 0 Polygon -7500403 true true 151 1 185 108 298 108 207 175 242 282 151 216 59 282 94 175 3 108 116 108 target false 0 Circle -7500403 true true 0 0 300 Circle -16777216 true false 30 30 240 Circle -7500403 true true 60 60 180 Circle -16777216 true false 90 90 120 Circle -7500403 true true 120 120 60 tree false 0 Circle -7500403 true true 118 3 94 Rectangle -6459832 true false 120 195 180 300 Circle -7500403 true true 65 21 108 Circle -7500403 true true 116 41 127 Circle -7500403 true true 45 90 120 Circle -7500403 true true 104 74 152 triangle false 0 Polygon -7500403 true true 150 30 15 255 285 255 triangle 2 false 0 Polygon -7500403 true true 150 30 15 255 285 255 Polygon -16777216 true false 151 99 225 223 75 224 truck false 0 Rectangle -7500403 true true 4 45 195 187 Polygon -7500403 true true 296 193 296 150 259 134 244 104 208 104 207 194 Rectangle -1 true false 195 60 195 105 Polygon -16777216 true false 238 112 252 141 219 141 218 112 Circle -16777216 true false 234 174 42 Rectangle -7500403 true true 181 185 214 194 Circle -16777216 true false 144 174 42 Circle -16777216 true false 24 174 42 Circle -7500403 false true 24 174 42 Circle -7500403 false true 144 174 42 Circle -7500403 false true 234 174 42 turtle true 0 Polygon -10899396 true false 215 204 240 233 246 254 228 266 215 252 193 210 Polygon -10899396 true false 195 90 225 75 245 75 260 89 269 108 261 124 240 105 225 105 210 105 Polygon -10899396 true false 105 90 75 75 55 75 40 89 31 108 39 124 60 105 75 105 90 105 Polygon -10899396 true false 132 85 134 64 107 51 108 17 150 2 192 18 192 52 169 65 172 87 Polygon -10899396 true false 85 204 60 233 54 254 72 266 85 252 107 210 Polygon -7500403 true true 119 75 179 75 209 101 224 135 220 225 175 261 128 261 81 224 74 135 88 99 wheel false 0 Circle -7500403 true true 3 3 294 Circle -16777216 true false 30 30 240 Line -7500403 true 150 285 150 15 Line -7500403 true 15 150 285 150 Circle -7500403 true true 120 120 60 Line -7500403 true 216 40 79 269 Line -7500403 true 40 84 269 221 Line -7500403 true 40 216 269 79 Line -7500403 true 84 40 221 269 wolf false 0 Polygon -16777216 true false 253 133 245 131 245 133 Polygon -7500403 true true 2 194 13 197 30 191 38 193 38 205 20 226 20 257 27 265 38 266 40 260 31 253 31 230 60 206 68 198 75 209 66 228 65 243 82 261 84 268 100 267 103 261 77 239 79 231 100 207 98 196 119 201 143 202 160 195 166 210 172 213 173 238 167 251 160 248 154 265 169 264 178 247 186 240 198 260 200 271 217 271 219 262 207 258 195 230 192 198 210 184 227 164 242 144 259 145 284 151 277 141 293 140 299 134 297 127 273 119 270 105 Polygon -7500403 true true -1 195 14 180 36 166 40 153 53 140 82 131 134 133 159 126 188 115 227 108 236 102 238 98 268 86 269 92 281 87 269 103 269 113 x false 0 Polygon -7500403 true true 270 75 225 30 30 225 75 270 Polygon -7500403 true true 30 75 75 30 270 225 225 270 @#$#@#$#@ NetLogo 5.2.0 @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ setup go avg-prop-ants-scouting avg-feeders-full food-returned TotalDisappointments @#$#@#$#@ @#$#@#$#@ default 0.0 -0.2 0 0.0 1.0 0.0 1 1.0 0.0 0.2 0 0.0 1.0 link direction true 0 Line -7500403 true 150 150 90 180 Line -7500403 true 150 150 210 180 @#$#@#$#@ 0 @#$#@#$#@