Skip to main content

milp-flare

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

FLARE (Formulation-Level Automated Reformulation Evaluation) uses an LLM-based agent and the Lean proof assistant to verify mixed-integer linear program (MILP) reformulations according to the FormulationBench definition of reformulation. FLARE-NL is a Large Language Model (LLM) proxy for FLARE that trades off formal guarantees for speed and cost. See the documentation for details.

Installation

pip install milp-flare

FLARE runs an agent harness (e.g., Claude Code, Codex, OpenCode) in a Docker container. The Docker image must be built prior to running the method.

milp-flare build-image

Furthermore, each agent harness has different requirements for authentication. See Installation for more details.

Quickstart

FLARE is most frequently run on the FormulationBench dataset (though it is not a strict dependency).

from pathlib import Path

from formulation_bench import Dataset
from milp_flare import FLARE, FormulationInput, ParameterMapInput
from milp_flare.harness import ClaudeCodeHarness

ds = Dataset.load()
pair = ds.reformulations[0]  # p1.a -> p1.b
a, b = pair.a, pair.b

harness = ClaudeCodeHarness(model="claude-opus-5", effort="medium")
flare = FLARE(harness=harness)

a_in = FormulationInput(
    formulation_md=a.render_markdown(), solve_py=a.gen_solve_py()
)
b_in = FormulationInput(
    formulation_md=b.render_markdown(), solve_py=b.gen_solve_py()
)
map_in = ParameterMapInput(
    map_md=pair.parameter_map.render_markdown(), map_py=pair.gen_map_py()
)

result = flare.verify(a_in, b_in, map_in, output_path=Path("runs/p1_a_b"))

Development

See AGENTS.md for development information.

Cite

@unpublished{robbins2026flare,
  title = {FLARE: Verifying MILP Reformulations with LLM-Based Theorem Proving},
  author = {Robbins, Henry and Lawless, Connor and Udell, Madeleine and Vitercik, Ellen},
  year = 2026,
  note = {Working paper},
  url = {https://flare.henryrobbins.com}
}

License

MIT

Metadata

Release files for milp-flare 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for milp-flare 0.3.0
File Size Uploaded Provenance Actions
milp_flare-0.3.0.tar.gz 56.2 kB Without provenance Details for milp_flare-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for milp-flare 0.3.0
File Interpreter ABI Platform Actions
milp_flare-0.3.0-py3-none-any.whl Python 3 none any Details for milp_flare-0.3.0-py3-none-any.whl

Total release size: 116.4 kB

Release files / milp_flare-0.3.0.tar.gz

Download URL milp_flare-0.3.0.tar.gz
Size 56.2 kB
Tags Source
SHA-256 checksum
How to use checksums
cdef0e7dd238b9dc9c1ba864e5a826397f59aea99bff73c7dcdf56a885d0396e
BLAKE2b-256 checksum
How to use checksums
0b117b72398c0ecdc540209a5260f97083b369d679b23aa2fbeaafe717c5cb1e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / milp_flare-0.3.0-py3-none-any.whl

Download URL milp_flare-0.3.0-py3-none-any.whl
Size 60.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
54073580589681e5c17ab8d8b616cec333d4e6db854ff1766485413ede7e6334
BLAKE2b-256 checksum
How to use checksums
a4a27dc0e0d4699dc7e4efbb53158cae3457f9958feba77ff46df5d6afc32eb7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for milp-flare 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page