Skip to main content

Payoff-Driven Stochastic Spatial Model for Evolutionary Game Theory

Project description

piegy

The package full name is: Payoff-Driven Stochastic Spatial Model for Evolutionary Game Theory. "pi" refers to "payoff, and "egy" is taken from "Evolutionary Game Theory".

Provides a stochastic spatial model for simulating the interaction and evolution of two species in either 1D or 2D space, as well as analytic tools.

Installation

To install piegy, run the following in terminal:

pip install piegy

Documentation and Source

See source code at: piegy GitHub-repo. The piegy documentation at: piegy Documentation.

How the Model Works

Our model can be summarized as "classical evolutionary game theory endowed with spatial structure and payoff-driven migration rules". Consider two species, predators and preys (denoted by U and V), in a rectangular region. We divide the region into N by M patches and simulate their interaction within a patch by classical game theory (i.e., payoff matrices and carrying capacity). Interactions across patches are simulated by payoff-driven migration rules. An individual migrates to a neighboring patch with probability weighted by payoff in the neighbors.

We use the Gillepie algorithm as the fundamental event-selection algorithm. At each time step, one event is selected and let happen; and the step size is continuous, dependent on the current state in the space. Data are recorded every some specified time interval.

Analytic Tools

The piegy package also provides a wide range of analytic and supportive tools alongside the main model, such as plotting, numerical tools, data saving & reading, etc. We also provide the piegy.videos module for more direct visualizations such as how population distribution change over time.

C Core

From version 2 on, the piegy simulations are now equipped with a C core, which makes it significantly faster than previous versions.

Examples

To get started, simply get our demo model and run simulation:

from piegy import simulation, figures
import matplotlib.pyplot as plt

mod = simulation.demo_model()
simulation.run(mod)

fig1, ax1 = plt.subplots()
figures.UV_dyna(mod, ax1)
fig2, ax2 = plt.subplots(1, 2, figsize = (12.8, 4.8))
figures.UV_heatmap(mod, ax2[0], ax2[1])

The figures reveal population dynamics and steady state population distribution.

Acknowledgments

  • Thanks Professor Daniel Cooney at University of Illinois Urbana-Champaign. This package is developed alongside a project with Prof. Cooney and received enormous help from him.
  • Special thanks to the open-source community for making this package possible.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

piegy-2.1.11.tar.gz (46.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

piegy-2.1.11-cp311-cp311-macosx_11_0_arm64.whl (63.9 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

Details for the file piegy-2.1.11.tar.gz.

File metadata

  • Download URL: piegy-2.1.11.tar.gz
  • Upload date:
  • Size: 46.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.10

File hashes

Hashes for piegy-2.1.11.tar.gz
Algorithm Hash digest
SHA256 c583b5c19be63bc0c200b695661ae0b0d450cf8a60f6728628594fd7d1131c61
MD5 506cba9ada1193906ed6ece3b4975399
BLAKE2b-256 9d40a550eab90044a28d705aa0c9336923e283844505dfab3d1beb698ea9cc30

See more details on using hashes here.

File details

Details for the file piegy-2.1.11-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for piegy-2.1.11-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0cd1a41aa8c379fe8738381f324451d83ac6c8a45d077f83a8b13ca0081ea870
MD5 5a5b494ac970b8042dbd000bfe10448d
BLAKE2b-256 c555a9125e5ad0fd8d0e3e7523e1e6bdd360a3dda618242955b4f9e266881d58

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page