Skip to main content

Official implementation of FLARE and FLARE-NL.

Project description

milp-flare

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

[!NOTE] This is the official implementation of FLARE and FLARE-NL introduced in FLARE: Verifying MILP Reformulations with LLM-Based Formal Proof Synthesis.

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
from milp_flare.harness import ClaudeCodeHarness

ds = Dataset.load()
p1 = ds.problems[1]
a = p1.formulations["a"]
b = p1.formulations["b"]

harness = ClaudeCodeHarness(model="claude-opus-4-7", 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()
)

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

Development

See AGENTS.md for development information.

Cite

TODO: arXiv paper.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

milp_flare-0.2.0.tar.gz (41.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

milp_flare-0.2.0-py3-none-any.whl (44.7 kB view details)

Uploaded Python 3

File details

Details for the file milp_flare-0.2.0.tar.gz.

File metadata

  • Download URL: milp_flare-0.2.0.tar.gz
  • Upload date:
  • Size: 41.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","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}

File hashes

Hashes for milp_flare-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f08b28c2f9bc171db55c79f8ec223c4dad61b22a54c24847c4082c591a71d0d9
MD5 07b201caadde2ae3b4c3819e9ef2475a
BLAKE2b-256 bca87a76cf937c82b1130baf365e0d4109dc385ba994b003385a3df4d8218dd4

See more details on using hashes here.

File details

Details for the file milp_flare-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: milp_flare-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 44.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","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}

File hashes

Hashes for milp_flare-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 24b6f3b86f95b2dd7d8157b64f01a035cad0fbf4870d47bc16c7dfeb9900c716
MD5 2146d4855db3211fb7bc3c40d9d2b95b
BLAKE2b-256 058c9a2bba1cbcb227cfcfc239b50e308c9cfe150cff00f3e11133a74050facf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page