Dominance of Cooperative Strategies in Iterated Prisoner's Dilemma with the Axelrod Python Library

Population share of each strategy across generations

The Core Principles: Repeated Encounters and Strategy Evolution

Foundation of the Dilemma: Each round of the IPD involves two players independently deciding whether to cooperate or defect. The highest collective payoff arises from cooperation, yet the individual temptation to defect for greater personal gain persists, risking mutual betrayal and the lowest payoff.

Iterative Nature: The essence of the IPD lies in its repetition. Players remember past actions and modify strategies, fostering a complex interplay of trust, prediction, and potential retaliation.

Strategy Evolution: Over iterations, strategies evolve. Tit-for-Tat, a strategy of mirroring the opponent’s previous move, emerged as an effective approach in early computer tournaments organized by Robert Axelrod. Its success highlighted the importance of reciprocity in the IPD.

Since, three broad categories of strategies have been established: cooperating strategies, defecting strategies, and zero determinant (ZD) strategies. The first two are fairly self-explanatory. Zero-determinant strategies being a more recent and controversial introduction in the 2010’s allowing a player using ZD strategies to unilaterally enforce a particular payoff relationship by choosing their moves according to calculations of the probabilities of payoff using linear equations. The real-world corollary to this could be negotiations with an unequal power dynamic and asymmetric information with an ability to also accurately assess the payoffs with this information.

Venn diagram of strategies in the Iterated Prisoner’s Dilemma

Image: Jplotkin8, CC BY-SA 3.0, via Wikimedia Commons.

History: Recreating the First Tournament

In Axelrod’s seminal work, “The Evolution of Cooperation” he outlined four common characteristics of winning strategies in IPD:

In Robert Axelrod’s original Prisoner’s Dilemma tournament, as detailed in his 1980 paper “Effective Choice in the Prisoner’s Dilemma,” the specific setup for repetitions and turns was not rigidly fixed. Instead, the tournament was structured to simulate an indefinite number of interactions, reflecting the real-world scenario where individuals cannot be certain about how many times they will interact with others.

To achieve this, Axelrod used a probabilistic approach. Each pair of strategies would play against each other for an indefinite number of turns, with the game having a fixed probability of ending after each turn. This approach effectively simulated an environment where the players could not predict the exact number of interactions they would have, thus encouraging strategies that were robust over a range of possible game lengths.

The probability chosen meant that the expected number of turns in each encounter was 200, but the actual number varied, introducing uncertainty and encouraging participants to develop strategies that could adapt to both short-term and long-term interactions. This design was crucial in evaluating the effectiveness of various strategies in a setting that closely mimics the unpredictability of real-life interactions.

Using the Axelrod library available here: https://axelrod.readthedocs.io/en/stable/index.html we can simulate Axelrod’s infamous first tournament using the original set of strategies submitted handily with axelrod.axelrod_first_strategies I’ve used the Plotly Express library for visualizations instead of the Axelrod plotting functions based on personal preference and interactivity. With the luxury of processing power now but a fairly low amount of patience to watch things run, I set the tournament to 100 turns with 1000 repetitions.

Strategies from Axelrod's First Tournament

In this first round, we see that the top-scoring strategies have a cooperation rating of upwards of .60 to .90 while the bottom strategies range lower. Summarizing another round of tournament results by cooperation rating bins here, we can show the results even more concisely.

Median Score by Binned Cooperation Rating

ESS - An Evolutionarily Stable Strategy

While in the short term depending on the tournament parameters, a variety of strategies can succeed, given continued repetition and rounds, Tit-for-Tat and a crop of other strategies that generally abide by Axelrod’s outlined characteristics, echoing Tit-for-Tat’s retaliatory but cooperative leaning, emerging more consistently than strategies of any other extremes.

The concept of an Evolutionarily Stable Strategy (ESS) is pivotal in understanding the dynamics of the Iterated Prisoner’s Dilemma (IPD). Originating from evolutionary biology and later adopted into game theory, ESS provides a framework for analyzing strategies that persist over time under evolutionary pressure. Many notable ESS are retaliatory but also generous - especially in noisy environments where there are high degrees of miscommunication.

Defining ESS

An ESS, in the context of the IPD, is a strategy that, if adopted by a population, cannot be invaded or replaced by an alternative strategy. It’s a strategy that, when prevalent in a group, proves to be the most effective against its kind. The resilience of an ESS comes from its ability to outperform or neutralize alternative strategies, ensuring its dominance over time.

ESS in the IPD

In the IPD, strategies evolve through repeated interactions, influenced by the outcomes of previous encounters. A strategy becomes an ESS if it can withstand the invasion of alternative strategies within this evolutionary context. For example, ‘Tit-for-Tat’, a strategy that cooperates on the first move and then replicates the opponent’s previous move, has been identified as an ESS in many IPD simulations. It balances retaliation and cooperation, making it robust against both exploitative and overly cooperative strategies.

Mechanics of ESS in the IPD

Retaliation and Forgiveness: ESS strategies in the IPD often incorporate elements of retaliation against defection and forgiveness following cooperation. This balance ensures that a strategy is neither too aggressive (which could lead to endless cycles of retaliation) nor too passive (which could be easily exploited).

Stability and Adaptability: An ESS must be stable enough to resist invasion by alternative strategies but adaptable to the changing behaviors of opponents. This adaptability is crucial in the iterated nature of the game, where static strategies can become predictable and thus exploitable.

Population Dynamics: The success of an ESS also depends on the composition of the population. In a diverse strategic environment, an ESS must be robust against a wide range of strategies. However, in a more homogeneous population, an ESS might only need to defend against a few similar strategies.

Using a replicator equation overlaid on the existing tournament logic - the first game dynamics studied in connection with evolutionary game theory. We predict the evolutionary outcome of population behavior using payoff translated as ‘fitness’ or reproductive success. Essentially, the fitness calculation uses each generation’s payoff as a multiplier to its existing population.

fitness[i] += sum(payoff) * population[j]
Evolution of Strategies from Axelrod's First Tournament

Here again, in this third simulation round using the above replicator equation for each progressive generation, high-cooperation strategies multiply for the first 20 generations, stabilizing at around 60% of the population while a range of cooperation-leaning strategies make up the rest of the population. Any strategies with a cooperation probability of less than .5 go extinct in the first 20 generations.

Emergence of Wisdom and Cooperation

Complex Strategy Landscape: The landscape of IPD strategies is vast and varied, ranging from always cooperating to more complex conditional strategies. These strategies can be adaptive and history-dependent, and research is continuing to progress in numerous directions building on Axelrod’s work. Recent papers have explored adding multi-layer networks, ethical bounds, imitation, particle swarms, spatial IPD, and the expression of emotion as a strategy for promoting cooperation, as well as selective attention or limited horizons for attention or memory. Each paper that builds on this initial research has found evidence for age-old wisdom such as forgiveness and forgetting as an adaptive memory management strategy.

Emergence of Cooperation: In a world seemingly dominated by self-interest, the IPD intriguingly demonstrates conditions under which cooperation can emerge and stabilize. Factors like the shadow of the future (the ongoing nature of interaction) significantly influence cooperative behavior and lend insight into the evolution of altruism in biological systems.

Conclusion: A Microcosm of Human Interaction

The Iterated Prisoner’s Dilemma is not just a theoretical construct but a reflection of the complexities of human interaction. It illustrates how repeated interactions, memory, and the potential for future encounters shape our decisions. Addiction can be cast as an intertemporal IPD with past and future selves, any paired relationship such as a romantic relationship can also be understood through the lens of IPD which is alluded to in psychology research with social sequence analysis and cascade models of interpersonal relationships.

From fostering cooperation in a competitive environment to understanding the dynamics of personal, social, and biological systems, the IPD remains a pivotal concept in deciphering the intricate dance of conflict and collaboration in our world.

Next Steps: Ideas for Future Analysis

Books Referenced

Evolution of Cooperation - Robert Axelrod

Papers Referenced

Li, G., & Sun, X. (2021). Evolutionary game on a growing multilayer network. Physica A: Statistical Mechanics and Its Applications, 578, 126110. https://doi.org/10.1016/J.PHYSA.2021.126110

Turker, M. Z., & Bingol, H. (2021). Forgiveness is an adaptation in iterated prisoner’s dilemma with memory. arXiv preprint arXiv:2112.07894. Retrieved from https://arxiv.org/abs/2112.07894

Glynatsi, N. E., & Knight, V. (2021). Game theory and Python: An educational tutorial to game theory and repeated games using Python. Journal of Open Source Education, 4, 78. https://doi.org/10.21105/JOSE.00078