## 4 Materials and Methods
### LLM-Guided Heuristic Evolution  
Let \(\mathcal{H}\) denote the space of heuristic programs, and \(\mathcal{P}_{t}=\{h_{1}^{t},\ldots,h_{\mu}^{t}\}\subset\mathcal{H}\) be the population at generation \(t\). The heuristic evolution follows a classical evolutionary pipeline enhanced with LLM-guided generation:  
\[\mathcal{P}_{t}^{\prime} =\text{Select}(\mathcal{P}_{t},f), \tag{1}\] \[\mathcal{P}_{t+1} =\text{Vary}(\mathcal{P}_{t}^{\prime})\cup\text{Elite}(\mathcal{P }_{t}), \tag{2}\]  
where \(f:\mathcal{H}\rightarrow\mathbb{R}\) is the fitness function, and \"Elite\" denotes the retention of top-\(k\) candidates from \(\mathcal{P}_{t}\). The \"Select\" operator samples a subset of heuristics from the current population according to their fitness, typically via tournament selection or fitness-proportional sampling. The \"Vary\" operator applies variation to the selected heuristics, including mutation, crossover, and optionally LLM-based modifications, to produce novel candidates. The initial population \(\mathcal{P}_{0}\) is sampled from the LLM using structured prompts \(\pi\in\Pi\), where \(\Pi\) denotes a predefined set of prompt templates designed to elicit diverse and  
Figure 1: An overview of the proposed EoH-MR framework. syntactically valid heuristics from the language model. Each prompt \(\pi\in\Pi\) encodes problem-specific context, task constraints, or examples, guiding the generation process toward feasible program candidates. Each generated heuristic \(h_{i}\) is verified for type correctness and filtered through static and dynamic validation. That is, \(h_{i}^{0}\sim\text{LLM}(\cdot\mid\pi)\) for \(i=1,\ldots,\mu\). During selection, either fitness-proportional or tournament-based methods are applied. The probability of selecting \(h_{i}^{t}\) is given by  
\[P(h_{i}^{t})=\frac{f(h_{i}^{t})}{\sum_{j=1}^{\mu}f(h_{j}^{t})+\epsilon},\]  
where \(\epsilon\) prevents division by zero. Selection emphasizes high-performing candidates while maintaining diversity. Variation is driven by four variation operators \(\mathcal{O}=\{\text{E1,E2,M1,M2}\}\). The application of operator \(op\in\mathcal{O}\) is modeled as  
\[h_{\text{new}}\sim\text{Apply}(op\sim P_{\text{op}},\mathcal{P}_{t}^{\prime}),\]  
where \(P_{\text{op}}\) is a learned or static distribution over operators. Here, \"Apply\" denotes applying operator \(op\) to one or more heuristics in the selected population \(\mathcal{P}_{t}^{\prime}\) to produce a new candidate \(h_{\text{new}}\). The operators are defined as follows [9]:  
* E1--Recombination: Constructs a new algorithm by recombining code segments from multiple parents, synthesizing novel structures not present in any single parent. Prompt: Create a new algorithm that has a totally different form from the given ones. * E2--N-Point Crossover: Generates a variant that retains motivational elements from parents but exhibits a different structure via subtree exchange at aligned points. Prompt: Create a new algorithm that has a totally different form from the given ones but can be motivated from them. * M1--Directed Mutation: Produces a heuristic variant by adapting existing logic to address identified bottlenecks, ensuring structural similarity while enabling targeted improvements. Prompt: Create a new algorithm that has a different form but can be a modified version of the algorithm provided. * M2--Exploratory Mutation: Alters main algorithm parameter settings to explore new neighborhoods in the parameter space, introducing parameter-level diversity. Prompt: Identify the main algorithm parameters and create a new algorithm that has different parameter settings of the algorithm. Candidates are evaluated using a fitness function \(f(h)\), and invalid candidates (for example, those causing exceptions or NaNs) are pruned. The top \(\mu\) heuristics among all valid parents and children form \(\mathcal{P}_{t+1}\). Algorithm 1 demonstrates the entire procedure.