globals [popn tot-alt tot-ego tot-prop-alt] breed [haystacks haystack] ;; plural then singular name for the breed of turtle. haystacks-own [ num-altruists ;; holds number of altruists num-egoists ;; holds number of egotists prop-alt ;; holds proportion of altruists ] to setup clear-all set popn num-haystacks * founding-popn-N ;; create agents, randomly locate set-default-shape haystacks "lander" create-haystacks num-haystacks ask haystacks [ set num-altruists 0 set num-egoists 0 let match round(assortativity-a * founding-popn-N) ;; number of founding population forced same type ifelse random-float 1 < initial-prop-altruists-x [set num-altruists match] [set num-egoists match] repeat (founding-popn-N - match) [ ifelse random-float 1 < initial-prop-altruists-x [set num-altruists (num-altruists + 1)] [set num-egoists (num-egoists + 1)] ] set prop-alt num-altruists / (num-altruists + num-egoists) draw-haystacks set heading 0 setxy (random-xcor * 0.9 + 0.05 * max-pxcor) (random-ycor * 0.9 + 0.05 * max-pycor) ] set tot-alt sum [num-altruists] of haystacks set tot-ego sum [num-egoists] of haystacks set tot-prop-alt (tot-alt / (tot-alt + tot-ego)) ask patches [ set pcolor white ;; set background colour of world to white (default is black) ] end to go reproduce if check-mix = "Y" [ mix ] tick make-plots if check-stable = "Y" [stop] end to reproduce ;;create the new altruists and egoists in each haystack ask haystacks [ set num-altruists (num-altruists + num-altruists * (reproduction + round(prop-alt * altruism-group-benefit-b) - altruism-personal-cost-c)) set num-egoists (num-egoists + num-egoists * (reproduction + round(prop-alt * altruism-group-benefit-b))) set prop-alt (num-altruists / (num-altruists + num-egoists)) draw-haystacks ] set tot-alt sum [num-altruists] of haystacks set tot-ego sum [num-egoists] of haystacks set tot-prop-alt (tot-alt / (tot-alt + tot-ego)) end to mix ;; mix the populations from haystacks to create new founding populations ask haystacks [ set num-altruists 0 set num-egoists 0 let match round(assortativity-a * founding-popn-N) ;; number of founding population forced same type ifelse random-float 1 < tot-prop-alt [set num-altruists match] [set num-egoists match] repeat (founding-popn-N - match) [ ifelse random-float 1 < tot-prop-alt [set num-altruists (num-altruists + 1)] [set num-egoists (num-egoists + 1)] ] set prop-alt (num-altruists / (num-altruists + num-egoists)) draw-haystacks ] set tot-alt sum [num-altruists] of haystacks set tot-ego sum [num-egoists] of haystacks set tot-prop-alt (tot-alt / (tot-alt + tot-ego)) end to make-plots ;; update the population plots set-current-plot "Population counts" set-current-plot-pen "A" plotxy ticks tot-alt set-current-plot-pen "E" plotxy ticks tot-ego set-current-plot "Altruist proportion" set-current-plot-pen "Prop" plotxy ticks tot-prop-alt end to draw-haystacks ifelse prop-alt < 0.35 [set color red] [ ifelse prop-alt > 0.65 [set color blue] [set color green] ] set size sqrt( (num-altruists + num-egoists)/(2 * founding-popn-N) ) end to-report check-mix ;; checks whether mixing done this tick if ticks mod generations-T = generations-T - 1 [report "Y"] report "N" end to-report check-stable ;; checks whether an equilibrium reached if all? haystacks [num-altruists = 0] [report "Y"] if all? haystacks [num-egoists = 0] [report "Y"] report "N" end @#$#@#$#@ GRAPHICS-WINDOW 566 23 996 474 10 10 20.0 1 10 1 1 1 0 1 1 1 -10 10 -10 10 1 1 1 ticks BUTTON 36 27 134 76 Setup setup NIL 1 T OBSERVER NIL NIL NIL NIL BUTTON 150 26 246 75 Run go T 1 T OBSERVER NIL NIL NIL NIL SLIDER 375 43 408 193 initial-prop-altruists-x initial-prop-altruists-x 0 1 0.5 0.05 1 NIL VERTICAL PLOT 39 295 337 456 Population Counts Time Population 0.0 10.0 0.0 10.0 true true PENS "E" 1.0 0 -2674135 true "A" 1.0 0 -13345367 true MONITOR 367 410 452 455 Population tot-alt + tot-ego 0 1 11 SLIDER 367 253 539 286 generations-T generations-T 1 25 3 1 1 NIL HORIZONTAL SLIDER 368 313 540 346 founding-popn-N founding-popn-N 1 10 10 1 1 NIL HORIZONTAL SLIDER 368 346 540 379 num-haystacks num-haystacks 1 20 10 1 1 NIL HORIZONTAL BUTTON 261 25 358 76 Step Once go NIL 1 T OBSERVER NIL NIL NIL NIL SLIDER 367 220 539 253 assortativity-a assortativity-a 0 1 0 0.05 1 NIL HORIZONTAL INPUTBOX 416 90 542 150 altruism-group-benefit-b 4 1 0 Number INPUTBOX 416 150 542 210 altruism-personal-cost-c 1 1 0 Number INPUTBOX 416 29 542 89 reproduction 1 1 0 Number PLOT 40 126 337 276 Altruist Proportion Time Altruists 0.0 10.0 0.0 1.0 true false PENS "Prop" 1.0 0 -16777216 true @#$#@#$#@ WHAT IS THIS SIMULATION FOR? ---------------------------- This simulation demonstrates the haystacks model developed by John Maynard Smith (1964), used in evolutionary biology and economics to investigate the conditions under which altruism can develop in groups over time despite the personal cost (and hence evolutionary disadvantage) to the altruist. The model implemented is the version described in Theodore Bergstrom's (2002) overview paper from the economics perspective. WHAT IS THE HYPOTHESIS? ----------------------- John Maynard Smith argued that altruism could be maintained (and eventually fixed) in a population under specific conditions. 1/ the altruists initially make up a high proportion of an isolated subpopulation; 2/ the benefit arising from the altruism ensures the isolated subpopulation grows much faster than the remaining population; 3/ periodically, the population mixes (allowing the altruists to 'infect' the other haystacks) and then re-establishes new isolated subpopulations. The hypothesis is that the faster growth of the high altruism subpopulation leads to an increasing proportion of altruists in the whole population. WHAT ARE THE ELEMENTS OF THE MODEL? ----------------------------------- There are several haystacks. A founding population of mice starts in each haystack. Each haystack has the same sized founding population but with (potentially) different distributions of altruists and egoists. An altruist is willing to incur a personal cost so as to improve the reproductive rate of all the mice in their own haystack. An egoist is not willing to do so, but benefits from the sacrifice of the altruists. For the purposes of the model, mice breed asexually; that is, altruists breed altruists and egoists breed egoists, and there is no need to track males and females. The success of the group is operationalised as reproduction. After some generations where each haystack is isolated, all the mice from the various haystacks intermingle and new founding populations for each haystack are drawn from the entire mouse population. This reproduction and mixing continues until the whole population is of only one type, altruists or egoists. The only agents are haystacks. The key properties of the haystack are the number of altruists and the number of egoists. These are updated each timestep based on reproduction rates. Mice are implicit rather than modelled. Additional haystack properties are for visualisation purposes and have no behavioural influence. The total number of mice (that is, the sum of the number of altruists and the number of egoists) governs the size, so that the differential impact of breeding can be seen. There is no meaningful geographic or network relationship. The patches have no impact. Each haystack has a location only for visualisation purposes. HOW DOES THIS SIMULATION WORK? ------------------------------ The world view shows several haystacks (number given by 'num-haystacks' slider). The colour of the haystack represents the mix of altruists and egoists in the haystack: blue for primarily (>65%) altruists, red for primarily (>65%) egoists, and green if roughly balanced. The size is determined by the number of mice. There are three input boxes for the reproduction rates to update the number of altruists and egoists in each haystack. > 'reproduction' is the additional mice in the next generation per existing mouse > 'altruism-group-benefit-b' is the group benefit of altruism > total additional mice in the next generation per altruist in the haystack > allocated randomly over all mice in the haystack > 'altruism-personal-cost-c' is the decrease in reproduction for each altruist > incurred by the altruists only Mathematically (following Bergstrom), if N is the number of existing mice in the haystack, x is the proportion of altruists, r is the base reproduction, b is the group benefit (additional mice) and c is the personal cost (to each altruist): > Base reproduction: Each altruist in the group allows an additional b mice across the group, so the base reproduction rate is increased by b/N per altruist. Overall, there are xN altruists, so the additional reproduction rate is (bx). > Egoist reproduction: Each egoist produces (r+bx) new mice in the next generation because they receive the group benefit at no cost plus the base reproduction. > Altruist reproduction: Each altruist would have produced (r+bx) new mice, but gave up c mice for the good of the group, so their reproduction rate is (r+bx-c). The 'Population Counts' monitor displays the combined haystack total number of altruists (blue) and egoists (red). Total is displayed in the 'Population' output. The 'Altruist Proportion' monitor displays the number of altruists as a proportion of the total altruist and egoist population. There are two sliders to control the iterative isolation and mixing process. The 'founding-popn-N' slider sets the total number of mice in each haystack at the beginning of the isolation phase. The 'generations-T' slider sets the number of generations for which mice will reproduce within their haystack during the isolation phase. At the end of the isolation phase, new founding populations are established for each haystack. The mix of altruists and egoists is proportional to the entire mouse population. Conceptually, this is equivalent to drawing these founding populations randomly from the mice in every haystack and any mice left over die. The cycle of reproduction and mixing continues until an evolutionary stable equilibrium has been achieved. At this point the entire mouse population is altruistic (in which natural selection at the group level has occurred) or egoistic (in which natural selection at the individual level has occurred). The mix of altruists and egoists in each haystack initially is controlled by two sliders. The 'initial-prop-altruists-x' slider sets the proportion of altruists in the population at the start of the simulation. This proportion changes over time due to differential reproduction rates. The 'assortativity-a' slider affects how the founding mice are distributed between haystacks at the start of each isolation phase. A value of 0 means that all haystacks have a mix of altruist and egoist mice in the same proportion. A value of 1 means that some haystacks have only altruistic mice and others have only egoistic mice, but no haystack has a mixed population. This is operationalised using the subgroup matching method: if (a) is the index of assortativity, then the first proportion (a) of the haystack's founding population is of one type (with the type is selected randomly using the population proportion). The remainder of the founder population is generated with the type selected randomly at the individual level. WHAT HAPPENS WHEN RUNNING THE SIMULATION WITH THE DEFAULT SETTINGS? ------------------------------------------------------------------- The default settings have been selected to demonstrate that egoists win in normal evolutionary arrangements. That is, egoists do better than altruists and eventually comprise the whole population despite an equal mix at the start. The settings are: 1 base reproduction 4 additional reproduction for haystack per altruist 1 personal cost of altruism That is, altruists give up their base personal reproduction to provide a group benefit of additional reproduction that is shared between all the mice in their haystack. 10 haystacks 10 founding population per haystack 3 generations between mixing 0.5 initial proportion altruists 0 assortativity WHAT HAPPENS WITH CHANGES IN THE INTERFACE SETTINGS? ---------------------------------------------------- To demonstrate Maynard Smith's idea, changes are only required in 3 of the settings. The other settings are available for further exploration. Use the same settings for reproduction rates, initial proportion of altruists and number of haystacks. Only the altruism in isolated populations will be changed. Variation 1: small founding population 3 founding population per haystack 3 generations between mixing 0 assortativity The small founding population size per haystack produces greater variation in the proportion of altruists within each haystack. Thus, there are some haystacks with much higher initial proportions of altruists and hence much higher reproduction rates. Altruists will (usually) win. Variation 2: moderate founding population, longer isolation 5 founding population per haystack 25 generations between mixing 0 assortativity With founding populations of 5 mice per haystack, there is variation in the altruist proportions, but 3 generations is insufficient for those higher altruist haystacks to develop much larger mice numbers. However, extending the isolation phase will (usually) allow altruists to win. Variation 3: positive assortativity 10 founding population per haystack 3 generations between mixing 0.5 assortativity With the default settings of 10 founding mice per haystack, variation in altruist proportions is small. However, higher assortativity increases this variation by making it more likely that altruist mice will stick together. Altruists will (usually) win, even with a short isolation phase. GAME THEORY BACKGROUND ---------------------- There are two types of games used extensively in evolutionary biology: the conflict game of Prisoners' Dilemma, and the cooperation game of Stag Hunt. PRISONERS' DILEMMA: Consider the situation where two people commit a crime. The police have enough evidence to convict the offenders of a lesser crime, but need the testimony of either one to convict the other of the more serious crime. The police offer a deal: confess and testify to receive a reduced sentence. Each offender has to choose whether to confess without knowledge of the choice of the other offender. If they both confess, they each receive sentences of 5 years. If neither confesses, they are sentenced to 2 years. If only one confesses, that offender receives no sentence and the other receives 10 years. It is clearly in the interest of each to confess, but that leads to a worse outcome than if neither confesses. STAG HUNT: Consider the situation where two (or more) people are required to successfully hunt a stag. Alternatively, each person could decide to hunt a rabbit. The amount of food available per person from a successful stag hunt is more than he or she would obtain from a successful rabbit hunt. However, the stag hunt is only successful if all the hunters participate. The benefits of participating in the stag hunt are higher than not participating, so participants are not being altruistic. The best response for a hunter is to participate in the stag hunt if all others participate, but to hunt rabbits if any of the others decides to do so. Therefore, the stag hunt requires a level of cooperation and trust. Within a haystack, the egoists always reproduce faster than the altruists, so the haystacks model is usually set up with the same incentives as a Prisoners' Dilemma. However, if there is a very high proportion of altruists and their share of additional reproduction is greater than their personal costs to obtain that reproduction, then the game is of Stag Hunt form. However, Maynard Smith's thesis does not rely on this Stag Hunt solution. Instead, altruist populations can emerge even within a Prisoners' Dilemma game if subpopulations with higher levels of altruism remain isolated for some time. CREDITS AND REFERENCES ---------------------- This model was developed by Jennifer Badham (research@criticalconnections.com.au) in September 2011. Maynard Smith J 1964, "Group selection and kin selection" in Nature, No. 4924 (March 14, 1964), pp 1145-1147. Bergstrom T 2002, "Evolution of Social Behavior: Individual and Group Selection" in Journal of Economic Perspectives, vol 16(2), pp 67-88. @#$#@#$#@ 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 lander true 0 Polygon -7500403 true true 45 75 150 30 255 75 285 225 240 225 240 195 210 195 210 225 165 225 165 195 135 195 135 225 90 225 90 195 60 195 60 225 15 225 45 75 leaf false 0 Polygon -7500403 true true 150 210 135 195 120 210 60 210 30 195 60 180 60 165 15 135 30 120 15 105 40 104 45 90 60 90 90 105 105 120 120 120 105 60 120 60 135 30 150 15 165 30 180 60 195 60 180 120 195 120 210 105 240 90 255 90 263 104 285 105 270 120 285 135 240 165 240 180 270 195 240 210 180 210 165 195 Polygon -7500403 true true 135 195 135 240 120 255 105 255 105 285 135 285 165 240 165 195 line true 0 Line -7500403 true 150 0 150 300 line half true 0 Line -7500403 true 150 0 150 150 pentagon false 0 Polygon -7500403 true true 150 15 15 120 60 285 240 285 285 120 person false 0 Circle -7500403 true true 110 5 80 Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90 Rectangle -7500403 true true 127 79 172 94 Polygon -7500403 true true 195 90 240 150 225 180 165 105 Polygon -7500403 true true 105 90 60 150 75 180 135 105 plant false 0 Rectangle -7500403 true true 135 90 165 300 Polygon -7500403 true true 135 255 90 210 45 195 75 255 135 285 Polygon -7500403 true true 165 255 210 210 255 195 225 255 165 285 Polygon -7500403 true true 135 180 90 135 45 120 75 180 135 210 Polygon -7500403 true true 165 180 165 210 225 180 255 120 210 135 Polygon -7500403 true true 135 105 90 60 45 45 75 105 135 135 Polygon -7500403 true true 165 105 165 135 225 105 255 45 210 60 Polygon -7500403 true true 135 90 120 45 150 15 180 45 165 90 square false 0 Rectangle -7500403 true true 30 30 270 270 square 2 false 0 Rectangle -7500403 true true 30 30 270 270 Rectangle -16777216 true false 60 60 240 240 star false 0 Polygon -7500403 true true 151 1 185 108 298 108 207 175 242 282 151 216 59 282 94 175 3 108 116 108 target false 0 Circle -7500403 true true 0 0 300 Circle -16777216 true false 30 30 240 Circle -7500403 true true 60 60 180 Circle -16777216 true false 90 90 120 Circle -7500403 true true 120 120 60 tree false 0 Circle -7500403 true true 118 3 94 Rectangle -6459832 true false 120 195 180 300 Circle -7500403 true true 65 21 108 Circle -7500403 true true 116 41 127 Circle -7500403 true true 45 90 120 Circle -7500403 true true 104 74 152 triangle false 0 Polygon -7500403 true true 150 30 15 255 285 255 triangle 2 false 0 Polygon -7500403 true true 150 30 15 255 285 255 Polygon -16777216 true false 151 99 225 223 75 224 truck false 0 Rectangle -7500403 true true 4 45 195 187 Polygon -7500403 true true 296 193 296 150 259 134 244 104 208 104 207 194 Rectangle -1 true false 195 60 195 105 Polygon -16777216 true false 238 112 252 141 219 141 218 112 Circle -16777216 true false 234 174 42 Rectangle -7500403 true true 181 185 214 194 Circle -16777216 true false 144 174 42 Circle -16777216 true false 24 174 42 Circle -7500403 false true 24 174 42 Circle -7500403 false true 144 174 42 Circle -7500403 false true 234 174 42 turtle true 0 Polygon -10899396 true false 215 204 240 233 246 254 228 266 215 252 193 210 Polygon -10899396 true false 195 90 225 75 245 75 260 89 269 108 261 124 240 105 225 105 210 105 Polygon -10899396 true false 105 90 75 75 55 75 40 89 31 108 39 124 60 105 75 105 90 105 Polygon -10899396 true false 132 85 134 64 107 51 108 17 150 2 192 18 192 52 169 65 172 87 Polygon -10899396 true false 85 204 60 233 54 254 72 266 85 252 107 210 Polygon -7500403 true true 119 75 179 75 209 101 224 135 220 225 175 261 128 261 81 224 74 135 88 99 wheel false 0 Circle -7500403 true true 3 3 294 Circle -16777216 true false 30 30 240 Line -7500403 true 150 285 150 15 Line -7500403 true 15 150 285 150 Circle -7500403 true true 120 120 60 Line -7500403 true 216 40 79 269 Line -7500403 true 40 84 269 221 Line -7500403 true 40 216 269 79 Line -7500403 true 84 40 221 269 x false 0 Polygon -7500403 true true 270 75 225 30 30 225 75 270 Polygon -7500403 true true 30 75 75 30 270 225 225 270 @#$#@#$#@ NetLogo 4.1 @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ default 0.0 -0.2 0 0.0 1.0 0.0 1 1.0 0.0 0.2 0 0.0 1.0 link direction true 0 Line -7500403 true 150 150 90 180 Line -7500403 true 150 150 210 180 @#$#@#$#@ 0 @#$#@#$#@