A Node Location Algorithm Based on Improved Whale Optimization in Wireless Sensor Networks

With the popularity of swarm intelligence algorithms, the positioning of nodes to be located in wireless sensor networks (WSNs) has received more and more attention. To overcome the disadvantage of large ranging error and low positioning accuracy caused by the positioning algorithm of the received signal strength indication (RSSI) ranging model, we use the RSSI modified by Gaussian to reduce the distance measurement error and introduce an improved whale optimization algorithm to optimize the location of the nodes to be positioned to improve the positioning accuracy. The experimental results show that the improved whale algorithm performs better than the whale optimization algorithm and other swarm intelligence algorithms under 20 different types of benchmark function tests. The positioning accuracy of the proposed location algorithm is better than that of the original RSSI algorithm, the hybrid exponential and polynomial particle swarm optimization (HPSO) positioning algorithms, the whale optimization, and the quasiaffine transformation evolutionary (WOA-QT) positioning algorithm. It can be concluded that the cluster intelligence algorithm has better advantages than the original RSSI in WSN node positioning, and the improved algorithm in this paper has more advantages than several other cluster intelligence algorithms, which can effectively solve the positioning requirements in practical applications.


Introduction
Wireless sensor networks (WSNs) are multihop wireless networks composed of sensor nodes deployed in the detection area in a wireless self-assembling manner [1,2]. It can be defined as a network of tiny, small, expensive, and highly intelligent devices of sensor nodes. These sensors are capable of cooperatively sensing the environment, collecting and processing information about the sensed objects in the network coverage area, and eventually transmitting the information to the observer. This dynamic and cooperative ability of WSNs to sense, process, and transmit information allows them to be used in a large number of applications that need to reflect certain features of the real world, such as smart factories, environmental monitoring, smart homes, and military reconnaissance. In these applications, WSNs node localization techniques are very important, both for finding data sources and for tracking moving targets. The definition of the WSNs localization problem is to find the exact location of unknown target sensor nodes randomly deployed in the monitoring environment by using the existing exact location of sensor nodes (represented as anchor nodes).
In recent years, with the rise of swarm intelligence algorithms derived from traditional algorithms, combined with the principle of bionics, researchers mathematically model swarm intelligence algorithms according to biological evolution mechanisms. The swarm intelligence optimization algorithm is an adaptive artificial intelligence technology for solving extreme value problems. Therefore, this algorithm is widely used in various industries. For example, the butterfly optimization algorithm (BOA) is used to optimize the coupling problem of the bolted rim to obtain the implementation of the latest optimization method for a light vehicle design [3]. A robot clamping mechanism is designed by combining the grasshopper optimization algorithm (GOA) and the Nelder-Mead algorithm [4]. A new hybrid Taguchi salt swarm algorithm is used to accelerate the optimization process of industrial structure design problems and seek the global optimal solution [5]. The seagull optimization algorithm (SOA) is used to solve the shape optimization problem of vehicle support [6]. A new metaheuristic algorithm equilibrium optimization algorithm (EOA) is used to solve the structural design optimization problem of automobile seat support [7]. Nine latest metaheuristic algorithms are used to seek the optimal design of automatic planetary gear train [8]. The swarm intelligence optimization algorithms play an important role in solving these problems. The localization problem in WSNs can also be regarded as a complex mathematical model to a certain extent, so a swarm intelligence algorithm is also suitable for the localization problem in WSNs. According to previous studies, we optimize the position coordinates of the positioning node in the optimization stage of the positioning algorithm to get the position coordinates closer to the real value.
An effective node positioning method must consider the following two points: (1) Which positioning algorithm should be used to obtain higher positioning accuracy? (2) What kind of swarm intelligence method should be used to optimize its positioning and get a closer approximation to the true distance? Based on whether the physical distance between nodes is measured during the positioning process, the positioning algorithm is divided into two categories: range-based and range-free [9,10]. Because the received signal strength indication (RSSI) [11,12] technology-based on ranging does not require much hardware for sensor nodes, it is easy to implement and has become a widely used ranging technology in WSNs node positioning. Therefore, this paper adopts the distance measurement method based on RSSI to meet the principle of low power consumption and low cost. However, when transmitted in the real physical environment, the wireless signal is unavoidably interfered with by noise such as multipath fading, diffraction, antenna gain, and nonline-of-sight and produces uncertain propagation loss, resulting in large positioning error of RSSI algorithm. We use the Gauss function to correct the collected RSSI values to solve this problem. What kind of swarm intelligence algorithm can better optimize the location of nodes to be located? The whale optimization algorithm (WOA) is selected because it has a simple structure, few parameters, and strong active searchability. WOA has been proved to be superior to some advanced optimization algorithms. It is faster and more accurate than the traditional particle swarm optimization (PSO) algorithm in solving multivariate functions [13]. However, the WOA still has the disadvantage of slow convergence and is easy to fall into local optimum. We introduce hierarchy and feedback mechanisms in the contraction encirclement stage and random walk stage of the WOA to improve the globality and convergence speed.
Based on the above problems, we integrate the RSSI ranging and trilateral centroid positioning algorithm after Gaussian preprocessing, which can improve the positioning accuracy to a certain extent. In this paper, the proposed improved WOA algorithm is used to optimize the positioning nodes to further reduce the positioning error. The main contributions of this paper are as follows: (1) We introduce the hierarchy of the GWO in the contraction encirclement stage to improve the global search ability of the WOA. In the random walk stage, the feedback mechanism is introduced to increase the diversity of the population to improve the convergence speed. The improved WOA is applied to the RSSI location problem of WSNs (2) The objective function is redesigned to obtain the location of the node to be located closer to the real value. To further save the optimization time, the auxiliary strategy of the bounding-box search space is used in the early stage of the algorithm The rest of this paper is organized as follows. Section 2 reviews the related work. Section 3 introduces the RSSI model. The Section 4 mainly introduces the principle of the WOA algorithm and the improvement of the WOA algorithm in this paper. Section 5 discusses the implementation of the improved WOA in RSSI location in detail. Section 6 gives the experimental results and corresponding analysis, and Section 7 summarizes the conclusions and general discussion.

Related Work
This section focuses on the work done in the RSSI positioning algorithm and node optimization to improve positioning accuracy.

RSSI Localization Algorithm.
The RSSI algorithm is a range-based algorithm that is widely used because it does not need additional hardware facilities and low power consumption. However, the accuracy of RSSI ranging is easily disturbed by uncertain factors such as multipath propagation and obstacles. Therefore, many researchers use different algorithms to improve positioning accuracy. Bianchi et al. analyzed the influence of RSSI samples, anchor node number, and location according to the threshold algorithm of receiver operating characteristics. Mobile node power consumption is reduced and localization accuracy is improved, but the hardware cost is high [14]. Newton Gauss' iterative method to solve the node position can effectively reduce the amount of iterative calculation, but the positioning accuracy is poor in a high noise environment [15]. Some studies incorporate deep learning, such as combined hierarchical analysis and weighted nearest neighbor algorithm for indoor localization in the literature [16]. The hierarchical analysis method can reasonably extend the influence of RSSI differences between reference points on the weights, resulting in better localization performance. The adaptive Kalman filter noise reduction method is also improved, and the output is corrected according to the error between the RSSI measurement and the desired output. The localization accuracy is effectively improved, but the time complexity of the algorithm is too high. The RSSI signals emitted by the anchor node to the node to be located were clustered by a fuzzy C-mean clustering algorithm, which reduced the RSSI ranging error and improved the localization accuracy of the node [17]. Ahmadi et al. combined the learning regression tree method and the filtering method using the RSSI metric to propose a novel target tracking algorithm that produces more accurate results. The results show the relevance and effectiveness of the method [18]. In addition, Shah et al.
proposed a 3D weighted centroid algorithm and RSSI ranging model strategy for WSNs node localization based on smart devices [19]. Ahmad et al. proposed a parametric loop division (PLD) algorithm for 3D localization in WSNs. In this scheme, the sensor nodes are located in the area defined by the anchor node network. By iteratively shrinking that region towards its center point, this scheme provides better positioning accuracy compared with the existing scheme [20]. Some other studies have combined two localization algorithms, such as the DV-Hop improvement algorithm based on RSSI hop quantization with error correction, which can effectively reduce the impact of accumulated errors on distance estimation and improve the localization accuracy of the node to be located [21].
These algorithms improve the positioning accuracy of the nodes to be positioned to a certain extent. We use the trilateral centroid location algorithm based on RSSI to locate the positioning nodes initially. It is less affected by the change of transmission environment and does not require the interaction between nodes in the positioning process. However, because RSSI values are susceptible to air or occlusion in the environment, when the distance is constant, the RSSI values received by the same unknown node will fluctuate to varying degrees. Furthermore, the RSSI values of nodes closer to each other are usually smaller than those of nodes farther away. Therefore, this paper corrects the RSSI values to avoid the accuracy of the data in the case of individual anomalies.

Node Optimization Algorithm.
WSNs range-based positioning algorithms usually measure the distance or angle between nodes according to the spatial geometry principle to achieve the localization of nodes, which can be divided into the trilateral localization method, triangular localization method, minimum-maximum method, maximum likelihood method, etc. The trilateral localization method is widely used due to the small time complexity of the algorithm, low power consumption, and low cost. Although the trilateral localization method can accurately locate the position when three anchor nodes cross (see Figure 1), the accuracy of their position estimation is low when there is no cross (see Figure 2).
We use a swarm intelligence optimization algorithm to optimize the initial position of the positioning node to make up for the low accuracy mentioned above. The optimization algorithm based on swarm intelligence considers the calculation of nodes to be located as an optimization problem. By setting the objective function, a conditional optimal solution is found in the solution space, that is, the coordinate value of the nodes to be located. For example, genetic algorithms (GA) [22], ant colony optimization (ACO) [23], firefly algorithm (FA) [24], grey wolf optimizer (GWO) [25], particle swarm optimization (PSO) [26], and recently developed swarm intelligence algorithms can produce higher accuracy, such as whale optimization algorithm (WOA) [27], slime mould algorithm (SMA) [28], Hunger games search (HGS) [29], and Harris Hawks optimizer (HHO) [30].
Due to the optimization capability of the particle swarm algorithm, many researchers have used it in the localization process of WSNs. Songyut et al. improved distance estimation by node selection and the PSO. The estimation error of each hop is considered to reduce the error between the actual distance and the estimated distance, and different methods are used to solve the problem of localization on the line or approximate line [31]. Wu et al. proposed a hybrid adaptive particle swarm optimization and Monte Carlo combination of node localization algorithm for 3D mobile wireless sensor networks, which considers the random mobility of anchor points and unknown nodes. And an improved particle swarm optimization method and Monte Carlo are used to localize the mobile nodes. The algorithm works well in various cases with the highest localization accuracy, least time consuming, and highest localization rate [32]. Meng et al. used a particle swarm optimization algorithm to optimize the nodes to be localized to improve the accuracy of the localized nodes. Due to the convergence conditions and initial search space characteristics of the particle swarm algorithm in WSN localization, the particle swarm algorithm was improved, and the improved particle swarm algorithm did not increase the time  3 Wireless Communications and Mobile Computing complexity and space complexity of the algorithm compared to the original particle swarm algorithm [33]. In addition, there are some applications of new swarm intelligence algorithms. A hybrid algorithm is presented, SMA combined with adaptive guided differential evolution (AGDE) (SMA-AGDE). The AGDE mutation method was used to enhance the local search ability of population agents, increase the diversity of the population, and avoid premature convergence. Using the AGDE mutation method to enhance the local search ability of population agents, increase the diversity of the population, and avoid premature convergence [34]. This paper presents a node location method based on the salp group algorithm (SSA). Under different wireless sensor network deployments, the algorithm is compared with the well-known optimization algorithms, namely, PSO, butterfly optimization (BOA), FA, and GWO. The simulation results show that this location algorithm is superior to other algorithms in terms of an average positioning error, calculation time, and some positioning nodes [35]. Based on the principle of hexagonal geometry, the unknown node is located at the centroid of the partition area. The routing mechanism is enhanced by the modified enhanced flower pollination algorithm (EFPA), which effectively reduces network traffic and energy consumption [36].
Owing to the limited hardware resources of WSNs nodes, the location algorithms using cluster intelligence optimization still need to keep the time and space complexity low, have a simple structure, be easy to implement, and do not require much parameter tuning. Among the various schemes mentioned above, a considerable number of algorithms do not meet this requirement. The WOA is a group intelligence optimization algorithm proposed by Seyedali Mirjalili in 2016 to find the best solution by mimicking the search process of whales catching food in the ocean. Pan et al. combined the advantages of the two algorithms of whale optimization and quasiaffine transformation evolution algorithm which not only retains the unique framework advantages of whale optimization but also has the excellent coevolution ability of the quasiaffine transformation evolution algorithm. At the same time, the search space is dynamically reduced to further save the optimization space and got a satisfactory positioning accuracy [37]. A new communication mechanism (CM) is embedded in the basic WOA to improve the global optimal searchability and development trend of WOA. Then, the optimization (BBO) algorithm based on biogeography is used to coordinate the exploration and development trends [38]. Three strategies are added to the original method to further improve its exploration and development performance and to better balance the exploration and development trend. The chaos initialization phase is introduced into the optimizer to start the whale group triggered by chaos. Gaussian variation is used to enhance the diversity level of the evolutionary population. Chaotic local search and "shrinkage" strategies are adopted to enhance the development tendency of the basic optimizer [39]. In the whale optimization algorithm (WOA), two new effective strategies, Levy flight and chaotic local search, are synchronously introduced to guide the group, further promote the coordination between the inclusive exploration ability and neighborhood information ability of traditional technologies, and study the ability of core search WOA to deal with optimization tasks [40].
We further improve the WOA algorithm to overcome the shortcomings of slow convergence and easy to fall into local optimization. In the optimization stage, the preliminary position of the positioning node is optimized to improve the positioning accuracy.

RSSI Ranging Model
According to the transmission loss between the transmitter and receiver, RSSI transforms the transmission loss into the distance by using the theoretical model or empirical model [11]. The channel attenuation has a great influence on the localization accuracy of RSSI. The Log-distance distribution model used in this paper is as follows: where PLðdÞ is the signal strength of the node to be located received by the base station, and PLðd 0 Þ is the signal strength of the anchor node d 0 received by the base station; n is the proportional factor of path length and path loss; d 0 is the distance between the anchor node and the base station; d represents the distance between the node to be located and the base station to be calculated; and ε is Gaussian noise with zero means. According to Equation (1), the estimated distance between the anchor node and the node to be located is as follows: 4. Improved Whale Algorithm 4.1. Whale Optimization Algorithm. The WOA is a class of stochastic swarm intelligence optimization algorithms constructed by simulating the whale feeding process. The individual whales in the algorithm update their position and estimate the position of the prey through certain optimization strategies to achieve the algorithm to find the optimal and converge to the optimal solution, which is the coordinate value of the node to be located. WOA includes three ways to update the position: surround prey, random search, and spiral search. Firstly, we initialize the position W ði = 1, 2, ⋯, nÞ and fitness values for each whale and then evolve each individual in the population separately, calculate the coefficient vectors A ! and C ! , and generate a uniformly distributed decision random number p.
where a decreases from 2 to 0 as the number of iterations 4 Wireless Communications and Mobile Computing increases throughout the iteration period and r 1 ! and r 2 ! are random vectors on ½0, 1.

Encircle the Prey.
When the decision coefficient p < 0:5 (p is a random number, and the legend in this paper takes 0.5) and | A ! | ≤1, it indicates that the current humpback whale has found the prey X P and is in the process of shrinking encircling (see Figure 3). At this time, the current global optimal whale position is regarded as the target prey position (or the position closest to the target prey), and the whale updates the position based on the current global optimal whale position. The mathematical model of this process is as follows: where t is the number of iterations, X ! ðtÞ is the whale position, and X ! * ðtÞ is the current global optimal whale individual location.

Random Search.
When the decision coefficient p < 0:5 and | A ! | >1, the current whales are randomly walking in the global space for foraging, and the survey range is wide (see Figure 3). The mathematical model of this strategy is as follows: where t is the current number of iterations, X r ! is the position vector of the randomly selected individuals in the current population, and the positions of the current whale individuals in the t and t + 1 generations are X ! ðtÞ and X ! ðt + 1Þ, respectively.

Spiral Search.
When the decision-making coefficient p ≥ 0:5, it means that the whale is engaged in spiral bubble predation (see Figure 4). Firstly, the distance between the current whale and the current optimal p ≥ 0:5 whale is calculated, and then, a spiral equation is established between the two positions, that is, the whale preys on its prey with a spiral bubble net. The mathematical model for simulating the spiral predation behavior of humpback whales is as follows: where D p ! is the distance from the whale in the current position to the whale in the current global optimal position, b is the constant used to define the shape of the logarithmic spiral, and l is a uniformly distributed random number between -1 and 1. The original WOA in the process of random walk foraging, the position of a whale, is randomly selected for updating. This complete randomness increases the uncertainty of the algorithm, leads to poor stability of the algorithm, and slows down the convergence speed. This paper adopts the feedback mechanism to improve the convergence speed of the algorithm by combining the current optimal whale position. In the process of shrinking and surrounding prey, only the optimal whale position in the current state is considered, and the suboptimal solution is not considered, so it is easy to fall into local optimization. However, the hierarchy used in the grey wolf optimization algorithm can better solve this problem. Therefore, the grey wolf optimization algorithm is combined to further solve the optimal whale position.

Improve the Globality of the Surrounding Contraction
Phase. In the process of circling the whale, the group will only consider the best whale position in the current state. Therefore, it belongs to local optimization. We consider other suboptimal solutions to solve this problem to increase the communication between groups. The hierarchy strategy of the grey wolf optimizer (GWO) is introduced to select the first three historical optimal positions { X α ! , We can obtain the potential optimal solution from Equation (8): The new location is updated to 4.3. Improve the Convergence Speed of Random Walk Stage. In the random walk foraging strategy of the whale optimization algorithm, the position of a whale in the population is randomly selected as the basic solution to update the position. Although this completely random selection can maintain the activity of the population, it also increases the uncertainty of the algorithm, resulting in the poor stability of the algorithm and slowing down the convergence speed. The feedback mechanism can increase the diversity of the population and exchange information with the whale in the current optimal position. In this way, the whale does not need to go for no purpose, and it can also avoid the blindness of randomly selected individuals. The mathematical model is as follows: where X r ! is for the randomly selected individuals and X ! * ðtÞ is the optimal location. It can be seen from Equation (10) that the position of the new whale is determined by the random whale position and the optimal whale position, which can ensure the population activity and accelerate the convergence speed. After introducing the feedback mechanism, the whale random walk formula is as follows: 5. Node Location Algorithm Based on Improved WOA 5.1. Trilateral Centroid Localization Algorithm Based on RSSI Modification. In this section, the Gaussian fitting func-tion is used to correct the collected RSSI values and screen out outliers. Then, the RSSI ranging model calculates the initial distance from the revised RSSI value to make the initial distance closer to the real distance. The trilateral centroid location algorithm calculates the estimated position of the node to be located. U (x, y) S 2 (x 2 , y 2 ) S 1 (x 1 , y 1 ) Figure 5: Principle of the trilateral localization algorithm.    Among the collected signal values, the data with large errors are generally small probability events, and most of the data still fluctuate within a reasonable range. Gaussian filtering can screen out the data in the high-probability occurrence area and output it as the average value. This effectively eliminates mutant data. The Gaussian fitting function is as follows [41]: where the mean q , x 0 , and A are undetermined coefficients, and the position and signal value relationship of anchor node are used to determine. x i represents the ith signal value received by the node, and N is the total number of RSSI values received by the node.
According to the characteristics of Gaussian function, most RSSI values are distributed in ½μ − σ, μ + σ. The average value of this interval indicates the high-density distribution of the RSSI values, which means that the closer the measured value is to the actual value. After Gauss filtering, the current RSSI value is output as follows: where n is in the interval ½μ − σ, μ + σ and the number of the RSSI values in.
Input Anchor node coordinates and estimated distance of nodes to be located. Output The optimized coordinate value X P of the node is to be located. 1. Initial number of whale: W = fX 1 , X 2 , ⋯, X N g; 2. Computing fitness (X i ) by Equation (21); 3. X P = best; 4. while t < t Max do 5. for all X i in W do 6. Update a, A, D, l, p; 7.
Update location by Equation (11) Algorithm 1: Improved optimization of node coordinates.

Trilateral Centroid Localization and Node Location
Estimation. It is assumed that the corresponding distances d 1 , d 2 , and d 3 of the node U ðx, yÞ to be located are calculated by receiving RSSI signals sent by three anchor nodes A 1 ðx 1 , y 1 Þ, A 2 ðx 2 , y 2 Þ, and A 3 ðx 3 , y 3 Þ. Take A 1 , A 2 , and A 3 as the center of the circle, and the distances d 1 , d 2 , and d 3 as the radius as the circle (see Figure 5).
In Figure 5, points S 1 ðx 1 , y 1 Þ, S 2 ðx 2 , y 2 Þ, and S 3 ðx 3 , y 3 Þ are the intersection points of three circles, that is, the three vertices in the trilateral centroid localization algorithm.
According to the distance formula between two points, the equations are established:

Wireless Communications and Mobile Computing
Equation (15) is transformed into a system of linear equations: Among are the following:  : ð17Þ The estimated coordinates of the nodes to be located are obtained: Because the RSSI values are easy to be interfered with by noise, environment, and other factors, the centers of three localization circles sometimes do not intersect at one point but intersect each other to form three intersections: S 1 ðx 1 , y 1 Þ, S 2 ðx 2 , y 2 Þ, and S 3 ðx 3 , y 3 Þ. The trilateral centroid localization algorithm can be used to estimate the location of the unknown node.
The estimated location of the node U ðx, yÞ to be located is as follows:

Location Optimization Based on Improved Whale
Algorithm. To further reduce the localization error, we get the estimated distance between the anchor node and the node to be located is obtained through the above correction calculation. (1) The search scope is created through the bounding box. (2) The fitness value is improved. (3) The improved whale algorithm is applied to optimize the location coordinates of the nodes to be located. The main idea of the bounding box algorithm is that in a two-dimensional area, the location of the neighbor anchor node of the unknown node and the communication radius of the sensor node can be used to obtain a two-dimensional square area where the unknown node is located.
We restrict the two-dimensional search space of the locations of the nodes to be located according to the minimum-maximum method. First, we calculate the distance d i between the anchor node and the node to be located i (distance from the ith anchor node to the node to be located, i = 1, 2, ⋯, n). Each anchor node is used as the center of the circle (2d i ) is the radius and draws a square parallel to the x-axes and y-axes. The search space for the location of the node is to be located in the intersection of all the bounding-boxes (shown in the red box in Figure 6).

Determination of Fitness Function.
The fitness function is improved by the difference between the approximate distance from the anchor node to the node to be located, and the actual distance from the whale to the anchor node. The three anchor nodes are supposed as A 1 , A 2 , and A 3 , respectively, and U is the node to be located (see Figure 7). To get the estimated position close to the actual position, the difference between the approximate distance from the anchor node to the unknown node and the actual distance from the whale to the anchor node is minimal. That is, f ðx k ðtÞ, A i Þ = ðjjx k ðtÞ − ðx Ai , y Ai Þjj − d newði,jÞ Þ is the smallest, where ðx Ai , y Ai Þ is the coordinate of the ith anchor node, d newði,jÞ is the estimated distance from the ith anchor node to the jth anchor node after RSSI correction, and x k ðtÞ is the position coordinate of the whale at time t.
Then set the fitness function value as where N is the number of anchor nodes.

Improved WOA to Optimize Nodes to Be Located.
Firstly, the location area is narrowed by bounding-box, and the location of the whale is initialized within this area. Then, the global optimal position of the whale is updated based on the improved fitness function of Equation (21). Finally, the location of the whale is updated according to three different situations. If the current whale is the optimal solution, the optimal location of the node to be located is obtained.

10
Wireless Communications and Mobile Computing According to the above description, the pseudocode of the improved whale optimization algorithm is given in Algorithm 1.

Simulation Results and Analysis
6.1. Performance Evaluation of Improved Whale Algorithm. We compare the improved whale algorithm with HPSO [42] and WOA-QT [37]. The parameter settings of the three algorithms are shown in Table 1. 20 benchmark functions are selected to evaluate the performance of the improved whale algorithm in this part, as shown in Tables 2 and 3. Most benchmark functions come from the literature [43], including unimodal and multimodal functions.
The dimension is set to 30, and the selected comparison indexes include the minimum value (the best value), the median value, the maximum value, the average value, and the standard deviation value of each experiment. Figures 8-27 show the convergence curve for each function.
In the test of 10 unimodal functions, we compared with the HPSO algorithm and WOA-QT algorithm, the improved whale algorithm shows excellent local search ability in addition to the F 7 function. From the experimental results of 10 multimodal functions, it can be seen that the improved whale algorithm has an absolute advantage in the ranking of all indicators. This shows that it can effectively avoid falling into local optimization.  Table 4.
In the same case, each algorithm runs 40 times, and the other parameters of the optimization algorithm are the same as those in Table 1. The simulation area is set as 50 m * 50 m, and 100 sensor network nodes including nodes to be located, and anchor nodes are randomly generated in the setting area. The communication radius of nodes to be located and anchor nodes is the same. We use the average position-ing error index to evaluate the positioning performance of the model: where N is the total number of nodes in the test area, ðx, yÞ is the actual value of the nodes to be located, and ðx i , y i Þ is the estimated value of the nodes to be located.

Comparative Analysis of RSSI Measurement and
Localization Error before and after Gaussian Fitting. From Figure 28, the curve of the change of the localization error between the RSSI measurement before Gaussian fitting and the RSSI measurement after Gaussian fitting can be seen.
The results show that the localization error decreases with

12
Wireless Communications and Mobile Computing the increase of distance. However, compared with the RSSI measurement before Gaussian fitting, the RSSI measurement after Gaussian fitting can improve the localization accuracy, especially for the near distance RSSI measurement. It is found that Gaussian filtering can effectively reduce the influence of short-term interference on the RSSI measurement value and improve the anti-interference, stability, and ranging accuracy of range. .73% compared with the original RSSI algorithm, HPSO algorithm, and WOA-QT algorithm. When the communication radius is small, the performance of the localization algorithm in this paper has obvious advantages over the other three algorithms, but when the radius increases gradually, the advantages are not obvious before.     increases as the ranging error increases. The average positioning errors of the original RSSI algorithm, HPSO algorithm, WOA-QT algorithm, and the node location algorithm in this paper are 0.82, 0.57, 0.51, and 0.39, respectively, and the positioning errors of this algorithm is reduced by 52.43%, 30.96%, and 22.83% compared with the original RSSI algorithm, HPSO algorithm, and WOA-QT algorithm. When the ranging error is 0.3, the average positioning error of the four algorithms increases greatly. However, no matter how the ranging error changes, the localization error of the algorithm in this paper is always smaller than that of the original RSSI, HPSO, and WOA-QT algorithm.

Conclusions
Given the problem that RSSI ranging values in WSNs are susceptible to environmental factors, this paper presents a WSNs node location algorithm based on improved whale optimization. The RSSI ranging model is modified by a Gaussian fitting function to obtain the initial position of the node to be located. To further improve the positioning accuracy, it is optimized by the improved whale optimization algorithm. First, create a bounding box search space to narrow the range of nodes to be located. Then, the objective function is redesigned to improve the fitness function by the difference between the approximate distance from the anchor node to the node to be located and the actual distance from the whale to the anchor node to obtain better convergence speed and more accurate cost value. To further improve the convergence speed and search accuracy of the algorithm, hierarchy and feedback mechanisms are introduced into the shrinking and enclosing phases of the whale algorithm and the random walk phases, respectively. The simulation results show that the performance of this algorithm is superior to the original RSSI algorithm, HPSO, and WOA-QT algorithm, with better convergence performance and higher node positioning accuracy under the same hardware conditions. How to further improve the performance of the algorithm is an important research work in the future.

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

Conflicts of Interest
The authors declare no conflict of interest.