Planning of Heuristics: Strategic Planning on Large Language Models with Monte Carlo Tree Search for Automating Heuristic Optimization

Chaoxu Mu, Xufeng Zhang, Hui WangarXiv 2025 · DOI

Abstract

Automating the design of heuristics for combinatorial optimization problems (COPs) has long been a goal in operations research and computer science. While Large Language Models (LLMs) have shown promise in generating code for such heuristics, they often lack the strategic foresight required to navigate complex algorithmic search spaces effectively. We present the Planning of Heuristics (PoH) framework, which reframes heuristic design as a Markov Decision Process (MDP) and employs Monte Carlo Tree Search (MCTS) to guide the LLM. By treating heuristic optimization as a planning problem, PoH enables the systematic exploration and refinement of algorithmic strategies. Our evaluations on the Traveling Salesman Problem (TSP) and Flow Shop Scheduling Problem (FSSP) demonstrate that PoH achieves state-of-the-art results, significantly outperforming existing evolutionary and deep learning-based methods.

Introduction

Combinatorial Optimization Problems (COPs), such as the Traveling Salesman Problem (TSP) and the Flow Shop Scheduling Problem (FSSP), are fundamental challenges in logistics, manufacturing, and network design. Because these problems are often NP-hard, practitioners rely on heuristics—efficient "rule-of-thumb" algorithms—to find near-optimal solutions within reasonable timeframes. Traditionally, designing high-performing heuristics requires significant domain expertise and a tedious manual trial-and-error process.

Recent advancements in Large Language Models (LLMs) have opened new avenues for Automatic Heuristic Design (AHD). However, current LLM-based approaches primarily rely on evolutionary strategies or simple iterative refinements. These methods often behave like a "random walk" in the space of possible algorithms, lacking the ability to "look ahead" or strategically plan a sequence of improvements. To address this, we introduce the Planning of Heuristics (PoH) framework.

Methodology: Heuristic Design as Planning

The core innovation of PoH is the conceptualization of heuristic optimization as a search problem within a tree of potential algorithms.

The Markov Decision Process (MDP) Formulation

PoH models the optimization process as an MDP defined by:

  • States ($S$): Each state represents a specific heuristic implementation, typically as Python code.
  • Actions ($A$): Actions are textual improvement suggestions generated by an "Optimizer LLM." These suggestions analyze the current heuristic's performance and propose specific algorithmic changes (e.g., "Use a product-based penalty instead of a sum-based one").
  • Rewards ($R$): The reward is a quantitative measure of the heuristic's performance on a training set, often calculated as $1 - \text{gap}$, where the gap is the relative difference from a known optimal solution.

Monte Carlo Tree Search (MCTS)

To navigate this MDP, PoH utilizes Monte Carlo Tree Search (MCTS), a powerful algorithm for strategic decision-making in large search spaces. The process follows a four-step iterative loop:

  1. Selection: Starting from the root (an initial base heuristic), the system traverses the tree using the Upper Confidence Bound (UCT) formula. This balances "exploitation" (refining heuristics that have already shown good performance) and "exploration" (investigating less-visited branches).
  2. Expansion: Once a leaf node is reached, the Optimizer LLM generates multiple new improvement suggestions, creating new child nodes.
  3. Simulation: To estimate the long-term potential of a new node, the system performs a "rollout" or simulation, where the LLM continues to refine the heuristic for a few more steps.
  4. Back-propagation: The performance results from the simulation are propagated back up the tree, updating the value estimates of all ancestor nodes.
The PoH framework: (a) illustrates the MCTS planning process over the heuristic search space, while (b) shows a concrete state transition where an Optimizer LLM transforms code based on a textual suggestion.

This planning approach allows PoH to identify "promising trajectories"—sequences of improvements that lead to highly optimized heuristics—which simpler greedy or evolutionary methods might overlook.

Experimental Evaluation

We evaluated PoH on two benchmark combinatorial optimization problems:

Traveling Salesman Problem (TSP)

Using the TSPLIB library, we trained the system on 64 instances of 100-node problems. Testing was conducted on instances ranging from 20 to 200 nodes. PoH demonstrated remarkable scalability; on the TSP200 benchmark, it achieved an optimality gap of just 0.227%. This significantly outperformed other LLM-based methods like ReEvo (0.306%) and EoH (0.338%), as well as traditional neural solvers.

Flow Shop Scheduling Problem (FSSP)

For FSSP, we used the standard Taillard instances. PoH achieved the lowest average relative makespan in four out of six tested categories, surpassing specialized deep learning models like PFSPNet.

Key Insights

  • Strategic Planning vs. Random Evolution: The success of PoH highlights that the structure of the search matters as much as the LLM's coding ability. MCTS provides the necessary foresight to navigate the vast space of possible algorithms efficiently.
  • The Role of Self-Reflection: By using an LLM to generate textual "actions," the system incorporates a form of self-reflection. The model doesn't just change code randomly; it analyzes failures and proposes logical fixes.
  • Complexity Handling: PoH’s performance advantage over evolutionary methods grows as the problem size increases, suggesting it is better suited for complex, large-scale industrial applications.

Conclusion and Future Work

The Planning of Heuristics framework represents a significant step forward in automating algorithmic design. By combining the generative power of LLMs with the strategic search capabilities of MCTS, we can discover heuristics that rival or exceed human-designed solutions. While MCTS introduces some computational overhead due to the need for multiple simulations, future work will focus on optimizing this process using techniques like Gumbel MCTS or more efficient evaluation proxies.

Summary updated

BibTeX
@misc{mu2025planning,
  author = {Chaoxu Mu and Xufeng Zhang and Hui Wang},
  title = {{Planning of Heuristics: Strategic Planning on Large Language Models with Monte Carlo Tree Search for Automating Heuristic Optimization}},
  year = {2025},
  eprint = {2502.11422},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2502.11422},
}
Figure