## 4 Application of HS to VM Consolidation
### Adaptive Harmony Search for Parameter Setting  
Metaheuristic algorithms can be applied to a variety of problems, but the process of appropriate parameter setup for different problems should be performed. In addition, since these algorithms are based on probability, it is common to conduct statistical analysis on repeated experiments; the number of iterations here can be a disadvantage considering the combinations of parameters. Despite these efforts for the solution quality, the parameters cannot guarantee solution quality with slight changes in the nature of the problem. To overcome this disadvantage, a self-adaptive HS, which explores and obtains the parameters itself, is widely being studied. This study addresses the parameter-setting-free harmony search (PSF-HS), novel self-adaptive harmony search (NS-HS), Improved Harmony Search (I-HS) and parameter adaptive harmony search (PA-HS) to reduce the complexity of setting the parameters [40; 41; 42; 43]. The PSF-HS, introduced by [PERSON] et al., implements the operation type memory (OTM), which stores the operator that improves the solution during iterations. It updates the HMCR and PAR by remembering the operator contribution to the generation of the improved new HM among the HMC, PA, and RS. The characteristic of increasing HMCR and decreasing PAR with increasing number of iterations is maintained to improve search \begin{table}
\begin{tabular}{l l} \hline \hline \multicolumn{2}{l}{**Pseudo Code for Harmony Search**} \\ \hline
1: & **Input**: List of PMs, VMs, \(x\) (VMs are allocated PMs before consolidation) \\
2: & **Output**: \(x^{\prime}\) (VMs are allocated PMs after consolidation) \\
3: & Initialize the DC status and Harmony Search parameters \\
4: & Replicate the vectors of the Harmony Memory on \(x\), **HM** = \(\{x^{1},x^{2},\ldots,x^{\text{HMS}}\}\) \\
5: & Calculate the objective function \(f(x^{1},x^{2},\ldots,x^{\text{HMS}})\) \\
6: & Recognize the worst vector in **HM**, \(x^{\text{worst}}\in\{x^{1},x^{2},\ldots,x^{\text{HMS}}\}\) \\
7: & **REPET** \\
8: & \(x^{\prime}=\phi\) \\
9: & **FOR**\(i=1\) to VMs.Length \\
10: & **IF** (Rand(\(0\leq\) HMCR) **THEN** \\
11: & \(x^{\prime}_{i}=x^{[I|_{1},\text{HMS}]}_{i}\) \\
12: & \(x^{\prime}_{i}\).is HMCR = true \\
13: & **ELSE** \\
14: & \(x^{\prime}_{i}=X_{i}\) \\
15: & **END IF** \\
16: & **END FOR** \\
17: & **FOR**\(i=1\) to VMs.Length \\
18: & Calculate workload stability by PM when VM is migrated \\
19: & \(BW_{i}\in\{SC^{1},x^{2}_{i},\ldots,x^{\text{PM}}_{i}\}\) \\
20: & **FOR**\(i=1\) to VMs.Length \\
21: & **IF** (\(x^{\prime}_{i}\). is HMCR = true) **THEN** // _VM Selection_ \\
22: & **IF** (PM\([x^{\prime}_{i}]\).is Ovelroad) **THEN** \\
23: & \(x^{\prime}_{i}\): is PAR = true \\
24: & **ELSE** (PM\([x^{\prime}_{i}]\). is Underload **\& Rand() \(\leq\) PAR) **THEN** \\
25: & \(x^{\prime}_{i}\). is PAR = true \\
26: & **ELSE** IF(Average(\(BW_{i}\)) \(<\) Top 10\% \& Rand() \(\leq\) PAR) **THEN** \\
27: & \(x^{\prime}_{i}\). is PAR = true \\
28 & **END IF** \\
29: & **IF** (\(x^{\prime}_{i}\). is PAR == true) \\
30: & \(x^{\prime}_{i}=BW_{i}\)\({}^{Roullette[1,\text{PM}\times\text{bandwidthRate}]}\) \\
31: & **END IF** \\
32: & **END IF** \\
33: & **END FOR** \\
34: & **IF** (\(f(x^{\prime})<f(x^{\text{worst}})\)) **then** \\
35: & **Replace**\(f(x^{\text{worst}})\) with \(f(x^{\prime})\) \\
36: & **END IF** \\
37: & **END REPEAT** \\
38: & Find the current best harmony (\(x^{\prime}\)) \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Pseudo code for harmony search (HS) in VM consolidation framework. efficiency by increasing the global search at the beginning of the iteration and increasing the local search towards the end of the iteration. \[HMCR_{i}=\frac{n\left(y_{i}^{j}=HMC\right)}{HMS}\]  
\[PAR_{i}=\frac{n\left(y_{i}^{j}=PA\right)}{HMS}\]  
\[OTM=\left| \begin{array}{cccc}y_{1}^{1}=RS&y_{2}^{1}=PA&\ldots&y_{n}^{1}=HMC\\ y_{1}^{2}=HMC&y_{2}^{2}=RS&\ldots&y_{n}^{2}=RS\\ \ldots&\ldots&\ldots&\ldots\\ y_{1}^{HMS}=HMC&y_{2}^{HMS}=HMS&\ldots&y_{n}^{HMS}=PA\end{array}