# Automated Generation of Hybrid Metaheuristics Using Learning-to-Rank
## 4 Methodology
### Algorithm Implementation of LTR-MHA  
Once the predictive model is trained, it can be employed to guide the search process. During each iteration, when a search agent requires position updating, the feature vectors for all candidate update actions of the current search agent are first constructed and fed into the predictive model \(LTRMHA\). The model evaluates these feature vectors and outputs a set of predicted scores. Based on these scores, the algorithm selects the candidate action with the highest predicted score for execution. As illustrated in Figure 1, the model predicts that the action \(\mathit{act}_{3}\) corresponds to the solution with the highest predicted score (0.78), indicating that this action is most likely to guide the search process towards the best solution. Therefore, in this iteration, the search agent selects \(\mathit{act}_{3}\). The implementation of the LTR-MHA is detailed in Algorithm 3.  
```
0:predictive model \(LTRMHA\), Update behaviors set Actions, Dimension \(D\), Maximum iterations \(I_{\max}\), Population size \(m\), Bounds \(lb,ub\), fitness function \(func\);
0: The best solution \(X^{*}\), the best fitness;
1: Initialize population \(P=\{X_{i}\mid i=1,2,\ldots,m\ \wedge\ |X_{i}|=D\}\);
2: Compute fitness values for all search agents via \(\mathit{fitness}_{i}=func(X_{i}(0))\);
3: Select best agent to \(X^{*}\);
4:while\(t<I_{\max}\)do
5:for each agent \(X_{i}\in P\)do
6:for candidate behavior \(\mathit{act}_{k}\in Actions\)do
7: Construct feature vector \(F_{\text{test}}^{k}\) for \(\mathit{act}_{k}\) according to Equation (19);
8:endfor
9: Feed feature set to \(LTRMHA\), obtain prediction scores \(PS\);
10: Determine the optimal behavior: \(\mathit{act}_{\text{predicted}}=\arg\max_{k}PS_{k}\);
11: Update \(X_{i}\) using \(\mathit{act}_{\text{predicted}}\); \(\triangleright\) Update strategy follows Equation (16)
12:endfor
13: Adjust search agents exceeding search space boundaries via \(rand(lb,ub)\);
14: Recalculate fitness values via \(\mathit{fitness}_{i}=func(X_{i}(t+1))\);
15: Update \(X^{*}\) if a better solution is available;
16:\(t=t+1\);
17:endwhile
18:return\(X^{*}\), the best fitness;
```  
**Algorithm 3** Pseudocode of LTR-MHAFirst, the population of search agents \(P\) is initialized, and the fitness value of each search agent is calculated. The best search agent is selected as the initial optimal solution \(X^{*}\) (lines 1-3). Then, within the \(I_{\text{max}}\), for each search agent and candidate action, the feature vectors to be evaluated are constructed. Since this method involves 12 update actions, the feature set to be predicted should contain 12 feature vectors (lines 5-8). These feature vectors are then fed into the \(LTRMHA\) predictive model, which outputs a set of predicted scores. The algorithm selects the update action corresponding to the highest predicted score for execution (lines 9-11). Subsequently, the algorithm checks whether any search agent has exceeded the search space boundaries, adjusts their positions accordingly, and recalculates the fitness values of all search agents (lines 13-14). If a better solution is found, the \(X^{*}\) is updated (line 14). After the loop ends, the final optimal solution \(X^{*}\) is returned (line 17).