## 3 Dynamic CH Selection and Energy-Efficient Routing Design
### Proposed Methodology
#### 3.4.3 Routing Algorithm Using JILFA  
Due to the availability of local optima that can trap the search, the original Jaya method may be unable to reach the best solution. To solve this difficulty, we proposed modifying the original Jaya method by multiplying its step size by random values. Instead of using random numbers to reposition the particles, the following Equation (19) is used  
\[\mathrm{X}_{\mathrm{j}\mathrm{k}}^{\mathrm{i}+1}=\mathrm{X}_{\mathrm{j}\mathrm{ k}}^{\mathrm{i}}+\left\|\mathrm{f}_{\mathrm{1}}\right|\Big{(}\mathrm{X}_{ \mathrm{j}\mathrm{best}}^{\mathrm{i}}-\left|\mathrm{X}_{\mathrm{j}\mathrm{k}}^ {\mathrm{i}}\right|-\left\|\mathrm{f}_{\mathrm{2}}\right|\Big{(}\mathrm{X}_{ \mathrm{j}\mathrm{worst}}^{\mathrm{i}}-\left|\mathrm{X}_{\mathrm{j}\mathrm{k}}^ {\mathrm{i}}\right|\Big{)}\Big{)} \tag{19}\]  
where \(\mathrm{f}_{\mathrm{1}}\) and \(\mathrm{f}_{\mathrm{2}}\) are 2-numbers chosen at random from the Levy distribution, respectively. The power-law index \(\beta\), which is required in Equation (20) to sample random numbers from the Levy distribution, is the only added parameter compared to the original Jaya algorithm. \[\mathrm{D}_{\mathrm{lf}}=\frac{\mathrm{U}}{\left|\mathrm{V}\right|^{1/\beta}} \tag{20}\]  
where the power-law index is denoted by \(\beta\), \(\mathrm{V}\) is a random number drawn at N(0, 1), and \(\mathrm{U}\) describes a random number drawn at N(0, \(\sigma\)2), and the standard deviation \(\sigma\) is given by Equation (21),  
\[\sigma=\left(\frac{\Gamma(1+\beta)\times\sin\left(\frac{\pi\beta}{2}\right)}{ \Gamma\Big{(}\frac{(1+\beta)}{2}\Big{)}\times\beta\times 2^{\frac{\beta-1}{2}}} \right)^{\frac{1}{\beta}} \tag{21}\]  
where \(\Gamma\) denotes the gamma function. Even though this new distribution is a minor change in the algorithm, it causes significant changes in the optimization procedure, which, as we will see later, results in higher actual quality to demonstrate effectiveness. Steps convoluted in the IJO-LF algorithm are as follows:  
Step 1: Population size (\(\mathrm{N}\)) initialization: Decision variables' numbers \(\mathrm{D}(\mathrm{j}=1,\ 2,\ldots\mathrm{D})\), decision variables for upper and lower bounds of \(\mathrm{\chi}_{\mathrm{maxj}},\mathrm{\chi}_{\mathrm{minj}}\) and maximum number of iterations \(\mathrm{it}_{\mathrm{max}}\) as an ending stage. Step 2: Initialization at random: The population of N solutions \(\mathrm{x}_{\mathrm{i}}(1,2,\ldots\mathrm{N})\) inside the search space boundary. Individually jth dimension of ith solution i.e., \(\mathrm{x}_{\mathrm{j}\mathrm{i}}\), is initialized among \(\mathrm{\chi}_{\mathrm{maxj}}\) and \(\mathrm{\chi}_{\mathrm{minj}}\) as per Equation (22). \[\mathrm{x}_{\mathrm{j}\mathrm{i}}=\mathrm{x}_{\mathrm{min,\,j}}+\mathrm{r}(0,1 )\Big{(}\mathrm{x}_{\mathrm{max,\,j}}-\mathrm{x}_{\mathrm{min,\,j}}\Big{)} \tag{22}\]Step 3: Fitness function evaluation: F\({}_{\text{i}}\) for each separate solution to the specific issue and determine the worst and best solutions, i.e., X\({}_{\text{worst}}\) and X\({}_{\text{best}}\) correspondingly. The solution with the F greatest value is considered the worst, while the solution with the slowest value is regarded as the best when minimizing the objective function. Step 4: Random numbers consideration: r1 and r2 among 0 and 1 with uniform distribution, Equation (18) is used to update the values of choice variables with each solution. Step 5: Evaluate the fitness F\({}_{\text{i}}^{\text{new}}\) for comparing the fitness F\({}_{\text{i}}\) of each formed solution to the fitness of the prior solution. Step 6: If F\({}_{\text{i}}^{\text{new}}>\text{F}_{\text{i}}\) for a maximization problem and F\({}_{\text{i}}^{\text{new}}<\text{F}_{\text{i}}\) for a minimization problem, replace X\({}_{\text{i}}\) with a fresh produced solution, i.e., X\({}_{\text{i}}^{\text{new}}\) new for a minimization problem, otherwise preserve the prior solution, i.e., X\({}_{\text{i}}\) and update the relevant fitness function value.