MeanFlux
A PyTorch library for mean field games of supply chains and the shortage risk they imply.
Status: pre-alpha · Python 3.11+ · PyTorch ≥2.2 · MIT License
MeanFlux computes the equilibrium of a multi-echelon supply network as a coupled system of Hamilton-Jacobi-Bellman and Fokker-Planck equations. It reports shortage risk (stockout probability, backlog, fill rate, tail risk and time to stockout) as differentiable functions of the model parameters.
The package installs and imports, but no solver has been released yet. The repository scaffold, continuous integration and documentation site are in place, and the numerical core is the next milestone.
Scope
- One inventory population per node of a supply network, coupled through order flow upstream and rationing downstream.
- Finite-horizon and stationary (ergodic) equilibria.
- Monotone finite-difference solvers on the GPU, batched over scenarios.
- Gradients of risk with respect to costs, volatilities and demand, by implicit differentiation through the equilibrium.
- Planned later are neural solvers, neural-operator surrogates, jump demand and common shocks.
Installation
MeanFlux is not on PyPI yet. Install it from a clone, after installing the PyTorch build that matches your hardware.
git clone https://github.com/navidsharifi/meanflux.git
cd meanflux
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install torch --index-url https://download.pytorch.org/whl/cu132 # or .../whl/cpu
pip install -e .
The documentation covers the installation in more detail and states the equations the solvers discretise.
Development
pip install -e ".[dev,docs]"
pre-commit install
pytest --cov
ruff check . && ruff format --check .
mypy
zensical build --clean
See CONTRIBUTING.md for the workflow and the design rules of the library.
Citation
If MeanFlux supports your research, please cite it with the metadata in CITATION.cff.
License
MIT
Metadata
Release files for meanflux 0.0.1
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 |
|---|---|---|---|---|
| meanflux-0.0.1.tar.gz | 5.9 kB | Without provenance | Details for meanflux-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| meanflux-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for meanflux-0.0.1-py3-none-any.whl |
Total release size: 10.1 kB
Release files / meanflux-0.0.1.tar.gz
| Download URL | meanflux-0.0.1.tar.gz |
|---|---|
| Size | 5.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c6dffc12570253979ac865aa4d0e2eeb1452a55e3e6c586e9fe42d6c5f8cef0e
|
|
BLAKE2b-256 checksum How to use checksums |
860530456eee354fef78a724dec1b74a8668f68a170ca9278e38e4945e3ef718
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / meanflux-0.0.1-py3-none-any.whl
| Download URL | meanflux-0.0.1-py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4e83212d21340166dd5e739f7f7824af00627dfb3ff7c827d8496858e1114059
|
|
BLAKE2b-256 checksum How to use checksums |
db411f33f2bbf5c5cc94c368b8be7a86f1440703ba65ee960cca2e86832bf869
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for meanflux 0.0.1
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.