A Proximity model of the Nash Bargaining Game

Dr J McKenzie Alexander

Department of Philosophy, Logic and Scientific Method
London School of Economics and Political Science

Description

This simulation implements a proximity-based local interaction model of divide-the-cake, the simplest version of the Nash bargaining game.

Agents are initially assigned a random strategy, representing how many slices of cake they want. The strategies range between asking for nothing (0 pieces of cake) and asking for the entire cake (10 pieces). At the start of each round of play, individuals connect to all agents who are within a certain distance. They then play divide-the-cake with each of these agents. All interactions are pairwise, so don't confused this model with that of the proximity-based model discussed in chapter 7 of The Structural Evolution of Morality. That model considers an N-player variant of divide-the-cake.

After everyone has interacted, players use imitate-the-best to adopt a new strategy. If more than one strategy has earned the maximal score in an agent’ neighbourhood, the tie is broken by a coin toss.

Once all interactions and potential updating has been performed, agents move a little bit. The wandering is not exactly a random walk, as they change their heading less frequently than they move.

How to use it

Click on "Setup" to initialize the model. Click "Step" to move the simulation forward one iteration. Clicking "Go" will cause the model to run forever (or at least until the "Go" button is clicked again to switch it off).

You can initialize the model to two special initial states by clicking on the “all-greedy” or “all-modest” buttons. The rest of the controls should be self-explanatory.

System Requirements.

The applet requires Java 5 or higher. Java must be enabled in your browser settings. Mac users must have Mac OS X 10.4 or higher. Windows and Linux users may obtain the latest Java from Sun's Java site.

View/download model file: Proximity model.nlogo


Procedures
breed [agents agent]


agents-own [
  strategy
  score
  interaction-radius
]

to setup
  clear-all
  set-default-shape agents "circle"
  
  create-agents population-size [
    setxy random-xcor random-ycor
    set strategy (random 11)
    set interaction-radius (random-float maximum-interaction-radius)
    set color (to-color strategy)
  ]
  update-plot
end

to go
  move-agents
  connect-agents
  interact
  update
  if (allow-mutations?) [
    check-for-mutations
  ]
  update-plot
  tick
end

to move-agents
  ask agents [
    if (random-float 1.0) < 0.1 [
      right random 360
    ]
    fd 0.1
  ]
end

to connect-agents
  ask links [die]
  ask agents [
     create-links-with (other agents) in-radius interaction-radius 
  ]
end

to interact
  ask agents [
    let new-score 0
    let my-strategy strategy
    
    ask link-neighbors [
      if ( [strategy] of self ) + my-strategy <= 10 [
        set new-score (new-score + my-strategy)
      ]
    ]
    
    set score new-score
  ]
end

;; This iterates through the list of neighbors and uses imitate-the-best to update
to update
  ask agents [
    let my-score score
    let list-of-best-strategies []
    let best-score score
    
    ask link-neighbors [
      let neighbors-score ([score] of self)
      let neighbors-strategy ([strategy] of self)
      
      if-else (neighbors-score > best-score) [
        set list-of-best-strategies (list neighbors-strategy)
        set best-score neighbors-score
      ] 
      [
        if (neighbors-score = best-score) [
           set list-of-best-strategies (lput neighbors-strategy list-of-best-strategies)
        ] 
      ]
    ]
    
    if (best-score > my-score) [
      set strategy one-of list-of-best-strategies
      set color (to-color strategy)
    ]
    
  ]
end

to check-for-mutations
  ask agents [
    if (random-float 1.0) < mutation-rate [
      set strategy (random 11)
      set color (to-color strategy)
    ]
  ]
end

to all-greedy
  ask agents [
    set strategy 10
    set color (to-color strategy)    
  ]
  ask links [die]
  clear-all-plots
end

to all-modest
  ask agents [
    set strategy 0
    set color (to-color strategy)    
  ]
  ask links [die]
  clear-all-plots
end

to update-plot
  foreach [0 1 2 3 4 5 6 7 8 9 10] [plot-strategy ?]
end

to plot-strategy [s]
  set-current-plot-pen (word s)
  plot count agents with [strategy = s]
end

to-report to-color [s]
  report (item s [red orange brown yellow turquoise lime sky blue violet magenta gray])
end