TL;DR
This paper introduces ReOpt-LLM, an agentic framework that allows non-expert end users to continuously adapt and re-optimize large-scale optimization models using natural language. By translating user prompts into structured "model patches" and dynamically selecting algorithmic strategies from an operations research (OR) toolbox, the framework achieves near-perfect semantic reliability and massive computational speedups without breaking the underlying mathematical structure.
What Problem Does This Paper Address?
In industrial settings, mathematical optimization models (like Mixed-Integer Programs, or MIPs) are typically built by OR experts and deployed as static decision-support systems. However, real-world environments are highly dynamic: business rules change, unexpected disruptions occur (e.g., weather or equipment breakdowns), and new constraints emerge.
When these changes happen, the end users (operators or planners) know the operational context but lack the advanced mathematical expertise required to modify the underlying code. This creates an organizational bottleneck, forcing companies to rely on slow, costly cycles of expert human maintenance. While prior research has explored using Large Language Models (LLMs) for code generation, applying them directly to large-scale optimization often fails because naive code edits easily break complex combinatorial structures, lack traceability, and ignore solver efficiency.
Methods
The authors propose ReOpt-LLM, a closed-loop, multi-agent framework that treats re-optimization as an auditable model-editing and orchestration task rather than a pure code-generation problem.
[User Prompt] ➔ [Agent 1: Patch Planner] ➔ [Deterministic Programmer] ➔ [Agent 2: Strategy Selector] ➔ [Agent 3: Validator & Solver]
The workflow consists of four main components:
- Agent 1: Patch Planner: Instead of writing raw code, the LLM translates the natural-language request into a highly restricted Domain-Specific Language (DSL) called a structured patch (e.g.,
UPDATE_PARAMETER,UPDATE_BOUND,ADD_CONSTRAINT_FAMILY). - Deterministic Programmer: A rule-based post-processor that normalizes the LLM's output, mapping natural-language entities (like "Plant 1") to exact internal model identifiers (
P1) and ensuring proper indexing. - Agent 2: Re-optimization Strategy Selector: The LLM reviews the proposed edits and selects the best combination of algorithmic tools from an OR Toolbox (such as warm starts, historical solutions, valid inequalities, or customized heuristics) based on the time budget and structural impact.
- Agent 3: Validator and Optimization Engine: Applies the patch, configures the commercial solver (Gurobi), and attempts to solve the model. If it encounters a schema error or infeasibility, a validation-triggered retry loop passes the error logs back to the Patch Planner for a corrected attempt.
Datasets
The framework was evaluated using two distinct, large-scale, real-world case studies:
- OCP Group Supply Chain (Morocco): An online re-optimization setting representing one of the world's largest phosphate-processing facilities. The models are massive MILPs averaging roughly 489,000 variables and 386,000 constraints. The goal here is rapid operational recovery (under a strict 300-second time limit) while keeping solutions close to the original plan.
- Cornell University Exam Scheduling: An offline pre-publication planning setting. These block-sequencing MIPs average roughly 701,000 binary variables and 414,000 constraints. The primary objective is maximizing schedule quality (minimizing student exam conflicts and stress) under a 3,600-second time limit, meaning solutions do not need to remain close to a prior plan.
Both case studies were tested across 5 distinct instances and 6 representative prompt classes (e.g., capacity degradation, late changes, combined disruptions), totaling 270 prompt-instance evaluation cases across multiple LLMs (GPT-4.1-mini, GPT-4.1, and GPT-5).
Key Insights and Ideas
- Structured Patches Over Direct Code Gen: Forcing the LLM to interact via an explicit patch language rather than writing raw Python/Gurobi code acts as a crucial safety rail. It ensures that modifications are transparent, auditable, and mathematically grounded.
- Semantic Reliability vs. Feasibility: The authors discovered that direct-code agents often generate code that runs successfully but implements the wrong operational change. ReOpt-LLM’s patch architecture ensures that the optimization model actually reflects the user's intent.
- Separation of Concerns: Dividing the problem into what to change (Patch Planner) and how to solve it (Strategy Selector) allows the system to remain scalable. An LLM cannot solve a 700k-variable MIP from scratch in real-time, but it can successfully act as an air traffic controller, activating the right warm-starts and heuristics from a pre-built OR toolbox.
Key Results
- Semantic Accuracy: In the OCP supply chain case, ReOpt-LLM achieved a 100% update correctness rate across all tested LLMs, whereas the direct-code baseline achieved 0% because it consistently applied incorrect edit semantics.
- Computational Efficiency: In the online OCP setting, using the LLM-guided Strategy Selector cut the mean runtime in half (from 194.88 seconds down to 97.20 seconds) and boosted the mean shipment fulfillment rate from 86.57% to 95.65% compared to solving without the toolbox.
- High-Quality Offline Planning: In the Cornell exam scheduling case, using GPT-5 within the ReOpt-LLM framework achieved a 100% final success rate (compared to just 33.3% for the direct-code agent). Furthermore, activating the toolbox selector eliminated all "no-incumbent" solver failures and brought the median objective penalty difference down to 0, matching the hindsight reference baseline exactly.
Limitations and Future Work
While highly effective, ReOpt-LLM operates under the assumption that the underlying algebraic structure of the core model remains fixed (i.e., it mutates parameters, bounds, and constraint families rather than rewriting the fundamental objective function from scratch).
The authors note that future research should focus on extending this patch-based agentic framework to handle stochastic optimization (uncertain environments), robust optimization, and multi-objective optimization settings where users can dynamically negotiate trade-offs in real time.
Summary updated