## 4 Materials and Methods
### CMA-ES Local Search  
To complement the structural exploration driven by LLMs, the framework incorporates a local optimization layer based on the Covariance Matrix Adaptation Evolution Strategy (CMA-ES). This layer performs fine-tuning of continuous parameters embedded within heuristic structures, enabling precise adaptation in regions where global search may stagnate.  
Each heuristic \(h\) generated by the LLM typically contains scalar constants that govern its behavior, such as scoring weights, decision thresholds, penalty coefficients, or time limits. These constants often appear as literals in the source code and play a critical role in controlling heuristic performance. Instead of manually specifying which parameters to optimize, the system relies on the LLM to identify them. Specifically, during heuristic generation, the LLM is prompted to mark potentially tunable constants using structured comments or syntax tokens. For example, numerical literals are annotated with tags such as # tunable_weight or embedded in specific functions like adjust_param(value). A static analysis module then parses the heuristic and extracts all such annotated values into a vector \(\mathbf{\theta}\in\mathbb{R}^{d}\).  
```
Prompt: I need you to identify numerical parameters in this algorithm  that could be optimized. These parameters might include:  1. Numerical constants that affect algorithm behavior (weights,  thresholds, coefficients)  2. Parameters that control convergence or termination  3. Parameters that balance exploration vs. exploitation  4. Other numerical values that significantly impact performance
```  
Let \(h(\mathbf{\theta})\) denote the heuristic instantiated with parameter vector \(\mathbf{\theta}\), and \(f(h(\mathbf{\theta}))\) its performance. The objective is to find:  
\[\mathbf{\theta}^{*}=\arg\max_{\mathbf{\theta}}f(h(\mathbf{\theta}))\]  
At generation \(g\) of local search, CMA-ES samples candidates:  
\[\theta_{i}^{(g)}\sim\mathcal{N}(\mathbf{m}^{(g)},\sigma^{(g)^{2}}\mathbf{C}^{( g)}),\quad i=1,\ldots,\lambda\]  
Each \(\theta_{i}^{(g)}\) is injected back into the heuristic via AST rewriting, resulting in a set of parameterized programs to be evaluated. The update process includes:  
* Fitness evaluation of all sampled heuristics \(h(\theta_{i})\).
* Selection of top-ranked samples for computing the new mean \(\mathbf{m}^{(g+1)}\).
* Step-size adaptation based on path length control.
* Covariance matrix update based on: \[\mathbf{C}^{(g+1)}=(1-c_{1}-c_{\mu})\mathbf{C}^{(g)}+c_{1}\mathbf{p}_{c} \mathbf{p}_{c}^{\top}+c_{\mu}\sum_{i=1}^{\mu}w_{i}(\theta_{i}^{(g)}-\mathbf{m }^{(g)})(\theta_{i}^{(g)}-\mathbf{m}^{(g)})^{\top}\]  
CMA-ES is invoked every \(f_{\text{memetic}}\) generations and applied to a small number of elite heuristics. The refined version \(h^{*}\) replaces its original if it achieves a minimum performance gain \(\delta\):  
\[f(h^{*})-f(h)>\delta\]  
This hybrid integration achieves two goals. First, it ensures that structural innovations discovered by the LLM are not wasted due to suboptimal parameters. Second, it delegates low-level numeric tuning to a principled optimizer, yielding better convergence properties while preserving the diversity and creativity afforded by the generative component. The entire procedures are shown in Algorithm 2.  
```
1:Input: Individual solution \(x\), objective function \(f(x)\)
2: Extract numerical parameters \(\theta\) from solution \(x\) with LLM
3: Initialize CMA-ES with \(\theta\) and step size \(\sigma=0.5\)
4:for\(t=1\) to maxiterationsdo
5: Sample population \(\{\theta_{i}\}\sim\mathcal{N}(m,\sigma^{2}\mathbf{C})\)
6: Evaluate \(f(x_{\theta_{i}})\) for each sampled parameter set
7: Update mean \(m\), step size \(\sigma\), and covariance matrix \(\mathbf{C}\)
8:endfor
9:Return: Best solution found
```  
**Algorithm 2** Hybrid Local Search with CMA-ES