Economics 670/509D, Agent-based Policy Modeling
Assignment 5
The Prisoner¡¯s Dilemma & the Genetic Algorithm
CD
C D
Figure 1: The Prisoner¡¯s Dilemma, Y, Z > 0 In the previous assignment, you did the following:
3,3
0,3+Y
3+Y,0
Z,Z
6. Now assume that agents have strategies. Have agents save a short history, of length history-length. The history lists the behavior of the opponents they encountered. For example, if some agent faces three opponents who play, in order, C, C, D, and history-length = 2, then the agent¡¯s history at the end would be (C, D).
Start at 1 and create fixed strategies. There are two possible length 1 histories: (C) and (D). So one strategy would be (C,C), which means ¡°if my opponent played C, I will play C, and if my opponent played D, I will play C.¡± or (D,C), which means ¡°if my opponent played C, I will play D, and if my opponent played D, I will play C.¡± (Ask if this does not make sense.) Therefore, there are four possible strategies in this case: (C,C),(C,D),(D,C), and (D,D).
Do the same process as previous, where you keep track of the population of each of these four types and then evaluate the populations at 2000 ticks. Is there a pattern?
Now:
1. Extend this model with genetic algorithms. We are going to let each agent be/have a single gene and begin with a history-length of 1. First implement reproduction with mutation, with some mutation rate that is a slider. Run for 500 ticks, and use BehaviorSpace to measure total wealth and total population at the end of that time. Use BehaviorSearch to find a mutation rate that maximizes total wealth at the end of this time.
2. Now expand to crossover. When a turtle is ready to reproduce, assume it chooses a close by, high-value turtle (use your discretion in this implementation) for crossover reproduction. Use BehaviorSpace to evaluate: does crossover increase the success of the population (as measured by total wealth and total population).
3. Now expand to history-length = 3. Reevaluate the question asked in the previous part: Does crossover increase the success of the population?
4. One of the claims in the Holland article is that ¡°Tit-for-Tat¡± will do better than other available strategies, even in history-length = 3. Evaluate this question using BehaviorSpace. Do you find this?
5. Submit your code and writeup via email to me and the TA with the subject line ¡°Assignment 5, NetLogo Version X.X.X¡± where X.X.X is the version of NetLogo that you used to write your code. Note your code must be runnable. If it does not run, you will not get any credit for this assignment!
1