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" are 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.

Examples

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

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

sim = model.demo_model()
model.run(sim)

fig1, ax1 = plt.subplots()
figures.UV_dyna(sim, ax1)
fig2, ax2 = plt.subplots(1, 2, figsize = (12.8, 4.8))
U_hmap, V_hmap = figures.UV_heatmap(sim, 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-1.1.4.tar.gz (34.6 kB view details)

Uploaded Source

Built Distribution

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

piegy-1.1.4-py3-none-any.whl (36.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for piegy-1.1.4.tar.gz
Algorithm Hash digest
SHA256 524d2352f7891f8c4387b2793526a5796592b1988b030d82a4d73b5f6f449360
MD5 5278deecb5285cd816b31508788a7f69
BLAKE2b-256 98d908aa82930c3822d284e9a62d13370a927e2f65a45e4a48559bdd3186cd17

See more details on using hashes here.

File details

Details for the file piegy-1.1.4-py3-none-any.whl.

File metadata

  • Download URL: piegy-1.1.4-py3-none-any.whl
  • Upload date:
  • Size: 36.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for piegy-1.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9b3f74c3bd7f0beb9983b76f976686aea20d091a53110c93f837e2e6986be4e0
MD5 7df40189b8138452aed753aaa37c2453
BLAKE2b-256 188024c4389465bfeaf2b14b05c858d5bf5562cd2d002c609c852d20a6538054

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