Python interface to GameTheory.jl
Project description
jlgametheory
Python interface to GameTheory.jl
jlgametheory is a Python package that allows passing
a NormalFormGame instance from
QuantEcon.py to
GameTheory.jl functions
via JuliaCall.
Implemented functions
lrsnash: Compute in exact arithmetic all extreme mixed-action Nash equilibria of a 2-player normal form game with integer payoffs.hc_solve: Compute all isolated mixed-action Nash equilibria of an N-player normal form game.
Example usage
import quantecon.game_theory as gt
import jlgametheory as jgt
lrsnash
lrsnash calls the Nash equilibrium computation routine in lrslib
(through its Julia wrapper LRSLib.jl):
bimatrix = [[(3, 3), (3, 2)],
[(2, 2), (5, 6)],
[(0, 3), (6, 1)]]
g = gt.NormalFormGame(bimatrix)
jgt.lrsnash(g)
[(array([Fraction(4, 5), Fraction(1, 5), Fraction(0, 1)], dtype=object),
array([Fraction(2, 3), Fraction(1, 3)], dtype=object)),
(array([Fraction(0, 1), Fraction(1, 3), Fraction(2, 3)], dtype=object),
array([Fraction(1, 3), Fraction(2, 3)], dtype=object)),
(array([Fraction(1, 1), Fraction(0, 1), Fraction(0, 1)], dtype=object),
array([Fraction(1, 1), Fraction(0, 1)], dtype=object))]
hc_solve
hc_solve computes all isolated Nash equilibria of an N-player game by using
HomotopyContinuation.jl:
g = gt.NormalFormGame((2, 2, 2))
g[0, 0, 0] = 9, 8, 12
g[1, 1, 0] = 9, 8, 2
g[0, 1, 1] = 3, 4, 6
g[1, 0, 1] = 3, 4, 4
jgt.hc_solve(g)
[(array([0., 1.]), array([0., 1.]), array([1., 0.])),
(array([0.5, 0.5]), array([0.5, 0.5]), array([1.000e+00, 2.351e-38])),
(array([1., 0.]), array([0., 1.]), array([-1.881e-37, 1.000e+00])),
(array([0.25, 0.75]), array([0.5, 0.5]), array([0.333, 0.667])),
(array([0.25, 0.75]), array([1.000e+00, 1.345e-43]), array([0.25, 0.75])),
(array([0., 1.]), array([0.333, 0.667]), array([0.333, 0.667])),
(array([1., 0.]), array([ 1.00e+00, -5.74e-42]), array([1., 0.])),
(array([0., 1.]), array([1., 0.]), array([2.374e-66, 1.000e+00])),
(array([0.5, 0.5]), array([0.333, 0.667]), array([0.25, 0.75]))]
Tutorials
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 jlgametheory-0.1.0.tar.gz.
File metadata
- Download URL: jlgametheory-0.1.0.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07a8a27c0de4ff2c0acb578c37456a87c4be49c977c8e48cc24f21e9fc3382be
|
|
| MD5 |
22359ef0f42e24f734e783a876adbd2e
|
|
| BLAKE2b-256 |
b41538a514a7ba5c48d370374d469245ef74c785d468e6a64e821ceb08491052
|
File details
Details for the file jlgametheory-0.1.0-py3-none-any.whl.
File metadata
- Download URL: jlgametheory-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2647ceb497a2ed050544fd2031291cbf59acca7c1ee405bbd8d095147a40afb5
|
|
| MD5 |
c1aff0fa4b829e9611697556c61a6237
|
|
| BLAKE2b-256 |
2a435fa8ae801490578c27961adb4355bc0bf6726d7e7fda3135df05ec79c4ea
|