Abstract
Wireless sensor network (WSN) attracts the attention of more and more researchers, and it is applied in more and more environment. The localization information is one of the most important information in WSN. This paper proposed a novel algorithm called the rotated black hole (RBH) algorithm, which introduces a rotated optimal path and greatly improves the global search ability of the original black hole (BH) algorithm. Then, the novel algorithm is applied in reducing the localization error of WSN in 3D terrain. CEC 2013 test suit is used to verify the performance of the novel algorithm, and the simulation results show that the novel algorithm has better search performance than other famous intelligence computing algorithms. The localization simulation experiment results reveal that the novel algorithm also has an excellent performance in solving practical problems. WSN localization 3D terrain intelligence computing rotated the black hole algorithm.
1. Introduction
Due to the maturity of microelectronics and wireless communication technology, a lot of funds and researchers are attracted by wireless sensor networks (WSNs). These technologies have promoted the development of cheap, ultra-small, multifunctional, and smart sensor nodes (SNs), which have the ability to communicate with each other through wireless media [1]. Due to size and cost limitations, SN has limited functions and low computing power. Depending on the application, a collection of hundreds or thousands of nodes can be deployed in the area of interest. These nodes can communicate with each other through wireless media and form a network called a WSN.
More and more fields can achieve better performance with the help of WSN, such as target tracking [2], military affairs, disaster management, environmental monitoring, and so forth. In order to better perceive the target in the above scene, the location information of the sensor node is indispensable; otherwise, the information obtained by the sensor node will have a low correlation with the target to be monitored.
In order to obtain the accurate location of the sensor node, a global positioning system (GPS) module needs to be installed to provide accurate location information. However, due to the high cost and high energy consumption, it is impossible to install a GPS module on any sensor node. Without a GPS module, how to know the location of a node has become a problem that plagues researchers. In recent years, many algorithms have been proposed to calculate the positions of all sensor nodes in WSN [3]. According to the different of localization mechanisms, these algorithms can be divided into two categories: range-based localization algorithms and rang-free localization algorithms. In some localization algorithms, such as received signal strength indication (RSSI) [4], the time of arrival (ToA) [5, 6], and the angle of arrival (AoA) [7] of the signal, these algorithms use specific physical data to estimate the location of unknown nodes (not equipped with GPS modules), called distance-based positioning algorithm. Although the range-based positioning algorithm provides more accurate position information than the range-free positioning algorithm, it needs to be equipped with a specific module, which greatly increases the cost and energy consumption. WiFi distance measurement is used to improve accurate of indoor localization [8].
On the other hand, some algorithms only need the connective information of WSN and can estimate the position of unknown nodes. These algorithms are called range-free localization algorithms, such as centroid algorithm [9], distance vector-hop (DV-Hop) algorithm [10, 11], and approximate point-in-triangulation test (APIT) algorithm [12].
In [13], anchor nodes are set at the border land of monitoring regions and improve the estimation of per hop distance. The enhanced PSO algorithm is proposed and used to enhance the localization accurate of WSN in [14]. The hop size of each anchor node is replaced by an average hop size of all anchor nodes in [15]. Chen et al. proposed a method which adds a reference anchor node on hop size that calculates formulate to reduce the error of hop size of each anchor node [16]. In [17], the weighted least square algorithm is introduced to reduce the localization error of DV-Hop. In [18], a model is introduced to analysis localization error of mobile Lidar.
The traditional 2D WSN has gradually been unable to meet the needs of the current society, such as smart city [19–22]. Some algorithms applied to 2D WSN must be extended to 3D WSN to adapt to new social needs. [23] proposes a method to optimize the deployment strategy of WSN in a 3D environment. Pan et al. proposed a new algorithm to optimize the coverage rate of WSN in 3D terrain [24], and a DV-Hop localization method applied in 3D terrain is proposed [25]. In [26], the authors utilize the GA algorithm to improve localization accurate of WSN in 3D terrain.
In order to find the optimal solution of engineering problems quickly and accurately, many optimization algorithms have been established, some of them are inspired by natural phenomena, and [27] has briefly introduced the swarm intelligence algorithm. For example, the most popular evolution-inspired technique is genetic algorithms (GA) [28, 29] that simulates the Darwinian evolution. Differential evolution (DE) is an enhanced GA algorithm with better performance than GA [30–32]. Other popular algorithms are evolution strategy (ES) [33], probability-based incremental learning (PBIL) [34], genetic programming (GP) [35], Phasmatodea population evolution (PPE) algorithm [36], and biogeography-based optimizer (BBO) [37]. The particle swarm optimization (PSO) algorithm was developed based on the swarm behavior, such as fish and bird schooling in nature [38, 39]. Whale optimization algorithm (WOA) [40, 41] is a metaheuristic optimization algorithm by mimicking the hunting behavior of humpback whales. Grey wolf optimization (GWO) algorithm can be regarded as an enhanced PSO and achieve better performance [42, 43]. The ant colony optimization (ACO) is inspired by social behavior of ants in an ant colony [44]. Bat algorithm (BA) was inspired by the echolocation behavior of bats [45]. Black hole (BH) algorithms are inspired by the black hole phenomenon [46]. The gravitational search algorithm (GSA) was constructed based on the law of gravity and the notion of mass interactions [47]. The novel algorithm called moth search algorithm (MSA) is proposed which combine Levy fly and moth search [48]. In addition, some methods are proposed to improve the search ability of algorithms, [49–51] introduce the concept of compact, and significantly reduce the memory usage. The surrogate method utilizes the Kriging model to enhance the algorithm run speed [52–56].
There are three contributions in this paper: Firstly, this study improves the search path of the black hole algorithm to improve the speed of obtaining the optimal solution. Secondly, the novel algorithm proposed in this article gets a better balance between local search ability and global search ability. Thirdly, this paper further enhances the localization accurate of WSN in 3D terrain.
The rest of the paper is organized as follows: in Section 2, the knowledge related to DV-Hop and BH algorithm are briefly introduced. The novel algorithm is shown in Section 3, and Section 4 utilizes the novel algorithm to reduce the localization error of WSN in 3D terrain. CEC 2013 test suit and simulation experiment of sensor nodes deploring are used to test the performance of novel algorithm in Section 5. Conclusion is the content of Section 6.
2. Related Work
2.1. DV-Hop Localization Algorithm in 3D Terrain
2.1.1. Original DV-Hop
This section briefly introduces the original DV-Hop localization algorithm. In this localization algorithm, every node is stored in a table with three attributes which are . and are the horizontal and vertical coordinates of the node, and is the hop count of the node connect with other sensor nodes. In the first stage after the installation of the WSN, the hop count of all sensor nodes is initial to zero, and each anchor node (the node with the GPS module installed) broadcasts a message packet containing its localization information in the network. If a sensor node receives a message from another sensor node, the hop count between them would increase one. There may be multiple path links between any two nodes; so, the number of hops between them may have different values, but only the minimum number of hops between any two sensor nodes is reserved in DV-Hop. Secondly, the anchor node collects the number of hops and distance information between itself and other connected anchor nodes, thereby calculating the average length per hop of this anchor node. The calculating equation is presented in the following: where the position of th anchor node is , and is the number of all anchor nodes. The hop count between th anchor node and th anchor node is represented as , and the average length of per hop of th anchor node is .
Each anchor node broadcasts its own to the network by controlling flooding. The distance between unknown node and anchor node can be calculated by Eq (2). At the same time, the unknown node forwards the information to surrounding nodes, and the corresponding hop count is increased by 1.
Then, the location of the unknown node can be estimated by the trilateration localization method, and the localization error can be reduced by the least-squares method [10].
2.1.2. DV-Hop in 3D Terrain
The wireless signal is transmitted from the transmitter to the receiver through electromagnetic radiation. Different from deploying WSN in a 2D environment, in a 3D environment, electromagnetic signals will be absorbed or blocked by surrounding obstacles. The number of obstacles determines the fading and shadowing of the signal between receiver and transmitter [57]. To detect whether the communication of nodes is blocker by surrounding terrain, a line-of-sight (LOS) algorithm is introduced. In this article, we use the Bresenham LOS algorithm, because it has a faster calculation speed, requires fewer calculation points, and does not require interpolation calculations [58]. The sensor model in WSN is a mathematical formula that characterizes the connectivity of sensors as a function of distance and terrain obstacles. This paper adopts the straightforward binary sensing model to determine whether a node is connected to the WSN. If a sensor node is within the communication radius of another sensor node, no obstacles obstruct the communication signal between them. These two sensor nodes can communicate with each other and vice versa. In order to illustrate the signal propagation in 3D terrain more vividly, Figure 1 shows the details of the LOS algorithm.

In Figure 1, there are 7 nodes on uneven terrain, named , , , , , , and , which are represented by blue dots. As can be seen from the figure, nodes and node are connected by a green dashed line, indicating that they can communicate with each other, and this is because there is no obstacle between node and node that hinders signal propagation. Conversely, node and node are connected by a red dashed line, and they cannot communicate with each other. As there is a mountain peak between them, the signal propagation is hindered.
2.2. Black Hole Algorithm
The black hole (BH) algorithm is one of the population-based methods which is inspired by the black hole phenomenon. In this method, a population of candidate solutions to a given problem is generated and distributed randomly in the search space.
In the proposed BH algorithm, the evolution of the population is done by moving all the candidates towards the best candidate solution in each iteration as shown in Eq. (2), and the best candidate solution is named black hole. If the population finds a better candidate solution than black hole, this solution would replace the black hole. where and are the locations of the th star at iterations and , respectively. is the location of the black hole in the search space at th iteration. The is a random number between 0 and 1, and is the number of stars (candidate solutions).
Otherwise, the black hole would engulfs the candidate solution which within the radius of its event horizon. This mechanism guarantees that the population will not be trapped in local optimal value. In order to keep the population size, a new individual will be generated randomly in search space of a problem. It is worth noting that a small number of individuals will pass through the event horizon of the black hole, which can improve the exploitation performance of the algorithm. The radius of the event horizon in the BH algorithm is calculated by the following equation:
In the above formula, represents the fitness value calculated according to the position of the black hole. The fitness value calculated from the position of the th individual is denoted by . When the distance between an individual and the black hole is less than , the individual will be swallowed, and the algorithm will randomly generate a new individual to maintain the population size.
3. Rotated Black Hole
In the original BH algorithm, the individual directly moves forward into the black hole. If the individual finds a better solution in the process, the black hole will be updated. However, in the multimodal problem, it is difficult for the intelligence computing algorithm to find a better solution on the straight path. [40] has introduced a formula which mimic the feeding behavior of whales and gotten great performance.
In order to improve the search ability of the BH algorithm in multimodal problems, the rotated model is introduced in this paper. The position update equation of population in the rotated model is presented in the following:
is the position of th individual at iteration, and the indicates the distance between it and black hole. The position of the black hole at iteration is represented by . The is a constant, it is set to 1 in this article, and is a rand number between -1 and 1. In the novel algorithm, the original position update way and the rotated model are combined to find the optimal solution. In each iteration, the algorithm generates a rand number, if the rand number is bigger than a special constant , the algorithm utilizes a rotated model and vice versa. The detail of the novel algorithm is presented in Algorithm 1 and Figure 2.
|

4. Rotated Black Hole Algorithm Applied on DV-Hop in 3D Terrain
In this section, the novel algorithm is applied to reduce locate error of unknown nodes in 3D terrain. [59] has proved that the intelligence computing algorithm has a distinct effect on WSN in 2D plane. In this paper, the 2D plane is extended to a 3D terrain as shown in Figure 3. This terrain is generated by the “peak” function of Matlab 2018a, and the connective state between any two nodes can be estimated by the LOS algorithm. The locate error of DV-Hop can be calculated by Eq. (6).

The position of the th anchor node is represented by , and is the estimation position of unknown node. The means the real distance between th anchor node and unknown node; so, is the error between the real position and estimation position of unknown node in WSN. This section applies the novel algorithm to reduce the error, and the fitness function is shown as follows: where the hop count between unknown node and th anchor node is represented by . The purpose of this article is to use the new algorithm to weigh trade-off all anchor nodes and find a suitable unknown node location.
5. Results and Discussion
5.1. CEC 2013 Simulation Results
To test the performance of the RBH algorithm, CREST was carried out using the CEC 2013 benchmark function, which is a convincing function for the testing optimization algorithm. There are 28 test functions in the CEC 2013 benchmark function. The to are unimodal functions, mainly check out the convergence rate of the optimization algorithm. The to are multimodal functions, which are used to verify the performance of avoiding local optimal values of algorithms. The to are composition functions, and their simulation results reveal the comprehensive performance of optimization algorithms. CREST was compared with some frequently used optimization algorithms, such as WOA, GA, BH, PSO, ABC, and MSA algorithms. CREST in this study is implemented on the same notebook computer which equips with an i5-7300HQ CPU @2.5GHz. CREST results were presented in Table 1, every data is the average of 48 test results, and the best results are marked by underline and bolt font for each function.
The optimal results of intelligence computing algorithms under the CEC 2013 were showed in Table 1, and the best result of each test problem is marked in bold. The search ability of RBH algorithm on 14 benchmark functions is better or equal than other algorithms.
In the unimodal problems, as the excellent local search ability of PSO, other algorithms are far from the PSO algorithm. In the multimodal problems, the new algorithm proposed in this paper has obtained 8 best results. The results show that the new algorithm has a strong global search ability than other comparison algorithms. Out of a total of eight composition problems, the new algorithm performed best in five, and this further verifies the novel algorithm with great global search ability. Through CREST, one conclusion was achieved that the RBH algorithm has good global search capabilities and is good at solving complex optimization problems.
In Figure 4, the details of intelligence computing algorithms to solve some optimal problems are given. Although the new algorithm cannot find a better solution than other algorithms in the early stage, it has a strong global search ability and is easy to avoid the local optimal value and finally find the optimal solution. Contrast other algorithms, the PSO has the fastest convergence rate but it has difficult jumping local optimal value; so, it is surpassed by other algorithms in the last stage. It can be seen that for complex problems, the new algorithm has an advantage due to its excellent global search ability.

(a)

(b)

(c)

(d)

(e)

(f)

(g)

(h)
5.2. Localization of WSN in 3D Terrain
In this section, the sensor nodes are randomly arranged in a 3D terrain as shown in Figure 3. In order to comprehensively check the performance of all positioning algorithms, we design three simulation experiments with different number of nodes, different number of anchor nodes, and communication radius of sensor nodes. The best experimental results for each experiment are underlined.
5.2.1. Localization Error of WSN with Different Numbers of Nodes in 3D Terrain
In this simulation experiment, we have configured 200, 250, 300, 350, 400, 450, and 500 nodes in the 3D terrain, respectively, the communication radius of all nodes is set to 20 m, and there are 30 anchor nodes. The simulation results are shown in Table 2 and Figure 5.

The localization error is the average value of localization error of all unknown nodes which is calculated by Eq. (6). From this table, we can see that the intelligence computing algorithm effectively improves the accuracy of the DV-Hop localization algorithm, and the novel algorithm has the strongest performance in all participated compared algorithms. The biggest localization error of the original DV-Hop algorithm appears 250 nodes. Generally speaking, the positioning error is positively related to the number of nodes. The reason for this phenomenon is that each node deployment is independent and random. In the experiment of deploying 250 nodes, the signals of many nodes are blocked by the terrain; so, the experimental results of the original DV-Hop are not ideal. However, in this experimental environment, intelligent computing shows strong optimization capabilities, which greatly reduces the positioning error.
5.2.2. Localization Error of WSN with Different Numbers of Anchor Nodes in 3D Terrain
In this simulation experiment, there are 15, 20, 25, 30, 35, 40, and 45 anchor nodes, respectively, the number of nodes is 300, and the communication radius of sensor node is set to 20 m. Table 3 and Figure 6 show the simulation results.

Generally, the positioning error decreases as the number of anchor nodes increases, but when the number of anchor nodes is greater than 35, a special situation occurs in the traditional DV-Hop. Excessive location information causes trouble to the traditional DV-Hop and reduces the accuracy of positioning. DV-Hop combined with intelligent computing algorithm, especially combined with RBH algorithm, can adapt to any conditions, and no matter the number of anchor nodes, the simulation results are equally excellent.
5.2.3. Localization Error of WSN with Different Communication Radii in 3D Terrain
The communication radius of the sensor node can determine the anchor node that provides location information to how many sensor nodes. So, the value of communication radius of sensor nodes is a important factor for simulation results. We install the communication radius as 14, 18, 22, 26, 30, 34, and 38 to test the performance of different localization algorithms. There are 300 sensor nodes and 30 anchor nodes in this experiment, and the simulation results are presented in Table 4 and Figure 7.

From this table, we can see the influence of the communication radius on the experimental results. Different from what we originally envisioned, the increase of communication radius would increase the localization error of WSN. And without exception, all localization algorithms show this feature. The novel algorithm gets the best result at each experiment except communication radius is 30.
6. Conclusion
In this paper, a novel algorithm is proposed, which utilizes a rotated optimal path to greatly improve the optimal ability of the original BH algorithm, especially in multimodal problems and composition problems. The CEC 2013 test suits show that the novel algorithm has outstanding global search ability; so, the novel algorithm can easily avoid local optimal value. In addition, this paper uses a new algorithm to optimize the position of the unknown node based on the DV-Hop positioning method, thereby reducing the error of the position estimation of the unknown node. The experiments in this paper have performed simulation experiments on the number of nodes, the number of anchor nodes, and the communication radius, respectively, and all prove that the new algorithm has a good effect on the localization problem of WSN in 3D terrain.
Data Availability
The related source code is uploaded in the following URL:https://mp.csdn.net/mp_download/manage/download/UpDetailed ~ ~ ~ ~ ~ ~ ~ ~ ~^~^~^~^~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~amp, which is available upon request.
Conflicts of Interest
The authors declare that they have no conflicts of interest.