Metadata-Version: 2.4
Name: meanflux
Version: 0.0.1
Summary: A PyTorch library for mean field games of supply chains and the shortage risk they imply.
Author: MeanFlux contributors
License-Expression: MIT
Project-URL: Homepage, https://github.com/navidsharifi/meanflux
Project-URL: Documentation, https://navidsharifi.github.io/meanflux/
Project-URL: Repository, https://github.com/navidsharifi/meanflux
Project-URL: Issues, https://github.com/navidsharifi/meanflux/issues
Keywords: mean field games,partial differential equations,supply chain,inventory,risk,scientific computing
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Typing :: Typed
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: torch>=2.2
Provides-Extra: optora
Requires-Dist: optora>=0.4; extra == "optora"
Provides-Extra: dev
Requires-Dist: build>=1.2; extra == "dev"
Requires-Dist: pytest>=8; extra == "dev"
Requires-Dist: pytest-cov>=6; extra == "dev"
Requires-Dist: pytest-benchmark>=5.3.1; extra == "dev"
Requires-Dist: hypothesis>=6.100; extra == "dev"
Requires-Dist: ruff>=0.5; extra == "dev"
Requires-Dist: mypy>=1.10; extra == "dev"
Requires-Dist: pre-commit>=3.7; extra == "dev"
Requires-Dist: twine>=5; extra == "dev"
Requires-Dist: scipy>=1.11; extra == "dev"
Provides-Extra: docs
Requires-Dist: zensical>=0.0.11; extra == "docs"
Requires-Dist: mkdocstrings-python>=1.10; extra == "docs"
Requires-Dist: matplotlib>=3.8; extra == "docs"
Provides-Extra: tutorials
Requires-Dist: matplotlib>=3.8; extra == "tutorials"
Dynamic: license-file

# MeanFlux

**A PyTorch library for mean field games of supply chains and the shortage risk they imply.**

Status: pre-alpha &middot; Python 3.11+ &middot; PyTorch &ge;2.2 &middot; 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.

```bash
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](https://navidsharifi.github.io/meanflux/) covers the
installation in more detail and states the equations the solvers
discretise.

## Development

```bash
pip install -e ".[dev,docs]"
pre-commit install
pytest --cov
ruff check . && ruff format --check .
mypy
zensical build --clean
```

See [CONTRIBUTING.md](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](CITATION.cff).

## License

MIT
