## 4 Proposed DEIDV-Hop Algorithm
### Complete DEIDV-Hop Algorithm  
By combining Sections 3 and 4, this paper proposes an enhanced DV-Hop algorithm based on DE called DEIDV-Hop, with the corresponding pseudo-code depicted in Algorithm 1.  
The flow of the algorithm follows with DEIDV-Hop initializing network parameters and generating simulated network topology (random or grid topology) yet utilizing the shortest path method to retrieve the hop-count value between nodes, corresponding to lines 1-13. After that, the information on a hop-count value between nodes is retrieved, and the average distance per hop is calculated by Equation (16). Next, the estimated distance between unknown nodes and anchor nodes is calculated according to line 15. As the third step and corresponding to lines 16-36, the DE algorithm is utilized to estimate the location of unknown nodes by initializing the parameters of DE and have the maximum number of iterations set. It mutates the target individual selection Equation (18) in line 22, and Equation (19) is used for the cross operation to obtain test individuals in lines 23-25. The greedy criterion is used to select the next generation of individuals for the target and experimental individuals in lines 27-31; finally, the optimal individual in the group is the estimated location of the unknown node at the end of the iteration.  
```
1:Initialization: total number of nodes N, Percentage p of anchor nodes, communication radius R;
2:Input: Parameter settings of DEIDV-Hop and the experimental area;
3: Parameter settings of DEIDV-Hop: see Table 1 Experimental area is \(100\times 100\) m\({}^{2}\)
4: Network deployment nodes to generate simulated network topology;
5:Calculate the hop-count value \(h_{i,j}\) according to the shortest path algorithm
6:for k = 1 to N
7:for i = 1 to N
8:if short_path(i,k) + short_path(k,j) < short_path(i,j)
9:short_path(i,j) = short_path(i,k) + short_path(k,j);
10:end
11:end
12:end
13:end
14:Calculate the average distance per hop, _HopSize_\({}^{\prime\prime}\) according to Equation (16);
15:Calculate the unknown distances;
16:for k = 1 to NP
17:Initialization: Generates NP individuals that contain 2 dimensions of variables according to Equation (9);
18: Calculate and evaluate each individual \(x_{i}\);
19:\(t=1\);
20:While\(t<t_{max}\) do
21:for i = 1 to NP //Mutation and Crossover
22: According to Equation (18), mutation vector \(v_{i}^{t}\) is generated;
23:for j = 1 to \(D\)
24: Trial vector \(u_{i}^{t}\) was obtained by crossover according to Equation (19);
25:end
26: Trial vector \(u_{i}^{t}\) was selected;
27:if\(f\left(u_{i}^{t}\right)<f\left(x_{i}^{t}\right)\) then //Minimize optimization problems
28:\(x_{i}^{t+1}=u_{i}^{t}\);
29:else
30:\(x_{i}^{t+1}=x_{i}^{t}\);
31:end
32:end
33:\(t=t+1\);
34:end
35: The best individual is the location of the unknown node;
36:end
```  
**Algorithm 1**The procedure of DEIDV-Hop  
\begin{table}
\begin{tabular}{c c} \hline \hline
**Parameter** & **Value** \\ \hline Deployment area size & 100 m \(\times\) 100 m \\ Percentage of the anchor node & 10–40\% \\ Communication radius R & 20–40 m \\ _NP_ & 20 \\ \(F\) & 0.9 \\ _CR_ & 0.2 \\ _tmax_ & 20 \\ _P\({}_{r}\)_ & 0.02 \\ \hline \hline \end{tabular}
\end{table}
Table 1: Parameter settings of DEIDV-Hop.