Skip to main content

Kin Selection

Status

This page describes the 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: rB>CrB > C.

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:

Kji+{wsameif lineagej=lineageiwotherotherwiseK^+_{j \to i} \propto \begin{cases} w_{\text{same}} & \text{if lineage}_j = \text{lineage}_i \\ w_{\text{other}} & \text{otherwise} \end{cases}

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.

Kin Selection Simulation Step
One synchronous grid update from step t to step t + 1 under kin-selection routing.
1

Start from the current grid state

Each site stores one cooperation trait hh and one inherited lineage label.

2

Compute cooperative output and private cost

Bi+=Bplushi,Ci=CscalehiB_i^+ = B_{\text{plus}} \cdot h_i, \qquad C_i = C_{\text{scale}} \cdot h_i

3

Build the kin-weighted routing kernel

Assign raw weight wsamew_{\text{same}} to same-lineage neighbors and wotherw_{\text{other}} to other-lineage neighbors, then row-normalize:

wij={wsameif lineagei=lineagejwotherotherwiseKij+=wijkwikw_{ij} = \begin{cases} w_{\text{same}} & \text{if } \text{lineage}_i = \text{lineage}_j \\ w_{\text{other}} & \text{otherwise} \end{cases} \qquad K_{ij}^+ = \frac{w_{ij}}{\sum_k w_{ik}}

4

Accumulate lineage-weighted receipts

Each site sums the kin-weighted share of cooperative benefit received from its neighbors:

Ri+=jKji+Bj+R_i^+ = \sum_j K_{ji}^+ \cdot B_j^+

5

Compute site fitness

Wi=w0+Ri+CiW_i = w_0 + R_i^+ - C_i

Baseline fitness w0w_0 dampens selection intensity.

6

Sample a local parent by softmax over fitness, copy trait and lineage

Parent selection is restricted to the site's local neighborhood. The offspring inherits trait hh (with small Gaussian mutation) and lineage label — same-lineage clusters grow when cooperators reproduce locally.

Display 1: One synchronous kin-selection update from step t to step t + 1.

Production

Each site produces cooperative output and pays a private cost proportional to its trait:

Bi+=BplushiB_i^+ = B_{\text{plus}} \cdot h_i

Ci=CscalehiC_i = C_{\text{scale}} \cdot h_i

Kernel construction

For each producer ii, a raw routing weight wijw_{ij} is assigned to each neighbor jj based on lineage match, then row-normalized so weights sum to 1:

wij={wsameif lineagei=lineagejwotherotherwisew_{ij} = \begin{cases} w_{\text{same}} & \text{if } \text{lineage}_i = \text{lineage}_j \\ w_{\text{other}} & \text{otherwise} \end{cases}

Kij+=wijkwikK_{ij}^+ = \frac{w_{ij}}{\sum_k w_{ik}}

Routing

Each site receives the lineage-weighted share of every neighbor's production:

Ri+=jKji+Bj+R_i^+ = \sum_j K_{ji}^+ \cdot B_j^+

Fitness score

Wi=w0+Ri+CiW_i = w_0 + R_i^+ - C_i

Local replacement

Each site samples a parent from its local neighborhood via softmax over WW. The offspring inherits the parent's trait hh (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:

  • hih_i is site ii's cooperation trait in [0, 1]
  • Bi+B_i^+ is the cooperative benefit produced by site ii
  • CiC_i is the private cost paid by site ii
  • Kij+K_{ij}^+ is the normalized routing weight from producer ii to recipient jj
  • Ri+R_i^+ is the total routed benefit received by site ii
  • WiW_i is the fitness score used for local replacement
  • w0w_0 is the fixed baseline fitness shared by all sites, which dampens selection intensity

Worked Example

Consider a focal site ii with four von Neumann neighbors, two same-lineage (A) and two other-lineage (B):

SiteLineageTrait hh
iiA0.8
j1j_1A0.7
j2j_2A0.6
j3j_3B0.9
j4j_4B0.5
Display 2: Worked example: trait values and lineage assignments for focal site ii and its four von Neumann neighbors.

Production

Bi+=1.0×0.8=0.80,Ci=0.2×0.8=0.16B_i^+ = 1.0 \times 0.8 = 0.80, \qquad C_i = 0.2 \times 0.8 = 0.16

Outgoing kernel row for site ii

Raw weights: wsame=0.8w_{\text{same}} = 0.8 for j1,j2j_1, j_2; wother=0.2w_{\text{other}} = 0.2 for j3,j4j_3, j_4. Row sum = 2.00, so normalized weights are 0.40 for same-lineage and 0.10 for other-lineage.

What ii sends

ij1: 0.80×0.40=0.32ij3: 0.80×0.10=0.08i \to j_1: \ 0.80 \times 0.40 = 0.32 \qquad i \to j_3: \ 0.80 \times 0.10 = 0.08

Same-lineage neighbors receive 4× more benefit than other-lineage neighbors.

What ii receives (assuming symmetric neighborhood structure)

Ri+=0.7×0.40j1+0.6×0.40j2+0.9×0.10j3+0.5×0.10j4=0.66R_i^+ = \underbrace{0.7 \times 0.40}_{j_1} + \underbrace{0.6 \times 0.40}_{j_2} + \underbrace{0.9 \times 0.10}_{j_3} + \underbrace{0.5 \times 0.10}_{j_4} = 0.66

Fitness

Wi=1.0+0.660.16=1.50W_i = 1.0 + 0.66 - 0.16 = 1.50

Why kinship helps

If ii were surrounded by four other-lineage neighbors with the same traits, all incoming weights would be 0.10:

Ri+=(0.7+0.6+0.9+0.5)×0.10=0.27,Wi=1.0+0.270.16=1.11R_i^+ = (0.7 + 0.6 + 0.9 + 0.5) \times 0.10 = 0.27, \qquad W_i = 1.0 + 0.27 - 0.16 = 1.11

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

ParameterDefaultRole
kin_weight_same_lineage0.8Routing weight toward same-lineage neighbors
kin_weight_other_lineage0.2Routing weight toward other-lineage neighbors
B_plus_scale1.0Scales cooperative benefit produced per unit trait
C_scale0.2Private cost per unit trait
Display 3: Key parameters controlling kin-selection routing weights and payoff scaling.

Hamilton's rule maps onto these parameters as rwsame/(wsame+wother)r \approx w_{\text{same}} / (w_{\text{same}} + w_{\text{other}}), B=B = B_plus_scale, C=C = 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), B/C=5B/C = 5.

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 (rB>CrB > C) 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 B/CB/C 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

ScenarioSuccess rateMean traitInterpretation
maintenance_common_start5 / 50.984Maintenance confirmed. Kin-biased routing locks cooperation near maximum.
spread_from_rare_kin_bias5 / 50.872Spread from rare confirmed. Cooperation invades reliably from 5% with kin bias.
no_kin_bias_ablation (spatial)1 / 50.488Equal 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 / 50.006Fully 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 / 50.008B/C=0.25B/C = 0.25 (rBrB < CC). Cooperation collapses from 90% to near zero — Hamilton's rule boundary confirmed within the spatial model.
Display 4: Proof-of-mechanism results. 5 seeds per scenario, 1000 steps. Success = mean final trait ≥ 0.60.

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 (Kii+=wsame/(wsame+4wother)=0.8/1.6=0.5K^+_{i \to i} = w_\text{same} / (w_\text{same} + 4 \cdot w_\text{other}) = 0.8 / 1.6 = 0.5 when all spatial neighbours are other-lineage). Fitness for that lone cooperator becomes:

Wi=1+0.5hiBplus0.2hi=1+0.3hi>1W_i = 1 + 0.5 \cdot h_i \cdot B_\text{plus} - 0.2 \cdot h_i = 1 + 0.3 h_i > 1

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 (B/C=5B/C = 5, rB>CrB > C). Right violates it (B/C=0.2B/C = 0.2, rB<CrB < C) — 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.

SpeedStep 0
Hamilton's rule satisfied (B/C = 5)
Cooperation: 5.0%
Hamilton's rule violated (B/C = 0.2)
Cooperation: 5.0%
Defector (trait 0)
Cooperator (trait 1)
Display 5: Live kin-selection comparison. Both grids start from the same random initial state (~5% cooperators, 18 lineages, kin bias 0.8/0.2). Left: Hamilton's rule satisfied (B/C=5B/C = 5, rBrB > CC — cooperation spreads). Right: Hamilton's rule violated (B/C=0.2B/C = 0.2, rBrB < CC — cooperation collapses).

References