Skip to main content

Direct Reciprocity

Status

Python-backed. This page describes the moran_models/nowak_mechanisms/direct_reciprocity/ package in the sibling EvolvedCooperation repository. It is not yet a browser replay case study.

Direct reciprocity is cooperation sustained by repeated encounters between the same individuals. An agent is more likely to help a neighbor from whom it has recently received help — "I scratch your back, you scratch mine."

How It Is Implemented Here

Each site carries a reciprocity memory variable alongside its cooperation trait. At each step, expressed cooperation is scaled by that memory:

Bi+=B_plus_scale×hi×clip(baseline+gain×mi,  0,1)B^+_i = \text{B\_plus\_scale} \times h_i \times \text{clip}(\text{baseline} + \text{gain} \times m_i,\; 0, 1)

where mim_i is the site's memory of recently received help. After reproduction, the memory of the offspring is updated from the parent's memory and the positive return it received in the previous step:

midecay×mparent+(1decay)×Rparent+B_plus_scalem_i \leftarrow \text{decay} \times m_{\text{parent}} + (1 - \text{decay}) \times \frac{R^+_{\text{parent}}}{\text{B\_plus\_scale}}

This means agents that have been helped in the past express more cooperation, which tends to attract further help — a direct reciprocal feedback loop.

Key Parameters

ParameterDefaultRole
memory_baseline_expression0.35Minimum cooperation expressed regardless of memory
memory_expression_gain0.85How strongly memory amplifies cooperation expression
memory_decay0.35Weight on previous memory versus recent experience
B_plus_scale1.0Scales cooperative benefit produced per unit trait
C_scale0.2Private cost per unit trait

Python Module Layout

moran_models/nowak_mechanisms/direct_reciprocity/
__init__.py
direct_reciprocity_model.py
direct_reciprocity_pygame_ui.py
config/
direct_reciprocity_config.py

Usage

./.conda/bin/python -m moran_models.nowak_mechanisms.direct_reciprocity.direct_reciprocity_model

Live viewer:

./.conda/bin/python -m moran_models.nowak_mechanisms.direct_reciprocity.direct_reciprocity_pygame_ui

References