Public Goods Game

Public Goods Game preview image

1 collaborator

Tags

public goods game 

Tagged by Jaroslaw Miszczak about 1 year ago

Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.2.1 • Viewed 139 times • Downloaded 11 times • Run 0 times
Download the 'Public Goods Game' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


WHAT IS IT?

Implementation if Public Goods Game on a square lattice. Details of the game can be found in the Wikipedia article https://en.wikipedia.org/wiki/Publicgoodsgame

HOW IT WORKS

Turtles play Public Goods Game. The

HOW TO USE IT

The model has the follwoing parametres:

  • world-size - size of the lattice used in the simulation
  • neighborhood-type - the neighbourhood used to play an elementay game (von Neumann or Moore)
  • noise-factor - thermal noise in the system, used in the Fermi-Dirac function for the imitation
  • synergy-factor - multipicatice constant in the Public Goods Game, used to calculate a payoff of a single game

THINGS TO TRY

Try to observe how the noise-factor and synergy-factor influence the fraction of players with free-rider strategy.

EXTENDING THE MODEL

Only fixed types of neighborhood are implemented. This cane be extended to the neighbourhoods with random number of neighbours.

Als, one can include movement of the turtles.

NETLOGO FEATURES

This implementation is based on turtles, and as such it can be extended to include te movement of the agents.

RELATED MODELS

(models in the NetLogo Models Library and elsewhere which are of related interest)

CREDITS AND REFERENCES

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

;;
;; turtles atributes
;;
turtles-own [
  contribution ;; player's contribution: 1 - contributor, green, 0 - free-rider, black
  income ;; income from the last round
  neighborhood ;; group of players used for playng the game
]

;;
;; setup the world
;;

to setup
  clear-all
  setup-world
  setup-turtles
  reset-ticks
end 

;;
;; main subroutine
;;

to go
  ;; play the public goods game for all turtles
  ask turtles [
    play-pgg
  ]
  ;; udate the strategy using the cumulative income from the round
  ask turtles [
    ;; calculate new strategy
    imitate-strategy
    ;; update visual representation
    update-colors
    ;; reset the income for the next round
    set income 0
  ]
  tick
end 

;;
;; world initialization
;;

to setup-world
  ;; make the world with custom size
  resize-world 0 (world-size - 1) 0 (world-size - 1)
  ;; heuristic scaling of the patch size
  set-patch-size floor ( 64 / (sqrt world-size) )

  ask patches [
    ;; make all patches white
    set pcolor white
    ;; add one turtle to each patch
    sprout 1
  ]
end 

;;
;; setup routine
;; contains selection of the initial strategies
;;

to setup-turtles
  ask turtles [
    ;; initializa the income
    set income 0
    ;; randomle assign initial strategies
    ifelse random-float 1.0 < 0.5 [
      set contribution 1 ;; cooperator
    ] [
      set contribution 0 ;; no contribution, free-rider
    ]
    update-colors
  ]
end 

;;
;; helper function to update visual aspects of turtles
;;

to update-colors
  ifelse contribution = 1 [
    set color green
  ] [
    set color black
  ]
end 

;;
;; evolution routine
;;

to play-pgg

  ;; choose which neighborhood to use
  (ifelse neighborhood-type = "von Neumann" [
    set neighborhood neighbors4
  ] neighborhood-type = "Moore" [
    set neighborhood neighbors
  ]
  )

  ;; calculate the payoff
  let game-payoff synergy-factor * (contribution + sum [ contribution ] of turtles-on neighborhood) / (1 + count turtles-on neighborhood)
    set income income + game-payoff - contribution

  ask turtles-on neighborhood [
    set income income + game-payoff - contribution
  ]
end 

to imitate-strategy
  ;; select one of the neighbors
  let my-neighbor one-of turtles-on neighborhood
  let my-neighbor-income [ income ] of my-neighbor

  ;; select new strategy using Fermi-Dirac function
  if random-float 1.0 < 1 / (1 + exp ( ( income - my-neighbor-income  ) / noise-factor  ) )   [
    set contribution [ contribution ] of my-neighbor
  ]
end 

;;
;; reporters
;;

to-report cooperators-fraction
  report count turtles with [ contribution = 1 ] / count turtles
end 

There is only one version of this model, created about 2 years ago by Jaroslaw Miszczak.

Attached files

File Type Description Last updated
Public Goods Game.png preview Preview for 'Public Goods Game' about 2 years ago, by Jaroslaw Miszczak Download

This model does not have any ancestors.

This model does not have any descendants.