Game Theory Library
Project description
NashyPy
nashypy
is a Python package designed for the analysis of Nash equilibria in game theory. It offers tools to read game data, visualize best response polyhedra and polytopes, and find Nash equilibria.
Note: this package is in development and currently can only run 2x2 games, 3x2 games are WIP.
Development Status
Note: nashypy
is currently under development. At this time, it supports 2x2 bimatrix games only. Support for larger games is in progress and will be available in a future update.
Installation
To install nashypy
, you can use pip:
pip install nashypy
Features
- Read Game: Load game data from a file or use a predefined example.
- Plot Best Response Polyhedra: Visualize the best response strategies in a two-dimensional plot.
- Plot Best Response Polytope: Plot feasible regions based on game strategies.
- Find Nash Equilibria: Compute and list all Nash equilibria of a given game.
Reading Game Data You can load games either by specifying the path to a game file or using one of the included examples:
import nashypy
# Load a game using an included example
game = nashypy.read_game(example="2x2_staghunt")
# Alternatively, load a game from a custom file path
game = nashypy.read_game(file_path="path/to/game.txt")
Visualizing Game Strategies
Once you have a game object, you can visualize the best responses:
# Plot best response polyhedra
nashypy.plot_best_response_polyhedra(game, savefig=True)
# Plot best response polytope
nashypy.plot_best_response_polytope(game, savefig=True)
Finding Nash Equilibria
To find and list all Nash equilibria of the loaded game:
equilibria, num_vertices = find_nash_equilibria(game)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file nashypy-0.0.1.tar.gz
.
File metadata
- Download URL: nashypy-0.0.1.tar.gz
- Upload date:
- Size: 24.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d417a0f4fdeec94885464ba22d2b1bbe31a9dbf38e653826c9160015b241200 |
|
MD5 | 98651bef20ce5160ecbaa2a2433b55f4 |
|
BLAKE2b-256 | 4a0a128f6f372461258d3c1d791fe4a65ad1035785d5a6984c62c4a61cfddb2e |
File details
Details for the file nashypy-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: nashypy-0.0.1-py3-none-any.whl
- Upload date:
- Size: 25.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 20a92c8b97f2457163ed97e4b3ff183a5eb165fc26147e1b50a7974525aeaf52 |
|
MD5 | 8a4fb688d6b03099c16fe1da69ccd3b1 |
|
BLAKE2b-256 | 993788274aed2f8b7c386acfff29db77456a17e196b8a3aadb8ae36475293a00 |