Hawk/Dove Simulation homework95

advertisement
Game Theory Simulation, 50 points page - 1
Game Theory 3.0 by Keith F. Goodnight
Introduction
This program models the basic Hawk/Dove/Bourgeois game. In this game, 3
strategies compete against each other for control of a resource which is assumed to
contribute directly to fitness. The three strategies are:
HAWK: Hawks will always fight to obtain the resource.
DOVE: Doves will display, but if actually challenged will retreat without fighting.
BOURGEOIS: Bourgeois will behave as Hawks if they "own" the resource, as Doves if
not.
Players meet each other in pairs, playing a discrete round of the game that ends in one
or the other obtaining the resource. The winner depends on which strategies meet: If Hawk
meets Dove then Hawk gains the resource while Dove gains nothing. If Hawk meets Hawk,
one will win while the other will incur a cost of injury in fighting. If Dove meets Dove, one
will win while both will incur a cost of displaying. When Bourgeois meet, the outcome will
depend not only on the strategy of the opponent but also on the ownership of the resource.
A payoff matrix can be used to indicate the expected payoff for each strategy in an
encounter with each other strategy (such a matrix is displayed on the program's opening
screen). The payoffs are based on the value of the resource and the costs of injury and
display, and on the assumption that an individual will win 50% of the games it plays against
its own strategy. For Bourgeois, the payoff also includes the assumption that it will be the
owner 50% of the time.
The payoffs for each type of encounter lead to a total payoff for each strategy, which
depends on the frequency with with it encounters each strategy in its competitors. The total
fitness obtained by each strategy is therefore frequency dependent, varying with the
frequency of the strategies in the population.
The overall "winner" of the game is an Evolutionarily Stable Strategy (ESS). ESS
refers to a strategy that, if fixed in the population, is secure against invasion by other
strategies but is able to invade populations where competing strategies are present. Which
strategy is the ESS will depend on the payoffs of the particular game; in some cases, the
ESS may not be a pure strategy but may be a mixture of two.
The Program has two distinct modes of operation. One calculates and displays a payoff
matrix for the game, while the other runs a simulation of natural selection on the strategies.
The same controls are available to the user in both modes (see below for a description of the
controls).
The program opens in the payoff mode. The screen shows a payoff matrix, and the
controls that allow you to determine which strategies are playing, the various payoffs, and
the current population frequencies.
The Display menu toggles between two sorts of matrix: The default as the program
opens shows the payoff for each type of encounter. You can also choose to display the net
payoffs obtained by each strategy based on the frequency with which they expect to receive
each of the payoffs shown in the full matrix (i.e. the population frequency of each strategy).
The screen also displays a prediction for the ESS under the current parameters. The
prediction is printed just below the matrix.
In the lower right corner of the window is a button called "Play the Game" which
takes you to the simulation mode of the program. When you click on this button, the screen
changes to show a graph with frequency on the vertical axis and generations on the
horizontal. The simulation will start immediately, tracing out the changes in each strategy's
Game Theory Simulation, 50 points page - 2
frequency over time. The button is still available, its name now changed to "Payoffs."
Clicking it again will return you to the payoff matrix.
Two types of simulations run simultaneously. One is an analytic simulation that
predicts the next generation's frequency of each strategy based on the predicted net payoffs.
This simulation produces a smoothly curving line showing each strategy's fate.
The second simulation is a stochastic model. A simulated population of 1000
individuals is used. These individuals are haploid, each possessing a single gene which
determines their strategy. They each are alloted a certain number of offspring; then they are
randomly paired with each other to play a round of the game. They either gain or lose
offspring based on the outcome of the game. Once everyone has played, each individual
produces however many offspring it has ended up with (the initial "allowance" of offspring
is large enough so that no one will end up with a negative number of offspring, no matter
how badly they lose). Finally, the next generation is produced by randomly selecting 400
individuals from the set of offspring. Because of the random element of this simulation, it
produces a jagged, wavering line on the screen.
Both simulations are run for 200 generations. You can stop the simulation at any time
by operating any of the program controls. Changing any parameter will restart the
simulation; clicking on the "Payoffs" button will return you to the matrix screen.
Menus:
The Apple Menu contains the usual Desk Accessories, plus a choice for an "About
Box."
The File menu lets you save the results of a simulation. The results will be saved as a
text file in a format compatible with most spreadsheet programs as well as graphing
programs such as Cricket Graph. The Save command is only available in simulation mode.
The File menu also contains a Quit command. You can also quit the program by clicking in
the "Close box" of the main window.
The Edit menu is provided for any Desk Accessories that might need the Cut/Paste
operations. None of these commands are used by GameTheory.
The Display menu contains only one command, which allows you to toggle between
the full and net payoffs matrix. It has no effect in simulation mode.
Strategies Playing: In the upper right area of the screen are three checkboxes that
determined which of the three strategies is currently playing. Clicking any of them will add
that strategy to the population; population frequencies are automatically reset so that all
strategies present are in equal frequency (You can change this with the Populations scroll
boxes described below).
Payoffs: Below the check boxes are three scroll bars which control the resource
value, cost of injury, and cost of display. All three parameters can range from 0 to 200.
Populations: At the bottom of the screen are three scroll bars controlling the number
of individuals of each strategy playing the game. The value of each scrollbar represents the
number of individuals in the simulated population; these numbers are used to calculate
frequencies for the payoff matrix. The simulation runs a population of 1000 individuals;
however, you do not have to set the scroll bars to add up to a population of 1000: the
scrollbars represent only the initial (generation 0) population size, and the simulation will
choose 1000 offspring to be the new generation regardless of the size of the generation 0
population. You cannot set a player’s initial population to 0; if you want to remove a player
from the simulation, use the checkboxes described above. Note: In simulation mode, these
values describe the initial conditions of the simulation. They do not change as the simulation
progresses.
Game Theory Simulation, 50 points page - 3
Useful tips:
1. To set equal numbers of each strategy, use the check boxes to add/remove players at the top
right of the screen rather than the scroll boxes at the bottom
2. The analytic result is the smooth curve and represents the theoretical prediction of change in
each generation.
3. The stochastic line is jagged and bumpy. It is an actual simulation and includes randomness in
who plays each other, who wins and which of many offspring surive to the next generation.
4. You do not need to run the simulation to find the ESS. The program indicates the ESS on the
payoff screen.
Download