Local interaction models of evolutionary games

File prefix: Export SVG?
Mutation rate: Allow mutations?
Topology: Show edges?
Show stroke?
Population size:
Edge prob:
Neighbourhood:
Wrap at edge?
Lattice width:
Lattice height:
Population size:
Rewire prob:
Interaction radius:
Agent display: Size:
Base game:

Legend

This web application provides an interactive interface for the exploration of a number of different local interaction models of evolutionary games.

In brief, a local interaction model is a two-player game played on a graph \(G=(V,E)\). The graph, consisting of a set of nodes \(V\) (also known as vertices) and edges \(E\), can be thought of as representing the social structure of the population — at least, the social structure relevant for the interactions studied. Each node \(v_i\in V\) represents a single player, and an edge \( (v_i, v_j) \in E\) represents the fact that the player \(v_i\) stands in a binary social relation to the player \(v_j\). (Think of the social relation as the friendship relation, for example.)

There are four different graph structures possible. They are:

  1. Two dimensional lattices
  2. Small-world networks constructed using the Watts-Strogatz algorithm
  3. Cycle graphs (a special case of the above obtained by setting the rewiring probability to 0)
  4. Random graphs

Selecting a graph topology under Parameters will cause some of the options available to change. For example, a lattice needs to know the height and width of the lattice, how individuals are connected (also known as the neighbourhood), and whether the lattice is supposed to wrap at the edges. None of these parameters are relevant for small-world networks, and so those parameters are hidden. For a small-world network, the relevant parameters are the population size, the interaction radius (that is, how many people on the left and right of the ring each player is connected to), and the rewiring probability. Under the Watts-Strogatz algorithm, once the basic graph structure is obtained, there is a fixed probability \(p\) of each edge being "rewired". If an edge is rewired, the target of that edge is randomly reassigned to another member of the population, excluding both the source and the original target. For a random graph, the only parameters are the population size and the probability of an edge being included (from the set of all possible edges). Note that if the edge probability is too low, it is likely that the graph won't be connected.

Initial conditions. When a simulation is started, each player is assigned a strategy at random with all strategies equally likely. Strategies are represented by a consecutive range of integers, starting with 0. The colour-coding for each strategy is displayed in the legend below the Parameters panel. If you want a different set of initial conditions, they can be specified using the "Initialise polymorphism" button with the specified arrays of strategies and probabilities. The contents of the Strategies text box should be a Javascript array of integers, with no gaps. Call this array \(\vec s = (s_1,\dots, s_k)\). The contents of the Probabilities text box should be a Javascript array of probabilities. Call this array \(\vec p = (p_1,\dots, p_k) \). It must be the case that \( \sum p_i = 1\) because \(p_i\) is the chance of \(s_i\) being assigned to a player in the initial conditions.

Mutation. If the "Allow mutations?" check box is ticked, at the start of each iteration each player has the specified chance of adopting a strategy at random. All strategies are equally likely to appear.

What happens each iteration? Each time the simulation is stepped forward, each individual (represented by a node) plays the specified base game with all of their neighbors. Each player receives a total score equal to the sum of all payoffs received. After this, each player compares their payoff with the payoff of all of their neighbours. If a player received a score strictly lower than the highest-scoring person in their neighbourhood, then they select a strategy from the set of highest-scoring strategies at random. (This is known as the learning rule imitiate-the-best.) After updating their strategy, the display is updated to reflect the change of strategies in the population.

The display. If a lattice is selected, the graph is set out in the standard grid-graph format: nodes arranged according to the width and height of the lattice. For all other graphs, the default display is calculated using a force layout algorithm: all nodes repel each other, two nodes connected by an edge attract each other, and — beginning from an initial circular layout — the graph is stepped forward for a number of iterations until it reaches a minimal-energy configuration. During the initial layout, the buttons labelled "Circular Embedding" and "Force-based Layout" will be disabled until the stable configuration is reached. Once the final configuration is reached, those buttons can be used to toggle the graph display, as sometimes the circular embedding reveals information obscured by the force-based layout.

The display can be zoomed and panned, to more closely inspect the graph structure. This can be done using standard methods: a scroll wheel, two-fingered swipe down/up, pinch/expand on touch devices, or by clicking on the / buttons in the lower-right hand corner of the display. To return to the original view, click .

Nodes in the game are drawn either as circles or squares, colour-coded to indicate the strategy used by the player. The display shape has no effect on the semantics of the simulation, it is purely to aid visibility. Why? For small-world networks, circular nodes are usually the clearest. For lattices, especially large lattices on the order of \(100\times 100\) or \(200\times 200\), suppressing the edges and using squares sized so that the agents are adjacent to each other, is usually best. Parameters related to the display which do not affect the details of the simulation can usually be adjusted in real-time without requiring the simulation to be reset.

The size of each node can be adjusted. The overall display fits within an SVG container of width 100 and height 100. A size of 1 will, for a circular node, set the radius of the circle to 1 and, for a square node, set the width and height to 1.

The base game. A number of different games are available. They are:

  • The Centipede game (10 stages)
  • A pure two-strategy coordination game:
    Do ThisDo That
    Do This (1,1) (0,0)
    Do That (0,0) (1,1)
  • Divide-the-dollar
  • The Hi-Lo game, a coordination game with one of the outcomes superior to the other
    Hi Lo
    Hi (2,2) (0,0)
    Lo (0,0) (1,1)
  • The prisoner's dilemma, with payoffs selected so as to favour the spread of Cooperate on the lattice
    Cooperate Defect
    Cooperate (1,1) (-0.1, 1.1)
    Defect (1.1, -0.1) (0, 0)
  • The prisoner's dilemma, with payoffs selected so as to result in chaotic behaviour on a lattice with the Moore 8 neighbourhood selected (as found by Nowak and May)
    Cooperate Defect
    Cooperate (1,1) (0, 1.61)
    Defect (1.61, 0) (0.01, 0.01)
  • The game of Rock-Paper-Scissors
    Rock Paper Scissors
    Rock (0,0) (-1, 1) (1,-1)
    Paper (1, -1) (0, 0) (-1,1)
    Scissors (-1, 1) (1,-1) (0, 0)

If you have any questions about this simulation,