## 3 Proposed Approach
### Whale Optimization Algorithm
#### 3.2.2 Bubble-Net Attacking  
Two mathematical models have been proposed to mimic the whale performance while attacking their prays: The shrinking encircling mechanism and Spiral updating position. To update the whales' position around the best solution in the search space, the shrinking encircling mechanism mimics this process by reducing the value of variable \(\vec{a}\) over the course of generations in a linear manner. Figure 5 demonstrates the expected positions of whales around the best solution.  
In nature, whales swim in an upward spiral path while hunting their food. To mimic this process, a logarithmic spiral function is used, as shown in Equation (6).  
\[\vec{X}(k+1)=\vec{D}^{\prime}\cdot e^{bl}\cdot cos(2\pi I)+\vec{X}^{*}(k) \tag{6}\]  
where \(\vec{D^{\prime}}=\mid\vec{x}^{*}(k)-\vec{X}(k)\mid\) denotes the distance between the \(i\)th solution and the optimal solution found so far, the parameter \(b\) creates the shape of the spiral function and \(I\) is random number between \(-1\) and \(1\). Figure 6 depicts the spiral swimming process for whales while hunting.  
Figure 4: Potential 2D and 3D locations of whales in the neighbourhood of the prey.  
Figure 5: Shrinking encircling mechanism.  
To model the shrinking encircling and spiral swimming behaviors, a probability of 50% is assumed to select between these two behaviors throughout the course of optimization. Each whale selects the operation to be performed randomly based on its location with respect to the optimal solution so far. Equation (7) explores the operation selection based on a random number \(p\).  
\[\vec{X}(k+1)=\begin{cases}\vec{X}^{*}(k)-\vec{A}\cdot\vec{D}&,p<0.5\\ \vec{D}^{\prime}\cdot e^{bt}\cdot cos(2\pi I)+\vec{X}^{*}(k)&,p\geq 0.5\end{cases} \tag{7}\]  
In simple, the exploration phase in WAO occurs once each whale in the population updates its position based on an arbitrarily selected whale. The next position for the whale will be in the area between its current position and the position of a randomly selected. The exploration phase occurs when the variable (A) has a value between \(-1\) and \(1\) as shown in Figure 7. The exploitation phase occurs when each whale updates its current position based on the position of the best whale so far, where a linear decreeing of the variable (A). In simple, Equations (8) and (9) present the exploration phase of WOA. Finally, the Pseudo-code of WOA is presented in Algorithm 2.  
\[\vec{D}=|\vec{C}\cdot\vec{X}_{rand}-\vec{X}(k)| \tag{8}\]  
\[\vec{X}(k+1)=\vec{X}_{rand}(k)-\vec{A}\cdot\vec{D} \tag{9}\]  
Figure 6: Spiral updating position (red circle denotes the position of prey while yellow circle is the position of a whale).  
Figure 7: Updating whale position either towards or moving away from a randomly picked hump-back whale.  
```
Initialize a random population of whales  Initialize all coefficients  Evaluate all solutions using fitness function  Determine the optimal solution so far (denoted as \(X^{*}\)) while(\(k\) < maximum number of iterations) do for each solution (whale) do  Update \(a\), \(A\), \(C\), \(l\), and \(p\) coefficients. if(\(p\) < 0.5) then if\(|A|<1\)then  Update the current solution's position by Eq.(2). else if\(|A|\geq 1\)then  Pick a random solution from the population  Update the position of \(X(k)\) using Eq.(9) else if(\(p\geq 0.5\)) then  Update the position of \(X(k)\) by Eq.(6)  Estimate the fitness value for each in the population.  Update \(X^{*}\) \(k=k+1\) return\(X^{*}\)
```  
**Algorithm 2** Pseudo-code of WOA.