formulation-bench

Utilities for loading and working with the FormulationBench dataset.


Keywords
milp, optimization, lean, dataset, formulation
License
MIT
Install
pip install formulation-bench==0.4.0

Documentation

formulation-bench

PyPI version CI codecov Documentation Status License: MIT Checked with mypy Ruff

Python utilities for loading and working with the FormulationBench dataset. FormulationBench is a collection of 20 optimization problems with 116 mixed-integer linear programming (MILP) formulations. Each formulation has a natural language description, LaTeX formulation, GurobiPy implementation, and Lean representation. Furthermore, there are 96 pairs of formulations consisting of 70 positive reformulation examples and 26 negative examples. Each positive example has a machine-checked Lean 4 reformulation proof. See the documentation for details.

Installation

pip install formulation-bench

Quickstart

Download the dataset:

from formulation_bench import Dataset
ds = Dataset.load()

Access a problem's formulations:

p1 = ds.problems[1]
p1a = p1.formulations["a"]

Access reformulation pairs:

pos = [r for r in ds.reformulations if r.is_reformulation]
neg = [r for r in ds.reformulations if not r.is_reformulation]

Development

See AGENTS.md for development information.

Cite

TODO: Add arXiv article citation

License

MIT