Kin Selection
Status
moran_models/nowak_mechanisms/kin_selection/ package in the sibling EvolvedCooperation repository.Kin selection is the first of Nowak's five mechanisms for the evolution of cooperation. Cooperation spreads when the benefit delivered to a recipient, weighted by genetic relatedness, exceeds the private cost paid by the actor — Hamilton's rule: .
Unique robustness. Of the five Nowak mechanisms, kin selection is the most biologically robust initiator of cooperation from rare. It works because offspring inherit the parent's cooperative trait and stay nearby — automatically clustering cooperators together. This spatial proximity is a trivial consequence of reproduction itself, requiring no additional biological conditions. Other mechanisms that also spread cooperation from rare (direct reciprocity with a spatial scaffold) depend on partner stability and memory that are not automatically given. The Nowak Mechanisms overview maps this distinction across all five mechanisms.
How It Is Implemented Here
Relatedness is operationalised through lineage labels. Every site carries an inherited lineage identifier. The positive routing kernel assigns higher weight to same-lineage neighbors than to other-lineage neighbors:
with row normalization applied afterward. Because offspring inherit the parent's lineage label, cooperator clusters accumulate same-lineage neighbors over time, which progressively recirculates more of the cooperative benefit back toward cooperators — the positive feedback that makes cooperation viable.
One Step
One full synchronous kin-selection update runs as follows. All sites update simultaneously.
t to step t + 1.Production
Each site produces cooperative output and pays a private cost proportional to its trait:
Kernel construction
For each producer , a raw routing weight is assigned to each neighbor based on lineage match, then row-normalized so weights sum to 1:
Routing
Each site receives the lineage-weighted share of every neighbor's production:
Fitness score
Local replacement
Each site samples a parent from its local neighborhood via softmax over . The offspring inherits the parent's trait (with small Gaussian mutation) and lineage label. Because the lineage label is inherited, same-lineage clusters grow when local cooperators outcompete their neighbors — the feedback that sustains cooperation.
Variable definitions:
- is site 's cooperation trait in [0, 1]
- is the cooperative benefit produced by site
- is the private cost paid by site
- is the normalized routing weight from producer to recipient
- is the total routed benefit received by site
- is the fitness score used for local replacement
- is the fixed baseline fitness shared by all sites, which dampens selection intensity
Worked Example
Consider a focal site with four von Neumann neighbors, two same-lineage (A) and two other-lineage (B):
| Site | Lineage | Trait |
|---|---|---|
| A | 0.8 | |
| A | 0.7 | |
| A | 0.6 | |
| B | 0.9 | |
| B | 0.5 |
Production
Outgoing kernel row for site
Raw weights: for ; for . Row sum = 2.00, so normalized weights are 0.40 for same-lineage and 0.10 for other-lineage.
What sends
Same-lineage neighbors receive 4× more benefit than other-lineage neighbors.
What receives (assuming symmetric neighborhood structure)
Fitness
Why kinship helps
If were surrounded by four other-lineage neighbors with the same traits, all incoming weights would be 0.10:
The lineage cluster raises fitness from 1.11 to 1.50 — a difference that compounds over many steps as same-lineage cooperators expand together.
Key Parameters
| Parameter | Default | Role |
|---|---|---|
kin_weight_same_lineage | 0.8 | Routing weight toward same-lineage neighbors |
kin_weight_other_lineage | 0.2 | Routing weight toward other-lineage neighbors |
B_plus_scale | 1.0 | Scales cooperative benefit produced per unit trait |
C_scale | 0.2 | Private cost per unit trait |
Hamilton's rule maps onto these parameters as , B_plus_scale, C_scale.
Simulation Results
The Nowak Mechanisms overview reports kin selection as Yes for both spread from rare and maintenance. This page demonstrates both and shows exactly how the mechanism operates.
Scripts: utils/proof_of_mechanism.py and well_mixed/utils/proof_of_mechanism.py. 5 seeds per scenario, 1000 steps each. Success threshold: mean final cooperation trait ≥ 0.60.
Step 1 — Maintenance: cooperation holds when common
Starting cooperation trait ≈ 0.90 (high), default kin bias (same-lineage weight 0.8, other-lineage weight 0.2), .
Result: 5/5 seeds successful. Mean final trait = 0.984.
Cooperation not only persists but rises slightly as the Moran process filters out low-trait agents. The kin-weighted routing recirculates benefit preferentially back toward same-lineage cooperators, creating a fitness premium that fully offsets the private cost. Hamilton's rule () is met and the population locks into near-maximum cooperation.
Step 2 — Spread from rare: kin selection enables invasion
Starting cooperation trait ≈ 0.05 (rare), same kin bias and as above.
Result: 5/5 seeds successful. Mean final trait = 0.872.
From a starting frequency of 5%, cooperation spreads to 87% on average across seeds. Offspring inherit the parent's lineage and stay local, automatically clustering same-lineage cooperators together. The kin-biased routing then preferentially recirculates benefit within those clusters, accelerating their growth. The ablation below isolates how much each component contributes.
Step 3 — Ablations: what breaks the mechanism
| Scenario | Success rate | Mean trait | Interpretation |
|---|---|---|---|
| maintenance_common_start | 5 / 5 | 0.984 | Maintenance confirmed. Kin-biased routing locks cooperation near maximum. |
| spread_from_rare_kin_bias | 5 / 5 | 0.872 | Spread from rare confirmed. Cooperation invades reliably from 5% with kin bias. |
| no_kin_bias_ablation (spatial) | 1 / 5 | 0.488 | Equal kin weights on the same spatial grid — network reciprocity alone. Spread is partial and stochastic. The kin bias amplifies the spatial baseline from 1/5 to 5/5; the spatial structure is the necessary foundation. |
| well_mixed_control (kin preference, no kin proximity) | 0 / 5 | 0.006 | Fully connected population — kin preference active but offspring scattered globally, so no kin proximity. Indistinguishable from the no-kin-bias control (0.005). Confirms that kin proximity (provided automatically by local reproduction) is what makes kin selection work. |
| below_hamiltons_rule (spatial) | 0 / 5 | 0.008 | ( < ). Cooperation collapses from 90% to near zero — Hamilton's rule boundary confirmed within the spatial model. |
What the ablations show. The no-kin-bias ablation removes lineage weighting while keeping local reproduction, leaving only the spatial assortment from offspring proximity. The result — 1/5 seeds, mean 0.488 — is the baseline from local reproduction alone. Kin-biased routing amplifies that to 5/5 by preferentially recirculating benefit within same-lineage clusters. The well-mixed control confirms the other side: kin preference without kin proximity produces no effect at all (0/5, mean 0.006 — identical to the no-kin-bias well-mixed control at 0.005). Kin proximity — automatically provided by local reproduction — is the necessary condition; kin-biased routing is the amplifier on top of it.
Why kin bias amplifies spatial structure: the self-routing advantage
The cluster-growth story — cooperators form patches, patches expand — explains maintenance. It does not explain why the kin bias makes patch formation so much more reliable than spatial structure alone. A lone cooperator on the grid surrounded entirely by other-lineage defectors would seem to gain little from kin routing.
The key is the self-routing term. Because self is always same-lineage and the neighbourhood includes self, the kernel routes approximately 50% of a cooperator's own output back to itself ( when all spatial neighbours are other-lineage). Fitness for that lone cooperator becomes:
Even before a cluster forms, a lone cooperator on the spatial grid already outcompetes local defectors. Network reciprocity without kin bias lacks this: a lone cooperator with uniform routing receives zero net benefit from its spatial neighbours and loses immediately. This is why the kin bias converts network reciprocity's stochastic 1/5 into a reliable 5/5 — it removes the vulnerable solo-cooperator phase. In a well-mixed population this advantage disappears: the self-routing benefit is diffused across 575 neighbours rather than concentrated in a local neighbourhood, and the effect vanishes.
Live simulation
Both grids below start from the same random initial state — roughly 5% cooperators, 18 lineages, kin bias 0.8/0.2. Left satisfies Hamilton's rule (, ). Right violates it (, ) — cost swamps benefit even with kin-biased routing. Press Play to watch spatial kin clusters grow on the left and collapse on the right. Press Reset to start a new random configuration.
References
- Hamilton, W. D. (1964). The genetical evolution of social behaviour. I. Journal of Theoretical Biology, 7(1), 1–16. https://doi.org/10.1016/0022-5193(64)90038-4
- Nowak, M. A. (2006). Five rules for the evolution of cooperation. Science, 314(5805), 1560–1563. https://doi.org/10.1126/science.1133755