## 4 The Proposed ECSO-OBL Algorithm
### Cluster Head Selection Using ECSO-OBL Algorithm  
Opposition-based learning is an effective optimization strategy that provides initial solutions with high quality and accelerates the performance of global optimization algorithms. This allows for sufficient information sharing among Cuckoo search population and enhances the balance between exploration and exploitation. The strategy considers the opposite of current solutions to expand the search space, thereby enhancing convergence speed and population diversity. The sensor nodes' locations are considered in defining clusters by using the ECSO-OBL algorithm. In the process of CH selection, the fitness values of the sensor nodes are defined based on the Euclidean distances between sensor nodes and the available energy at each sensor node. The following fitness function to balance coverage and available energy is defined:  
\[F=\min\left[\frac{\sum_{i}^{S}C_{ik}}{a}\left(\frac{P_{i}}{E_{i}}\right) \right],\,\,\forall k \tag{12}\]  
where \(C_{ik}=1\), if Equation (1) is satisfied; otherwise, \(C_{ik}=0\). The second term in (12) represents the energy consumption of the sensor nodes. \"\(a\)\" is the coverage factor, \(P_{i}=\) initial battery power, and \(E_{i}=\) energy consumption rate. The sensor nodes with higher fitness values are selected as CHs, and the rest of the sensor nodes select their CH based on the distance to reach the CH and the available energy at that node. \"Levy flight\" is a random walk with random steps whose durations is as per the Levy distribution. CH selection in the WSN is achieved through the ECSO-OBL algorithm as follows:  
* Initial cluster vertices are produced randomly using [PERSON]'s flight path. * Initially, 10% of the total sensor nodes are selected as the best CHs, and the fitness function is used to assess their quality. * Based on the fitness function, the solutions are revised if their quality is higher than the current solution. * With the support of [PERSON]'s flight, the worst nests are discarded and rebuilt in a new location. * This procedure is continued until the termination condition is satisfied, and the algorithm execution is concluded. The above steps are repeated in iterations as shown in Figure 3, and all the nests progressively approach the optimal solutions. We consider coverage optimization in WSNs by using an improved CSO algorithm which is defined based on the brood parasitism of cuckoo species. The steps of the ECSO-OBL algorithm are shown in Algorithm 1, where the new solutions are generated by either the probability fraction \"\(P_{m}\)\" of the total host nests or Levy flight (it is a random walk model with the Levy distribution for step length). The best solution of global search in the CSO algorithm depends mainly on mutation probability and the step size control factor. Keeping constant values for these parameters minimizes the convergence rate and localization accuracy in WSNs. Therefore, we define dynamic values for mutation probability and Levy flight using Equations (13) and (14) to achieve the global optimal solution with high localization accuracy. Figure 3: The flowchart of the ECSO-OBL algorithm. Firstly, we define the mutation probability \(P_{m}\) as per Equation (13), which is based on the fitness of solutions to overcome the problem of local convergence and enhance population diversity. If we choose \(P_{m}\) as too small a value, localization accuracy is reduced, and the algorithm needs a greater number of iterations to achieve optimal performance. On the other hand, if \(P_{m}\) is too large, convergence time is higher. Therefore, it is essential to have an optimal value of mutation probability that is proportional to the objective function value. \[P_{m}(i)=\left\{ \begin{array}{ll}(P_{m_{min}}+(P_{m_{max}}-P_{m_{min}})\,\times &(fitness(i)-f_{min})\,\,\,\text{if}\,\,(fitness(i)-f_{min})<1\\ \frac{P_{m_{max}}}{N_{i}},&\text{otherwise,\,\,\,where\,\,}i=1,\,2,\,3,\,\,\dots \dots\dots\dots s\end{array} \right.