egtplot: A Python Package for 3-Strategy Evolutionary Games

Inom Mirzaev, Drew F. K. Williamson, Jacob G. ScottbioRxiv 2018 · DOI

TL;DR

This paper introduces egtplot, a Python package designed to visualize the dynamics of three-strategy evolutionary games. It addresses the historical difficulty of visualizing these complex systems in Python, offering both static and animated plots to explore game dynamics and parameter sweeps, with applications in biological modeling, including cancer research.

What Problem Does This Paper Address?

Evolutionary game theory (EGT) is a powerful framework for understanding how populations of strategies evolve over time due to interactions and fitness differences. While EGT has been applied to diverse fields from poker to host-parasite coevolution, visualizing the dynamics of three-strategy games, particularly their phase portraits and equilibria, has been a challenge within the Python ecosystem. This paper aims to fill that gap by providing a user-friendly Python package, egtplot, that simplifies the creation of these visualizations.

Methods

The core of the paper is the introduction of the egtplot Python package, specifically the plot_static function. This function takes a payoff matrix as input and generates a visual representation of the evolutionary game dynamics on a 3-dimensional simplex. The package leverages scipy.integrate.odeint (which in turn uses the FORTRAN library odepack) to solve the replicator equations, the mathematical model describing how strategy proportions change over time. The package offers extensive customization options for plotting, including controlling initial conditions, displaying equilibria, coloring the background by speed, and plotting trajectories. The paper also introduces a plot_animated function for creating animations of these dynamics.

Datasets

Not discussed in the paper. The paper focuses on demonstrating the functionality of the egtplot package using example payoff matrices, rather than evaluating performance on specific datasets.

Key Insights and Ideas

  • Bridging the Visualization Gap: egtplot directly addresses a practical need for researchers working with three-strategy evolutionary games in Python, making complex dynamics more accessible.
  • Rich Visualization Capabilities: The package goes beyond simple trajectory plotting, offering features like background speed coloring and detailed equilibrium identification, which provide deeper insights into game dynamics.
  • Parameter Sweep Analysis: The ability to easily perform parameter sweeps and visualize their impact on game dynamics is crucial for understanding how model parameters influence evolutionary outcomes. This is demonstrated with examples relevant to cancer research.
  • Application to Cancer Modeling: The paper highlights the utility of egtplot by using it to model interactions between cancer and healthy cells, demonstrating its relevance to real-world biological problems.

Key Results

The paper showcases the capabilities of egtplot through several illustrative examples:

  • Static Plots: Demonstrations of plot_static reveal stable and unstable equilibria, saddle points, and edge equilibria for various payoff matrices.
  • Parameter Sweeps: The package effectively visualizes how changing parameters (like $\alpha$, $\beta$, $\gamma$, and $\rho$ in the cancer cell interaction model) alters the phase portraits and stable states of the game. For instance, varying $\alpha$ and $\beta$ leads to distinct changes in the location and nature of equilibria.
  • Animated Plots: While not directly embeddable in the document, the paper describes the plot_animated function's ability to create dynamic visualizations, offering a more intuitive understanding of trajectories over time.

Limitations and Future Work

  • Edge Equilibria Specificity: The paper notes that plot_static can currently only determine whether equilibria are stable for initial conditions exactly on an edge. Points slightly off the edge may behave differently.
  • Functionality for Subplots: While parameter sweeps generate multiple subplots, the package currently lacks the functionality to assign different arguments (like ic_type or path_color) to individual subplots.
  • Future Work: The paper implicitly suggests future work could involve expanding the capabilities for assigning individual arguments to subplots in parameter sweeps and potentially incorporating more advanced analytical tools within the package. The authors also point to their GitHub repository for further details and demonstrations.

Summary updated

Abstract

Evolutionary game theory is a very broad modeling framework that effectively describes many aspects of biological cooperation and competition. Visualization of three-strategy evolutionary games has historically been difficult within the Python ecosystem. We have created a package to ease visualization efforts that is capable of displaying both static and animated dynamics with the game space. We demonstrate the functionality of our package here and motivate the demonstration with an example drawn from a game theoretic-treatment of cancer cell interactions.
BibTeX
@misc{mirzaev2018egtplot,
  author = {Inom Mirzaev and Drew F. K. Williamson and Jacob G. Scott},
  title = {{egtplot: A Python Package for 3-Strategy Evolutionary Games}},
  year = {2018},
  doi = {10.1101/300004},
  howpublished = {bioRxiv},
}
Figure