Large Language Model for Discrete Optimization Problems: Evaluation and Step-by-step Reasoning
Authors: Tianhao Qian, Guilin Qi, Z. Y. Wu, Ran Gu, Xuanyi Liu, Canchen Lyu
Organizations: School of Mathematics, Southeast University, Nanjing, China · School of Computer Science and Engineering, Southeast University, Nanjing, China · School of Mathematical Sciences, Chongqing Normal University, Chongqing, China
This work investigated the capabilities of different models, including the Llama-3 series of models and CHATGPT, with different forms of expression in solving discrete optimization problems by testing natural language datasets. In contrast to formal datasets with a limited scope of parameters, our dataset included a variety of problem types in discrete optimization problems and featured a wide range of parameter magnitudes, including instances with large parameter sets, integrated with augmented data. It aimed to (1) provide an overview of LLMs' ability in large-scale problems, (2) offer suggestions to those who want to solve discrete optimization problems automatically, and (3) regard the performance as a benchmark for future research. These datasets included original, expanded and augmented datasets. Among these three datasets, the original and augmented ones aimed for evaluation while the expanded one may help finetune a new model. In the experiment, comparisons were made between strong and week models, CoT methods and No-CoT methods on various datasets. The result showed that stronger model performed better reasonably. Contrary to general agreement, it also showed that CoT technique was not always effective regarding the capability of models and disordered datasets improved performance of models on easy to-understand problems, even though they were sometimes with high variance, a manifestation of instability. Therefore, for those who seek to enhance the automatic resolution of discrete optimization problems, it is recommended to consult the results, including the line charts presented in the Appendix, as well as the conclusions drawn in this study for relevant suggestions.
Figures & tables
PROBLEMS
MANUAL
EXPANDED
AUGMENTED
Assignment
60
48
108
1D-Binpacking
960
640
1600
Crew-scheduling
150
100
250
Steiner
980
980
1960
UBQP
135
90
225
CVRP
606
404
1010
Table 3: Statistics on Various Datasets
Fig. 1 : Statistics on the Number of Variables
Error Types
Description
IndexError
Raised when trying to access an index that is out of range for a list or a sequence.
FileNotFoundError
Raised when a file or directory is requested but cannot be found.
OverflowError
Raised when a calculation exceeds the limits of the data type, typically in numeric operations.
NameError
Raised when a local or global name is not found, meaning the variable or function is not defined.
ValueError
Raised when a function receives an argument of the right type but an inappropriate value, such as converting a non-numeric string to an integer.
AttributeError
Raised when an invalid attribute reference is made, meaning the attribute does not exist on the object.
Table 4: Error Types and Descriptions
①Implicit
①Explicit
① ↓
There are 120 items S and several boxes B with a capacity of 150. The volumes of the 120 items are [BLANK] , and it is given that si≤150 ( 1≤i≤120 ). The packing problem seeks to pack all items into the boxes in such a way that the number of boxes used is minimized. The following table shows the volumes of the items: [BLANK]
There are 120 items S and several boxes B with a capacity of 150. The volumes of the 120 items are s1,s2,…,s120 , and it is given that si≤150 ( 1≤i≤120 ). The packing problem seeks to pack all items into the boxes in such a way that the number of boxes used is minimized. The following table shows the volumes of the items: x1 , x2 ,…, x119 , x120
①Implicit-Disorder
The packing problem seeks to pack all items into the boxes in such a way that the number of boxes used is minimized The following table shows the volumes of the items: x1x2 … x119x120s120 , and it is given that si≤150 ( 1≤i≤120 ) 1.There are 120 items S and several boxes B with a capacity of 150. The volumes of the 120 items are s1,s2,
②CoT Prompting(Optional)
② ↓
Dealing with 1D bin - packing problems involves several key steps. Here’s a concise outline: 1. Define the Problem: Clearly state the items to be packed (sizes and quantities) and the capacity of the bins. 2. Choose a Strategy: Select a bin - packing algorithm or heuristic (First - Fit, Best - Fit, FFD, BFD). 3. Sort the Items: If using a decreasing strategy, sort the items in descending order. 4. Initialize Bins: Create an empty list or array to represent the bins. 5. Pack the Items: Iterate through the sorted list and place each item into the first suitable bin. 6. Handle Overflows: If an item cannot fit, create a new bin. 7. Track Usage: Record how many bins are used and their contents. 8. Evaluate the Solution: Assess packing efficiency (number of bins used, waste). 9. Optimize (if needed): Explore further optimization techniques. 10. Implement and Test: Run with various inputs to ensure correctness and efficiency.
③Common Prompting
③
Table 5: A case study of 1D-Binpacking problem
Task
Dataset
GPT-4o-mini
LLAMA3-8B
ORLM
DeepSeek-R1
PoT
PoT+CoT
PoT
PoT+CoT
PoT
PoT+CoT
PoT
PoT+CoT
Assignment
Explicit-origin
\
76.67
\
\
\
\
\
\
Implicit-origin
80.88
91.67
9.09
43.33
0.00
8.33
98.33
85.00
Implicit-disorder
\
92.59
13.89
39.81
0.93
9.26
\
\
1D-Binpacking
Explicit-origin
\
83.37
\
\
\
\
\
\
Implicit-origin
64.06
75.73
55.21
12.50
3.54
8.12
80.47
82.55
Table 6: PR Task Performance Comparison
Task
Dataset
GPT-4o-mini
LLAMA3-8B
ORLM
DeepSeek-R1
PoT
PoT+CoT
PoT
PoT+CoT
PoT
PoT+CoT
PoT
PoT+CoT
Assignment
Explicit-origin
\
0.00
\
\
\
\
\
\
Implicit-origin
4.41
10.00
2.27
5.00
0.00
0.00
8.33
6.67
Implicit-disorder
\
11.11
0.00
4.63
0.00
0.93
\
\
1D-Binpacking
Explicit-origin
\
10.85
\
\
\
\
\
\
Implicit-origin
5.94
4.79
6.04
1.25
0.62
0.00
9.65
10.07
Table 7: AR Task Performance Comparison
Task
Dataset
GPT-4o-mini
LLAMA3-8B
ORLM
DeepSeek-R1
PoT
PoT+CoT
PoT
PoT+CoT
PoT
PoT+CoT
PoT
PoT+CoT
Assignment
Explicit-origin
\
-
\
\
\
\
\
\
Implicit-origin
1.969
1.969
-
1.876
0.00
0.534
1.847
1.944
Implicit-disorder
\
1.838
-
2.276
-
0.220
\
\
1D-Binpacking
Explicit-origin
\
0.089
\
\
\
\
\
\
Implicit-origin
0.2284
0.092
0.727
0.691
1.267
1.182
0.249
0.292
Table 8: MAPE Task Performance Comparison
Task
Error
Reason
Assignment
cost_matrix[i, j] = c
IndexError: index 3301 is out of bounds for axis 1 with size 3000
1D-Binpacking
with open(’data123.txt’, ’r’) as file: S = [float(line.strip()) for line in file]
ValueError: could not convert string to float: ’[ … ]’
Optimization modeling formulates real-world decision problems as mathematical programs that solvers can use to find optimal decisions. Large language models (LLMs) can automate this process, but the resulting correct formulations can require substantial time and memory to construct and solve, limiting practical scalability. Therefore, we systematically investigate whether LLMs can identify problem structure from natural-language descriptions and apply suitable optimization modeling techniques to generate mathematical models and solver code that solve the problems correctly and efficiently. To this end, we first curate OptTips, a knowledge base of 50 expert modeling techniques in eight families. Using this knowledge, we develop OptDachshund, a multi-agent framework that transforms problems from existing optimization benchmarks into new tasks for evaluating LLMs' use of modeling techniques. It constructs conventional and expert mathematical models with solver code for the same task and data, providing baselines for correctness and computational cost. The resulting EfficientOpt benchmark contains 561 expert-reviewed tasks with paired reference implementations. Evaluation of 11 representative LLMs reveals an efficiency gap on correctly solved tasks with comparable measurements: for every LLM, most generated programs take longer to solve than their expert counterparts. Within the comparable reference-size subset, 57% of programs with correct objective values and fewer variables and linear constraints have longer recorded solver times. Case studies show that different modeling techniques can achieve the same optimal value at similar recorded cost. Faster solving may not reduce execution time if the code takes longer to prepare data and build the model. LLM optimization modeling should therefore be evaluated for both correctness and computational efficiency.
Zhong Li, Xin Huang, Jinhui Wan +6
Great Bay University · Beijing Jiaotong University · Beihang University +1
Optimization problems are pervasive in sectors from manufacturing and distribution to healthcare. However, most such problems are still solved heuristically by hand rather than optimally by state-of-the-art solvers because the expertise required to formulate and solve these problems limits the widespread adoption of optimization tools and techniques. We introduce a Large Language Model (LLM)-based system designed to formulate and solve (mixed integer) linear programming problems from their natural language descriptions. Our system can develop mathematical models, write and debug solver code, evaluate the generated solutions, and improve efficiency and correctness of its model and code based on these evaluations. OptiMUS is designed as a productivity tool for optimization practitioners who understand the problem domain and can describe it precisely, but seek to accelerate the modeling and implementation workflow. OptiMUS-0.3 utilizes a modular structure to process problems, allowing it to handle problems with long descriptions and complex data without long prompts. Experiments demonstrate that OptiMUS-0.3 outperforms direct-prompting baselines by over 43% on easy and 18% on hard instances. It remains competitive with fine-tuned specialist models on benchmark problems, and outperforms them on real-world case studies (28.6% vs. 0%) where fine-tuned models fail to generalize. Ablation studies show that modular architecture with error correction is central to these gains. A key finding is that system architecture is a stronger driver of performance than model capability. Structured decomposition with targeted error correction enables weaker models to match stronger models under naive prompting, and remains competitive with fine-tuned specialist models without retraining costs.
Ali AhmadiTeshnizi, Wenzhi Gao, Herman Brunborg +3
a School of Management Science and Engineering, Stanford University, Stanford, California 94305 · b Institute for Computational and Mathematical Engineering, Stanford University, Stanford, California 94305
Large Language Models (LLMs) are increasingly involved in complex mathematical optimization, even if the pragmatic user who triggers them is unaware of it. After all, many real-world problems reduce to the search for better or the best solutions. The field of LLM-as-optimizer has three paradigms: direct optimization, tool-augmented optimization, and tool-creating optimization. Direct optimization uses iterative prompting and heuristic generation to navigate solution spaces. Tool-augmented optimization translates natural language problems into formal specifications and orchestrates external solvers. Tool-creating optimization goes further, using LLMs to discover reusable algorithms or heuristics that can be deployed at zero marginal LLM cost. We describe current performance frontiers based on the benchmarks from the literature. We identify the critical reasoning gap in current architectures and argue for trade-offs between the future potential of direct optimization and the auditability of tool-augmented optimization. Even future, more powerful models might opt for tool-making to improve operational efficiency for repetitive families of problems.
Roko Peran, Luka Hobor, Mihael Kovac +1
Student at University of Zagreb Faculty of Electrical Engineering and Computing, Zagreb, Croatia · University of Zagreb Faculty of Electrical Engineering and Computing, Zagreb, Croatia