Skip to main content

Tools for simulating and solving polymatrix games.

Project description

What is it?

A simple library for simulating and solving polymatrix games, where players are nodes of a network and edges represent two-player games.

Right now polymatrix can handle any amount of players and connections between them, but only two possible strategies and two state variables for each player. If your use case is not supported, reach out via email or post an issue, I'll see what I can do.

Installation

pip install polymatrix

Usage

Making a quick game between randomly connected 7 players and simulating 5 random rounds:

game = polymatrix.QuickGame(7)
game.simulate(5)

Making a game between 5 players on a ring topology (each player connected to two others) and with a starting state of 100 units for all players. Then play some strategy profiles:

game = polymatrix.PolymatrixGame(start_populations_matrix =[[100,100]]*5, topology="ring")
game.play(strategy_profile = [0,1,1,1,0])
print(game.state)

Architecture

The the high-level functionality (such as payoff functions) are in the PolymatrixGame class in polymatrixgame.py module, which inherits from more general MultiplayerGame from multiplayergame.py. The fundamental data of the game is information about the players (player.py) and how they are connected (network.py). The game network is really a networkx graph but with some extra methods (such as random edge addition/removal which I used for genetic programming). This is a high-level overview of dependencies:

Polymatrix game software architecture

Literature

I highly recommend a 2016 paper by Cai, Candogan, Daskalakis and Papadimitriou about zero-sum polymatrix games: https://www.cs.mcgill.ca/~cai/pdf/zerosum.pdf

For general algorithmic game theory: https://www.cs.cmu.edu/~sandholm/cs15-892F13/algorithmic-game-theory.pdf

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

polymatrix-0.0.3.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

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

polymatrix-0.0.3-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file polymatrix-0.0.3.tar.gz.

File metadata

  • Download URL: polymatrix-0.0.3.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2

File hashes

Hashes for polymatrix-0.0.3.tar.gz
Algorithm Hash digest
SHA256 252249331c55fda8aa4bd3e93ecfbc26157030bf689bc767ab8f50704cbbc487
MD5 eeb3b954fbe6809ded4aea8c526aff86
BLAKE2b-256 1ee68ac21648043e2b3805796fe79236c1835aed32049103395e8f5cfa5937aa

See more details on using hashes here.

File details

Details for the file polymatrix-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: polymatrix-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 12.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2

File hashes

Hashes for polymatrix-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 cfd6a4f165140e1c40d34e858baa1a966f85a6fe4ab87d76b7819fad8502df21
MD5 63f6517d9b0863b7cfa3845e2d281039
BLAKE2b-256 6b4326903565ec7c722bbc4a701659e136e85ecff19d50c46007f59ddd4707b2

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