Conditional Defection (cooperate for the spread)

Conditional Defection (cooperate for the spread) preview image

1 collaborator

Default-person Ahmed Ibrahim (Author)

Tags

agent-based model 

Tagged by Ahmed Ibrahim about 6 hours ago

cooperation 

Tagged by Ahmed Ibrahim about 6 hours ago

game theory 

Tagged by Ahmed Ibrahim about 6 hours ago

natural selection 

Tagged by Ahmed Ibrahim about 6 hours ago

population dynamics 

Tagged by Ahmed Ibrahim about 6 hours ago

selfishness 

Tagged by Ahmed Ibrahim about 6 hours ago

social dilemma 

Tagged by Ahmed Ibrahim about 6 hours ago

social evolution 

Tagged by Ahmed Ibrahim about 6 hours ago

Visible to everyone | Changeable by everyone
Model was written in NetLogo 7.0.0 • Viewed 5 times • Downloaded 2 times • Run 0 times
Download the 'Conditional Defection (cooperate for the spread)' 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?

  • This model examines the conditional cooperation of selfish agents, who typically act as defectors but temporarily cooperate when migration or dispersal is necessary. It is based on the first model described in this 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

  • Key finding: The model highlights how agents that would usually overexploit common resources can still form temporary alliances to share the costs of migration, thereby overcoming spatial structure mechanisms and group (multilevel) selection that would otherwise enhance cooperation, thereby threatening the evolutionary stability of cooperating strategies.

HOW IT WORKS

  • Agents (turtles) are normally defectors, i.e., they harvest resources greedily.

  • However, when migration becomes necessary (e.g., when local resources decline), these selfish agents adopt a conditional rule:

  • They temporarily cooperate with other defectors to migrate as a group.

  • The dispersal costs are shared, allowing them to colonize new areas.

  • Once settled in a new patch, they revert to selfish harvesting.

  • The cycle of overexploitation → cooperation for dispersal → settlement repeats, creating complex evolutionary dynamics.

  • Group dispersal range is the spatial radius within which selfish agents can share the costs of migration.

  • The larger the dispersal range, the more potential selfish agents are available to share migration costs.

  • If the dispersal range is very small or zero, selfish agents cannot share costs with neighbors. In this case, they behave like traditional defectors.

  • The group dispersal range is not confined to greedy agents but applies to all agents. Therefore, it represents the case of the wild-type cooperators who can also cooperate for the spread.

HOW TO USE IT

  • Sliders and parameters allow control of:

  • Number of agents

  • Carrying capacity of patches

  • Costs of migration

  • Growth rate of resources

  • Mutation rate of agents

  • Group dispersal range (defines the neighborhood radius within which agents can cooperate for migration)

  • Setup initializes the world with agents and resource patches.

  • Go runs the simulation step by step.

  • Agents are colored according to their role (defectors vs. cooperators).

  • Plots show population changes, average energy, and resource dynamics over time.

THINGS TO NOTICE

  • Watch how defectors normally go extinct but survive and dominate when they form successful migratory groups

  • Larger group dispersal range promotes conditional defectors, while smaller or zero range eliminates it, turning conditional defectors back into traditional defectors.

  • Group dispersal events can preserve selfish populations that would otherwise collapse.

THINGS TO TRY

  • Change the group dispersal range and observe how it alters the ability of defectors to cooperate for migration.

  • Adjust the migration cost to see whether individuals can migrate alone or must rely on others.

EXTENDING THE MODEL

  • Introduce punishment or monitoring (from the second model of the paper) and observe interactions.

  • Vary the dispersal radius to see if conditional defectors still dominate when movement options change.

KEY RESULTS

  • Conditional defectors who succeed in dispersal by splitting the costs of migration manage to:

  • Outcompete cooperators.

  • Undermine multilevel selection, group selection, and spatial structure mechanisms that normally support cooperation.

  • The strategy of “cooperate only for dispersal” provides a powerful evolutionary advantage to selfish agents, especially when the group dispersal range is large enough to facilitate cost sharing.

NETLOGO FEATURES

  • Uses agent-based conditional rules where strategies switch depending on context.

  • Implements group migration as a collective action problem among selfish individuals.

  • Resource regeneration and patch-based carrying capacity reflect ecological constraints.

RELATED MODELS

  • Evolution of Cooperation (NetLogo Models Library)

  • Commons Dilemma models

  • The second model in the same paper (conditional defection via “Pay for the escape”).

CREDITS AND REFERENCES

  • Based on: 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 version: (specify your version, e.g., 6.1).

Original model implementation adapted from the authors’ supplementary material.

For the NetLogo-Software:

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

breed [plants plant]
breed [foragers forager]

foragers-own
[eattype
 energy
 flockmates
 mypatch
 strategy]

patches-own [
  is-gap?
  seedpatch?
  seedpatchnum
  foodpatch?
  foodpatchnum
  assortindex
  resource]

globals
[patch-width
 gap
 foodpatchlist
 growth-rate
 carryingcap
 costchild
]

to setup
  clear-all

  set patch-width Size-Resource-Areas
  set gap Distance-Resource-Areas
  set growth-rate 0.2
  set carryingcap 10

  setup-plants
  setup-frgs
  set costchild 10

  reset-ticks
end 

to setup-plants
 foreach [ 0 1 2 3 4 5 6 7 8 9 10 11 12 13]
  [ x  ->
      foreach [ 0 1 2 3 4 5 6 7 8 9 10 11 12 13] [ y  ->
  ask patches with [ pxcor = ( gap / 2 ) + (x * ( gap + (patch-width )))  and pycor =  ( gap / 2 ) + (y * (gap + (patch-width))) ]
  [set seedpatch? true
        sprout-plants 1 [set hidden? true]
        set seedpatchnum [who] of plants-here
   ]
  ]
  ]

  ask patches with [seedpatch? = true]
  [ let localpatch (patch-set self patches in-radius patch-width)
    ask localpatch
     [ set resource carryingcap

       if resource = 0 [set resource 0.1]
        set pcolor scale-color brown resource 0 (carryingcap + 10)
        set foodpatch? true
        set foodpatchnum [seedpatchnum] of localpatch with [seedpatch? = true]

    ]
  ]

  set foodpatchlist (  [who] of plants )
end 

to setup-frgs
  ask n-of (Number-Agents * Percent-Sustainables / 100) patches with [foodpatch? = true]
  [sprout-foragers 1
    [
      set eattype "low"
      set strategy "cooperator"
      set color green
      set mypatch [foodpatchnum] of patch-here ]
  ]

   ask n-of (Number-Agents * ( 100 - Percent-Sustainables) / 100) patches with [foodpatch? = true]
  [sprout-foragers 1
    [
      set eattype "high"
      set strategy "defector"
      set color red
      set mypatch [foodpatchnum] of patch-here
    ]
  ]

  ask foragers [
    if Agents = "People" [ set shape "person"]
    if Agents = "Bacteria" [ set shape "bacteria" ]
    if Agents = "Cows" [ set shape "cow"]
    if Agents = "Cells" [ set shape "cell"]
  set size 2
  set energy Living-costs]
   ask foragers
  [ ask  patches in-radius patch-width [ set is-gap? false ] ]
end 

to go

   ask foragers [ flock ]
   ask foragers [
    if Agents = "People" [ set shape "person"]
    if Agents = "Bacteria" [ set shape "bacteria" ]
    if Agents = "Cows" [ set shape "cow"]
    if Agents = "Cells" [ set shape "cell"]]

  move
  eat
  if Evolution? [reproduce]
  expend-energy
  if Evolution? [death]

  ask patches with [foodpatch? = true]
  [regrow
    recolor]

  tick
end 

to flock
  find-flockmates
end 

to find-flockmates
  set flockmates other foragers in-radius group-dispersal-range with [strategy = [strategy] of myself]
end 

to move
  ask foragers
  [let local ( patch-set patch-here ( patches in-radius 2 with [not any? foragers-here] ))
   if local != nobody
    [let local-max  ( max-one-of local [resource]  )
    ifelse local-max != nobody and [resource] of local-max >= Living-costs
      [face local-max
        move-to local-max
        set mypatch [foodpatchnum] of patch-here
      ]
      [if any? ( patches in-radius 2 with [not any? foragers-here] )
        [move-to one-of ( patches in-radius 2 with [not any? foragers-here] )]]
      if is-gap? != false and (count flockmates >= 1) [set energy (energy - (dispersal-costs / (count flockmates + 1)) )]
      if is-gap? != false and (count flockmates = 0) [set energy (energy - dispersal-costs)]
  ]
  ]
end 

to eat
  ask foragers
  [ifelse eattype = "low"
    [ set  energy energy + ([resource] of patch-here * 0.5)
      ask patch-here [set resource resource / 2]]
    [ set  energy energy + ([resource] of patch-here * 0.99)
      ask patch-here [set resource resource - (0.99 * resource) ]]
  ]
end 

to reproduce
 ask foragers
  [ let birthrate 0.0005 * energy
  if energy > costchild and random-float 1 < birthrate [
     let destination one-of neighbors with [not any? turtles-here]
     if destination != nobody [
        hatch 1 [
          move-to destination
          mutate
          set energy costchild ]
        set energy (energy - costchild)
       ]
      ]
      ]
end 

to mutate
  if random-float 1 < Mutation-rate
  [
    let new-strategy one-of ["cooperator" "defector"]
    set strategy new-strategy

    ifelse strategy = "cooperator"
      [set eattype "low"]
      [set eattype "high"]

    update-color
  ]
end 

to expend-energy
  ask foragers [set energy energy - Living-costs ]
end 

to death
  ask foragers
  [if energy <= 0 [die]
  ]
end 

to regrow
  ifelse resource >= 0.1
  [set resource precision (resource + ((growth-rate * resource) * (1 - (resource / carryingcap )))) 3]
  [set resource 0.1]
end 

to recolor
  set pcolor scale-color brown resource 0 (carryingcap + 10)
end 

to update-color
  if strategy = "cooperator" [set color green]
  if strategy = "defector" [set color red]
end 

to calcassort
  foreach (foodpatchlist) [ x ->
    let foodpatch patches with [foodpatchnum = x]
    let lowfrgs count foragers with [eattype = "low" and mypatch = x]
    let frgs count foragers with [ mypatch = x]
    ask patches with [seedpatch? = true and seedpatchnum = x]
      [ set assortindex (lowfrgs / frgs) ]
    ]
end 

to-report avenhigh
  report sum [energy] of foragers with [eattype = "high"] / count foragers with [eattype = "high"]
end 

to-report avenlow
  report sum [energy] of foragers with [eattype = "low"] / count foragers with [eattype = "low"]
end 

to-report gensim-pop
  report ( count patches with [seedpatch? = true] - 1) / (count foragers - 1)
end 

to-report avassort
  report sum [assortindex] of patches with [seedpatch? = true] / count patches with [seedpatch? = true]
end 

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

Attached files

File Type Description Last updated
Conditional Defection (cooperate for the spread).png preview Preview for 'Conditional Defection (cooperate for the spread)' about 6 hours ago, by Ahmed Ibrahim Download

This model does not have any ancestors.

This model does not have any descendants.