## 2 Basic Principles
### Whale Optimization Algorithm  
The Whale Optimization Algorithm (WOA) is a heuristic algorithm inspired by the social behavior of humpback whales. Whales are the largest mammals in the world, and spindle cells have been found in certain regions of their brains, enabling them to learn, think, judge, and communicate like humans, distinguishing them from other creatures. Most humpback whales prefer to prey on krill and schools of small fish near the water surface. Research has revealed that humpback whales employ a unique hunting strategy known as bubble-net feeding, as illustrated in Figure 2 showing the predation process of humpback whales. In the first stage, the whale dives to a depth of approximately 12 m, creating spiral-shaped bubbles around its prey, a method referred to as the \"upward spiral\" in bubble-net feeding. In the subsequent stage, the whale rapidly swims toward the surface to capture food, a behavior known as \"double loops\", which includes three distinct phases: coral loop, lobtail loop, and capture loop. The WOA uses a set of random candidate solutions and updates them in each step through encircling prey, spiral position updates, and searching for prey until the optimal solution is found [34; 35; 36; 37].  
(1) Encircling prey  
Assuming the position of a whale is \(W_{i}\) (\(i=1\), \(2\), \(\ldots\), \(m\)), where \(m\) is the number of whales in the search space, the best position represents the optimal solution or a near-optimal solution. After identifying the best search agent, other search agents attempt to update their positions toward this best position, as shown in Equation (13):  
\[\left\{\begin{array}{l}D=|C\!\cdot\!X^{*}(t)-X(t)|\\ X(t-1)=X^{*}(t)-A\!\cdot\!D\\ A=2a\!\cdot\!r-a\\ C=2\!\cdot\!r\end{array}\right. \tag{13}\]  
where \(t\) is the current iteration, \(A\) and \(C\) are random coefficients, \(X^{*}(t)\) is the position of the prey (best solution), \(X(t)\) is the current whale position, \(a\) linearly decreases from \(2\) to \(0\) during iterations, and \(r\) is a random number in \([0,1]\).  
(2) Spiral position update  
During the exploitation phase, the WOA employs a spiral position update method, as shown in Figure 3. Assuming the whale's position is \(X(t)\) and the prey's position is \(X^{*}(t)\), a spiral equation is created to simulate the spiral movement of humpback whales, as given in Equation (14):  
\[\left\{\begin{array}{l}X(t+1)=D\!\cdot\!e^{ll}\!\cdot\!\cos(2\pi l)+X^{*}(t) \\ D=|X^{*}(t)-X(t)|\end{array}\right. \tag{14}\]  
where \(D\) represents the distance between the whale and the prey, \(X^{*}(t)\) \(\$\) is the best position, \(X(t)\) is the current position, \(b\) is a constant defining the spiral shape, and \(l\) is a random number within \([-1,1]\).  
Figure 2: Predation process of humpback whales.  
While spiraling toward the prey, the whale simultaneously contracts the encircling range. Assuming a probability \(Pi\) for choosing the shrinking encircling mechanism and \(1-P_{i}\) for selecting the spiral model to update the whale's position, the mathematical model is as follows:  
\[X(t+1)=\begin{cases}X^{*}(t)-AD,&p<P_{i}\\ D\cdot e^{bl}\cdot\cos(2\pi l)+X^{*}(t),&p\geq P_{i}\end{cases} \tag{15}\]  
where \(P_{i}\) is the probability of choosing the shrinking encircling mechanism.  
During the exploration phase, humpback whales search for prey randomly and update their positions based on a randomly selected search agent rather than the best search agent. If \(|A|>1\), the position is updated according to Equation (16); if \(|A|<1\), the position is updated according to Equation (14):  
\[\left\{\begin{array}{l}D=|C\cdot X_{\text{rand}}(t)-X(t)|\\ X(t+1)=X_{\text{rand}}(t)-A\cdot D\end{array}\right. \tag{16}\]  
where \(X_{\text{rand}}(t)\) is a random whale position.