A Node Location Method in Wireless Sensor Networks Based on a Hybrid Optimization Algorithm

Wireless sensor networks (WSN) have gradually integrated into the concept of the Internet of Things (IoT) and become one of the key technologies. This paper studies the optimization algorithm in the field of artificial intelligence (AI) and effectively solves the problem of node location in WSN. Specifically, we propose a hybrid algorithmWOA-QT based on the whale optimization (WOA) and the quasi-affine transformation evolutionary (QUATRE) algorithm. It skillfully combines the strengths of the two algorithms, not only retaining the WOA’s distinctive framework advantages but also having QUATRE’s excellent coevolution ability. In order to further save optimization time, an auxiliary strategy for dynamically shrinking the search space (DSS) is introduced in the algorithm. To ensure the fairness of the evaluation, this paper selects 30 different types of benchmark functions and conducts experiments from multiple angles. The experiment results demonstrate that the optimization quality and efficiency of WOA-QT are very prominent. We use the proposed algorithm to optimize the weighted centroid location (WCL) algorithm based on received signal strength indication (RSSI) and obtain satisfactory positioning accuracy. This reflects the high value of the algorithm in practical applications.


Introduction
With the development of the Internet of Things (IoT) to this day, it can be said that the basic task originally conceived has been completed, namely, the interconnection of human, machine, and things [1]. However, people are no longer satisfied with the simple networking and put forward higher requirements. As the rapid expansion of scale, IoT has produced an alarming amount of real-time monitoring data [2]. There is no doubt that scientific management of these data requires a "Super Brain", and intelligence has become an inevitable choice for the evolution and upgrade. Artificial intelligence (AI) is fully qualified for this role. The history of AI is much longer than that of IoT, but it has been plagued by the difficulty of technical development and the lack of kinetic energy for achievement transformation. In recent years, AI has made breakthrough progress at the technical level, which makes people full of confidence and hope for its future. How to guide AI from the laboratory into various real application scenarios is a challenging task. The booming IoT has provided a broad stage for AI to fully release its potentia, and the naturally existing data sources continuously provide power for it. Relying on the mature platform built by IoT, AI can meet the most urgent demand for technology landing. Although IoT already has a considerable volume in terms of industrial chain and scale, many key technologies still need to be polished and improved. IoT has been thinking for a long time to seek considerable progress and sustainable development, and the empowerment of AI just opens an important window of opportunity for its development. Therefore, the term AIoT (Artificial Intelligence of Things) came into being, which can be understood as the integration of AI and IoT.
AI covers a wide range of technologies, in which the optimization algorithm has received extensive attention from researchers. Among many optimization algorithms, the metaheuristic algorithm is the most active. Some of them are inspired by the evolution phenomenon in nature, represented by genetic algorithm (GA) [3] and differential evolution algorithm (DE) [4]. Some algorithms are inspired by biological collective behavior, including particle swarm optimization (PSO) [5], artificial bee colony algorithm (ABC) [6,7], Cat swarm optimization (CSO) [8,9], WOA [10,11], and symbiotic organism search algorithm [12,13]. Some are related to physical or mathematical rules, such as black hole (BH) [14,15] and QUATRE [16,17]. Unfortunately, there is no one algorithm capable of solving all optimization problems according to the NFL theorem [18]. This has stimulated researchers' endless enthusiasm, either proposing new algorithms and technologies, or improving existing ones [19,20], or combining different ones [21]. It is found that the hybrid strategy of the algorithm is worth trying in many cases. This article mixes two algorithms, WOA and QUATRE, and introduces the technology of dynamically shrinking the search space. In the test of the benchmark function, it is found that the hybrid algorithm has made great progress.
As the key core technology of IoT, WSN has been extended from military applications originally to a large number of civil fields, such as environmental and ecological protection, medical and health monitoring, agricultural planting, traffic management, and logistics management [22]. The main research contents of WSN include network topology control and network protocol, node deployment [23,24], network security [25,26], location technology, and data fusion and data management. The development of WSN also faces many challenges. For example, how to use the limited communication ability to complete the transmission of sensing data needs further research. And how to maximize the service life of the network through low-power design is also an urgent problem to be solved. This paper introduces the optimization algorithm into the node location problem of WSN and achieves satisfactory location accuracy.
The rest of this article is as follows: the second part is the related research work, mainly for the brief introduction of WOA and QUATRE; the third part discusses the combination and improvement strategy of the two algorithms in detail; the fourth part is the statistics and analysis of experimental data based on benchmark functions; the fifth part is to use the algorithm to realize the location in WSN; and the last part is the summary and outlook.

Related Works
2.1. Whale Optimization Algorithm (WOA). As a metaheuristic optimization algorithm based on swarm intelligence, WOA is exquisitely designed and full of characteristics. It simulates the hunting behavior of humpback whale groups. Inspired by this hunting method, WOA designed three models: searching for prey, encircling prey, and bubble-net attacking. First, initialize the position of each whale: X ! = ðx 1 , x 2 , ⋯, x n Þ, which represents an n-dimensional candidate solution. Through the cooperation of two stages of exploration and exploitation, the best position is gradually found (i.e., the optimal solution).
where r ! is a random vector between ½0, 1. As the iteration progresses, a ! decreases linearly from 2 to 0. Therefore, A There is a random number prob ∈ ½0, 1, which is used to indicate the selection probability of the updated mode. The random vector A ! and the random number prob jointly control the conversion between exploration and exploitation. Vector D ! has different representations at different stages. The operation symbol ð•Þ means multiplying item by item, and j•j means taking the absolute value.
(1) Exploration: searching mode WOA's exploration phase mimics the process of whales searching for prey in the ocean. Use a randomly selected search agent to update the solution. To achieve the goal of global search, the search agent is forced to leave the reference whale. The position update formula for exploration is as follows: X ! ðtÞ is the solution vector at the t − th iteration. X ! rand represents a random solution in the current population.
When prob < 0:5 and jA ! j ≥ 1, Equation (2) will be used to update the solution vector.
(2) Exploitation The exploitation phase of WOA includes two modes: encircling mode and bubble-net attacking mode.
2.1.1. Encircling Mode. Once humpback whales find their prey, they surround them. Since the best position is unknown, it is assumed that the current best solution is the destination or the approximate best position. Other search agents will update their position with reference to the current optimal, as shown in Eq. (3): X * ! ðtÞ denotes the current optimal. When prob < 0:5 and jA ! j < 1, the solution will be updated by the above formula.
Here, the distance between X ! ðtÞ and X * ! ðtÞ is recorded as D′ ! , which can be understood as the distance between the whale and its prey. The constant b is used to define the shape of the logarithmic spiral. l is a random number between ½0, 1. When prob ≥ 0:5, Equation (4) will be used to generate a new solution.

QUasi-Affine Transformation Evolutionary (QUATRE)
Algorithm. QUATRE is a coevolutionary algorithm based on quasi-affine transformation. As a new structure of evolutionary calculation, it can be used to solve the problem of distributed bias in the DE algorithm. The evolution formula is similar to the affine transformation, as shown below: Suppose there are ND-dimensional solution vectors X i , which constitute a population matrix: X = ðX 1 , X 2 , ⋯, X i , ⋯, X N Þ T . There are two matrices: the donor matrix B and the coevolutionary matrix M. The operator ⨂ represents the bitwise multiplication of matrix elements. M and M are mutually inverse matrices, and and they are both binary matrices (matrix elements only take 0 or 1).

The Coevolutionary Matrix M.
The QUTARE algorithm considers that all search agents in the population have the same status. By the cooperative structure, the search agents cooperate with each other and share information. The initialized matrix M initial is constructed, and then, through a series of transformations, the coevolutionary matrix M is obtained.
There are three methods for constructing M initial . The specific choice depends on the size relationship between the population size ps and the search space dimension D. If ps = D, M initial is a D-dimensional binary lower triangular matrix, as shown in Equation (6). When ps > D, M initial needs to be expanded. If ps = p•D, M initial is a matrix of pD-dimensional binary lower triangular matrices stacked vertically. If ps = p•D + q, the first p•D rows are handled according to the previous situation, and the rest take the first q lines in Equation (6), as shown in Equation (7 Assume that the population matrix of the Gth generation is X G = ðX 1,G , X 2,G , ⋯, X i,G , ⋯, X N,G Þ T , which consists of ND-dimensional candidate solutions X i,G . Each X i,G has an evolution guide vector B i,G corresponding to it. X gbest,G represents the best individual in the population. X r1 and X r2 are generated by randomly arranging the row vectors of X G . F ∈ ð0, 1 is the scaling factor.

The Hybrid Algorithms Based on WOA and QUATRE (WOA-QT)
The metaheuristic algorithm has two basic elements: exploration and exploitation. The task of exploration is to trial different solutions in the search space and try to find the global optimal. The task of the exploitation is to search in the local scope and fully tap the optimization opportunities brought by the current optimal. Ideally, if the two stages can cooperate with each other and realize smooth transition, the local optimum can be avoided and the optimal solution can be found finally [27]. WOA has proved to be superior to some advanced optimization algorithms, for example, PSO, DE, GSA, and fast evolutionary programing (FEP) [28]. It provides multiple 3 Wireless Communications and Mobile Computing update modes and strives to balance the relationship between exploration and exploitation. But inevitably, it still faces many problems, such as how to further improve the exploration ability, release the exploitation potential, and avoid local optimization. Local optimal stagnation and slow convergence are its two main disadvantages. In order to improve the ability to escape from the local optimum, this paper introduces the QUATRE algorithm into WOA and use the strategy of dynamically shrinking the search space to improve time efficiency. In this part, we will analyze the causes of the problems in detail and explain the relevant countermeasures.
3.1. The Combination of WOA and QUATRE. Although WOA has two different exploitation models, both of them are highly dependent on the current optimum. When the problem is a multimodal function or a complex function, there is a risk of falling into a local optimum. How to deal with this situation requires careful consideration.
QUATRE is a coevolution algorithm, which uses matrix mode calculation and concise parameters. From the point of view of statistics and probability theory, the moving way of individuals is more reasonable in the process of evolution. In addition, the coevolutionary matrix in the algorithm can perceive the structure of objective function more comprehensively, which makes the search of solution space more effective.
Based on the above considerations, this paper proposes a hybrid algorithm based on WOA and QUATRE. The specific idea is to embed QUATRE in the exploitation stage of WOA.
The current optimal solution X * ! ðtÞ plays an absolute dominant role in both the encircling mode and the bubble-net attacking mode. The QUATRE algorithm can be used to preprocess the current optimal, and the effect is equivalent to perturb the current optimal solution in accordance with statistics and probability theory to make up for the lack of randomness and diversity. The fusion method of the two algorithms in the encircling mode is as follows: : Here, the current optimal solution X * ! ðtÞ is processed by the QUATRE to get X Q ! ðtÞ, which will replace X * ! ðtÞ to guide the position update of the encircling mode in the exploitation stage.
Similarly, in the bubble-net attacking mode, the fusion of the two algorithms is also performed, as shown in the following formula: X Q ! ðtÞ replaces X * ! ðtÞ to guide the position update of the bubble-net attacking mode during the exploitation phase. In the proposed WOA-QT, Equations (9) and (10) will still have a 50% probability of being selected.
QUATRE has different mutation strategies, which emphasize different focuses of search capabilities [29,30]. The mode QUATRE/best/1 is concise in form which only uses the current optimal solution X gbest,G and two randomly selected solutions X r1 and X r2 . X gbest,G dominates the evolution of the population, so that individuals with higher fitness values can be fully utilized to perform good local search, and the convergence speed is faster. Although the combination of the two algorithms has increased the randomness of the population, we choose QUATRE/best/1 as the mutation strategy to avoid overcorrection. Therefore, both the population diversity is ensured and the convergence speed is also taken into account. Therefore, both the population diversity is ensured and the convergence speed is also taken into account.

Strategy of Dynamically Shrinking Search Space (DSS).
The candidate solution should gradually approach the global optimal solution. The general trend is that the size of search space will decrease as the iteration progresses. However, the search space of WOA is always the size at the time of initialization. It is obviously unreasonable to roam randomly in such a fixed-size space, which may cause delay in the optimization process. In this paper, we propose a mechanism to dynamically shrink the search space, which is used in the exploration phase of WOA. As the optimization proceeds, the upper and lower limits of the selection range of the random solution will change accordingly, so that the size of the search space is gradually reduced, thereby improving search efficiency. The specific method is as follows: First define four variables: the upper limit of the newly generated search space ub_new, the lower limit of the newly generated search space lb_new, the largest solution component of the current iteration ub_ max, and the smallest solution component of the current iteration lb_ min. The initial values of the above variables are set according to the initial size of the search space.
where t represents the current number of iterations and max _iter is the maximum number of iterations. As the iteration progresses, ub_new will decrease approximately linearly according to Equation (11), and lb_new will increase approximately linearly according to Equation (12). As a result, the exploration scope is gradually reduced, and the global optimum is constantly approached. The random solution in the exploration process is now generated from a dynamically shrinking search space defined by ub_new and (1) Initialization: generate N individuals X i ði = 0, 1, 2, 3,⋯,NÞ randomly to form population X. Set initial values to parameters in WOA and QUATRE. Specify the maximum number of iterations max _iter and parameters related to the size of the search space (including initial upper limit ub and lower limit lb, the upper limit ub_new and lower limit lb_ new of search space after each iteration, the maximum solution component ub_ max and minimum solution component lb_ max of the current iteration).
(2) Evaluation: calculate each individual's fitness value f ðX i Þ. By comparing with each other, determine the individual X * who currently has the best fitness value.
(3) Update: choose one of the modes to update the individual's position.
(i) Exploration: when prob < 0:5 and jAj ≥ 1 , use Equation ((2)) to update the solution. That is to select a random solution X rand in the current search space (between the upper limit ub_new and lower limit lb_new ).
(ii) Exploitation (A) When prob < 0:5 and jAj < 1, use Equation (9) to update the solution. This is the WOA encircling mode embedded with QUATRE (B) B. When prob ≥ 0:5, use Equation (10) to update the solution. This is the WOA bubble-net attacking mode embedded with QUATRE (4) Reevaluation: re-evaluate the population to find the best individual X * . And shrink the size of search space according to the Equations (11) and (12).
(5) Termination: repeat steps (3) to (4). If a predefined function value has been obtained or all iterations have been completed, record the global optimal solution X * and its best fitness value f ðX * Þ. The optimization process ends here.

Experiment Results and Analysis
This part selects 30 benchmark functions for performance evaluation, as shown in Tables 1, 2, and 3. Most of the benchmark functions come from literature [31], including three categories: unimodal, multimodal, and fixed-dimension complex functions. We also separately evaluate the performance in solving low-dimensional and high-dimensional problems. The selected unimodal functions and multimodal functions are scalable functions covering low and high Generate initial population X containing N individuals X i ði = 0, 1, 2, 3,⋯,NÞ. Initialize the parameters related to the algorithm: a, r, b, prob, t, max_iter. Initialize two matrices in QUATRE: the coevolutionary matrix M (Eq. (6) or Eq. (7)). the donor matrix B (Eq. (8)). Initialize the parameters related to the search space size: ub = ub_new = ub_max. lb = lb_new = lb_min. Calculate the fitness value of each solution. X * = the best individual.
Update the position of the current solution using Eq. (10).

Experiments for Low-Dimensional Unimodal and
Multimodal Functions. First, the low-dimensional unimodal functions and multimodal functions are tested, and the dimension is set to 30. The comparative indicators we selected include the minimum (i.e., optimal value), medium, maximum, mean, and standard deviation values of each experiment. Figure 1 shows the convergence curve of each function.
In the test of 10 unimodal functions, we can see that WOA-QT has achieved the first place in the comparison of the optimal values for 9 times (F1-F6, F8-F10). Compared with the other two algorithms, WOA-Q's optimization accuracy and convergence speed have been significantly improved, showing excellent local search capabilities. In addition, WOA-QT also has an absolute advantage in the comparison of other statistical data, which shows that its performance stability is far better than WOA and QUATRE.
From the experimental results of 10 multimodal functions, we can see that WOA-QT has an absolute advantage in the ranking of all indicators. This shows that it can effectively avoid falling into the local optimal.

Experiments for High-Dimensional Unimodal and
Multimodal Functions. This experiment continues to use the test functions from the previous section but expand the dimension to 500. The conclusion of this experiment is basically consistent with that of the last one. The WOA-QT still maintains good performance in high-dimensional situations. Please see Figure 2 for the function convergence curves.

Experimental Results of Fixed-Dimension Complex
Function. We also tested 10 fixed-dimension complex functions. It is found that the comprehensive performance of WOA-QT is still the best of the three. Figure 3 shows the function convergence curves obtained in this experiment.

Analysis of Experiment
Results. In this paper, different types of benchmark functions are selected for testing for the sake of the scientificity and fairness of evaluation. It also examines the algorithm's ability to solve scalable dimensional problems.
When solving the unimodal problem, WOA-QT embodies the outstanding local exploitation ability. In the face of multimodal problems, it can well avoid falling into local optimum. Both optimization accuracy and speed benefit greatly from the effective hybrid mechanism of the two algorithms. In addition, when the dimension of the problem space expands or shrinks, or when the problem is gradually complicated and the amount of calculation increases suddenly, WOA-QT still maintains reliable optimization performance, especially with a satisfactory convergence speed. The high time efficiency proves the effectiveness of the DSS strategy. Functions ix 4 30,500 −1:28,1:28 ½ 0 Wireless Communications and Mobile Computing

Node Location in WSN
WSN, RFID, cloud computing, and wireless data communication, etc., together constitute the technical foundation of IoT. Among them, WSN is not only an important information collection subject of the perceptual layer of IoT but also a basic transmission channel of the network layer. WSN plays a vital role in how to realize the intelligent perception, transmission, processing, and application of data in IoT. There are many research topics in WSN, among which node location has always been a research hotspot. Because the monitoring data with unknown location information is usually meaningless, and the location problem is the basis and premise of most applications, the performance of the sensor node location algorithm directly affects its usability. The commonly used evaluation indicators include location accuracy, scale, node density, and power consumption. This paper uses the proposed WOA-QT algorithm to solve the node location problem in WSN. Specifically, it is to intelligentize the node location algorithm to further improve the positioning accuracy.
Although there are many node location algorithms, they can be classified into range-based and range-free. Range- Different location algorithms have their own advantages and disadvantages. The location algorithm used in this paper integrates RSSI ranging and weighted centroid positioning algorithms (WCL_RSSI), which can improve positioning accuracy to a certain extent. To meet the requirements of further reducing the positioning error, this paper uses the proposed WOA-QT algorithm to optimize WCL_RSSI.

RSSI Ranging Technology.
The principle of the RSSI ranging method is to convert the strength of the received wireless signal energy into the distance between the nodes, and then use it to estimate the location of the unknown node. Because no additional hardware is required, and the cost and power 30,500 −10, 10 ½ 0 7 Wireless Communications and Mobile Computing consumption are relatively low, the RSSI method is widely used, especially for large-scale WSN node location problems. However, environmental factors such as distance and obstacles will have a great impact on the transmission of wireless signals, resulting in severe attenuation of the signal's power strength. This paper selects the log-distance distribution model as the distance measurement model of wireless signal propagation path loss, as shown below: Assuming that the distance between the node to be located and the signal source is d, RSSIðdÞ indicates the signal strength received by the node; d 0 is the reference distance, generally 1m; γ is the path loss factor that reflects the influence of the environment on signal transmission. The more obstacles in the transmission path, the greater the value of γ; X σ is a random variable, obeying normal distribution: X σ~N ðμ, σ 2 Þ. By Equation (13), the distance d can be obtained: d = 10 ðRSSIðd0Þ−RSSIðdÞ+X σ /10γÞ .
There are K beacon nodes in the target area: S i ðx i , y i Þ, i = 1, 2, ⋯, K. Nðx, yÞ is the unknown node. If the distance between N and S i is too far, the signal power will be greatly attenuated, which will seriously affect the location accuracy.
Generally speaking, the unknown node and the beacon node are not directly connected, and there may be several intermediate nodes between the two. Therefore, it can be considered that RSSI starts from the beacon node S i and is finally transmitted to the unknown node N in a relay manner. The distance of the connection path between the two is recorded as D i . If M intermediate nodes are passed, then D i = ∑ M+1 l=1 d r , where d r can be obtained by Equation (13). In order to convert D i to the Euclidean distance ρ i between N and S i , this requires knowing the approximate proportional relationship between the two distances. Assume that the connection distance between two beacon nodes S i and S j is D i,j (can be obtained by RSSI ranging), and the Euclidean distance is We define α i as the path scale factor of the beacon node S i , as shown below:   Obviously, the distance ρ i can be obtained with the following formula:  10 Wireless Communications and Mobile Computing the unknown node and the three beacon nodes is recorded as (ρ 1 , ρ 2 , and ρ 3 ), which are used to construct the weight coefficient. The relevant formulas are as follows: S 1 ðx 1 , y 1 Þ, S 2 ðx 2 , y 2 Þ, and S 3 ðx 3 , y 3 Þ represent three beacon nodes, and the coordinate of the centroid of the triangle enclosed by them is the position of unknown nodes N l ðx l , y l Þ.
WCL_RSSI has the advantages of low computational complexity, simple implementation and high location accuracy. Moreover, the location process is less affected by the change of the transmission environment and does not require interaction between nodes [32].

Apply the Proposed WOA-QT Algorithm to WCL_RSSI.
This article uses WOA-QT to improve WCL_RSSI in order to obtain the node position with higher accuracy. In the two-dimensional plane, the solution of the WOA-QT corresponds to the candidate position coordinates of the unknown node, which is denoted as N l ðx, yÞ. The Euclidean distance between N l ðx, yÞ and the beacon node . N l ðx w , y w Þ represents the location of unknown node estimated by the WCL_RSSI. Similarly, the distance between N l ðx w , y w Þ and Obviously, there is a deviation between d o and d w . It should be noted that the connection path between the unknown node and the beacon node has a great influence on the location accuracy. The greater the number of hops, the smaller the positioning error tends to be. The weight of hops needs to be considered when

11
Wireless Communications and Mobile Computing measuring the distance error. Therefore, the evaluation function f ðx, yÞ is as follows: There are K beacon nodes. The hop number between the beacon node S i and the unknown node is recorded as hop i . Equation (18) expresses the optimization goal, that is, to minimize the root mean square error of the difference between the two distances.

Simulation Results.
Assume that in a two-dimensional area of 1000 m × 1000 m, 60 beacon nodes are deployed, and the positions of 240 unknown nodes are to be deter-mined. The communication radius of sensor node is 15 meters, and the maximum number of iterations of the algorithm is 400. Table 4 lists the average distance error between the unknown node position estimated by each algorithm and the true position. The simulation experiment involves five algorithms. Simulation results show that WCL_RSSI based on WOA-QT has the smallest error, and the positioning accuracy is improved obviously. In order to visualize the positioning error, Figure 4 marks the distance deviation between the estimated position of each unknown node and its true position.  In this paper, the optimization algorithm in AI is used to solve the node location problem in WSN which is the key technology of IoT. There are two optimization algorithms involved: WOA and QUATRE. WOA is derived from natural wisdom, and the QUARTRE has the beauty of mathematics. The two algorithms utilize each other and work closely together to form an organic whole. The overall optimization performance is much better than that when the two are separated. The potential of local exploitation is further tapped through the mutual fusion, so that the local stagnation is effectively avoided in the process of searching for the global optimal. Although algorithm hybridization will inevitably bring more calculations, but with the cooperation of the two algorithms and the DSS strategy, the time efficiency of the algorithm has not been affected, and even better in many cases. So the increase in complexity of this algorithm is worthwhile. With the help of optimization technology, the node location accuracy of WSN has been significantly improved. It can be said that a successful AIoT case with application value is realized.

Conclusion
The QUATRE algorithm has many variants. When combined with other algorithms, we can consider how to choose different variants adaptively [33]. In addition, the complexity caused by algorithm hybridization can be considered to use surrogate-assisted technology to ease [34,35]. In the field of WSN, there are many challenging problems that need to be overcome [36,37]. It can be combined with other AI technologies such as machine learning [38][39][40] to promote the birth of more application scenarios of AIoT.