Gurobi Code Repair Agent

AAAI 2026 Workshop on AI for Scientific Research (AI4Research) — Accepted.

This agent automatically identifies and repairs optimization model bugs in Gurobi LP/MIP/ILP code using tool execution, static analysis, and test-driven evaluation.

Overview

This project builds an end-to-end code repair agent for Gurobi-based optimization models, together with a curated benchmark and a rigorous evaluation pipeline.

I created a dataset of 26 Gurobi use cases covering LP, ILP, MIP, QCP, and classic combinatorial/logistics models. Each use case includes a natural language description, the mathematical formulation, and a reference Gurobi implementation.

For every use case, I wrote a 10-test unit-test suite (260 tests total) that checks:

On top of this benchmark, I implemented a set of repair tools, building on the tool design from my Lean4 project. However, the Gurobi domain introduces its own challenges: running a gurobipy model exposes only coarse solver signals, unlike Python exceptions, which often pinpoint the exact line or operation that failed. A model that runs without errors is not necessarily correct, so human-written unit tests that check input–output behavior, and the reference (oracle) implementations behind them, are essential.

The agent runs in an iterative loop: it reads the failing script, analyzes the error signal, proposes and applies a fix, and then re-runs the unit tests. I evaluate the agent on every use case by measuring compile/execute success and pass/fail/error across all unit tests.

Paper

Read the paper (PDF)

← Back to Home