piegy


Namepiegy JSON
Version 2.3.10 PyPI version JSON
download
home_pageNone
SummaryPayoff-Driven Stochastic Spatial Model for Evolutionary Game Theory
upload_time2025-07-18 18:27:03
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseBSD 3-Clause License Copyright (c) 2025, Chenning Xu Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
keywords game theory evolutionary game theory spatial model stochastic model payoff driven
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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:

```bash
pip install piegy
```

## Documentation and Source

See source code at: [piegy GitHub-repo](https://github.com/Chenning04/piegy.git). 
The *piegy* documentation at: [piegy Documentation](https://piegy.readthedocs.io/en/). 

## 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:

```python
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.


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "piegy",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "Game Theory, Evolutionary Game Theory, Spatial Model, Stochastic Model, Payoff Driven",
    "author": null,
    "author_email": "Chenning Xu <cxu7@caltech.edu>",
    "download_url": "https://files.pythonhosted.org/packages/52/f2/e9aacd76039b476726ef3da1870e40cce37970a4a2c92b51bb5125ede1c8/piegy-2.3.10.tar.gz",
    "platform": null,
    "description": "# piegy\n\nThe 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\".\n\nProvides a stochastic spatial model for simulating the interaction and evolution of two species in either 1D or 2D space, as well as analytic tools.\n\n## Installation\n\nTo install *piegy*, run the following in terminal:\n\n```bash\npip install piegy\n```\n\n## Documentation and Source\n\nSee source code at: [piegy GitHub-repo](https://github.com/Chenning04/piegy.git). \nThe *piegy* documentation at: [piegy Documentation](https://piegy.readthedocs.io/en/). \n\n## How the Model Works\n\nOur 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.\n\nWe 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.\n\n## Analytic Tools\n\nThe *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.\n\n## C Core\n\nFrom version 2 on, the *piegy* simulations are now equipped with a C core, which makes it significantly faster than previous versions.\n\n## Examples\n\nTo get started, simply get our demo model and run simulation:\n\n```python\nfrom piegy import simulation, figures\nimport matplotlib.pyplot as plt\n\nmod = simulation.demo_model()\nsimulation.run(mod)\n\nfig1, ax1 = plt.subplots()\nfigures.UV_dyna(mod, ax1)\nfig2, ax2 = plt.subplots(1, 2, figsize = (12.8, 4.8))\nfigures.UV_heatmap(mod, ax2[0], ax2[1])\n```\n\nThe figures reveal population dynamics and steady state population distribution.\n\n\n## Acknowledgments\n\n- 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.\n- Special thanks to the open-source community for making this package possible.\n\n",
    "bugtrack_url": null,
    "license": "BSD 3-Clause License\n        \n        Copyright (c) 2025, Chenning Xu\n        \n        Redistribution and use in source and binary forms, with or without\n        modification, are permitted provided that the following conditions are met:\n        \n        1. Redistributions of source code must retain the above copyright notice, this\n           list of conditions and the following disclaimer.\n        \n        2. Redistributions in binary form must reproduce the above copyright notice,\n           this list of conditions and the following disclaimer in the documentation\n           and/or other materials provided with the distribution.\n        \n        3. Neither the name of the copyright holder nor the names of its\n           contributors may be used to endorse or promote products derived from\n           this software without specific prior written permission.\n        \n        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n        AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n        IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n        DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\n        FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n        DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n        SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n        CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n        OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n        OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n        ",
    "summary": "Payoff-Driven Stochastic Spatial Model for Evolutionary Game Theory",
    "version": "2.3.10",
    "project_urls": {
        "Documentation": "https://piegy.readthedocs.io/en/",
        "Source": "https://github.com/Chenning04/piegy.git"
    },
    "split_keywords": [
        "game theory",
        " evolutionary game theory",
        " spatial model",
        " stochastic model",
        " payoff driven"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "52f2e9aacd76039b476726ef3da1870e40cce37970a4a2c92b51bb5125ede1c8",
                "md5": "33f9bd802856af4a2c8a8a59959a27b5",
                "sha256": "5078d56096fe9ab0eb35036e3d773921135543f7672997b4d1d42e543127cfda"
            },
            "downloads": -1,
            "filename": "piegy-2.3.10.tar.gz",
            "has_sig": false,
            "md5_digest": "33f9bd802856af4a2c8a8a59959a27b5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 48999,
            "upload_time": "2025-07-18T18:27:03",
            "upload_time_iso_8601": "2025-07-18T18:27:03.906500Z",
            "url": "https://files.pythonhosted.org/packages/52/f2/e9aacd76039b476726ef3da1870e40cce37970a4a2c92b51bb5125ede1c8/piegy-2.3.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-18 18:27:03",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Chenning04",
    "github_project": "piegy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "piegy"
}
        
Elapsed time: 0.60773s