Evolution of Heuristics: Towards Efficient Automatic Algorithm Design Using Large Language Model

Fei Liu,Xialiang Tong,Mingxuan Yuan,Xi Lin,Fu Luo,Zhenkun Wang,Zhichao Lu,Qingfu Zhang
2024-06-02
Abstract:Heuristics are widely used for dealing with complex search and optimization problems. However, manual design of heuristics can be often very labour extensive and requires rich working experience and knowledge. This paper proposes Evolution of Heuristic (EoH), a novel evolutionary paradigm that leverages both Large Language Models (LLMs) and Evolutionary Computation (EC) methods for Automatic Heuristic Design (AHD). EoH represents the ideas of heuristics in natural language, termed thoughts. They are then translated into executable codes by LLMs. The evolution of both thoughts and codes in an evolutionary search framework makes it very effective and efficient for generating high-performance heuristics. Experiments on three widely studied combinatorial optimization benchmark problems demonstrate that EoH outperforms commonly used handcrafted heuristics and other recent AHD methods including FunSearch. Particularly, the heuristic produced by EoH with a low computational budget (in terms of the number of queries to LLMs) significantly outperforms widely-used human hand-crafted baseline algorithms for the online bin packing problem.
Neural and Evolutionary Computing,Artificial Intelligence
What problem does this paper attempt to address?
The paper aims to address the problem of automatically designing efficient heuristic algorithms, particularly in complex search and optimization problems where manually designing heuristic algorithms is both time-consuming and requires extensive expertise. The paper proposes a new framework called "Evolution of Heuristics" (EoH), which combines large language models (LLMs) with evolutionary computation methods to automatically design heuristic algorithms. ### Research Objectives - **Reduce Human Intervention**: Reduce the need for expert manual design of heuristic algorithms through an automated process. - **Increase Efficiency**: Improve the efficiency of generating high-quality heuristic algorithms compared to existing methods. - **Generality**: The proposed method can be applied to various combinatorial optimization problems. ### Main Contributions 1. **EoH Framework**: Proposes the EoH framework, which uses LLMs to evolve both the natural language descriptions (ideas) and code implementations of heuristics, achieving automatic heuristic design with minimal human design and no need for domain-specific model training. 2. **Prompt Strategies**: Develops several simple yet effective prompt strategies to guide LLMs in generating more diverse and effective heuristic algorithms. These strategies are generally applicable to other LLM-assisted search methods. 3. **Experimental Validation**: Conducts comprehensive evaluations of EoH on three widely studied combinatorial optimization benchmark problems, demonstrating its performance superiority over many existing automatic heuristic design methods. Specifically, for the online bin packing problem, the heuristics identified by EoH outperform those generated by methods like FunSearch, with significantly fewer LLM queries required. ### Method Overview - **Heuristic Representation**: Each heuristic algorithm includes a natural language description, code block, and fitness value. - **Evolutionary Framework**: EoH maintains a population of heuristic algorithms, using several prompt strategies (including exploration and modification strategies) to generate new heuristics and guide the search direction through selection operations. - **Integrating LLMs**: Utilizes LLMs to generate natural language descriptions and corresponding code implementations of heuristics, continuously improving these heuristics through the evolutionary process. ### Experimental Results - For the online bin packing problem, the heuristics generated by EoH significantly outperform manually designed heuristics (such as Best Fit) and automatic design methods like FunSearch, especially with lower computational resource consumption. - For the Traveling Salesman Problem (TSP), EoH also shows excellent performance, particularly in terms of the gap to the known optimal solution. - In the flow shop scheduling problem, EoH performs outstandingly, generating heuristics that surpass traditional manually designed heuristics. In summary, the paper effectively addresses the problem of automatically designing heuristic algorithms by proposing the EoH framework and validates its superiority across multiple combinatorial optimization problems.