CS代考 Project 6 – Hawks and Doves Use the program HawksandDoves.nlogo.

Project 6 – Hawks and Doves Use the program HawksandDoves.nlogo.
The program implements the game theory model of Hawks and Doves described in the notes.
The population size is Ntot. There are Ntot/2 patches with food (coloured grey). Two agents are placed on each of these patches. The strategies are H or D.
The payoffs are

Copyright By PowCoder代写 加微信 powcoder

H beats D and gets the full value V
D loses and gets nothing
Two doves share, or each wins half the time with no cost
Two hawks fight. Either they pay half the cost and get half the value, or one randomly gets V and the other loses C
The fitness of each individual is set to w = 1 + g, where g is the payoff that the individual gets from the contest. The maximum possible fitness is wmax = 1 + V (when a Hawk beats a Dove). Each individual has a probability w/wmax of producing an offspring. The population is kept constant by killing random individuals until the population falls back to Ntot. This means that individuals reproduce at a rate proportional to their fitness, and they die at an equal rate independent of their fitness.
Each individual has a probability h of playing the Hawk strategy. The program begins with two pure strategies: pure Hawks (h = 1) and pure Doves (h = 0). There is a slider to set the initial frequency of hawks, p0. To determine whether H can invade D, start with a low fraction of H (p0 = 0.02) and ask whether H increases when rare. To determine whether D can invade H, start with a low fraction of D (p0 = 0.98 means the D fraction is 0.02).
Q1. Pure Hawks and Pure Doves (10 marks)
(a) Set V = 0.5 and C = 1.0. From the theory of the hawk-dove model, what should the ESS be? Show that with these parameters, H can invade D, and D can also invade H. Save the graphs of density as a function of time and include them in the report. Show that these densities tend to the expected values from the ESS theory after a long time. Save the graphs of fitness as a function of time. Comment on these. Is the fitness of H or D higher initially? If one fitness is higher than the other, what happens to the densities of the strategies? Show that the fitnesses of D and H both tend to the expected mean frequency of the ESS theory after a long time.
(b) Repeat this for V = 1.5 and C = 1.0.
Comment on any differences in case (b) from case (a).

Q2 Winners and Losers (10 marks – include the code in the report for this part)
Save the old program and make a new version of the file to add the following changes. In the first version of the program, payoffs were shared when there were two equal opponents, i.e. two Doves get V/2 each and two Hawks get (V-C)/2 each. Now change this so that there is a winner and a loser. When there are two Doves, one of the two (at random) gets V and the other gets nothing. When there are two Hawks, one of them (at random) gets V and one gets –C. Note that when there is one H and one D, there is already a winner and a loser, so you don’t need to change this part.
Set the parameters to V = 0.5 and C = 1, as in Q1(a). Repeat the analysis with the Winners and Losers version and compare it with your results from the Shared-payoff version. Are these equivalent?
Q3 Mixed Strategies (10 marks – include the code in the report for this part)
Go back to the program from Q1 with the shared payoffs, and save a new version of this. Here we will consider two strategies A and B with probabilities hA and hB of playing hawk, which can take any value in the range 0 to 1.
Instead of using blue and red turtles for pure D and pure H, let
blue = resident strategy A, initial frequency 1 – p0 = 0.98, hawk probability hA
red = invader strategy B, initial frequency p0 = 0.02, hawk probability hB
Add sliders for hA and hB. In the setup, set the initial h values to these values instead of 0 and 1. These values will be inherited by future generations of turtles (because turtles own h).
(a) Use V = 0.5, and C = 1. The ESS strategy is hESS = V/C. Set hA = 0, and hB = hESS. What do you expect will happen? Can the ESS invade the population of Doves? Run the program and show that the result is consistent with ESS theory.
(b) With the same V and C, what happens if A is pure hawks and B is the ESS?
(c) Consider cases where the resident, A, is the ESS. What does the theory predict? Consider invaders that are either all H or all D. Show that the results are consistent with the theory.
Q4 The Bourgeois Strategy (10 marks – include the code in the report for this part)
Once again start from the program with all H competing with all D and shared payoffs. In this version we will add a third strategy called bourgeois B (as in the lecture notes). Change the program so that turtles own two variables, hown and hint, which determine the probability of playing H if the turtle is an owner or an intruder. Use green turtles for B, red for H and blue for D. Start the program with equal frequencies of the three strategies.
H has hown = 1 and hint = 1 D has hown = 0 and hint = 0 B has hown = 1 and hint = 0
The program is written so that there is an order of arrival of the two turtles at the food patch. Turtle t1 is the first to arrive – call it the owner. Turtle t2 is the second to arrive – call it the intruder. Re-write the rest of the program, so that it correctly accounts for the Bourgeois strategy.

Consider two cases:
(a) V = 0.5 and C = 1 (where the ESS of the simple HD game is mixed)
(b) V = 1.5 and C = 1 (where the ESS of the simple HD game is all H)Describe what
happens in the two cases and show the plots. What happens to the mean fitness of the population when the B strategy wins? How does this compare to the mean fitness in the long time limit of the simple HD game?
Total Marks 40 for this sheet.

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com