MFGLib: A Library for Mean-Field Games
Overview
MFGLib is an open-source Python library dedicated to solving Nash equilibria (NEs) for generic mean-field games (MFGs) with a user-friendly and customizable interface, aiming at promoting both applications and research of MFGs. On one hand, it facilitates the creation and analysis of arbitrary user-defined MFG environments with minimal prior knowledge on MFGs. On the other hand, it serves as a modular and extensible code base for the community to easily prototype and implement new algorithms and environments of MFGs as well as their variants and generalizations.
The official documentation for MFGLib is available at https://mfglib.readthedocs.io/en/latest/. A companion introductory paper can be found at https://arxiv.org/abs/2304.08630.
Installation
MFGLib supports all major platforms and can be installed with pip:
$ pip install mfglib
Developers who would like to contribute to the library should refer to the Contributing section on the
project's documentation site.
Usage
Here is an example that shows how to use MFGLib to define an environment called rock paper scissors, and solve it using MF-OMO with default hyperparameters and tolerances, and plot the exploitability scores over iterations.
from mfglib.env import Environment
from mfglib.alg import MFOMO
from mfglib.scoring import exploitability_score
import matplotlib.pyplot as plt
# Environment
rock_paper_scissors_instance = Environment.rock_paper_scissors()
# Run the MF-OMO algorithm with default hyperparameters and default tolerances and plot exploitability scores
solns, expls, runtimes = MFOMO().solve(rock_paper_scissors_instance, max_iter=300, verbose=True)
plt.semilogy(runtimes, exploitability_score(rock_paper_scissors_instance, solns))
plt.grid(True)
plt.xlabel("Runtime (seconds)")
plt.ylabel("Exploitability")
plt.title("Rock Paper Scissors Environment - MFOMO Algorithm")
plt.show()
Please refer to the documentation for more info on how to use the library.
Citing
If you wish to cite MFGLib, please use the following:
@article{mfglib,
author = {Guo, X. and Hu, A. and Santamaria, M. and Tajrobehkar, M. and Zhang, J.},
title = {{MFGLib}: A Library for Mean Field Games},
journal = {arXiv preprint arXiv:2304.08630},
year = {2023}
}
If you find MFGLib to be helpful and would like to send virtual kudos, please consider leaving a star on the GitHub repository.
Metadata
Release files for mfglib 0.3.0
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 | |
|---|---|---|---|---|
| mfglib-0.3.0.tar.gz | 31.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mfglib-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 76.1 kB
Release files / mfglib-0.3.0.tar.gz
| Download URL | mfglib-0.3.0.tar.gz |
|---|---|
| Size | 31.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
14b9b9be2a96afb466d5bc36f1dcfc2ce5fc13a6072671f4a62ba20d8a2fd3b0
|
|
BLAKE2b-256 checksum How to use checksums |
b9ac668ebab5741908c49f4543addd39cde8dba2db8a29efa7fcde55400cef5e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.3.3 CPython/3.13.12 Linux/6.17.0-1008-azure
|
Release files / mfglib-0.3.0-py3-none-any.whl
| Download URL | mfglib-0.3.0-py3-none-any.whl |
|---|---|
| Size | 44.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
293a2123c9ce262d9eab377e462e1ac2d5bcbb2c09cabab01752cefd0ce4a0bf
|
|
BLAKE2b-256 checksum How to use checksums |
dac68cb5acca3006d65c8b624e3fb864e77eb46065689d6f2edbf01ccfe2c79c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.3.3 CPython/3.13.12 Linux/6.17.0-1008-azure
|
Security for mfglib 0.3.0
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.