This project implements the simulation model described in the paper "Evolution of Parochial Altruism by Multilevel Selection". It simulates the dynamics of altruism and parochialism in a population divided into multiple groups, exploring how these traits evolve under selective pressures from within-group and between-group interactions.
The model represents an absorbing Markov chain where a mutant strategy (either altruistic or parochial) spreads or dies out in a population initially dominated by egoists. Key processes include:
- Reproduction: Individuals duplicate based on fitness, migrate, or stay within their group.
- Conflict: Groups engage in contests, and winners replace losing groups.
- Splitting: Groups split into smaller groups once they exceed a maximum size.
- Absorption: The simulation continues until the population is homogeneous (either all mutants or all incumbents).
- Fitness-Driven Selection: Reproduction depends on fitness values derived from interactions within and between groups.
- Dynamic Group Conflicts: Groups compete, and winners are determined probabilistically based on payoffs.
- Splitting Mechanism: Groups split when they exceed a defined size, maintaining structure and introducing assortment effects.
- Parameter Tuning: Flexible settings for group size, conflict frequency, migration rates, and interaction probabilities.
- Fixation Probability Calculation: Estimates the probability of mutant strategies reaching fixation compared to neutral drift.
| Parameter | Range (Default) |
|---|---|
| κ (Average Frequency of Groups in Conflict) | 0.0–0.1 (0.025) |
| q (Splitting Probability) | 0–1 (0.01) |
| n (Group Size) | 5–20 (10) |
| m (Number of Groups) | 5–20 (10) |
| b/c (Benefit-Cost Ratio) | 1.5–5 (2.0) |
| z (Steepness of Winning Probability Curve) | 0–1 (0.5) |
| α (Ingroup Interaction Frequency) | 0–1 (0.8) |
| λ (Migration Rate) | 0–1 (0.0) |
| w (Selection Intensity) | 0–1 (0.1) |
| A | P | E | |
|---|---|---|---|
| A | b − c | b − c | −c |
| P | b − c | b − c | −c |
| E | b | b | 0 |
| A | P | E | |
|---|---|---|---|
| A | b − c | −c | −c |
| P | b | 0 | 0 |
| E | b | 0 | 0 |
This project uses a bash script, manage.sh, to streamline common operations.
-
Clone the Repository
./manage.sh clone cd Learning-Dynamics -
Set up a Python Environment
./manage.sh setup
-
Run the Simulation
./manage.sh run
-
Clean up the Python Environment
./manage.sh clean