Abstract
Localization provides the key support for wireless sensor networks (WSNs). In order to solve the large-error problem in the third phase and the poor position accuracy of the least square method in the weighted DV-Hop algorithm, a hybrid algorithm of GA + simplex method was proposed in this paper. The weighted DV-Hop position algorithm was applied to estimate the distance between the unknown node and the anchor node in the first and second phase. In the third phase, a hybrid genetic algorithm with the simplex method was proposed to optimize the coordinates of the unknown nodes. In the hybrid genetic algorithm, a fitness function which combined the cost function with the penalty function was built, and the simplex method was used to increase the local search ability of the algorithm. Experiments show that both of the localization accuracy and network coverage rate are improved significantly, and the hybrid algorithm of GA + simplex method is suitable for the WSN localization.
1. Introduction
In the past decades, the advances in microelectronics, computer, and wireless communication technologies stimulate the rapid development of low-power and multifunction sensors, which can integrate the information acquisition, data processing, wireless communication, and other functions in a tiny volume. The wireless sensor network (WSN) is a multiple-hops and self-organizing network system which consists of a large number of low-cost microsensor nodes deployed in monitoring area and communicating through wireless. WSN can be used to aware, collect, and process the information of perception objects in the network coverage area and then send the results to observers. The three components of a sensor network are sensor, cognitive object, and observer.
The application prospects of sensor networks are very broad and they can be widely used in military, environmental monitoring, health care, and so forth. With in-depth research and extensive application, sensor networks will gradually be applied to the various areas of human life.
In sensor networks, the location information is crucial. Monitoring messages without the location information are usually useless [1]. Therefore, the node location is one of the most basic functions in sensor networks, and it plays a key role in various applications. The node localization can be divided into two categories: range-based and range-free. The range-based localization (RBL) is obtained by calculating the actual distance between the unknown node and the anchor nodes. The range-free localization (RFL) is obtained by estimating the distance of the two nodes. RFL is less sensitive to the complex environment in signal transmission, but its hardware costs and energy consumption are low. Therefore, RFL is very suitable for WSN applications [2].
The traditional distance vector-hop (DV-Hop) algorithm was proposed by Dragos Niculescu, which uses GPS and distance vector routing. It is a range-free method [3], meaning that it does not measure the distance directly but rather utilizes the information of the distance vector and network connectivity to get the estimated distance. Therefore, DV-Hop has less demanding on the physical measuring unit, and it performs well in the isotropic networks [2].
The biological evolution law of selecting the superior and eliminating the inferior exists in natural systems. The evolution is a self-adaptive process that behaves robustly. Inspired by the evolution law, J. Holland proposed the genetic algorithm (GA), which is very suitable for solving global optimal solution in the combination and optimization problems [4]. It can obtain the optimal solution with a high probability and is easy to implement in mathematic models as well [5].
The paper is organized as follows. In the next section, the traditional DV-Hop positioning algorithm with its error analysis is introduced. The GA + simplex method for restricted problems is discussed in Section 3. In Section 4, an improved DV-Hop algorithm, the hybrid algorithm based on the GA + simplex method, is proposed. Experimental results and related analysis are presented in Section 5, and the conclusion is followed in the last section.
2. The DV-Hop Algorithm
2.1. The Principle
The procedure of the traditional DV-Hop algorithm is shown in Figure 1.

Flowchart of the traditional DV-Hop algorithm.
In general, there are three stages in the algorithm [6].
The first stage is to calculate the minimum counts of hop between unknown nodes and every anchor node. Neighboring nodes receive group messages in which anchor nodes broadcast their own position. The messages include the range of hop-counts with the initial value of zero. Receiving node will ignore group messages with the maximum of hop-counts which are broadcasted by the same anchor node until the minimum of hop-counts from every anchor node is recorded and then add 1 to the recorded hop-counts and send the value to a neighboring node. With this strategy, all nodes including unknown nodes and anchor nodes in WSN can record the minimum hop-counts to every anchor node.
The second stage is to calculate the estimated distance between unknown nodes and anchor nodes. For every anchor node, we use the hop-counts between two anchor nodes recorded in the first stage and the following formula to calculate the average hop-size:
Here
As is shown in Figure 2,

Schematic diagram of DV-Hop algorithm.
The third stage is to calculate the unknown node's location with a three-sided measurement method, the maximum likelihood estimation method, or other multisided location methods. The detailed steps are described as follows.
The distances obtained by the first two stages between the unknown node
In (2), subtract the last one from each equation, and we have
The above equations are simplified and reorganized as the following linear equations,
With the least square method, we have [6]
2.2. Simulation Analysis
The simulation results of the traditional DV-Hop localization algorithm are shown in Table 1, in which the total number of nodes distributed randomly is 250, and the numbers of anchor nodes are 5, 10, 15, 20, 25, and 30. From the table, we can see that, with the increase of anchor nodes’ ratio, the positioning error decreases and the accuracy improves. However, the decreasing rates of positioning errors are declining, and overall errors are still significant.
The positioning error of the traditional DV-Hop with the number of anchor nodes.
The position error formula is as follows:
Here
2.3. The Error Analysis
2.3.1. Error Analysis and Improved Ideas in the Second Phase
The traditional DV-Hop location algorithm is suitable for the wireless sensor network in which anchor nodes are uniformly distributed, the network is isotropic, or most of the nodes are densely distributed. When nodes are distributed unevenly, there may be a large error when unknown nodes regard the average hop-size received first as the average hop-size to all anchor nodes. The authors in [7] use the average distance of every hop among all of the anchor nodes instead of the average hop-sizes in the traditional algorithm. In this paper, we improve the traditional algorithm through methods of assigning every received average hop-size a weight, namely, using the normalized thought to obtain the average hop-size.
2.3.2. Error Analysis and Improved Ideas in the Third Phase
From the third stage of DV-Hop positioning algorithm, we can see that
Let us denote that the real distances from the anchor nodes
And then we have the following:
Hence, the problem can be reduced to minimize the function
When
3. The Improvement of DV-Hop Localization Algorithm
3.1. The Improvement in the Second Stage
The process of the modified algorithm is as follows. Let us define
Here σ is the mean square error of ith anchor node,
We assume that unknown nodes have received the information of n anchor nodes:
Therefore, we have
So the average distance of every hop is
The above algorithm is based on the weighted average distance of each hop, and the simulation results are shown in Table 2, in which the total number of nodes distributed randomly is 250, and the number of anchor nodes is 5, 10, 15, 20, 25, and 30. The results show positioning errors comparing the above modified algorithm with [7].
The positioning errors of DV-Hop in [7] and the modified DV-Hop.
As can be seen from the table, with the proportion of anchor nodes increasing, the positioning errors decrease, and the modified algorithm performs better. Although the positioning accuracies of both algorithms are increasing, the errors are still relatively large.
With the least squares weighted DV-Hop algorithm, the third phase error is still very large for nonlinear constraint problems. A hybrid genetic algorithm of GA + simplex method is presented to optimize the weighted DV-Hop algorithm.
3.2. The GA + Simplex Method for Restricted Problems in the Third Stage
3.2.1. The Principle
The basic procedure of GA is as follows. With constant iterations, the algorithm updates the assumption groups, and a fitness function is used to evaluate all individuals in each iteration, and then individuals with higher fitness values are picked with a higher probability. A new population is created through selection, crossover, and mutation genetic methods [14].
The defects of the genetic algorithm are time-consuming in computations and poor local search ability [15]. Therefore, the improved GA adopts the principle of saving the best individual in order to shorten the computation process.
The simplex method converts a variety of nonstandard forms into standard forms through series of transformations, and it is effective to solve the linear problem which contains many constraints of nonstandard forms. Therefore, it behaves strong apriority in local search ability.
3.2.2. Solving Restricted Problems
To satisfy the constraint condition in (7) which contains many constraint conditions [16], the penalty function could be used to transform the restricted problems into the unconstrained optimization problem:
Here
To construct the punishment function, let
Then the punishment function is
One has
If
If
From the above two cases, we have
Therefore, the new objective function is
To solve
Here
After the penalty term is added, all solutions in the 2-dimensional space can be regarded as feasible ones, and it can obviously avoid taking the local optimal solution as the global optimal solution, but the corresponding amount of computation is increased [17]. We adopt the principle of saving the best individual, which can shorten the operation time. And the new algorithm can improve the poor performance from adding the penalty function.
3.2.3. The Improved DV-Hop Algorithm Based on the GA + Simplex Method
We assume that there are total N nodes in a WSN which contains M anchor nodes, and we want to locate the
The procedure of the proposed hybrid algorithm of GA + simplex method is as follows.
Step 1.
Initialize the number t of anchor nodes M.
Step 2.
From
Step 3.
Randomly generate the initial population of n groups.
Step 4.
Put the fitness function
Step 5.
Arrange all individuals according to the fitness level, and adopt the principle of saving the best individual. For the top five individuals with the highest fitness values, go to Step 7, and for the rest of
Step 6.
Generate a new group Selection (copy): here we use the roulette method. Crossing (restructuring): two-point crossover method is used. Mutations: select one or more genes, and then do the corresponding change according to the mutation probability Update
Step 7.
Combine the top five individuals with the highest fitness from Step 5 with the group
Step 8.
Adopt the simplex method. Select individuals with a certain probability and perform the simplex method in the new group, and then replace the original individual with the new individual.
Step 9.
If the number of iterations reaches the maximum, continue to Step 10. Otherwise, go back to Step 4.
Step 10.
Obtain the position coordinates of anchor nodes
In Step 4, the fitness function
4. Experimental Results and Analysis
4.1. The Simulation Scenario
In the experiment, MATLAB was employed to perform the simulation of the weighted DV-Hop localization algorithm, the GA DV-Hop positioning algorithm [10], and the hybrid GA + simplex algorithm, respectively. In order to ensure the accuracy of simulation results, before the start of each simulation, the network topology was constructed according to the parameters related to WSN connectivity and the density of anchor nodes. Anchor nodes are randomly generated and uniformly distributed in the region for better performance [1]. The experiment was repeated many times with the same parameters, and the average of results for each experiment was recorded. Only the isotropic WSN is discussed here.
Position performance is evaluated according to the average position error [16] and the network coverage rate.
The position error is defined in Section 2.2.
The network coverage rate is the ratio of the unknown nodes that obtain the coordinates and the total unknown nodes in the network. It is one of the targets of location algorithm to achieve the precise positioning of unknown nodes as much as possible. In the case of meeting a certain positioning accuracy, the higher network coverage rate represents the better network performance.
The GA + simplex method needs to set the parameters, and we use the binary coding with the code length
4.2. Results and Analysis
4.2.1. The Impact of Network Connectivity on the Positioning Accuracy
We arranged a total of 250 nodes in the region, and the number of anchor nodes was 10. Figure 3 shows the simulation diagram of the weighted DV-Hop algorithm, the GA DV-Hop algorithm, and the hybrid DV-Hop algorithm based on the GA + simplex method. From the figure, we can see that when the connectivity is less than 10, errors of three algorithms are reduced, and margins become large. The GA positioning algorithm performs better than the weighted DV-Hop positioning algorithm. The error of the hybrid of GA + simplex method is less than that of GA positioning algorithm. The simplex method can make up for some drawbacks of GA. When the connectivity is larger than 10, errors for all of the three algorithms are deteriorated. But the hybrid algorithm of GA + simplex method performs better than the other two. The reason is that when the network connectivity is large and over a certain value, hop-counts between nodes are inaccurate.

The impact of network connectivity to the positioning accuracy.
4.2.2. The Impact of the Number of Anchor Nodes on the Positioning Accuracy
There are 250 nodes in the region, and the anchor node ratio varies from 0.02 to 0.12. Figure 4 shows the impact of anchor node ratio on the three algorithms in the isotropic network. From the figure, we see that, with the increase of anchor node ratio, performances of the three positioning algorithms are all improved. This is because, with the increase of the anchor node ratio, the number of available positioning nodes is increased, and the knowing ability of the network is also increased. The hybrid algorithm of GA + simplex method performs better than the other two.

The impact of the number of anchor nodes on the positioning accuracy.
4.2.3. The Influence of Anchor Nodes on the Network Coverage
Figure 5 shows that, with the increase of the proportion of anchor nodes, the network coverage rates of the three positioning algorithms are increased. The positioning coverage of GA DV-Hop is larger than that of the weighted DV-Hop algorithm, and the hybrid algorithm of GA + simplex method performs significantly better than the GA DV-Hop. When anchor nodes proportion is small, the network coverage rate increases by a big margin, and the coverage gaps of the three algorithms are large. As the proportion of anchor nodes increases to a certain degree, the network coverage rate increases more slowly and stably.

The impact of the number of anchor nodes to the network coverage.
4.2.4. The Impact of Number of Nodes on the Positioning Accuracy
Figure 6 shows the simulation results with the number of nodes being 50–250. The figure shows that, for a certain proportion of anchor nodes, when the number of nodes increases, the average positioning errors of the three algorithms are reduced, but the accuracy of the new algorithm is better than the other two algorithms, especially when the number of nodes is relatively small.

The impact of number of nodes on the positioning accuracy.
4.2.5. Positioning Stability
The confidence interval of the average positioning error reflects the stability of an algorithm. The general formula is defined as follows:
Here n is the number of samples.
Confidence intervals of the three algorithms in different node numbers are shown in Figure 7. From Figure 7, the GA + simplex method has the least positioning error and interval size. The GA + simplex method performs the best positioning performance with a minimum width of the confidence interval. So the new method is most stable in the three algorithms.

Confidence intervals comparison of the three algorithms in Figure 6.
4.2.6. Algorithm Convergence
From Figure 8, it can be found that ε can influence the convergence of GA + simplex method. More concretely, when

Convergence of GA + simplex method at different ε.
4.2.7. Time Complexity
The GA + simplex method saves the best individuals when updating the population to reduce the total execution time. From Figure 9, the runtime increases along with population size but decreases after saving the best individuals. Therefore, the new algorithm can reduce the time complexity.

Time complexity analysis.
5. Conclusion
The genetic algorithm is suitable for correction of the weighted DV-Hop localization due to its own characteristics. This paper proposes a hybrid algorithm based on GA + simplex method to optimize the weighted DV-Hop localization in the third phase. Without large calculation, the algorithm preserves the advantage of the GA algorithm, while its simplex method makes up some inherent flaws of the GA. The experiment shows that the improved algorithm has higher positioning accuracy and network coverage in isotropic WSN than other localization algorithms, and it is suitable for WSN positioning.
Footnotes
Conflict of Interests
The authors declare that there is no conflict of interests regarding the publication of this paper.
Acknowledgment
The authors are thankful for the financial support from the key disciplines construction of universities of Shanxi Province Foundation (80010302010053).
