Skip to main content

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


Download files

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

Source Distribution

nashypy-0.0.1.tar.gz (24.2 kB view details)

Uploaded Source

Built Distribution

nashypy-0.0.1-py3-none-any.whl (25.3 kB view details)

Uploaded Python 3

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

Hashes for nashypy-0.0.1.tar.gz
Algorithm Hash digest
SHA256 7d417a0f4fdeec94885464ba22d2b1bbe31a9dbf38e653826c9160015b241200
MD5 98651bef20ce5160ecbaa2a2433b55f4
BLAKE2b-256 4a0a128f6f372461258d3c1d791fe4a65ad1035785d5a6984c62c4a61cfddb2e

See more details on using hashes here.

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

Hashes for nashypy-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 20a92c8b97f2457163ed97e4b3ff183a5eb165fc26147e1b50a7974525aeaf52
MD5 8a4fb688d6b03099c16fe1da69ccd3b1
BLAKE2b-256 993788274aed2f8b7c386acfff29db77456a17e196b8a3aadb8ae36475293a00

See more details on using hashes here.

Supported by

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