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:
There are 3 types of attributes to define a game: global_attributes, for example: probability of an edge existing, edge weight distribution, global utility etc player_attributes (specific to a node) link_attributes (specific to an edge)
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
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file polymatrix-0.0.4.tar.gz.
File metadata
- Download URL: polymatrix-0.0.4.tar.gz
- Upload date:
- Size: 11.1 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
84f1f55f3a724b2d9aab449f2aa4ed29830e676c22107c95edd5b63017f8386a
|
|
| MD5 |
13dad3a4b7a9f44ec92c552e07a99711
|
|
| BLAKE2b-256 |
a50efe9fa0790cbd3564eb600ecb50a3efd8be3a53a6ad689e8956fe572f625c
|
File details
Details for the file polymatrix-0.0.4-py3-none-any.whl.
File metadata
- Download URL: polymatrix-0.0.4-py3-none-any.whl
- Upload date:
- Size: 13.1 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
82ef2aa7c690f5d97d5d0907c0a65012bf6bbb400345253adb05809ffb12f508
|
|
| MD5 |
3eed8cb7ffe3c2d9d3942c76dd98e9d6
|
|
| BLAKE2b-256 |
5fef927b4e7f5bee703f6f3d56decfce7d312d1dd55b79b1e19542d6a08f4657
|