3.14. Lab 13: Evolution of cooperation¶
Due Date: 11:59pm March 22, 2024 Labs should be submitted as a single Jupyter notebook to CourseLink Dropbox This lab counts for 4% of the final grade |
To do in advance of this lab:
Make sure you have run the code in Allen Downey’s Chapter 12 notebook.
3.14.1. Exercises¶
Complete the exercises corresponding to Exercise 12.1 – 12.2 in Chapter 12 of Think Complexity (version 2):
The simulation in this notebook depends on a number of conditions and parameters that the author chose arbitrarily. As an exercise, explore other conditions to see what effect they have on the results. Here are some suggestions:
Vary the initial conditions: instead of starting with all defectors, see what happens if you start with all cooperators, all TFT, or random agents.
In
Tournament.melee
, the agents are shuffled at the beginning of each time step, so each agent plays against two randomly-chosen agents. What happens if you don’t shuffle? In that case, each agent would play against the same neighbors repeatedly. That might make it easier for a minority strategy to invade a majority, by taking advantage of locality.Since each agent only plays against two other agents, the outcome of each round is highly variable: an agent that would do well against most other agents might get unlucky during any given round, or the other way around. What happens if you increase the number of opponents each agent plays against during each round? Or what if an agent’s fitness at the end of each step is the average of its current score and its fitness at the end of the previous round?
The function Downey chose for
prob_survival
varies from 0.7 to 0.9, so the least fit agent, withp=0.7
, lives for 3.33 timesteps, on average, and the most fit agent lives for 10 timesteps. What happens if you makeprob_survival
more or less “aggressive”?The author chose
num_rounds=6
so that each element of the genome has roughly the same impact on the outcome of a match. But that is substantially shorter than what Alexrod used in his tournaments. What happens if you increasenum_rounds
? Note: if you explore the effect of this parameter, you might also want to create an instrument to measure the niceness of the last 4 elements of the genome, which will be under more selective pressure asnum_rounds
increases.The author’s implementation has differential survival but just random reproduction. What happens if you add differential reproduction?
In these simulations, the population never converges to a state where a majority share the same, presumably optimal, genotype. There are two possible explanations for this outcome: one is that there is no optimal strategy, because whenever the population is dominated by a majority genotype, that condition creates an opportunity for a minority to invade; the other possibility is that the mutation rate is high enough to maintain a diversity of genotypes even if the majority is non-optimal. To distinguish between these explanations, try lowering the mutation rate to see what happens. Alternatively, start with a random population and run without mutation until only one genotype survives. Or run with mutation until the system reaches something like a steady state; then turn off mutation and run until there is only one surviving genotype. What are the characteristics of the genotypes that prevail in these conditions?
3.14.2. Submission¶
Please submit a single Jupyter notebook which completes the above exercises, filling in Allen Downey’s Chapter 12 notebook. There are already placeholders in the notebook for your work.