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.2.tar.gz
.
File metadata
- Download URL: nashypy-0.0.2.tar.gz
- Upload date:
- Size: 24.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 746e6f76581fe9e252f33857b6c3009b4d5f552ea1991d2b015cc4510150878c |
|
MD5 | beb10cbb99a962b5693d3fe43a189833 |
|
BLAKE2b-256 | 342c64e9ce88eee61b762d1090735238b383ee7fd3aa876390af1f6b4956243b |
File details
Details for the file nashypy-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: nashypy-0.0.2-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 | 123e7bd97341d1466257235bbc4a1d5f03df3fe67fd5eff4d80501e35ce10cff |
|
MD5 | f48b6659c61b42ad945b3e4b06e670dc |
|
BLAKE2b-256 | 39cf4a6d8efb5348ad06ab6e8848828dbd8da50f3c5da2858106abbc4ddce0e6 |