Conditional Defection in the Commons (Pay to escape) — from the Modeling Commons

Model was written in NetLogo 7.0.0 • Viewed 23 times • Downloaded 0 times • Run 0 times

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


WHAT IS IT?

This model simulates the evolution of sustainable and unsustainable (greedy) harvesting strategies in a shared commons under conditions of monitoring and punishment. It is an updated NetLogo implementation of the second model presented in the article:

Ibrahim, A.M. The conditional defector strategies can violate the most crucial supporting mechanisms of cooperation. Sci Rep 12, 15157 (2022). https://doi.org/10.1038/s41598-022-18797-2

The model explores how different agent types (sustainable harvesters, greedy harvesters, punishers, and escapers) interact in the commons, and how punishment, escape attempts, and monitoring accuracy affect sustainability outcomes.

Key finding: The model highlights how escaping cheaters (Conditional defector agents who cooperate to reduce the perception accuracy of the punishers.) can undermine punishment mechanisms and kin selection that would otherwise enhance cooperation, thereby threatening the evolutionary stability of sustainable strategies.

HOW IT WORKS

  • The world is a grid of patches with renewable resources.

  • Agents (turtles) harvest resources with either sustainable (low) or greedy (high) strategies.

  • Some sustainable agents are punishers:

They monitor their neighborhood within a radius of 2 patches.

punishers pay a perception cost for detecting greedy agents.

Upon detection, punishers can sanction cheaters depending on the punishment rule:

Kill → remove the cheater.

Fine → subtract a fine from the cheater’s harvest, which is redistributed among neighboring agents.

Suspend harvest once → prevent cheater from harvesting in the current round.

Punishers also pay an additional punishment cost when applying sanctions.

  • Greedy agents are escapers.

They monitor their neighborhood within a radius of 2 patches.

If punishers are nearby, escapers can attempt to avoid detection by paying an escape cost.

These escape costs are summed up, every round, into a global interference level.

The interference reduces the effective detection accuracy of punishers in proportion to the total escape energy wasted.

  • Agents update their energy after harvest and costs, reproduce with mutation, or die if their energy is depleted.

  • Resources regrow logistically each round.

THINGS TO NOTICE

  • The effectiveness of punishment in suppressing greed when no escapers are present.

  • How the introduction of escapers undermines punishment:

Escapers invest energy in escape attempts when punishers are nearby.

The accumulated escape energy generates interference, reducing detection accuracy.

As interference grows, greedy agents escape more frequently, avoiding sanctions.

  • Key insight: even though punishment and kin selection usually promote cooperation, the presence of escaping cheaters, "conditional defectors," can erode both mechanisms, allowing greed to persist or dominate.

HOW TO USE IT

  • Number-Agents: number of agents initialized.

  • Percent-Sustainables: proportion of sustainable harvesters.

  • Percent-Punishers: proportion of sustainables that are punishers.

  • Harvest-sustainable: harvest amount for sustainable agents.

  • Harvest-greedy: harvest amount for greedy agents.

  • Living-costs: baseline energy cost per round.

  • Costs-perception: the costs in units of energy that punishing agents have to pay for perceiving other agents.

  • Costs-punishment: the costs in units of energy that punishing agents have to pay to punish other agents. All punishing agents of an agent divide the costs of punishment.

  • Costs-escape: the costs in units of energy that escaping cheater agents have to pay for avoiding detection.

  • Fine: fine imposed on cheaters when punishment is "pay fine".

  • Punishment: mode of punishment ("kill", "pay fine", or "suspend harvest once").

  • Growth-rate: intrinsic growth rate of resources.

  • Carrying-capacity: maximum resource capacity per patch.

  • Mutation-rate: probability of trait mutation during reproduction.

  • Death-rate: baseline mortality rate.

  • Perception-accuracy: base probability of detecting greedy harvesters.

  • interference-scale: strength of interference caused by escape energy waste.

  • Buttons:

  • setup: initializes agents and resources.

  • go: runs the simulation continuously.

THINGS TO TRY

  • Change Costs-escape and Harvest-greedy to see whether escape becomes an effective strategy.

  • Increase Fine or switch Punishment type to test different enforcement regimes.

  • Explore how Perception-accuracy interacts with interference-scale.

EXTENDING THE MODEL

  • Add spatial mobility beyond local moves (migration dynamics).

  • Allow heterogeneous perception and escape ranges for punishers and cheaters, respectively.

  • Explore the coevolution of resource regeneration parameters with harvesting behavior.

NETLOGO FEATURES

  • Uses turtles-own and patches-own to manage agent and resource states.

  • Implements logistic resource growth with carrying capacity.

  • Employs detection accuracy modified by interference, combining agent-level and global variables.

  • Mutation is implemented directly in reproduce.

RELATED MODELS

  • Models in the NetLogo library: Commons, Altruism, Evolutionary Strategies.

  • Other commons dilemma and cooperation models that explore punishment, monitoring, or resource harvesting.

CREDITS AND REFERENCES

This model is an update of the second model from: * Ibrahim, A.M. The conditional defector strategies can violate the most crucial supporting mechanisms of cooperation. Sci Rep 12, 15157 (2022). https://doi.org/10.1038/s41598-022-18797-2

NetLogo: Wilensky, U. (1999). NetLogo. Center for Connected Learning and Computer-Based Modeling, Northwestern University.

Licence

CC BY-NC-SA 3.0

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. http://creativecommons.org/licenses/by-nc-sa/4.0/

Comments and Questions

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

Click to Run Model

turtles-own [
  harvestPref
  harvest-amount
  punisher?
  escaper?
  aware-of-who
  energy
  harvest
  punished?
  escape-attempts
  escaped-this-round?
  detected-this-round?
]

patches-own [ resource ]

globals [
  commons
  commonsResources
  total-escape-attempts
  total-successful-escapes
  round-escape-energy-wasted
  interference-level
]

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; SETUP
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to setup
  clear-all
  set total-escape-attempts 0
  set total-successful-escapes 0
  set round-escape-energy-wasted 0
  set interference-level 0

  ask n-of Number-Agents patches [
    sprout 1 [
      set shape "circle"
      set size 0.8
      set punished? false
      set aware-of-who turtle-set nobody
      set escape-attempts 0
      set escaped-this-round? false
      set detected-this-round? false
      set harvest 0

      ifelse random-float 100 < Percent-Sustainables [
        set harvestPref "low"
        set harvest-amount Harvest-sustainable
      ] [
        set harvestPref "high"
        set harvest-amount Harvest-greedy
      ]

      ifelse random-float 100 < Percent-Punishers and harvestPref = "low"
        [ set punisher? true ]
        [ set punisher? false ]

      ifelse harvestPref = "high" [
        set escaper? true
      ] [
        set escaper? false
      ]

      set energy Living-costs + 1
      update-color
    ]
  ]

  ask patches [
    set resource Carrying-capacity
    set pcolor scale-color brown resource 0 (Carrying-capacity + 30)
  ]

  reset-ticks
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; GO
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to go
  if count turtles = 0 [ stop ]

  set round-escape-energy-wasted 0
  ask turtles [
    set escaped-this-round? false
    set detected-this-round? false
    set harvest 0
  ]

  ask turtles [ harvesting ]

  ask turtles with [punisher?] [
    set aware-of-who turtle-set nobody
  ]

  escape-behavior
  update-interference
  sense-cheaters

  ask turtles with [ escaped-this-round? and not detected-this-round? ] [
    set total-successful-escapes total-successful-escapes + 1
  ]

  punish

  ask turtles [
    set energy energy + harvest
    expend-energy
    reproduce
    death
  ]

  ask patches [
    regrow
    recolor
  ]

  tick
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ESCAPE
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to escape-behavior
  ask turtles with [ harvestPref = "high" and escaper? ] [
    if energy > Costs-escape [
      let potential-punishers turtles in-radius 2 with [ punisher? ]
      if any? potential-punishers [
        set energy energy - Costs-escape
        set round-escape-energy-wasted round-escape-energy-wasted + Costs-escape
        set escape-attempts escape-attempts + 1
        set escaped-this-round? true
        set total-escape-attempts total-escape-attempts + 1
      ]
    ]
  ]
end 

to update-interference
  ifelse round-escape-energy-wasted > 0 [
    ifelse interference-scale > 0 [
      set interference-level round-escape-energy-wasted * interference-scale
      if interference-level < 0 [ set interference-level 0 ]
      if interference-level > 1 [ set interference-level 1 ]
    ] [
      set interference-level 0
    ]
  ] [
    set interference-level 0
  ]
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; HARVESTING
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to harvesting
  ifelse Punishment = "suspend harvest once" and punished?
    [ set harvest 0 ]
    [ harvest-commons ]

  set punished? false
end 

to harvest-commons
  set commons (patch-set neighbors patch-here)
  set commonsResources sum [resource] of commons
  let commonsList sort-on [(- resource)] commons

  ifelse commonsResources < harvest-amount [
    set harvest commonsResources
    ask commons [ set resource 0 ]
    move-away
  ] [
    let remaining-need harvest-amount
    foreach commonsList [ the-patch ->
      if remaining-need > 0 [
        let available [resource] of the-patch
        ifelse available <= remaining-need [
          set harvest harvest + available
          set remaining-need remaining-need - available
          ask the-patch [ set resource 0 ]
        ] [
          set harvest harvest + remaining-need
          ask the-patch [ set resource resource - remaining-need ]
          set remaining-need 0
        ]
      ]
    ]
  ]
end 

to move-away
  let next-patch max-one-of (neighbors with [ not any? turtles-here ]) [resource]
  if next-patch != nobody [
    move-to next-patch
    set energy energy - 1
  ]
end 

to sense-cheaters
  ask turtles with [punisher?] [
    set harvest harvest - Costs-perception

    let cheaters turtles in-radius 2 with [harvestPref = "high"]
    let base-accuracy Perception-accuracy
    let effective-accuracy base-accuracy * (1 - interference-level)
    if effective-accuracy < 0 [ set effective-accuracy 0 ]
    if effective-accuracy > 100 [ set effective-accuracy 100 ]
    let detected []
    foreach sort cheaters [ c ->
      if random-float 100 < effective-accuracy [
        set detected lput c detected
        ask c [ set detected-this-round? true ]
      ]
    ]

    set aware-of-who detected
  ]
end 

to punish
  ask turtles with [ harvestPref = "high" and punished? = false] [
    let punishers (turtles-on neighbors) with [ member? myself [aware-of-who] of self]
    if any? punishers [
      set punished? true
      if Punishment = "kill" [ die ]
      if Punishment = "pay fine" [
        set harvest harvest - Fine
        set punished? false
        ask turtles-on neighbors [
          set harvest harvest + (Fine / (count turtles-on neighbors))
        ]
      ]
      ask punishers [
        set harvest harvest - (Costs-punishment / count punishers)
      ]
    ]
  ]
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; LIFE CYCLE
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to expend-energy
  set energy energy - Living-costs
end 

to reproduce
  let birthrate 0.001 * energy
  if random-float 1 < birthrate [
    let destination one-of neighbors with [ not any? turtles-here ]
    if destination != nobody [
      hatch 1 [
        move-to destination
        set punished? false
        set aware-of-who turtle-set nobody
        set escape-attempts 0
        set escaped-this-round? false
        set detected-this-round? false
        set harvest 0
        mutate
        set energy ([energy] of myself / 2)
      ]
      set energy (energy / 2)
    ]
  ]
end 

to mutate
  if random-float 100 < Mutation-rate [
    ifelse harvestPref = "high" [
      set harvestPref "low"
      set escaper? false
      set harvest-amount Harvest-sustainable
    ] [
      set harvestPref "high"
      set harvest-amount Harvest-greedy
    ]
  ]

  if random-float 100 < Mutation-rate and harvestPref = "low" [
    set punisher? not punisher?
  ]

  ifelse harvestPref = "high" [
    set punisher? false
    set escaper? true
  ] [
    set escaper? false
  ]

  update-color
end 

to update-color
  ifelse harvestPref = "low" [
    ifelse punisher?
      [ set color green ]
      [ set color turquoise ]
  ] [

    set color red
  ]
end 

to death
  if energy <= 0 [ die ]
  if random-float 100 < Death-rate [ die ]
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; RESOURCES
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to regrow
  ifelse resource > 0 [
    let growth-amount (Growth-rate * resource) * (1 - (resource / Carrying-capacity))
    set resource resource + growth-amount
    if resource > Carrying-capacity [ set resource Carrying-capacity ]
  ] [
    set resource 0.1
  ]
end 

to recolor
  set pcolor scale-color brown resource 0 (Carrying-capacity + 30)
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; REPORTERS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to-report escape-success-rate
  if total-escape-attempts <= 0 [ report 0 ]
  report (100 * total-successful-escapes) / total-escape-attempts
end 

to-report current-interference-level
  report interference-level * 100
end 

to-report current-effective-accuracy
  report Perception-accuracy * (1 - interference-level)
end 

to-report round-escape-payments
  report round-escape-energy-wasted
end 

to-report detection-rate
  let detectable-cheaters turtles with [harvestPref = "high" and not escaped-this-round?]
  if not any? detectable-cheaters [ report 0 ]
  let detected count turtles with [harvestPref = "high" and detected-this-round?]
  report (100 * detected) / count detectable-cheaters
end 

There is only one version of this model, created about 6 hours ago by Ahmed Ibrahim.

Attached files

File Type Description Last updated
Screenshot 2025-09-28 034948.png png image about 2 hours ago, by Ahmed Ibrahim Download

This model does not have any ancestors.

This model does not have any descendants.