Aggressiveness Sim
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
This model aims to simulate the evolution, via natural selection, of aggressiveness in a population. It is very interesting to observe the success of these traits in a carefully managed population.
HOW IT WORKS
There are two types of turtles: aggressive turtles, which are red and shown by the red line on the graph, and nonaggressive turtles, which are blue and shown by the green line on the graph. Each turtle needs 2 food to survive, and another 2 food to reproduce (so 4 food total to survive AND reproduce). Intermediate amounts of food lead to corresponding chances of survival and reproduction. For example, 1 food will lead to a 50% chance of survival, while 2.5 food will lead to survival and a 25% chance of reproduction. Each cycle of the simulation, some randomly determined patches will grow 4 food. Each turtle will find a patch with food. If it is alone, it will eat all 4 food, thus reproducing. If it ends up on the same patch as a 2nd turtle, then if both turtles are nonaggressive, each turtle will get 2 food and survive; if both turtles are atggressive, each turtle will get somewhere between 0 and 1.5 food; and if there is one of each, the nonagressive one wil get between 0 and 1.5 food; the aggressive one will get between 2.5 and 4 food. If there are not enough patches with food for there to be no more than 2 turtles per patch, the extra turtles will automatically die.
HOW TO USE IT
First, one must setup the simulation:
- The percentAgrAtStart slider determines what percent of turtles will be aggressive when you click setup.
- the numStartingTurtles slider determines the amount of turtles that are created after you click setup.
- The worldWidth and worldHeight sliders control the width and height, respectively, of the world (in patches).
- Note that world size does not affect the results of the simulation and is purely visual.
You are now ready to click setup and configure the simulation rules.
- The numFood slider determines the number of patches that will grow food each round.
- The slightlyRandomFood? switch, when turned on, will allow for a random +/- 5 variation in the amount of patches that grow food each cycle, to create some variation between cycles.
- The agr-agrFood slider controls how much food each aggressive turtle gets when encountering another aggressive turtle.
- The agr-nonAgrFood slider controls how much food the aggressive turtle gets when encountering a nonaggressive turtle.
- Note that the nonaggressive turtle will then get 4 - [whatever the slider is set to]
- The oldAge? switch, when turned on, will cause turtles to keep track of and die from old age.
- The deathAge slider determines the age, in cycles, at which turtles will die.
- The slightlyRandomDeath? switch, when turned on, will lead to +/- 3 random variation in a turtle's deathAge.
- The Add One Aggressive Turtle and the Add One Nonaggressive Turtle buttons can be pressed at any point while the simulation is running to insert one turtle of the respective type into the simulation.
- The whatTurtlesAlone? dropdown lets one choose which turtles, if any, prefer to be alone on a patch rather than sharing the patch with another turtle, when the amount of available patches permits this.
- The waitTime slider determines how long, in seconds, the feeding time lasts. This is purely visual and does not affect the results of the simulation. This slider also affects how long the turtles wiggle before going to a random food, also not affecting the results of the simulation. Setting this slider to 0 is perfect for running cycles very quickly, thus tracking the effects of various options over multiple generations in a short period of time.
THINGS TO NOTICE
Notice how at different combinations of simulation rules, the equilibrium that is achieved, as seen in the graph that shows the population of both aggressive and nonaggressive turtle, is different. This equilibrium can be determined algebraically by calculating and comparing the expected food values per cycle of each type of turtle; an equilibrium is achieved then these values are equal. Also notice how a population of all nonaggressive turtles will achieve a greater total population than a population of mixed turtles (or all aggressive turtles) under the same conditions, as can be seen on the total population graph. This shows how natural selection doesn't always lead to what is best for the species, but rather what is best for each trait. This can be tested by starting with wither all nonaggressive turtles or all aggressive turtles and then adding a couple of the opposite type of turtles using the buttons, and observing how that affects both realtive and total populations. Also note that it is easiest to spot patterns when waitTime is set to 0, since this allows the simulation to run cycles quicker.
THINGS TO TRY
We recommend starting at the following values for how much food turtles get, and playing around from there: agr-agrFood = 0, agr-nonAgr food = 3.
RELATED MODELS
Check out the models in the Social Science category of the models library: many of them explore or simualte similar principles to the ones shown in this simulation. More specifically: Altruism, Cooperation, and the models in the Prisoner's Dillema folder.
CREDITS AND REFERENCES
This model is mostly based on this video by Primer: https://youtu.be/YNMkADpvO4w?si=U0TPOxsYml1Sqmwo. Credit to this video for sparking my interest in behavioral simulations and the prisoner's dillema: https://youtu.be/mScpHTIi-kM?si=7q3HA5SyK_TxGaLV. Credits to the programs in the Model Library/Social Science/Prisoner's Dillema folder for helping inspire some functionality in this simulation.
Comments and Questions
turtles-own [agr age deathAgeX] patches-own [foodAmount splitPcnt] to setup ca reset-ticks resize-world ((worldWidth - 1) / -2) ((worldWidth - 1) / 2) ((worldHeight - 1) / -2) ((worldHeight - 1) / 2) updateFood cro numStartingTurtles [ setxy random-xcor random-ycor set color (blue) set agr 0 set age 0 ifelse slightlyRandomDeath? [ set deathAgeX (deathAge + ((random 6) - 3)) ] [ set deathAgeX deathAge ] ] ask n-of ((percentAgrAtStart / 100) * numStartingTurtles) turtles [ set color red set agr 1] updateFood tick end to go wait 0.05 updateFood ask patches [ set splitPcnt 500] repeat 100 * waitTime [ ask turtles [ wiggle wait 0.0005]] ask turtles [ getToAnyFood ] ask turtles [ goToSoloDuoFood ] ask turtles [ splitFood ] ask turtles [ updateAge] wait waitTime tick end to getToAnyFood let foodPatches (patches with [foodAmount = 4]) move-to one-of foodPatches end to goToSoloDuoFood let foodPatches (patches with [foodAmount = 4]) ifelse (((count turtles-here) > 1) and any? (foodPatches with [count turtles-on self = 0])) [ let soloFoodPatch one-of (foodPatches with [(count (turtles-on self) < 1)]) if whatTurtlesAlone? = "all" [ move-to soloFoodPatch set heading random 360 bk 0.4] if whatTurtlesAlone? = "onlyArg" and agr = 1 [ move-to soloFoodPatch set heading random 360 bk 0.4] if whatTurtlesAlone? = "onlyArg" and agr = 0 [ move-to soloFoodPatch set heading random 360 bk 0.4]][ ifelse ((count turtles-here) > 2) [ ifelse (any? (foodPatches with [count turtles-on self < 2])) [ let duoFoodPatch one-of (foodPatches with [(count (turtles-on self) < 2)]) move-to duoFoodPatch set heading random 360 bk 0.4 ] [ die ]] [ set heading random 360 bk 0.4]] end to updateFood cp ask patches [ set pcolor brown - 3] ifelse slightlyRandomFood? [ let totalFood numFood + ((random 10) - 5) if totalFood < 0 [ set totalFood 0] ask n-of totalFood patches [ set foodAmount 4 set pcolor green ]] [ ask n-of numFood patches [ set foodAmount 4 set pcolor green ]] end to wiggle fd (1 + ((random 5) + 1) * 0.1) lt random 45 rt random 45 end to splitFood ifelse splitPcnt != 500 [ if (splitPcnt < 50) and ((random 50) >= splitPcnt) [ die] if (splitPcnt > 50) and (((random 50) + 50) < splitPcnt) [ hatch 1 [ set age 0 ifelse slightlyRandomDeath? [ set deathAgeX (deathAge + ((random 6) - 3)) ] [ set deathAgeX deathAge ]]] ] [ ifelse (count turtles-here) = 1 [ hatch 1 [ set age 0 ifelse slightlyRandomDeath? [ set deathAgeX (deathAge + ((random 6) - 3)) ] [ set deathAgeX deathAge ]]] [ if (agr = 0) and (([agr] of one-of other turtles-here) = 0) [ set splitPcnt 50] if (agr = 0) and (([agr] of one-of other turtles-here) = 1) [ set splitPcnt (agr-nonAgrFood * 25) if (((random 50) + 50) < splitPcnt) [ die]] if (agr = 1) and (([agr] of one-of other turtles-here) = 0) [ set splitPcnt (100 - (agr-nonAgrFood * 25)) if ((random 50) + 50) >= (agr-nonAgrFood * 25) [ hatch 1 [ set age 0 ifelse slightlyRandomDeath? [ set deathAgeX (deathAge + ((random 6) - 3)) ] [ set deathAgeX deathAge ]]] ] if (agr = 1) and (([agr] of one-of other turtles-here) = 1) [ set splitPcnt (agr-agrFood * 25) if random 50 >= splitPcnt [ die]] ]] end to addAgr cro 1 [ set agr 1 set color red setxy random-xcor random-ycor ifelse slightlyRandomDeath? [ set deathAgeX (deathAge + ((random 6) - 3)) ] [ set deathAgeX deathAge ]] end to addNon cro 1 [ set agr 0 set color blue setxy random-xcor random-ycor ifelse slightlyRandomDeath? [ set deathAgeX (deathAge + ((random 6) - 3)) ] [ set deathAgeX deathAge ]] end to updateAge if oldAge? [ set age age + 1 if age >= deathAgeX [ die]] end
There is only one version of this model, created 3 days ago by Samuel Sunko.
Attached files
No files
This model does not have any ancestors.
This model does not have any descendants.