Skip to content

giakoumoglou/game_theory_spatial_PD

Repository files navigation

1. Game Theory: Spatial Prisoner's Dilemna

made-with-matlab License: MIT View Spatial Prisoners Dilemna on File Exchange forks stars issues-open issues-closed size

This script is a simulation of Martin A. Nowak and Robert M. May paper about "Evolutionary Games and Spatial Chaos" 1992. It is created by N. Giakoumoglou, M. Demetriou and P. Manouselis for a presentation in Game Theory course in May 2020.

1.1 The Spatial Prisoner's Dilemna

In spatial prisoner's dileman there are two players those who always cooperate, C, and those who always defect, D. We place those players on a two dimensional lattice (grid), each lattice site is occupied either by a C or a D. In each round of the game (each generation), the players play the PD game with nearest neighboring sites and with one's own site (thus we define these sites as a territory – a 3x3 grid). The score for each player is the sum of the payoffs in these encounters with neighbors. At the start of the next generation, each lattice-site is occupied by the player with the highest score among the previous owner and the immediate neighbors. Boundaries are fixed but we can also define the lattice as a torus. Conclusions we will deduct remain true if players interact only with the four orthogonal neighbors in square lattices or self-interactions are included.

1.2 The Prisoner's Dilemna Game

The PD can be formulated in tabular form as follows, where T > R > P ≥ S

C D
C R=1 S=0
D T=b>1 P=0

1.3 Chaos in the Spatial PD game

The dynamical behavior of the system depends on the parameter b.

  • (b > 1.8) 2x2 or larger cluster of D will continue to grow at the corners.
  • (b < 1.8) big D cluster will shrink
  • (b < 2) 2x2 or larger cluster of C will continue to grow
  • (b > 2) C clusters do not grow
  • (2 > b > 1) C clusters can grow in regions of D and vice versa

Chaos persists in shifting patterns C → D, D → C, D → D, C → C

1.4 Some Examples

Color assignments:

  • C → C blue
  • D → D red
  • D → C yellow
  • C → D green

fc = frequency of cooperators
limT→inf fc = 12log2 – 8 = 0.318 can be proven
Although this approximation always works when we have 10% random D and 1.8<b<2 we don’t know why it does so!

1.4.1 10% D randomly at 99x99 lattice, T=200, b=1.6

1.4.2 10% D randomly at 99x99 lattice, T=200, b=1.9

1.4.3 10% D randomly at 99x99 lattice, T=200, b=2.5

1.4.4 1 D at the center of the 99x99 lattice, T=2000, b=1.9

1.4.5 8 Neighbors (thus self interaction exluded)

  • “Interesting Region" is 5/3>b>8/5 (here b=1.62 with 10% random D)
  • Similar symmetric patterns 
  • fc → 0.299

1.4.6 5 Neighbors (including self)

  • “Interesting Region” is 2>b>5/3 (here b=1.8 with 10% random D)
  • Similar symmetric patterns 
  • fc  → 0.374

1.4.7 4 Neighbors (thus self interaction exluded)

  • “Interesting Region” is 3/2>b>4/3 (here b=1.4 with 10% random D)
  • Similar symmetric patterns 
  • fc → 0.374

1.5 Conclusions and Applications

Although the details of the patterns depend on the value of b, a wide range of values leads to chaotic patterns whose nature is almost always independent of the initial proportions of C and D. Such deterministically generated spatial structures may model and describe pre-biotic evolution of cooperation (among molecules, cells or organisms) as well as Turing models and 2-state Ising models.

2. Code

  • Spatial_PD_4_NN.m: In this implementation, the spatial PD game is played among 4 orthogonal neighbours. One can define the following parameters for the PD game:
    • b: Defection payoff
    • torus: If ~0, define the lattice as a torus, 0 else
    • p: Proportion of defectors in [0, 1]
    • self_interaction: If 0, self interaction is excluded, if ~0, included
    • rounds: Number of rounds/generation/time step
    • n : Squared lattice side size
    • printLattice : If 1, prints the lattice over rounds
    • printFc: If 1, prints the frequency of cooperators over rounds
    • limit: If >0, prints limit in fc as a horizontal line
  • Spatial_PD_8_NN.m: In this implementation, the spatial PD game is played among 4 orthogonal neighbours. One can define the following parameters for the PD game:
    • b: Defection payoff
    • torus: If ~0, define the lattice as a torus, 0 else
    • p: Proportion of defectors in [0, 1]
    • self_interaction: If 0, self interaction is excluded, if ~0, included
    • rounds: Number of rounds/generation/time step
    • n: Squared lattice side size
    • flag: If 1, places a single D in the center of the nxn lattice (n must be odd to work correctly)
    • printLattice: If 1, prints the lattice over rounds
    • printFc: If 1, prints the frequency of cooperators over rounds
    • limit: If >0, prints limit in fc as a horizontal line
  • main.m: Includes the reproduction of the figures of the paper and much more!

3. Support

Reach out to me:

4. Citation

About

This script is a simulation of Martin A. Nowak and Robert M. May paper about "Evolutionary Games and Spatial Chaos" 1992.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages