Table of Contents
Fetching ...

LLM-Driven Instance-Specific Heuristic Generation and Selection

Shaofeng Zhang, Shengcai Liu, Ning Lu, Jiahao Wu, Ji Liu, Yew-Soon Ong, Ke Tang

Abstract

Combinatorial optimization problems are widely encountered in real-world applications. A critical research challenge lies in designing high-quality heuristic algorithms that efficiently approximate optimal solutions within a reasonable time. In recent years, many works have explored integrating Large Language Models (LLMs) with Evolutionary Algorithms to automate heuristic algorithm design through prompt engineering. However, these approaches generally adopt a problem-specific paradigm, applying a single algorithm across all problem instances, failing to account for the heterogeneity across instances. In this paper, we propose InstSpecHH, a novel framework that introduces the concept of instance-specific heuristic generation. InstSpecHH partitions the overall problem class into sub-classes based on instance features and performs differentiated, automated heuristic design for each problem subclass. By tailoring heuristics to the unique features of different sub-classes, InstSpecHH achieves better performance at the problem class level while avoiding redundant heuristic generation for similar instances, thus reducing computational overhead. This approach effectively balances the trade-off between the cost of automatic heuristic design and the quality of the obtained solutions. To evaluate the performance of InstSpecHH, we conduct comprehensive experiments on 4,500 subclasses of the Online Bin Packing Problem (OBPP) and 365 subclasses of the Capacitated Vehicle Routing Problem (CVRP). Experimental results show that InstSpecHH demonstrates strong intra-subclass and inter-subclass generalization capabilities. Compared to previous problem-specific methods, InstSpecHH reduces the average optimality gap by 6.06\% for OBPP and 0.66\% for CVRP. These results highlight the potential of instance-aware automatic heuristic design to further enhance solution quality.

LLM-Driven Instance-Specific Heuristic Generation and Selection

Abstract

Combinatorial optimization problems are widely encountered in real-world applications. A critical research challenge lies in designing high-quality heuristic algorithms that efficiently approximate optimal solutions within a reasonable time. In recent years, many works have explored integrating Large Language Models (LLMs) with Evolutionary Algorithms to automate heuristic algorithm design through prompt engineering. However, these approaches generally adopt a problem-specific paradigm, applying a single algorithm across all problem instances, failing to account for the heterogeneity across instances. In this paper, we propose InstSpecHH, a novel framework that introduces the concept of instance-specific heuristic generation. InstSpecHH partitions the overall problem class into sub-classes based on instance features and performs differentiated, automated heuristic design for each problem subclass. By tailoring heuristics to the unique features of different sub-classes, InstSpecHH achieves better performance at the problem class level while avoiding redundant heuristic generation for similar instances, thus reducing computational overhead. This approach effectively balances the trade-off between the cost of automatic heuristic design and the quality of the obtained solutions. To evaluate the performance of InstSpecHH, we conduct comprehensive experiments on 4,500 subclasses of the Online Bin Packing Problem (OBPP) and 365 subclasses of the Capacitated Vehicle Routing Problem (CVRP). Experimental results show that InstSpecHH demonstrates strong intra-subclass and inter-subclass generalization capabilities. Compared to previous problem-specific methods, InstSpecHH reduces the average optimality gap by 6.06\% for OBPP and 0.66\% for CVRP. These results highlight the potential of instance-aware automatic heuristic design to further enhance solution quality.

Paper Structure

This paper contains 29 sections, 4 equations, 16 figures, 5 tables, 1 algorithm.

Figures (16)

  • Figure 1: InstSpecHH Diagram. First, construct problem subclasses and their representations (top). Next, generate instance-specific heuristic algorithms (middle). Finally, select the best‐matching heuristic algorithm for the target instance (bottom).
  • Figure 2: Heuristic Algorithm Selection Prompt Template.
  • Figure 3: Example of natural language description for OBPP (left) and CVRP (right) problem features.
  • Figure 4: Estimated Total Time Cost Analysis: The total time cost is calculated as $T_{\text{total}} = T_{\text{offline}} + n \times T_{\text{online}}$. For EoH (Individual), $T_{\text{offline}} = 0$. For InstSpecHH, $T_{\text{offline}} = \#\text{intra-subclass} \times T_{\text{code design}}$, where $T_{\text{code design}}$ is estimated based on the online time cost of EoH (Individual). The online costs are estimated based on Table \ref{['tab:inv_analysis']} (Inter-Subclass).
  • Figure 5: InstSpecHH Performance vs Number of Heuristic Algorithm: Inter-subclass generalization performance under different heuristic retention ratios in InstSpecHH + LLM. Lower objective values indicate a higher quality of the selected heuristics.
  • ...and 11 more figures