NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Efficient Heuristics Generation for Solving Combinatorial Optimization Problems Using Large Language Models

Xuan Wu, Di Wang, Chunguo Wu, Lijie Wen, Chunyan Miao, Yubin Xiao, You Zhou

Abstract

Combinatorial Optimization Problems (COPs) are fundamental challenges in computer science, traditionally requiring expert-designed heuristics. While Large Language Models (LLMs) offer a path toward automated heuristic design, they often suffer from vague output and excessive computational costs. This paper presents Hercules, a framework that enhances LLM-driven heuristic generation through two novel techniques: Core Abstraction Prompting (CAP), which extracts logic from top-performing solutions, and Performance Prediction Prompting (PPP), which uses LLMs to estimate code fitness. Experimental results demonstrate that Hercules achieves state-of-the-art performance across multiple benchmarks while reducing search time by up to 59%.

Introduction

Combinatorial Optimization Problems (COPs)—such as the Traveling Salesman Problem (TSP) or the Bin Packing Problem (BPP)—are notoriously difficult to solve optimally due to their NP-hard nature. Traditionally, human experts design "heuristics" to find high-quality solutions efficiently. Recent research has explored using Large Language Models (LLMs) to automate this process. However, existing LLM-based methods face two significant hurdles: unspecificity in generated search directions and high resource consumption due to the need for extensive code evaluation.

Methodology: The Hercules Framework

Hercules addresses these challenges through two primary innovations designed to make heuristic generation both smarter and more efficient.

Core Abstraction Prompting (CAP)

Standard prompting often results in vague advice from LLMs, such as "understand the problem specifics" or "test and iterate." CAP overcomes this by forcing the LLM to analyze "elite" (top-performing) heuristics discovered in previous iterations. The LLM abstracts the core components—the specific mathematical logic or algorithmic tricks—that contribute to their success. These components are then used as prior knowledge to guide the generation of more actionable search directions.

Performance Prediction Prompting (PPP)

Evaluating every generated heuristic on hundreds of problem instances is computationally expensive. Hercules-P introduces PPP, where the LLM acts as a performance predictor. By comparing new code to "anchor" examples (historical best and worst performers), the LLM predicts a fitness score.

A key strength of PPP is its ability to recognize semantic similarity. As shown in Figure 2, two code snippets may look different syntactically but perform identical logic. PPP identifies these similarities, preventing the system from wasting resources on redundant evaluations.

Figure 2: Two heuristics that are syntactically different but semantically identical. PPP recognizes this logic overlap to avoid redundant computational evaluation.

To ensure reliability, Hercules employs Confidence Stratification (ConS). If the LLM's prediction confidence is low, the system falls back to traditional, rigorous evaluation.

Experimental Evaluation

The authors evaluated Hercules across a diverse set of classic optimization tasks, including TSP, BPP, the Multiple Knapsack Problem (MKP), Capacitated Vehicle Routing (CVRP), and the Orienteering Problem (OP). Benchmarks included the well-known TSPLIB and various synthetic datasets ranging from 120 to 1,000 nodes.

Key Results

  • State-of-the-Art Performance: Hercules outperformed existing LLM-based methods like EoH and ReEvo across all tasks. Notably, it achieved an 11.1% performance gain over baselines for 200-node TSP instances.
  • Efficiency Gains: Hercules-P reduced total search time by 7% to 59%, depending on the task, with minimal impact on the quality of the final algorithms.
  • Real-World Application: In a case study involving 49 U.S. state capitals, Hercules found a route 200 miles shorter than other automated methods.
  • Model Agnosticism: The framework proved effective across various models, including GPT-4o, Llama-3, and GLM-4.

Conclusion and Future Work

Hercules demonstrates that abstracting core logic and predicting performance can significantly enhance the efficiency and effectiveness of LLM-driven heuristic design. While the framework is model-agnostic, its performance scales with the underlying LLM's capabilities. Future research will focus on integrating these techniques with more advanced search strategies, such as beam search, to further explore the space of possible algorithms.

Summary updated

BibTeX
@inproceedings{wu2025efficient,
  author = {Xuan Wu and Di Wang and Chunguo Wu and Lijie Wen and Chunyan Miao and Yubin Xiao and You Zhou},
  title = {{Efficient Heuristics Generation for Solving Combinatorial Optimization Problems Using Large Language Models}},
  booktitle = {ACM SIGKDD Conference on Knowledge Discovery and Data Mining},
  year = {2025},
}
Figure