# Hyper-Heuristic Based on ACO and Local Search for Dynamic Optimization Problems +
## 3 HULK: Hyper-Heuristic Based on ACO and Local Search Operators
### Integration between Algorithms in the Dynamic Test Environment  
The hyper-heuristic proposed can be summarized in a running environment that allows for the intelligent integration of ACO with both LK and US algorithms. The synchronization between algorithms happens through a shared distance matrix. While running the tests, each T iteration of a perturbation was applied to the distance matrix, as described in Section 2.2. The algorithm adopted as a local search is selected in the beginning of each hyper-heuristic throughout a weighted roulette wheel. If the ACO improves the solution or does not produce an improvement solution after five or more iterations, apply local search. Additionally, if the algorithm does not produce an improvement after 0.4 T iterations (where T is the dynamic change period), apply both LSO in sequence. The first algorithm to be applied on the sequential local search is selected through the weighted roulette. The general framework for the dynamic test running environment is in Algorithm 2. Observe that this idea can be applied in a wide variety of DOPs, mainly routing problems; one recent example for dynamic vehicle routing problem can be found in [48], where local search operators smartly repair the solution obtained by ACO.  
```
1:Initialize parameters: \(T\) (the period of dynamic change), \(M\) (the maximum number of iterations for the test), \(A_{s}(i)\) (the magnitude of change for the iteration \(i\)) and \(\gamma,\delta\leftarrow\) 0.50 (where \(\gamma\) is the percentage of choice of US, and \(\delta\) is the percentage of choice of LK)
2:\(i\gets 0\) (the current number of iterations for the test)
3:\(n\gets 0\) (the current number of iterations without improvement for the test)
4:\(t\gets 0\) (the current period of dynamic change)
5:\(DistanceMatrix\leftarrow\) ReadProblem()
6:InitializeEnvironment
7:InitializePheromoneTrails(\(\tau_{0}\))
8:Select \(A\) using a weighted roulette wheel (biased by \(\gamma\) for US and \(\delta\) for LK) to be the first algorithm to interact with ACO, A' will be the LSO who was not chosen
9:while (\(i<M\))do
10:if (\(mod(i/T)=0\)) then
11:\(DistanceMatrix\leftarrow\) ApplyDynamicChanges(\(A_{s}(i)\))
12:\(\gamma,\delta\gets 0.50\)
13:\(t\gets t+1\)
14:endif
15:ConstructSolutions
16:\(\pi^{ib}\leftarrow\) FindIterationBest
17:if (\(mod(i/T)=0\) and \(t=1\)) then
18:\(\pi^{bs}\leftarrow\pi^{ib}\)
19:endif
20:if (\(n>=0.4T\)) then
21:\(\pi^{ib}\leftarrow\) ApplyLSO(\(\pi^{ib}A,DistanceMatrix\))
22:\(\pi^{ib}\leftarrow\) ApplyLSO(\(\pi^{ib}A^{\prime},DistanceMatrix\))
23:else
24:if (\(n>=5\) or (\(\phi(\pi^{ib},t)<\phi(\pi^{bs},t))\)) then
25:\(\pi^{ib}\leftarrow\) ApplyLSO(\(\pi^{ib},A,DistanceMatrix\))
26:endif
27:endif
28:PheromoneUpdate
29:if ((\(\phi(\pi^{ib},t)<\phi(\pi^{bs},t))\)) then
30:\(\pi^{bs}\leftarrow\pi^{ib}\)
31:\(n=0\)
32:endif
33: Select \(A\) using a weighted roulette wheel to be the algorithm to interact with ACO in the next iteration, A' will be the LSO that was not chosen
34:\(i\gets i+1\)
35:\(n\gets n+1\)
36:endwhile
37:OUTPUT: \(\pi^{bs}\) %best TSP solution
```  
**Algorithm 2** Hyper-heuristic HULK Dynamic Test Running Environment.