## 4 The Proposed ECSO-OBL Algorithm
### Cluster Head Selection Using ECSO-OBL Algorithm
\tag{13}\]  
where \(f_{min}\) is the current global optimal fitness value and \(fitness(i)\) is the current fitness value of ith solution. \((fitness(i)-f_{min})\) represents the quality of the \(i\)th solution. \(P_{m_{min}}\) and \(P_{m_{max}}\) are the minimum and maximum values of the mutation probabilities, respectively. \begin{tabular}{l l} \hline \hline Start & \\ For i = 1 to N & /* N \(\rightarrow\) Total number of target nodes (TN) \\ & Select each TN; \\ & Perform AN selection; & /* AN \(\rightarrow\) anchor node \\ & Compute distance between TN and each selected AN; \\ & Assign weights to ANs; \\ & Define the fitness function; \\ & Define the range of \(P_{m}\): set \(P_{m_{min}}\) \& \(P_{m_{max}}\); \\ & Generate initial set of solutions, \(S_{k}\), k = 1, 2, 3, \(\dots\).R; \\ & Define the range of solutions: \(S_{max}\) \& \(S_{min}\); \\ & While \((N_{i}<N_{T})\) do & /* N\({}_{T}\)\(\rightarrow\) Maximum number of iterations \\ & For each \(S_{k}\) do \\ & If \((S_{k}<S_{min})\) then \\ & \(S_{k}\ \gets\ S_{min}\) ; \\ & Else if \((S_{k}>S_{max})\) then \\ & \(S_{k}\ \rightarrow\ S_{max}\) ; \\ & End if; \\ & Set \(f_{min}\) as current global optimal fitness value; \\ & Calculate \(P_{m}\) according to Equation (13); \\ & Generate a fraction of \(P_{m}\) as new solutions; \\ & Compute the objective function; \\ & Evaluate the fitness of the objective function; \\ & End for; \\ & End While; \\ & End for; \\ & Derive the new set of best or optimal solutions; \\ & Arrange the solutions to find the best of them; \\ & End \\ \hline \hline \end{tabular}   
Secondly, the Levy flight-based solution is the most efficient way of exploring the search space, and new solutions are generated as per Equation (14). \[s_{i}^{(k+1)}=s_{i}^{k}+\Delta.Lvy(\gamma) \tag{14}\]where \(Lxy(\gamma)\) is the step size and it is defined as \(Lxy(\gamma)=\frac{x}{|y|^{\gamma-1}}\). \(\gamma\) is a constant that takes values as \(1<\gamma\leq 3\), and \(\Delta\) is the step size control factor. x and y are the normal distributions where \(x\sim N\big{(}0,\sigma_{x}^{2}\big{)}\), \(y\sim N\Big{(}0,\sigma_{y}^{2}\Big{)}\), and the corresponding variances are given in Equation (15). \[\sigma_{x}=[\frac{\Gamma(1+\gamma)sin(\frac{\pi_{\gamma}}{2})}{\Gamma\Big{[} \frac{1+\gamma}{2}\Big{]}\gamma^{2(\gamma-1)/2}}]^{\gamma-1},\ \ \ \sigma_{y}=1 \tag{15}\]  
When the step size control factor \(\Delta\) is low, few of the newly generated solutions shown in Equation (14) walk around the existing best solution to speed up the local search. On the other hand, when \(\Delta\) is high, the new solutions walk away from the present best solution and cause the absence of global optimal solution. Therefore, it is essential to define the variable step size as shown in Equation (16). \[\Delta=\Delta_{max}-\frac{N_{i}}{N_{T}}\ (\Delta_{max}-\Delta_{min}) \tag{16}\]  
where \(N_{T}\) and \(N_{i}\) are the total number of iterations and the present iteration number, respectively. \(\Delta_{min}\) and \(\Delta_{max}\) are the minimum and maximum step sizes, respectively. From Equation (16), the size of \(\Delta\) decreases when the iteration numbers increase. During the initial iterations, the higher step sizes maximize the global search, and at a later stage, the lower step sizes intensify the local search. Overall, we can achieve global optimal solutions and a higher conversion rate with enough iterations. The time complexity of the ECSO-OBL algorithm in generating population is \(O(N)\), where \(N\) is the size of the population. It also requires \(O(N)\) to calculate the fitness of the initially generated population. After generating the initial solutions, the computation of the fitness function and the updating of the population at each iteration need \(O(2N)\). And the time complexity involved in sorting all the solutions and finding optimal solutions is \(O(N^{2})\). Therefore, the total time complexity of the ECSO-OBL algorithm is \(O[2N+N^{2}+\text{max}O(N^{2})+O(2N)]\).