#### Abstract

Node location is one of the most important problems to be solved in practical application of WSN. As a typical location algorithm without ranging, DV-Hop is widely used in node localization of wireless sensor networks. However, in the third phase of DV-Hop, a least square method is used to solve the nonlinear equations. Using this method to locate the unknown nodes will produce large coordinate errors, poor stability of positioning accuracy, low location coverage, and high energy consumption. An improved localization algorithm based on hybrid chaotic strategy (MGDV-Hop) is proposed in this paper. Firstly, a glowworm swarm optimization of hybrid chaotic strategy based on chaotic mutation and chaotic inertial weight updating (MC-GSO) is proposed. The MC-GSO algorithm is used to control the moving distance of each firefly by chaos mutation and chaotic inertial weight when the firefly falls into a local optimum. The experimental results show that MC-GSO has better convergence and higher accuracy and avoids the premature convergence. Then, MC-GSO is used to replace the least square method in estimating node coordinates to solve the problem that the localization accuracy of the DV-Hop algorithm is not high. By establishing the error fitness function, the linear solution of coordinates is transformed into a two-dimensional combinatorial optimization problem. The simulation results and analysis confirm that the improved algorithm (MGDV-Hop) reduces the average location error, increases the location coverage, and decreases and balances the energy consumption as compared to DV-Hop and the location algorithm based on classical GSO (GSDV-Hop).

#### 1. Introduction

A wireless sensor network (WSN) is a network formed by a large number of sensor nodes through wireless communication, which is used to perceive and transmit all kinds of information. There is a wide demand for location service information in real life and work. The location technology of WSNs is the base of location service.

Currently, the positioning technology of WSNs can be divided into two categories: range-based and range-free. Although range-based positioning technology has high positioning accuracy, it is not suitable for the applications which require low power consumption and low cost [1–3]. DV-Hop as a range-free algorithm has been widely used because of its simplicity, efficiency, and low cost. However, a least square method used in the third stage of DV-Hop makes large node positioning error. Essentially, DV-Hop is an optimization problem based on the measured values of different distances or paths. Applying intelligent optimization algorithms to the localization technology is a new attempt to solve the problems of the DV-Hop localization algorithm. Its basic idea is to establish the mathematical theory system of intelligent location by observing the biological model of nature and carry out iterative optimization of the corresponding objective function. At present, many intelligent algorithms have been applied to node localization, such as the ant colony algorithm, genetic algorithm, particle swarm optimization (PSO), and glowworm swarm optimization (GSO) or firefly swarm optimization. An improved DV-Hop algorithm based on mixed chaos strategy (MGDV-Hop) is proposed in this paper, in which the GSO of hybrid chaotic strategy (MC-GSO) is based on chaos mutation and chaotic inertia weight. MC-GSO increases the diversity of GSO algorithm population, enhances the ability of local and global search, avoids the algorithm falling into the local optimal state prematurely, and improves the robustness of the algorithm. MGDV-Hop based on MC-GOS can improve the location coverage and reduce the node energy consumption while improving the accuracy of node location.

The rest of the paper is organized as follows. Section 2 contains the related works. Section 3 contains the introduction of the DV-Hop algorithm. Section 4 describes the MC-GSO and MGDV-Hop algorithms proposed in this paper. Section 5 contains the simulation experiments and analysis. Section 6 gives the conclusions.

#### 2. Related Works

Many scholars proposed the following improvements on the low accuracy of DV-Hop localization: the concept of minimum deviation degree was proposed, although the positioning error was reduced, the energy consumption was high, and when the number of nodes is large, only the unknown nodes close to the beacon have higher positioning accuracy [4]. A localization algorithm combining a centroid with DV-Hop was proposed, which reduced the energy consumption of nodes but still had a high localization error [5]. The communication radius of nodes and the number of hops between nodes were corrected, and the average distance of per hop was corrected. The improved algorithm reduced the average localization error. However, the power consumption of the nodes is increased due to the increase of calculation for the multiple corrections [6]. In recent years, some intelligent algorithms have been used to improve DV-Hop; for example, the particle swarm optimization (PSO) is one of the most popular algorithms. The PSO was used to improve the localization accuracy of DV-Hop [7–10]. However, the PSO algorithm is weak in solving discrete and combinatorial optimization problems, especially for some nonrectangular coordinate systems, and the parameter control of the PSO is not flexible. This research on DV-Hop localization algorithms mentioned above barely mentioned the experimental data of energy consumption.

The concepts of success and failure of search in glowworm swarm optimization were introduced, and the GSO was optimized by changing the step size and establishing multimodal functions [11]. The range of fluorescein changes in GSO during the process of fluorescein renewal was limited [12]. The population of fireflies was divided into several subgroups of different sizes, and each subgroup was optimized separately, improving the convergence rate [13]. The GSO was combined with integrated learning, using the greedy algorithm to select some fireflies, and constructed the integrated firefly [14]. The local search ability of GSO was improved by introducing chaotic local search operator [15]. Chaotic perturbation term was introduced in an iterative process, and the optical absorption coefficient was linearly correlated with an iteration number [16]. A strategy based on Gao Si mutation was proposed, in which the mutation factor was added to avoid the algorithm falling into a local optimum [17]. A GSO of variable step size was proposed and applied to an MLP equalizer [18]. For the convenience of comparison, Table 1 gives some main performances of these improved GSO algorithms in [11-18] with respect to the average number of iterations, the average convergence time, and the error of optimal value.

In order to obtain better performances in all three of the above, in this paper, a GSO of hybrid chaotic strategy (MC-GSO) is proposed based on chaos mutation and chaotic inertia weight. MC-GSO increases the diversity of GSO algorithm population, enhances the ability of local and global search, avoids the algorithm falling into the local optimal state prematurely, and improves the robustness of the algorithm. Then, MC-GSO is used to replace the least square method in the third stage of DV-Hop for solving the defect of low positioning accuracy of DV-Hop, improving location coverage and the power consumption of nodes in WSNs.

#### 3. DV-Hop Algorithm

##### 3.1. DV-Hop Process

DV-Hop is a no distance measurement location algorithm based on distance vector routing; it is proposed to avoid the direct measurement of distance between nodes. The basic idea of DV-Hop is that the distance between the unknown node and the reference node is represented by the product of the average distance of per hop and the least hop number between the two nodes. Furthermore, the location of nodes is determined by triangulation or maximum likelihood estimation. The work flow of the DV-Hop algorithm is as follows.

###### 3.1.1. Distance Vector Switching

In this stage, the minimum number of hops between the unknown node and the beacon node is obtained. The data storage unit of each node maintains a data table , in which is the identifier of the beacon node that is the ID number and (,) is the location of the beacon node , and is the number of hops from unknown node to beacon node .

When the node detects that the packet information it receives comes from the same ID number, it invokes the information in its own data table. If the number of hops in the data table is higher than the number of hops currently received, the information of hops in the data table will be updated; otherwise, it will be ignored.

###### 3.1.2. Mean Hop Distance and Flooding Broadcast

After the first stage, the minimum hop number between the unknown node and the beacon node, as well as the coordinates of the other beacons deployed in WSNs, has been recorded in the data table of each beacon node. Then we can calculate the average distance of each hop () in the network, and the average hop distance is broadcast to all nodes in the WSNs as a correction value. The calculation method is given by formula (1), and then the distances between the unknown node and other beacon nodes are obtained.

In formula (1), represents the minimum number of hops between the beacon node and the beacon node .

###### 3.1.3. Estimation of the Location of Unknown Nodes

Assuming that are the position coordinates of beacons, according to the second stage, the distance between the unknown node and the beacon node is respectively, and the coordinates of the unknown node are . A linear equation group is established to solve the coordinates of unknown node .

##### 3.2. Shortcomings of DV-Hop

Using the location information of different beacon nodes, the mean hop distance between nodes () in the WSNs is calculated. If the distribution of nodes in WSNs is not uniform, the average hop distance can not represent the hop distance between nodes in the whole network. Therefore, there is a great error in estimating the coordinates of an unknown node in this case.

When the number of hops from an unknown node to a beacon node increases to 2, the error will accumulate because the error is proportional to the number of hops.

When determining the location of an unknown node, the iterative location of a beacon node will cause error to accumulate. When the beacon node rebroadcasts its own data packet, it may add a new error to the previous positioning error, increasing the final error. When the WSN is deployed in a wide range, it will result in a greater positioning error [19].

#### 4. DV-Hop Based on GSO of Mixed Chaos Strategy(MGDV-Hop)

##### 4.1. Basic Idea of MGDV-Hop

In order to solve the problems of DV-Hop, we consider improving this algorithm with GSO.

Firstly, a hybrid chaotic strategy (MC-GSO) based on chaos variation and position update of inertial weight is proposed. MC-GSO is used to avoid the firefly individuals falling into the local optimal state prematurely during the evolution of the population. Then, the MC-GSO algorithm is used to replace the least square method used by DV-Hop in estimating node coordinates. According to the calculation formulas of an unknown node, the error between the estimated coordinates and the real coordinates is obtained, and the corresponding error fitness function is derived. The minimum value of fitness function is solved by the MC-GSO algorithm, reducing the mean positioning error.

##### 4.2. GSO Based on Mixed Chaos Strategy (MC-GSO)

###### 4.2.1. Position Update Based on Chaotic Inertial Weight

As the population is evolving, the differences among individuals gradually reduce in the later iteration period of the standard GSO. Inspired by the inertia weight of the particle swarm optimization, the position updating formula of the MC-GSO is as follows:

In formula (2), the first part on the right is the position of the firefly individual before moving, which ensures the global convergence of the algorithm; the second part is the moving step size and the probability factor of the firefly individual choosing the moving direction. In order to enhance the global and local search ability of the algorithm, the inertia weight is introduced to ensure that the position of the firefly after moving is superior to the previous position.

The chaotic inertial weight is using logistic mapping, such as

In formula (3), is the number of iterations, , , and is the inertial weight of the iteration.

###### 4.2.2. Chaotic Variation of Firefly Individual

When the convergence rate of the GSO algorithm is slow, chaotic variables are used to replace some fireflies and make the algorithm jump out of the local optimum quickly. The strategy is defined as where denotes the number of iterations of the algorithm, is a chaotic sequence, denotes the number of random vectors generated by chaos, and is the influence factor of chaotic mutation operators; its expression are as follows: where represents the maximum iteration number of the algorithm.

The chaotic sequence produced by chaos has an iterative initial value in the range of [0,1], and the iterative initial value . Firstly, a vector in the interval of [0,1] is generated randomly in the solution space of dimensional. is shown as formula (6), and chaotic sequence is as formula (7):

chaotic sequences are obtained by using formula (7).

By using the generated chaotic sequences, the chaotic variation of the generation firefly is carried out according to formula (4), and the sequence is obtained. Comparing the fitness of the target function before and after the mutation, if the optimal solution after chaotic mutation is superior to the original solution, the individual of firefly will be updated.

###### 4.2.3. Algorithm Flow of MC-GSO

The MC-GSO algorithm is a multichaos strategy which combines chaotic inertial weight and chaos mutation. In the initial iteration of the algorithm, a weight is added to the first part of the position update formula to control the influence of the previous generation of firefly location information on the current firefly location information. The weight determines the moving distance of the firefly and strengthens the local search ability of the population. With the iterative evolving of the population, the individual trapped in the local optimum is mutated by chaotic perturbation mechanism. The states of individual fitness before and after mutation are compared, and the best state is selected to make the algorithm jump out of the local optimum and continue to iterate; the iteration stops until a global optimum is found.

The specific steps of MC-GSO are as follows:

*Step 1. *Initiate the relevant parameters. The size of the firefly population is , and the search dimension is . The maximum range of the individual decision domain of the firefly is Rs, and its coefficient of variation is . The maximum iteration number is . The volatilization coefficient of fluorescein and its renewal rate are and , respectively. The random position of firefly individual is . The initial value of the fluorescein is , its perceptual range is , and the moving step size is when the position is updated. The population is initialized at random, and the range of activity of fireflies is set.

*Step 2. *Update fluorescein. Calculate all fireflies’ objective function values (fitness values), and initialize bulletin boards, and convert them to the corresponding fluorescein value . Meanwhile, firefly selects individuals with larger fluorescein than its own to form neighbor set .

*Step 3. *The probability of individual moving to individual is calculated, and the roulette method is used to select individual .

*Step 4. *Update the position of fireflies according to formulas (2) and (3).

*Step 5. *Update the firefly’s perceptual radius.

*Step 6. *Update the fitness value. Calculate the fluorescein and fitness value of the firefly individuals in the current population. If the current fitness value of the firefly individuals is better than the original state, the original state and the fitness value will be changed.

*Step 7. *If the optimal fitness of the firefly population does not change or change very little after three successive iterations, the algorithm is in the state of local extremum, and Step 8 is executed; otherwise, Step 9 is executed.

*Step 8. *The chaotic variation of fireflies in the local optimal state is carried out, comparing the fitness of the target function before and after the chaos mutation. If the value after chaos mutation is better than the original value, the mutated firefly individual will replace the premutation firefly individual . If the firefly individual that has been replaced is superior to the optimal in the bulletin board, the individual in the bulletin board is replaced by the former.

*Step 9. *After the end of an iteration, if the algorithm satisfies the termination condition, it exits the iteration; otherwise, it turns to Step 2 and continues to iterate until the optimal solution is output.

##### 4.3. The Flow of MGDV-Hop

###### 4.3.1. Fitness Function of Error

Let the estimation distance between the beacon node and the unknown node is , which is obtained in the second stage of DV-Hop based on the and the number of hops. Let the true distance between the unknown node and the beacon node be ; the error of the localization is shown as

Fitness function is used to denote the sum of errors in positioning, such as
where *N* is the total number of beacons in the WSNs. MC-GSO calculates the minimum value of by iterating. Finally, the unknown node coordinates with the smallest error are output.

###### 4.3.2. The Steps of MGDV-Hop

*Step 1. *When , the network topology of WSNs and related parameters is initiated, including the size of the network, the number of nodes in the network, the number of beacon nodes, the number of unknown nodes, and the number of hops between nodes.

*Step 2. *The beacon nodes broadcast their own information to the whole network by flooding mechanism. According to the position information obtained by the beacon nodes, the average hop distance is calculated by using the minimum hop value according to formula (1).

*Step 3. *Each unknown node obtains from the nearest beacon, and the distance between the unknown node and the beacon node is obtained.

*Step 4. *Calculate the value of according to the formula (4).

*Step 5. *Initialize the firefly population, and use the fitness function as a firefly individual; the fluorescein of the firefly can be obtained by the fitness function which is constructed by the location error (the larger the fluorescein intensity, the smaller the location error). The dimension of the population is , and the scale is , setting the relevant parameters.

*Step 6. *Carry out Step 3 to Step 9 of MC-GSO.

*Step 7. *Through MC-GSO, the minimum value of the fitness function is obtained, which is the optimal solution, and output it. Finally, the minimum error point is obtained, and the coordinates of the unknown node can be obtained.

#### 5. Simulation Experiment

##### 5.1. Experiment of MC-GSO

###### 5.1.1. Experimental Parameters and Environment

The experimental parameters are as follows:

The step size was selected according to experience, and different test functions were chosen with different step sizes. Other experimental parameters are set according to Table 2.

The experimental environment is as follows:

The processor is 2.7 GHz Intel Core i5, the display is Intel Iris Graphics 6100 1536 MB, the memory is 8 GB 1867 MHz DDR3, the operating system is Macos Sierra, and the integrated development environment is MATLAB R2015a.

###### 5.1.2. Experimental Test Function

The MC-GSO is compared with the classical GSO and the GS-GSO which is based on Gaussian mutation, and the performances are compared by using six standard test functions.

The parameter setting of the test functions and the search range are shown in Table 3.

###### 5.1.3. Experimental Results and Analysis

GSO, GS-GSO, and MC-GSO were used to carry out 25 independent experiments on the six test functions above. The optimal solution of the minimum value of the six functions is solved. We can obtain the following performances: the minimum iteration times of convergence (), the average iteration times (), the maximum iteration times (), the average convergence time (), convergence rate (), the optimal value of the function (fitness_{best}), the worst value (finness_{bad}), and the average value (fitness_{average}). The algorithm converges when the fitness function satisfies ; otherwise, it is considered that the algorithm is not convergent.

###### 5.1.4. Convergence Rate and Iteration Times

Table 4 shows that the GSO algorithm does not converge to the functions to , while the convergence rate of the GS-GSO and the MC-GSO to the function to reaches 100%. The convergence accuracy of the MC-GSO is the highest, followed by that of the GS-GSO, and the convergence accuracy of the GSO is the least.

###### 5.1.5. Global Optimization Ability and Solution Accuracy

From the data in Table 5, we can see that the convergent iterative of MC-GSO can reach a relatively stable state. With the increasing of iteration times, the optimal function value of MC-GSO can achieve convergence accuracy when the number of iterations is less than 40 times. For the same iteration of the same function, the convergence time of MC-GSO is much lower than that of GS-GSO, and the accuracy of MC-GSO is higher than that of GSO and GS-GSO.

###### 5.1.6. Analysis

In MC-GSO, aiming at the shortcomings of the classical GSO algorithm, in the early stage of iteration, chaotic inertia weight is introduced into the position update formula in order to avoid individual missing of the optimal solution and falling into local optimum. In the later stage of iteration, in order to improve the convergence rate, when the firefly falls into the local optimal solution, the algorithm makes chaos mutation on each individual firefly for jumping out of the local optimum.

##### 5.2. Experiments for MGDV-Hop

###### 5.2.1. Location Error Calculation Model

The calculation for the location error of the node is shown as formula (10), and the calculation for the mean positioning error is shown as formula (11): where is the number of unknown nodes in the region, is the coordinates of an unknown node obtained by MGDV-Hop, is the actual coordinates of the node, and is the communication radius of the node.

###### 5.2.2. Location Coverage Calculation

The formula for calculating the location coverage is shown as where is location coverage, is the number of the nodes which have been located, and is the total number of unknown nodes.

###### 5.2.3. Energy Consumption Calculation Model

The energy consumption model is shown as formulas (13) and (14): where is the energy consumption that a node sends bit data to another node which is at a distance , is the energy consumption of a node for receiving bit data, is the energy consumption of the circuit for sending or receiving 1 bit data, is free-space model amplifier multiple, and is multipath fading model amplifier multiple.

In this paper, the average residual energy of all nodes and the variance of residual energy are used to measure the energy consumption performance of the location algorithms. Their calculation is shown in (15), respectively: where is the residual energy of node after location and transmission and is the total number of the nodes.

###### 5.2.4. Experimental Parameters and Environment

In the environment of MATLAB 2015a, 100 sensor nodes are randomly deployed in a WSNs of 100 m × 100 m. The simulation experiment is performed 100 times under the condition of different communication radii and different numbers of beacon nodes. The experimental results are compared with the classical DV-Hop and the location algorithm based on classical GSO named the GSDV-Hop algorithm in terms of the average location error, node location coverage, and network energy consumption. The parameters of the following simulation experiments are shown in Table 6.

###### 5.2.5. Experimental Results and Analysis

*5.2.5.1. Influence of Communication Radius on Mean Positioning Error*. In the case of changing the communication radius, the number of beacon nodes is set to 30, and the experimental results are shown in Figure 1. When the communication radius is from 15 m to 50 m, the average location error of the node with a larger communication radius is smaller. When the communication radius continues to increase, the average positioning error tends to be stable. From Figure 1, it can be concluded that the MGDV-Hop is superior to the other two algorithms in terms of location error.

*5.2.5.2. Influence of the Number of Beacons on Positioning Error*. From the experiment of the influence of the communication radius on the mean positioning error, we realize that the average location error is the smallest when the communication radius is 30 m; in this case, by changing the number of beacon nodes, the effect of the number of the beacon node number on the location error is determined. The simulation results are shown in Figure 2. When the number of beacons increases from 15 to 50, the average positioning error of the three algorithms shows a certain fluctuation, but it can be seen that the average positioning error of the MGDV-Hop is the lowest and the error curve is smoother than the other two algorithms, indicating that its stability is better.

*5.2.5.3. Influence of the Number of Beacons on Positioning Coverage*. Set m; the MGDV-Hop, classical DV-Hop, and GSDV-Hop are simulated when the numbers of beacons are 5, 10, 15, 20, 25, 30, and 40, respectively. Each simulation experiment is performed 100 times, and the average value of the simulation results is taken.

As shown in Figure 3, with the increasing of the number of beacon nodes, the positioning coverage of these three algorithms increases gradually, and when the number of beacons is small, the location coverage of MGDV-Hop is higher than that of GSDV-Hop and DV-Hop.

*5.2.5.4. Comparison of Node Energy Consumption*. Set m; the number of beacon nodes is 35. The simulation experiment is performed 100 times, and the average value of the simulation results is taken.

In the process of location, the unknown node can establish a nonlinear system of equations by only knowing the distance to the beacon and then can estimate its coordinates by using the firefly optimization algorithm.

The MC-GSO algorithm and the least square algorithm use the same method to calculate the distance between the unknown node and the beacon. The difference is that the MC-GSO is based on iterative optimization of fitness function, and no extra calculation is required. The least square method needs to solve the nonlinear equations. As a result, MGDV-Hop consumes less energy of nodes. Figure 4 shows the relationship between the average residual energy of nodes and time, and the relationship between the variance of residual energy of nodes and the time is shown in Figure 5. These compared results confirm that MGDV-Hop can reduce the energy consumption of nodes and make it more balanced.

###### 5.2.6. Analysis

In practical applications, the distribution of nodes in WSNs is random. The DV-Hop will result in a high location error when the nodes are not evenly distributed. Aiming at the error caused by the random distribution, in MGDV-Hop, the MC-GSO proposed in the third section is used to reduce the error caused by randomness. By analyzing and estimating the coordinate errors, the error fitness function is established, and the MC-GSO algorithm is used to approximate the fitness function and solve the coordinates of the unknown nodes when the error is minimum.

#### 6. Conclusions

Because the classical DV-Hop produces a large localization error in estimating the position of the unknown node, a firefly algorithm based on a mixed chaos strategy is proposed to improve the DV-Hop.

In MC-GSO, chaotic mutation and chaotic inertial weight are used to avoid firefly individuals falling into a local optimal state prematurely during population evolution, and the diversity of the GSO algorithm population is increased. The ability of local search and global search can also be enhanced.

In MGDV-Hop, the least square method used by DV-Hop in estimating node coordinates is replaced by MC-GSO. According to the calculation formula of unknown nodes, the error between the estimated coordinates and the real coordinates is obtained, and the corresponding error fitness function is derived. The MC-GSO is used to solve the minimum value of fitness function, which reduces the average positioning error, increases the location coverage of unknown nodes, and reduces the energy consumption.

#### Data Availability

The data used to support the findings of this study are available from the corresponding author upon request.

#### Conflicts of Interest

The authors declare that they have no conflicts of interest.

#### Acknowledgments

This work is supported by the National Natural Science Foundation of China (61762030).