# Topology-Aware Anchor Node Selection Optimization for Enhanced DV-Hop Localization in IoT
## 4 Grey Wolf Optimization Algorithm and Its Binary Variant  
### Continuous Version of the Grey Wolf Optimization Algorithm  
In recent years, swarm intelligence optimization algorithms have rapidly emerged, providing effective solutions to a wide range of engineering optimization problems. Among these, continuous GWO, proposed by [PERSON] et al. (2013), stands out as a classical algorithm and has attracted considerable attention from researchers. The algorithm is inspired by the strict social hierarchy and cooperative hunting strategies of grey wolves. To simulate hunting and social behavior, the population is categorized into four roles: \(\alpha\), \(\beta\), \(\delta\), and \(\omega\) wolves. The \(\alpha\) wolf serves as the highest-ranking leader, \(\beta\) wolves assist in decision-making, \(\delta\) wolves follow \(\alpha\) and \(\beta\) wolves, and the remaining are classified as \(\omega\) wolves. During the optimization process, the positions of \(\omega\) wolves are iteratively updated under the guidance of the top three wolves (\(\alpha\), \(\beta\), and \(\delta\)).  
During the hunting phase, grey wolves track and encircle their prey, a behavior mathematically defined as follows:  
\[D=\left|C\cdot\mathbf{X}_{p}(t)-\mathbf{X}(t)\right| \tag{9}\]  
\[\mathbf{X}(t+1)=\mathbf{X}_{p}(t)-A\cdot D \tag{10}\]  
where \(t\) denotes the current iteration number, while \(\mathbf{X}\) and \(\mathbf{X}_{p}\) represent the position vectors of a grey wolf and the prey, respectively. \(D\) represents the distance between a grey wolf and the prey. The coefficient vectors \(A\) and \(C\) are defined as follows:  
\[A=2\cdot a\cdot r_{1}-a \tag{11}\]  
\[C=2\cdot r_{2} \tag{12}\]  
\[a=2-2\cdot t/T_{\max} \tag{13}\]  
where \(r_{1}\) and \(r_{2}\) are random vectors uniformly distributed in the range \([0,1]\). The parameter \(a\) is a convergence factor that decreases linearly from 2 to 0 as the number of iterations increases. \(T_{max}\) denotes the maximum number of iterations.  
Once the prey is located, the \(\alpha\) wolf leads the \(\beta\) and \(\delta\) wolves to encircle it. This tracking behavior is mathematically defined as follows:  
\[D_{i}=\left|C\cdot\mathbf{X}_{i}-\mathbf{X}\right|;i=\alpha,\beta,\delta \tag{14}\]  
where \(\mathbf{X}\) denotes the current position of the grey wolf. \(C\) represents a random vector, while \(\mathbf{X}_{a}\), \(\mathbf{X}_{\beta}\), and \(\mathbf{X}_{\delta}\) indicate the positions of the \(\alpha\), \(\beta\), and \(\delta\) wolves, respectively. \(D_{a}\), \(D_{\beta}\), and \(D_{\delta}\) denote the distances between the \(\alpha\), \(\beta\), and \(\delta\) wolves and other individuals.  
\[\mathbf{X}_{j}=\mathbf{X}_{i}-A\cdot D_{i};i=\alpha,\beta,\delta;j=1,2,3 \tag{15}\]  
\[\mathbf{X}(t+1)=\frac{\mathbf{X}_{1}+\mathbf{X}_{2}+\mathbf{X}_{3}}{3} \tag{16}\]  
where \(\mathbf{X}_{1}\), \(\mathbf{X}_{2}\), and \(\mathbf{X}_{3}\) denote the step size and direction of the \(\omega\) wolf as it moves toward the \(\alpha\), \(\beta\), and \(\delta\) wolves, respectively. The final position of the \(\omega\) wolf is then determined by Equation (16).  
The GWO algorithm has advantages such as a small number of control parameters and good robustness ([PERSON] et al., 2017). Since its proposal, the GWO algorithm has been successfully applied to solve numerous complex optimization problems. Conducting a theoretical analysis of the convergence of the GWO algorithm contributes to a deeper understanding of its working principle and performance. Reference ([PERSON] et al., 2017) analyzed the convergence of the GWO algorithmby constructing a mathematical model of a Markov chain based on the convergence criteria of the stochastic search algorithm. We successfully proved that the GWO algorithm can achieve global convergence with probability 1 by means of the martingale convergence theorem [35].