Matrix Games in JAX
Enter the Matrax! 😎
Matrax is a lightweight suite of 2-player matrix game environments written in JAX. It is a direct re-implementation of the matrix games provided in this repository from the AARG. It follows the Jumanji RL environment suite API developed by InstaDeep.
2-Player Matrix Games 🧑🤝🧑
| Category | Shape (action space) | Registered Version(s) | Source |
|---|---|---|---|
| 🔻 Penalty Game | 3 x 3 | Penalty-{k}-{state}-v0 |
code |
| 🧗♀️ Climbing Game | 3 x 3 | Climbing-{state}-v0 |
code |
| 🤝 No-Conflict Games | 2 x 2 | NoConflict-{id}-{state}-v0 |
code |
| 💣 Conflict Games | 2 x 2 | Conflict-{id}-{state}-v0 |
code |
Installation 🎬
You can install the latest release of Matrax from PyPI:
pip install matrax
Alternatively, you can install the latest development version directly from GitHub:
pip install git+https://github.com/instadeepai/matrax.git
Matrax has been tested on Python 3.9. Note that because the installation of JAX differs depending on your hardware accelerator, we advise users to explicitly install the correct JAX version (see the official installation guide).
Quickstart ⚡
import jax
import matrax
# Instantiate a matrix game environment using the registry
env = matrax.make("Penalty-25-stateless-v0")
# Reset your (jit-able) environment
key = jax.random.PRNGKey(0)
state, timestep = jax.jit(env.reset)(key)
# Interact with the (jit-able) environment
action = env.action_spec.generate_value() # Action selection (dummy value here)
state, timestep = jax.jit(env.step)(state, action) # Take a step and observe the next state and time step
Registry and Versioning 📖
Like Jumanji, Matrax keeps a strict versioning of its environments for reproducibility reasons.
We maintain a registry of standard environments with their configuration.
For each environment, a version suffix is appended, e.g. EnvironmentName-v1.
When changes are made to environments that might impact learning results,
the version number is incremented by one to prevent potential confusion.
Citing Matrax 📝
If you use any of the environment implementations in Matrax please consider citing this library.
@software{matrax2023github,
author = {Arnu Pretorius},
title = {Matrax: Matrix Games in JAX},
url = {http://github.com/instadeepai/matrax},
version = {v0.0.4-alpha},
year = {2023},
}
See Also 🔎
Other works have embraced the approach of writing RL environments in JAX. In particular, we suggest users check out the following sister repositories:
- 🌴 Jumanji is a diverse suite of scalable reinforcement learning environments.
- 🦾 Brax is a differentiable physics engine that simulates environments made up of rigid bodies, joints, and actuators.
- 🏋️ Gymnax implements classic environments including classic control, bsuite, MinAtar and a collection of meta RL tasks.
- 🎲 Pgx provides classic board game environments like Backgammon, Shogi, and Go.
Metadata
Release files for matrax 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| matrax-0.0.5.tar.gz | 16.8 kB | Without provenance | Details for matrax-0.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| matrax-0.0.5-py3-none-any.whl | Python 3 | none | any | Details for matrax-0.0.5-py3-none-any.whl |
Total release size: 35.1 kB
Release files / matrax-0.0.5.tar.gz
| Download URL | matrax-0.0.5.tar.gz |
|---|---|
| Size | 16.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1eac133220775afdddc8eb06431c65318a57cf3eb437470afe70fcb3a10accbc
|
|
BLAKE2b-256 checksum How to use checksums |
f664c4fc3d8a7c737facd8d589a9b61e0a10868735325433f1cc1fb4c68bbe18
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.13.0
|
Release files / matrax-0.0.5-py3-none-any.whl
| Download URL | matrax-0.0.5-py3-none-any.whl |
|---|---|
| Size | 18.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5f97837d2b104fb4766b180b980c5202c0791cd38db7ce12066c51048f0b88bb
|
|
BLAKE2b-256 checksum How to use checksums |
0e093b11ca9f0da688a6ff957e7d94367d83c765bc0277671ce3878d924c7668
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.13.0
|
Security for matrax 0.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.