ConstraintBench: Benchmarking LLM Constraint Reasoning on Direct Optimization
Organizations: Haladir Research Team
Abstract
Large language models are increasingly applied to operational decision-making where the underlying structure is constrained optimization. Existing benchmarks evaluate whether LLMs can formulate optimization problems as solver code, but leave open a complementary question. Can LLMs directly produce correct solutions to fully specified constrained optimization problems without access to a solver? We introduce ConstraintBench, a benchmark for evaluating LLMs on direct constrained optimization across 10 operations research domains, with all ground-truth solutions verified by the Gurobi solver. Each task presents a natural-language scenario with entities, constraints, and an optimization objective; the model must return a structured solution that a deterministic verifier checks against every constraint and the solver-proven optimum. We evaluate six frontier models on 200 tasks and find that feasibility, not optimality, is the primary bottleneck. The best model achieves only 65.0% feasibility, yet feasible solutions average 89 to 96% of the Gurobi-optimal objective. No model exceeds 30.5% on joint feasibility and optimality within 0.1% of the solver reference. Per-domain analysis shows large variation in difficulty, with average feasibility spanning from 85.0% in the facility location domain to 0.8% in the crew assignment domain. Further, systematic failure modes include duration constraint misunderstanding, entity hallucination, and a feasibility-optimality decoupling in facility location and vehicle routing where models achieve high feasibility but 0% optimality. ConstraintBench and all evaluation infrastructure will be publicly released.
Figures & tables
| Benchmark | Task | Domains | # Problems | Verification | Data Quality |
|---|---|---|---|---|---|
| NL4Opt [ 3 ] | Formulation | LP | 1,101 (289 test) | Objective match | Human-annotated |
| IndustryOR [ 4 ] | Formulation | Mixed | 100 | Objective match | Human-annotated |
| Mamo [ 5 ] | Formulation | Mixed | – | Objective match | Human-annotated |
| OptMATH [ 6 ] | Formulation | Mixed | Large-scale | Objective match | Synthetic + human |
| ComplexOR [ 7 ] | Formulation | MILP | – | Objective match | Human-annotated |
| OptiBench [ 8 ] | Formulation | Mixed | – | Objective match | Human-annotated |
| Domain | Decision Variables | Objective | Variable Type |
|---|---|---|---|
| Order Fulfillment | Source allocation per order-product pair | Minimize total cost | Integer |
| Production Mix | Units to produce per product | Maximize total profit | Integer |
| Shift Scheduling | Employee-shift assignments | Minimize total cost | Binary |
| Crew Assignment | Worker-task hour allocations | Minimize total cost | Continuous |
| Job-Shop Scheduling | Operation start times and machine assignments | Minimize makespan | Mixed |
| Project Planning | Task start/finish periods | Minimize project duration | Integer |
| Model | Feasibility (%) | Obj. Quality (%) | % Optimal | Errors |
|---|---|---|---|---|
| GPT-5.2-pro | 65.0 | 95.2 | 30.5 | 1 |
| GPT-5.2 | 64.0 | 93.8 | 21.0 | 1 |
| Claude Opus 4.6 | 49.0 | 96.0 | 21.5 | 13 |
| Claude Opus 4.5 | 50.5 | 94.0 | 12.5 | 5 |
| o4-mini | 50.5 | 89.0 | 8.5 | 2 |
| Gemini 3 Pro Preview | 44.5 | 94.8 | 8.5 | 0 |
| Model | Fac. Loc. | Prod. Mix | Order Ful. | Job Shop | Shift Sch. | Portfolio | Vehicle | Bin Pack | Project | Crew |
|---|---|---|---|---|---|---|---|---|---|---|
| Feasibility (%) | ||||||||||
| GPT-5.2-pro | 100.0 | 95.0 | 70.0 | 95.0 | 85.0 | 65.0 | 65.0 | 70.0 | 5.0 | 0.0 |
| GPT-5.2 | 85.0 | 90.0 | 80.0 | 80.0 | 80.0 | 65.0 | 80.0 | 50.0 | 25.0 | 5.0 |
| Claude Opus 4.6 | 90.0 | 85.0 | 70.0 | 80.0 | 70.0 | 65.0 | 10.0 | 10.0 | 10.0 | 0.0 |
| Claude Opus 4.5 | 90.0 | 80.0 | 80.0 | 80.0 | 65.0 | 70.0 | 10.0 | 20.0 | 10.0 | 0.0 |
| o4-mini | 65.0 | 85.0 | 90.0 | 60.0 | 55.0 | 70.0 | 75.0 | 5.0 | 0.0 | 0.0 |
| Domain | Feasible Sol. | Within 0.1% | Within 1% | Within 5% | Median Gap |
|---|---|---|---|---|---|
| Production Mix | 100 | 68 (68%) | 87 (87%) | 96 (96%) | 0.03% |
| Shift Scheduling | 85 | 51 (60%) | 62 (73%) | 80 (94%) | 0.00% |
| Bin Packing | 32 | 17 (53%) | 17 (53%) | 20 (62%) | 0.00% |
| Job Shop | 92 | 41 (45%) | 41 (45%) | 64 (70%) | 1.32% |
| Project Planning | 10 | 3 (30%) | 3 (30%) | 8 (80%) | 4.35% |
| Order Fulfillment | 95 | 13 (14%) | 44 (46%) | 65 (68%) | 1.16% |
| Model | Discrepant / 200 | Median Error (%) | Max Error (%) |
|---|---|---|---|
| GPT-5.2-pro | 22 | 13.7 | 128.9 |
| GPT-5.2 | 24 | 10.6 | 125.9 |
| Claude Opus 4.6 | 20 | 12.8 | 104.5 |
| Claude Opus 4.5 | 24 | 9.4 | 107.0 |
| o4-mini | 26 | 3.8 | 129.3 |
| Gemini 3 Pro Preview | 34 | 20.9 | 9,999,900.0 |
Appendix figures & tables3 assets
Supplementary material from the paper’s appendix.
Appendix
| Parameter | Value |
|---|---|
| Temperature | 0 |
| Max output tokens | 64,000 |
| Reasoning tokens (OpenAI) | 55,000 (effort: high) |
| Extended thinking (Anthropic) | Enabled, same budget |
| Structured output | Enabled (all providers) |
| Trials per task | 1 |
| Provider | Structured Output Mode | Reasoning Config | Retry on Parse Failure |
|---|---|---|---|
| OpenAI (GPT-5.2, GPT-5.2-pro) | Responses API, structured output | reasoning_effort=high, 55K tokens | 3 retries |
| OpenAI (o4-mini) | Responses API, structured output | reasoning_effort=high, 55K tokens | 3 retries |
| Anthropic (Claude Opus 4.5, 4.6) | Structured schema | Extended thinking enabled, same budget | 3 retries |
| Google (Gemini 3 Pro Preview) | JSON mode | Default reasoning | 3 retries |
| Domain | 0.1% | 0.5% | 1.0% | 5.0% |
|---|---|---|---|---|
| Production Mix | 56.7 | 64.2 | 72.5 | 80.0 |
| Facility Location | 0.0 | 0.0 | 1.7 | 23.3 |
| Job-Shop Scheduling | 34.2 | 34.2 | 34.2 | 53.3 |
| Order Fulfillment | 10.8 | 15.0 | 36.7 | 54.2 |
| Shift Scheduling | 42.5 | 44.2 | 51.7 | 66.7 |
| Portfolio | 10.0 | 21.7 | 28.3 | 63.3 |