# Resource Scheduling in Cloud Computing Based on a Hybridized Whale Optimization Algorithm
## 4 Original and Hybrid Whale Optimization Algorithm
### Proposed Hybrid Whale Optimization Algorithm
#### 4.3.3 Population Initialization and WOA-AEFS Pseudo-Code  
As in every other swarm approach, generation of the initial population is performed at the beginning of every run. In WOA-AEFS, in the initialization phase, a population of \(N\) solutions \(\vec{X}_{i}(i=1,2,3,...N)\), where each solution is comprised of \(M\) decision variables \(\vec{X}_{i}=x_{i}^{1},x_{i}^{2},...x_{i}^{M}\), is created. The population is represented as matrix of size \(NxM\):  
\[P=\begin{bmatrix}x_{1}^{1}&x_{1}^{2}&x_{1}^{3}&\cdots&x_{1}^{j}&\cdots&x_{1}^ {M}\\ x_{2}^{1}&x_{2}^{2}&x_{2}^{3}&\cdots&x_{2}^{j}&\cdots&x_{2}^{M}\\ x_{3}^{1}&x_{3}^{2}&x_{3}^{3}&\cdots&x_{3}^{j}&\cdots&x_{3}^{M}\\ \cdots&\cdots&\cdots&\cdots&\cdots&\cdots\\ x_{N}^{1}&x_{N}^{2}&x_{N}^{3}&\cdots&x_{N}^{j}&\cdots&x_{N}^{M}\\ \end{bmatrix}.\]  
Every parameter (decision variable) \(j\) of each solution from the population is generated by using the Equation (32) in the initialization phase.  
Taking into account everything stated in Section 4.3, the basic steps of execution of our proposed WOA-AEFS approach can be summarized in Algorithm 1.  
```
Initialization. Generate random initial population \(P\) by applying Equation (32) and for all solutions set the value of trial to 0. Control parameters initialization. Initialize values for ABC exploration control parameters \(eir\) and \(limit\) and FA's search control parameter \(\alpha\). Fitness calculation. Calculate fitness of each candidate solution and determine the global best solution \(\vec{X}^{*}\) while(\(t<maxIter\))do for each candidate solution do  Update \(\vec{A}\), \(\vec{C}\), \(\vec{a}\), \(l\), \(p\), \(p_{1}\) if\(p<0.5\)then if\(|\)A\(|\)\(<\)1 then  Update current candidate solution \(\vec{X}\) by using Equation (25) and store new value in \(\vec{X}_{new}\) elseif\(|A\geq 1|\)then  Choose random solution \(\vec{X}_{rnd}\) form the population  Update current candidate solution \(\vec{X}\) by using Equation (31) and store new solution in \(\vec{X}_{new}\) endif elseif\(p\geq 0.5\)then if\(p_{1}<0.5\)then  Update current candidate solution \(\vec{X}\) by using FA's search equation (Equation (34)) and store new solution in \(\vec{X}_{new}\) endif  Choose between old \(\vec{X}\) and new \(\vec{X}_{new}\) solutions by using greedy selection mechanism  if new solution is chosen, replace \(\vec{X}\) with \(\vec{X}_{new}\) and set its \(trial\) value to 0.  If old solution is chosen, increment \(trial\) value of \(\vec{X}\). endfor  If any solution goes beyond feasible region of the search space, modify it  Evaluate all solutions in the population by calculating fitness  Sort all solutions by fitness criteria in descending order  Replace all solutions that belong to \(eir\) % worst solutions in the population and for which \(trial\geq limit\) holds with random solution by using Equation (32).  Update position of the global best solution \(\vec{X}^{*}\) if necessary \(t=t+1\)  Recalculate values for \(eir\) and \(\alpha\) parameters by using Equations (33) and (36), respectively. endwhile return The best solution (\(\vec{X}^{*}\)) from the population
```  
**Algorithm 1** Pseudo-code of the WOA ABC exploration firefly search (WOA-AEFS)