A Optimized 3D DV ‐ Hop Localization Algorithm Based on Hop Count and Differential Evolution Methods

: The location problem is a fundamental problem in underwater wireless sensor networks. This paper focuses on the distance vector hopping (DV-Hop) localization algorithm, which is most widely used in underwater wireless sensor networks (UWSNs). The algorithm does not require distance measurement and is simple to implement, but the research on DV-Hop algorithm in 3D space is not mature, which leads to large positioning errors. Based on the error analysis of the 3D DV-Hop algorithm, this paper proposes a 3D differential evolutionary hop count DV-Hop (DEHDV-Hop) algorithm to reduce the localization error. We define a continuous hop value based on the number relationship of adjacent nodes and solve the upper bound of the hop count under this definition. The discrete values of the global hop count are converted to continuous values using the broadcasted node information. The concept of trust is introduced by analyzing the error between the actual and estimated distances between anchor nodes. The method of obtaining the average hop distance of unknown nodes in the original algorithm is replaced so that the estimated distance is calculated using the new hop count and hop distance. Finally, the hop count information is segmented, a new fitness function is constructed, and the coordinates of the unknown nodes are solved iteratively using a differential evolutionary algorithm.


Introduction
At present, countries all over the world are paying more and more attention to the rights and interests of the sea, and the proportion of the marine economy in the global economy is getting higher and higher [1], and each country the enthusiasm of developing and using the ocean is growing year by year, and underwater wireless sensor networks(UWSNs) have become the focus of research [2]. Underwater node localization is a fundamental method and key technology for underwater wireless sensor networks to realize applications in many fields [3]. Obtaining data information about the location of target nodes within a specific water area is crucial and of great research value. The localization technology of single sensor is difficult to achieve precise positioning in the monitoring area, while the underwater wireless sensor network technology that connects multiple sensor nodes to the network precisely achieves information sharing and fusion among nodes, which better improves the accuracy of target positioning. In addition, in underwater wireless sensor networks, the limited computing power and energy of nodes requires the design of node localization algorithms with the performance index of saving communication energy. Therefore, the improvement of underwater node localization technology is beneficial to the overall application research of underwater wireless sensor networks with long-term significance, which can ensure the reliability of localization accuracy and improve the stability of the system, as well as solve the communication problems caused by nodes with low energy and limited computing and communication capabilities.
In recent years, with the development of the three major technologies of sensors, communication and computers, UWSN research based on these technologies has started to rise from two-dimensional space to three-dimensional space. Since it is much more difficult and complex to deploy and control wireless networks in three-dimensional space than in two-dimensional space, UWSN technology research for three-dimensional space is still a hot topic [4]. In recent years, some swarm intelligence algorithms have been widely used in UWSNs. In order to reduce the localization error, the localization algorithms are combined with swarm intelligence algorithms to implement a variety of localization techniques, and the common swarm intelligence optimization algorithms include genetic algorithm (GA) [5], particle swarm optimization (PSO) [6], and differential evolution algorithm (DE) [7], etc. Gaurav and Ashok [8] proposed a GA-based improved 3D GAIDV-Hop algorithm, by updating the correction factor to modify the average hop distance of anchor nodes, and further optimized the number of hops by the row search algorithm, and defined coplanarity to reduce the effect of coplanar anchor nodes on localization. The proposed localization algorithm is optimized to locate the unknown nodes using GA algorithm. Santar proposed a new PSO [9] based improved PSODV-Hop that reduces the localization error by using a two-dimensional hyperbolic method to calculate the unknown node positions , and finally uses a PSO algorithm to correct the estimated positions. Although a large number of research algorithms already exist to solve the problem of localization, there are still certain drawbacks making it possible to continue to study and optimize the algorithms, which is an ongoing researchable topic and has important research implications.

DV-Hop Localization Algorithm
In UWSNs, when the nodes are far away from each other, ranging-based localization algorithms are very inaccurate for both angle and signal strength measurements and cause node energy wastage. Therefore, it is of broader market and application value to study ranging-free localization algorithms with high energy utilization, efficiency and accuracy. Among them, DV-Hop algorithm as the most widely used method based on ranging-free algorithm has become a significant research content in UWSN localization algorithm research.

DV-Hop Algorithm Principle Introduction
The core idea of the 3D DV-Hop algorithm [11] is divided into four main steps, and the detailed process is as follows.

Get the Minimum Number of Hops
The anchor node sends a packet containing ID, location and hop count information to the neighbor node, where the initial value of hop count is 0. After the packet is delivered to the neighbor node, it is recorded and the hop count is incremented by 1, and then the packet is forwarded to other neighbor nodes.
In the process of broadcasting information, if a node in the network receives the packet with the same ID number several times then it compares with the original recorded data and keeps the minimum number of hops. The above process is repeated so that all nodes in the network can to get the minimum hop value.

Calculation of the Average Jump Distance of
Anchor Nodes Based on the known anchor node positions, the true distance between anchor nodes can be calculated. The average hop distance of the anchor nodes can be obtained by equation (1) combined with the minimum hop count information. Then the hop distance information of the anchor nodes is redelivered using information broadcast. The average hop distance of unknown nodes is determined by the anchor node closest to it.
where the coordinates of anchor node and anchor node are , , and , , is the number of hops between and , m is the number of anchor nodes, and Hopsize denotes the average hop distance of . As shown in Figure 1, 、 、 , represent three anchor nodes, 1,2, … are unknown nodes, and n is the number of unknown nodes. Assuming that to has 50 m away and the number of jumps is 3, and to has 120m away and the number of jumps is 6, the average jump distance of is (50 120 )/(3+6)/ 18.89m , Similarly, the average jump distance of and can be calculated as 14.375 m and 16.82 m , respectively.

Calculation of the Estimated Distance
After step B, the estimated distance between the unknown node and the anchor node is calculated using equation (2) .
where ℎ , denotes the minimum number of hops and the estimated distance between and , respectively.

Calculation of the Location of Unknown Nodes
After the calculation by step C, when the unknown node receives not less than 4 anchor nodes information, the location of the unknown node can be solved using the least squares method in three dimensions.

Hop Count Error
In the DV-Hop algorithm, if two nodes can communicate directly and a node is within the communication range of another node, the number of hops is denoted as 1 hop. As shown in Fig. 2, let the communication range of nodes are both spheres of radius R. As can be seen from the figure, the number of hops from to and the hops from to are both 1 hop, and the estimated distances will be equal to the subsequent calculations, however, the actual distances are significantly different. Therefore, the main error of DV-Hop come from the inaccuracy of the hop counts, and the error generated by the hop count affects the calculation of the average hop distance and thus the accuracy of the estimated distance. If the error in hop counts is small enough, the error in estimating the position of unknown nodes will be reduced, so a more accurate method of hop counts calculation and distance estimation needs to be found.

Average Jump Distance Error and Least Squares
Positioning Error The error of the average hop distance is mainly affected by the degree of tortuosity of the minimum transmission path between nodes. The greater the degree of tortuosity, the greater the difference between the estimated and actual values of the average hop distance of the anchor nodes, resulting in inaccurate estimation of the distance between the nodes and thus an increase in the localization error. In addition, the average hop distance of unknown nodes in DV-Hop is determined based on the information of 1 anchor node, while the distribution of nodes in UWSN is characterized by a huge number and random unevenness, so more anchor node information should be fully utilized to calculate the average hop distance of unknown nodes. In the final localization process, due to the iterative calculation error of the least squares method itself, coupled with the fact that there is also an error in the estimated distance, further processing will result in the accumulation of errors and large localization errors. Therefore, in this paper, DE is used instead of least squares to calculate the coordinates of the unknown nodes.

DEHDV-Hop Algorithm
From the analysis of the error sources of DV-Hop algorithm, it is known that the error of 3D DV-Hop mainly comes from three parts. Based on this, this paper proposes the DEHDV-Hop algorithm, which firstly redefines the calculation method of hop counts based on the number of nodes shared among neighboring nodes and the number of neighboring nodes of the nodes themselves, gives the range of hop counts values, and proves it theoretically. Then the concept of trust degree is proposed to redefine the average hop distance from unknown nodes based on the error between the actual and estimated distance about anchor nodes. Finally, the hop counts information is segmented, a new objective function is constructed based on the distance information between nodes, and the DE algorithm is used to optimize the position of the unknown nodes, and then a more accurate position is obtained.

Optimize the Number of Hops
As shown in Fig 3, the communication radius of nodes in UWSN is R, X is any node in the network, X is any neighbor node of X . Let solid dots denote the neighbor nodes shared by two nodes, hollow dots denote the remaining neighbor nodes of two nodes, and d denotes the distance between two nodes. In order to reduce the error caused by the number of hop, this paper defines the continuous value of the number of hop and improves the number of hop by using the ratio of the number of node. Define the continuous hop value of the communication range of neighboring nodes X and X . Assuming that N denotes the number of nodes X and neighboring nodes ( N |X | 1 ), |X | denotes the number of neighboring nodes of node X , and N denotes the number of nodes X 、X and their common neighboring nodes, the continuous hop value is expressed as Since the nodes are deployed randomly, the number of hop H , from node X to node X calculated in equation (3) may not be equal to H , , only if N N , H , H , , but this case is a coincidental one. Therefore, the average of H , and H , is taken as the value of consecutive jump of node X and node X .  Fig. 3, it can be seen that the number of nodes is related to the distance d between nodes, when the closer the neighboring nodes are, the closer N is to N , the closer H is to 0. Conversely, when d is larger, the difference between N and N is larger and the number of hops between nodes is closer to 1. Therefore, the distance between nodes indirectly affects the number of hops between nodes. In the network, the value range of i ∈ 0, R and the hop count range H ∈ 0,1 .

Correction of Average Jump Distance
To address the problem of error in the average hop distance selection in the traditional DV-Hop algorithm, this section introduces the concept of trust degree to update the unknown nodes so as to obtain the average hop distance value. The real distance between each anchor node in UWSN can be calculated by the Euclidean distance algorithm, and the estimated distance can be obtained from equation (2). The values of the actual distance and the estimated distance are not necessarily identical, and the following is a method to update the unknown nodes according to the error relationship, so as to obtain the average hop distance. Since the average hop distance calculated by each anchor node is different, two different estimated distances are generated between anchor nodes and . In order to balance the error generated by the estimated distance, the estimated distance takes the average value of the two distances, as shown in equation (4).

Hopsize
Hopsize /2 The actual distance between the anchor node and the anchor node is found by the Euclidean distance formula and is denoted as . Combining the errors of and , the average hop distance error caused by the distance error from to can be calculated according to Equation (5).
The hop distance error between and the rest of the anchor nodes is summed up and averaged, which is the average hop distance error of .
The trust level of each anchor node is the proportion of the inverse of the average hopping distance error of that anchor node to the inverse of the average hopping distance error of all anchor nodes.
The average hop distance of the updated unknown node is expressed as equation (8) ∑ Hopsize (8) Finally, the average number of hops of the corrected unknown nodes is multiplied by the improved number of hops to obtain the distance between any two nodes in the network, which is the estimated distance d .

Localization Process
The localization process of DV-Hop is calculated using the least squares method, however, the unknown node coordinates obtained by this method have a large error. Therefore, in order to obtain more accurate position coordinates, the DE algorithm is introduced in this paper to solve for the position of the unknown nodes. The DE algorithm [12] is a swarm intelligence optimization algorithm that usually uses stochastic search techniques. It has three main advantages over other swarm intelligence optimization algorithms: fewer parameters, fast convergence, and robustness. The algorithm consists of three processes: mutation, crossover and selection. The mutation process is done by using the differences between the selected individuals in the population, and then the original individuals are crossed with the mutated individuals produced by the mutation process to obtain the candidate individuals. If the candidate individual is better than the original individual in terms of fitness, the candidate individual replaces the original individual and becomes an individual in the new population.
A. Initialization: The network environment of the localization area is initialized and set, and the initial population , , … is generate according to equation (9), where , , … , NP represents the population size.
where denotes the population obtained after mutation, t denotes the number of population generations, and F is the scaling factor.
C. Crossover: The mutant population is crossed over with the original population according to equation (11).
where , denotes the population obtained after crossover and CR is the crossover probability.
C. Selection: selection of individuals with higher fitness into the next generation according to the principle of elimination in biology. (12) where and are the adaptation values for and , respectively. When the fitness of the test individual is better than , the test individual replaces the original individual, otherwise the original individual is retained.
In order to reduce the complexity of the fitness function , this paper improves the traditional DE algorithm. By using the hop counts and distance information from the unknown node to the anchor node to optimize the fitness function, the computational effort of the algorithm is effectively reduced and the running time is decreased by improving the fitness function. The original fitness function in the DE algorithm is calculated using the estimated distances from the unknown nodes to all anchor nodes in the network.
where the coordinates of the anchor node and the unknown node are ( , , ) and ( , , ). denotes the estimated distance from to and m is the number of anchor nodes.
Although a better localization effect can also be achieved by using the calculation of equation (13), the computational effort of the algorithm will also increase a lot, so a new method of constructing the fitness function is proposed in this paper. Considering that in the range of 1 hop, the number of hops calculated by the method in Eq. (8) is more accurate than DV-Hop, and it will be closer to the real distance in the calculation of the estimated distance. On the contrary, as the number of hops becomes larger, the error accumulation in the estimated distance due to the accumulation of hops will be larger. The adaptation function of this paper differs from that of the original DE algorithm by segmenting the hop count information of unknown nodes and anchor nodes, giving priority to the information of anchor nodes with less than 1 hop to reduce the computation of the DE algorithm, and the adaptation function is: where denotes the number of anchor nodes with less than 1 hop for the k-th unknown node.
If the unknown node has no anchor node with less than 1 hop, the information of anchor nodes with less than t (t is the number of hops from the unknown node to the nearest anchor node, t > 1, and t is taken as an integer) hops is used, and is the number of p-hops nodes of the k-th unknown node. Since the accumulation of the number of hops can cause excessive distance error, a weight factor is used to correct the distance error accumulated by the excessive number of hops. In this regard, a new objective function is given as follows: Using the DE algorithm means that the localization problem is transformed into a function minimization optimization problem. Through iteration, the smaller the individual's fitness The smaller the value of the degree function, the more accurate the localization of the unknown node.

Experimental Simulation Verification
In this paper, the DEHDV-Hop algorithm is experimentally validated by simulation on MATLAB 2018b, and all nodes are randomly deployed in the corresponding 3D network monitoring area. The node distribution model is shown in Figure 4. The specific parameters of the simulation are shown in Table 1.  The following metrics are used as criteria to evaluate the performance of the algorithm for localization.
A. Average localization error (ALE): It is mainly used to evaluate the localization performance of the algorithm as the total number of nodes, the proportion of anchor nodes, and other different parameters change. The calculation formula is as follows: where the estimated and actual coordinates of the unknown node are ( , , ), ( , ,̂ ), and n is the number of unknown nodes.
B. Normalized Average Positioning Error (Nor-ALE): It mainly evaluates the association between the communication radius R and the performance of the positioning algorithm as shown in equation (17).
C. Localization error percentage (LEP): It mainly evaluates the percentage of errors in locating the nodes, and the nodes that are incorrectly located are those whose distance from the actual location to the estimated location of the unknown node is greater than half of the communication range. The proportion can be expressed as the ratio of the number of nodes incorrectly located ( ) to the number of unknown nodes (n ).

/n (18)
We simulate the algorithm under the conditions of varying communication range, anchor node ratio, and total number of nodes, illustrate the results of each improvement step, and compare it with GADV-Hop [13] and PSODV-Hop [14]. comparison algorithm 100 nodes are deployed in the UWSN, of which 30% are anchor nodes. As can be seen from Figure 5, the fold of the DEHDV-Hop algorithm is almost entirely below the DV-Hop algorithm. When the node ID is 10, the average localization error produced by the DV-Hop algorithm is 24.26m, while that of DEHDV-Hop is only 4.38m, and the localization error of DEHDV-Hop is reduced by 19.88m. The localization error of DEHDV-Hop algorithm is compared with that of GADV-Hop and PSODV-Hop algorithms, although there is a certain ID node of the average localization error of PSODV-Hop is smaller than that of DEHDV-Hop, but on the whole, the localization error of DEHDV-Hop for a single node is more than 95% smaller than that of the comparison algorithms.
The communication radius of a node is an important variable that affects the localization error of the algorithm. In order to investigate the effect of the variation of the communication radius on the normalized average localization error, the simulation parameters are set to 100 sensor nodes, the proportion of anchor nodes is 30%, and the communication distance varies from 25m to 50m. Figure 6 shows the variation of normalized average localization error of the four algorithms. All four algorithms have a tendency to decrease the localization error as the communication radius of nodes increases, and it is worth noting that the localization error of DEHDV-Hop has been smaller than that of GADV-Hop and PSODV-Hop, which indicates that the algorithm proposed in this paper has a good correction effect in dealing with the variable factor of communication radius.  In the simulation area, the variation of the total number of nodes has a significant impact on the localization error. Figure  7 shows the trend of the average localization error during the change of the total number of nodes from 200 to 450. The average localization error of all four algorithms decreases gradually as the total number of nodes increases, because as the total number of nodes increases, more and more nodes in the network can communicate with each other, and a large amount of node location information can be collected, which reduces the localization error. In conclusion, the DEHDV-Hop algorithm not only makes the localization error decrease, but also makes the localization error more stable during the change of the total number of nodes.

Conclusion
The article firstly introduces the principle of the DV-Hop algorithm in 3D space and gives a detailed analysis of the causes of its error. Secondly, the hop values between nodes are improved by redefining the hop count according to the neighbor node ratio. For the error between the actual and estimated distance of anchor nodes, the concept of trust degree is introduced to update the average hop distance between unknown nodes. The DE algorithm is used to construct a new fitness function using distance information so as to optimize the unknown node positions, and a theoretical derivation process is made, and finally the proposed algorithm is validated by simulation. Theoretical and MATLAB simulation experiments show that the DEHDV-Hop algorithm has a smaller localization error compared with the comparison algorithm under various parameter conditions.