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

Authors: Jeng-Shyang Pan; Fang Fan; Shu-Chuan Chu; Zhigang Du; Huiqi Zhao
Journal: Wireless Communications and Mobile Computing
 (2020)

---

## Abstract

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 algorithm WOA-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.


---

## Body

## 1. 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.


## 2. 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→=x1,x2,⋯,xn, 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).Three vectors appear in the algorithm:A→,C→ and D→. A→ and C→ are defined as follows:
(1)A→=a→∙2r→−1,C→=2r→where r→ is a random vector between 0,1. As the iteration progresses, a→ decreases linearly from 2 to 0. Therefore, A→∈−2,2, C→∈0,2. 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 ∙ means taking the absolute value.(1) Exploration: searching modeWOA’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:(2)D→=C→∙X→rand−X→t,X→t+1=X→rand−A→∙D→.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 A→≥1, Equation (2) will be used to update the solution vector.(2) ExploitationThe 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):
(3)D→=C→∙X∗→t−X→tX→t+1=X∗→t−A→∙D→X∗→t denotes the current optimal. When prob<0.5 and A→<1, the solution will be updated by the above formula.


#### 2.1.2. Bubble-Net Attacking Mode

Bubble-net attacking is the most distinctive hunting method of humpback whales. In addition to swimming around prey, whales also move along a spiral path. WOA creates a spiral equation to simulate through the distance, as shown in the following formula:(4)D′→=X∗→t−X→t,X→t+1=D′→∙ebl∙cos2πl+X∗→t.Here, the distance betweenX→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.


### 2.2. 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:(5)X←M⨂X+M¯⊗B.Suppose there areND-dimensional solution vectors Xi, which constitute a population matrix: X=X1,X2,⋯,Xi,⋯,XNT. 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).


#### 2.2.1. The Coevolutionary MatrixM

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 matrixMinitial is constructed, and then, through a series of transformations, the coevolutionary matrix M is obtained.There are three methods for constructingMinitial. The specific choice depends on the size relationship between the population size ps and the search space dimension D. If ps=D, Minitial is a D-dimensional binary lower triangular matrix, as shown in Equation (6). When ps>D, Minitial needs to be expanded. If ps=p∙D, Minitial 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). Next, M can be obtained after two steps of transformation of Minitial. First, the elements of each row in Minitial are randomly arranged. Then, the elements of each row vector remain unchanged while their positions in the matrix are randomly arranged. So we can get M, see
(6)Minitial=111⋯11⋯1~1111⋯⋯1⋯1=M.(7)Minitial=111⋯11⋯1111⋯11⋯1111⋯~11⋯11⋯1⋯111⋯1⋯11⋯111111=M.


#### 2.2.2. The Donor MatrixB

The donor matrixB dominates the way of evolution. Similar to the different mutation strategies in DE, there are many ways to generate B. The mode used here is called QUATRE/best/1, as shown in
(8)Bi,G=Xgbest,G+F∙Xr1,G−Xr2,G.Assume that the population matrix of theGth generation is XG=X1,G,X2,G,⋯,Xi,G,⋯,XN,GT, which consists of ND-dimensional candidate solutions Xi,G. Each Xi,G has an evolution guide vector Bi,G corresponding to it. Xgbest,G represents the best individual in the population. Xr1 and Xr2 are generated by randomly arranging the row vectors of XG. F∈0,1 is the scaling factor.


## 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→=x1,x2,⋯,xn, 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).Three vectors appear in the algorithm:A→,C→ and D→. A→ and C→ are defined as follows:
(1)A→=a→∙2r→−1,C→=2r→where r→ is a random vector between 0,1. As the iteration progresses, a→ decreases linearly from 2 to 0. Therefore, A→∈−2,2, C→∈0,2. 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 ∙ means taking the absolute value.(1) Exploration: searching modeWOA’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:(2)D→=C→∙X→rand−X→t,X→t+1=X→rand−A→∙D→.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 A→≥1, Equation (2) will be used to update the solution vector.(2) ExploitationThe 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):
(3)D→=C→∙X∗→t−X→tX→t+1=X∗→t−A→∙D→X∗→t denotes the current optimal. When prob<0.5 and A→<1, the solution will be updated by the above formula.


### 2.1.2. Bubble-Net Attacking Mode

Bubble-net attacking is the most distinctive hunting method of humpback whales. In addition to swimming around prey, whales also move along a spiral path. WOA creates a spiral equation to simulate through the distance, as shown in the following formula:(4)D′→=X∗→t−X→t,X→t+1=D′→∙ebl∙cos2πl+X∗→t.Here, the distance betweenX→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.


## 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):
(3)D→=C→∙X∗→t−X→tX→t+1=X∗→t−A→∙D→X∗→t denotes the current optimal. When prob<0.5 and A→<1, the solution will be updated by the above formula.


## 2.1.2. Bubble-Net Attacking Mode

Bubble-net attacking is the most distinctive hunting method of humpback whales. In addition to swimming around prey, whales also move along a spiral path. WOA creates a spiral equation to simulate through the distance, as shown in the following formula:(4)D′→=X∗→t−X→t,X→t+1=D′→∙ebl∙cos2πl+X∗→t.Here, the distance betweenX→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.


## 2.2. 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:(5)X←M⨂X+M¯⊗B.Suppose there areND-dimensional solution vectors Xi, which constitute a population matrix: X=X1,X2,⋯,Xi,⋯,XNT. 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).


### 2.2.1. The Coevolutionary MatrixM

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 matrixMinitial is constructed, and then, through a series of transformations, the coevolutionary matrix M is obtained.There are three methods for constructingMinitial. The specific choice depends on the size relationship between the population size ps and the search space dimension D. If ps=D, Minitial is a D-dimensional binary lower triangular matrix, as shown in Equation (6). When ps>D, Minitial needs to be expanded. If ps=p∙D, Minitial 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). Next, M can be obtained after two steps of transformation of Minitial. First, the elements of each row in Minitial are randomly arranged. Then, the elements of each row vector remain unchanged while their positions in the matrix are randomly arranged. So we can get M, see
(6)Minitial=111⋯11⋯1~1111⋯⋯1⋯1=M.(7)Minitial=111⋯11⋯1111⋯11⋯1111⋯~11⋯11⋯1⋯111⋯1⋯11⋯111111=M.


### 2.2.2. The Donor MatrixB

The donor matrixB dominates the way of evolution. Similar to the different mutation strategies in DE, there are many ways to generate B. The mode used here is called QUATRE/best/1, as shown in
(8)Bi,G=Xgbest,G+F∙Xr1,G−Xr2,G.Assume that the population matrix of theGth generation is XG=X1,G,X2,G,⋯,Xi,G,⋯,XN,GT, which consists of ND-dimensional candidate solutions Xi,G. Each Xi,G has an evolution guide vector Bi,G corresponding to it. Xgbest,G represents the best individual in the population. Xr1 and Xr2 are generated by randomly arranging the row vectors of XG. F∈0,1 is the scaling factor.


## 2.2.1. The Coevolutionary MatrixM

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 matrixMinitial is constructed, and then, through a series of transformations, the coevolutionary matrix M is obtained.There are three methods for constructingMinitial. The specific choice depends on the size relationship between the population size ps and the search space dimension D. If ps=D, Minitial is a D-dimensional binary lower triangular matrix, as shown in Equation (6). When ps>D, Minitial needs to be expanded. If ps=p∙D, Minitial 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). Next, M can be obtained after two steps of transformation of Minitial. First, the elements of each row in Minitial are randomly arranged. Then, the elements of each row vector remain unchanged while their positions in the matrix are randomly arranged. So we can get M, see
(6)Minitial=111⋯11⋯1~1111⋯⋯1⋯1=M.(7)Minitial=111⋯11⋯1111⋯11⋯1111⋯~11⋯11⋯1⋯111⋯1⋯11⋯111111=M.


## 2.2.2. The Donor MatrixB

The donor matrixB dominates the way of evolution. Similar to the different mutation strategies in DE, there are many ways to generate B. The mode used here is called QUATRE/best/1, as shown in
(8)Bi,G=Xgbest,G+F∙Xr1,G−Xr2,G.Assume that the population matrix of theGth generation is XG=X1,G,X2,G,⋯,Xi,G,⋯,XN,GT, which consists of ND-dimensional candidate solutions Xi,G. Each Xi,G has an evolution guide vector Bi,G corresponding to it. Xgbest,G represents the best individual in the population. Xr1 and Xr2 are generated by randomly arranging the row vectors of XG. F∈0,1 is the scaling factor.


## 3. 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 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 solutionX∗→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:
(9)XQ→t=M⨂X∗→t+M¯⊗B.D→=C→∙XQ→t−X→t.X→t+1=XQ→−A→∙D→.Here, the current optimal solutionX∗→t is processed by the QUATRE to get XQ→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:(10)XQ→t=M⨂X∗→t+M¯⊗B,D′→=XQ→t−X→t,X→t+1=D′→∙ebl∙cos2πl+XQ→t.XQ→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 Xgbest,G and two randomly selected solutions Xr1 and Xr2. Xgbest,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.


### 3.2. 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 spaceub_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.
(11)ubnew=ubnew+ubmax−ubnew∗tmaxiter,(12)lbnew=lbnew+lbmin−lbnew∗tmaxiter.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 lb_new. And the contraction speed is not too fast, which can effectively avoid local optimal stagnation.


### 3.3. Hybrid Algorithm WOA-QT

This section describes the optimization steps of WOA-QT. The pseudo code is shown in Pseudocode1.(1) Initialization: generate N individuals Xii=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 fXi. 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: whenprob<0.5andA≥1, use Equation ((2)) to update the solution. That is to select a random solutionXrandin the current search space (between the upper limitub_newand lower limitlb_new).(ii) Exploitation(A)
Whenprob<0.5 and A<1, use Equation (9) to update the solution. This is the WOA encircling mode embedded with QUATRE(B)
B. Whenprob≥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 fX∗. The optimization process ends here.Pseudocode 1: The pseudocode of the proposed WOA-QT.
Generate initial populationX containing N individuals Xii=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 matrixM (Eq. (6) or Eq. (7)).the donor matrixB (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.While (t < max_iter) and (not obtain the predefined function value).For each solution.Updatea, r, b, l, prob, M, B.If1 (prob <0.5).If2 (A<1).Update the position of the current solution using Eq. (9).Else if2 (A≥1).Select a random solutionXrand.Update the position of the current solution using Eq. (2).End if2.Else if1 (prob≥0.5).Update the position of the current solution using Eq. (10).End if1.End for.Check if any solution goes beyond the search space and amend it.Calculate the fitness value of each solution.UpdateX∗ if there is a better solution.t = t +1.Shrink the search space size using Eq. (11) and (12).End while.ReturnX∗


## 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 solutionX∗→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:
(9)XQ→t=M⨂X∗→t+M¯⊗B.D→=C→∙XQ→t−X→t.X→t+1=XQ→−A→∙D→.Here, the current optimal solutionX∗→t is processed by the QUATRE to get XQ→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:(10)XQ→t=M⨂X∗→t+M¯⊗B,D′→=XQ→t−X→t,X→t+1=D′→∙ebl∙cos2πl+XQ→t.XQ→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 Xgbest,G and two randomly selected solutions Xr1 and Xr2. Xgbest,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.


## 3.2. 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 spaceub_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.
(11)ubnew=ubnew+ubmax−ubnew∗tmaxiter,(12)lbnew=lbnew+lbmin−lbnew∗tmaxiter.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 lb_new. And the contraction speed is not too fast, which can effectively avoid local optimal stagnation.


## 3.3. Hybrid Algorithm WOA-QT

This section describes the optimization steps of WOA-QT. The pseudo code is shown in Pseudocode1.(1) Initialization: generate N individuals Xii=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 fXi. 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: whenprob<0.5andA≥1, use Equation ((2)) to update the solution. That is to select a random solutionXrandin the current search space (between the upper limitub_newand lower limitlb_new).(ii) Exploitation(A)
Whenprob<0.5 and A<1, use Equation (9) to update the solution. This is the WOA encircling mode embedded with QUATRE(B)
B. Whenprob≥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 fX∗. The optimization process ends here.Pseudocode 1: The pseudocode of the proposed WOA-QT.
Generate initial populationX containing N individuals Xii=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 matrixM (Eq. (6) or Eq. (7)).the donor matrixB (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.While (t < max_iter) and (not obtain the predefined function value).For each solution.Updatea, r, b, l, prob, M, B.If1 (prob <0.5).If2 (A<1).Update the position of the current solution using Eq. (9).Else if2 (A≥1).Select a random solutionXrand.Update the position of the current solution using Eq. (2).End if2.Else if1 (prob≥0.5).Update the position of the current solution using Eq. (10).End if1.End for.Check if any solution goes beyond the search space and amend it.Calculate the fitness value of each solution.UpdateX∗ if there is a better solution.t = t +1.Shrink the search space size using Eq. (11) and (12).End while.ReturnX∗


## 4. Experiment Results and Analysis

This part selects 30 benchmark functions for performance evaluation, as shown in Tables1, 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 dimensions. All the experiments were compared among WOA-QT, WOA, and QUATRE. Each algorithm runs independently 40 times. The specific experimental scheme is as follows.Table 1
Details of 10 unimodal functions.
FunctionsDIMENSIONRANGEf_minF1x=∑i=1nxi230,500100,1000F2x=∑i=1nixi230,500−10,100F3x=∑i=1nx+Πi+1n30,500−10,100F4x=∑i=1n∑j−1ixj230,500100,1000F5x=maxixi,iϵ1,m30,500100,1000F6x=∑i=1n−1100xx+1−xi2+xi−1230,500−30,300F7x=∑i=1n−1xi+0.5230,500100,1000F8x=∑i=1nix430,500−1.28,1.280F9x=∑i=1nix4+rand0,130,500−1.28,1.280F10x=∑i=1n∣xi2∣30,500−1,10Table 2
Details of 10 multimodal functions.
FunctionsDIMENSIONRANGEf_minF11x=1−cos2Π∑i=1nxi2+0.1∑i=1nxi230,500−100,1000F12x=∑i=1nxi2−10∗cos2πxi+1030,500−5.12,5.120F13x=−208exp−0.21m∑inxi2−exp1m∑i=1ncos2πxi+20+2.71830,500−32,320F14x=14000+∑i=1nxi2−Πi=1ncosxii+130,500−600,6000F15x=πn∗10∗sinπy1+∑i−1n−1yi−121+10∗sin2πyi+1yi=1+xi+14∗uzi,a,k,m=kxi−a,x>a0,−a<xi<ak−xi−a,x>a30,500−50,500F16x=∑i=1n∣xisinxi+0.1xi∣30,500−100,1000F17x=0.59+sin2∑i=1nxi2−0.51+0.0001∑i=1nx4230,500−100,1000F18x=∑i=1n0.1n−0.1∑i=1ncos5πxi−∑i=1nxi−π230,500−10,100F19x=∑i=1n−10.1nxi2+xx+120.25×1+sin250xi2+xx+12∧0.130,500−1,10F20x=∑i=1n106i−1n−1xi230,500−10,100Table 3
Details of 10 fixed-dimension complex functions.
FunctionsDIMENSIONRANGEf_minF21x=∑i=15i∗cosi+1x1+i∗∑i=15i∗cosi+1x2+i2−5.12,5.12−186.7309F22x=∑i=111ai−x1bi2+bix2bi2+bix3+x424−5,50.0003F23x=−1+cos12x12+x220.5x12+x22+22−5.12,5.12−1F24x=x2−5.14π2x12+5πx1−62+101−18πcosx1+102−5,50.398F25x=1+x1+x2+x32∗19−14x1+3x12−14x2+6x1x2+3x22×18−32x1+12x12+48x2−36x1x2+27x222−2,23F26x=−0.0001sinx1sinx2exp100−x12+x22π+10.12−10,10−2.0626F27x=−0.0001cosx1cosx2exp100−x12+x22π+10.12−10,10−2.0626F28x=−∑i=15X−aiX−aiT+ci−140,10−10.1532F29x=−∑i=17X−aiX−aiT+ci−140,10−10.4028F30x=−∑i=110X−aiX−aiT+ci−140,10−10.5363


### 4.1. 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. Figure1 shows the convergence curve of each function.Figure 1
The convergence curves of 30-dimensional functions (F1-F20).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.


### 4.2. 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 Figure2 for the function convergence curves.Figure 2
The convergence curves of 500-dimensional functions (F1-F20).


### 4.3. 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. Figure3 shows the function convergence curves obtained in this experiment.Figure 3
The convergence curves of fixed-dimension functions (F21-F30).


### 4.4. 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.


## 4.1. 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. Figure1 shows the convergence curve of each function.Figure 1
The convergence curves of 30-dimensional functions (F1-F20).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.


## 4.2. 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 Figure2 for the function convergence curves.Figure 2
The convergence curves of 500-dimensional functions (F1-F20).


## 4.3. 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. Figure3 shows the function convergence curves obtained in this experiment.Figure 3
The convergence curves of fixed-dimension functions (F21-F30).


## 4.4. 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.


## 5. 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-based location algorithm calculates the position of unknown nodes by measuring distance or angle information. Commonly used ranging technologies include Time of Arrival (TOA), Time Difference of Arrival (TDOA), Received Signal Strength of Indicator (RSSI), and Angle of Arrival (AOA). Range-free localization algorithm only determines the node position according to the connectivity of the network and other information without knowing the distance or angle. The commonly used methods are convex programming, DV-hop, centroid location algorithm, and so on.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.


### 5.1. 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 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:(13)RSSId=RSSId0−10γlgdd0+Xσ.Assuming that the distance between the node to be located and the signal source isd, RSSId indicates the signal strength received by the node; d0 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=10RSSId0−RSSId+Xσ/10γ.There areK beacon nodes in the target area: Sixi,yi,i=1,2,⋯,K. Nx,y is the unknown node. If the distance between N and Si 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 Si 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 Di. If M intermediate nodes are passed, then Di=∑l=1M+1dr, where dr can be obtained by Equation (13).In order to convertDi to the Euclidean distance ρi between N and Si, this requires knowing the approximate proportional relationship between the two distances. Assume that the connection distance between two beacon nodes Si and Sj is Di,j (can be obtained by RSSI ranging), and the Euclidean distance is
(14)di,j=xj−xi2+yj−yi2.We defineαi as the path scale factor of the beacon node Si, as shown below:
(15)αi=∑j=1,j≠iKDi,j/di,j.Obviously, the distanceρi can be obtained with the following formula:
(16)ρi=Di/αi.


### 5.2. Weighted Centroid Location Algorithm Based on RSSI (WCL_RSSI)

It is not hard to see, if only relying on RSSI ranging to locate, the accuracy is poor. Therefore, a weighted centroid location algorithm (WCL) based on RSSI has emerged. The ordinary centroid location algorithm considers that all beacon nodes have equal status. In fact, different beacon nodes have different influences on the location of unknown nodes. The WCL algorithm is to reflect the degree of influence of each beacon node on the position of the centroid (i.e., the unknown node) through the weight factor. The triangle centroid positioning algorithm is used here. The pairwise distance between 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:
(17)xl=x1/ρ1+ρ2+x2/ρ2+ρ3+x3/ρ1+ρ31/ρ1+ρ2+1/ρ2+ρ3+1/ρ1+ρ3,yl=y1/ρ1+ρ2+y2/ρ2+ρ3+y3/ρ1+ρ31/ρ1+ρ2+1/ρ2+ρ3+1/ρ1+ρ3.S1x1,y1, S2x2,y2, and S3x3,y3 represent three beacon nodes, and the coordinate of the centroid of the triangle enclosed by them is the position of unknown nodes Nlxl,yl.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].


### 5.3. 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 asNlx,y. The Euclidean distance between Nlx,y and the beacon node Sixi,yi is do=x−xi2+y−yi2. Nlxw,yw represents the location of unknown node estimated by the WCL_RSSI. Similarly, the distance between Nlxw,yw and Sixi,yi is dw=xw−xi2+yw−yi2. Obviously, there is a deviation between do and dw. 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 measuring the distance error. Therefore, the evaluation function fx,y is as follows:
(18)fx,y=min1K∑i=1Kdo−dwhopi2.There areK beacon nodes. The hop number between the beacon node Si and the unknown node is recorded as hopi. Equation (18) expresses the optimization goal, that is, to minimize the root mean square error of the difference between the two distances.


### 5.4. Simulation Results

Assume that in a two-dimensional area of1000m×1000m, 60 beacon nodes are deployed, and the positions of 240 unknown nodes are to be determined. 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.Table 4
The average distance error of each algorism.
WOA-QT(WCL_RSSI)PSO(WCL_RSSI)WOA(WCL_RSSI)QUATRE(WCL_RSSI)WCL_RSSI20.763223.31522.746522.633224.9505Figure 4
The comparison of location errors. (a) PSO and WOA-QT. (b) QUATRE and WOA-QT. (c) WOA and WOA-QT. (d) WCL based on RSSI and WOA-QT.
(a)(b)(c)(d)


## 5.1. 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 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:(13)RSSId=RSSId0−10γlgdd0+Xσ.Assuming that the distance between the node to be located and the signal source isd, RSSId indicates the signal strength received by the node; d0 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=10RSSId0−RSSId+Xσ/10γ.There areK beacon nodes in the target area: Sixi,yi,i=1,2,⋯,K. Nx,y is the unknown node. If the distance between N and Si 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 Si 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 Di. If M intermediate nodes are passed, then Di=∑l=1M+1dr, where dr can be obtained by Equation (13).In order to convertDi to the Euclidean distance ρi between N and Si, this requires knowing the approximate proportional relationship between the two distances. Assume that the connection distance between two beacon nodes Si and Sj is Di,j (can be obtained by RSSI ranging), and the Euclidean distance is
(14)di,j=xj−xi2+yj−yi2.We defineαi as the path scale factor of the beacon node Si, as shown below:
(15)αi=∑j=1,j≠iKDi,j/di,j.Obviously, the distanceρi can be obtained with the following formula:
(16)ρi=Di/αi.


## 5.2. Weighted Centroid Location Algorithm Based on RSSI (WCL_RSSI)

It is not hard to see, if only relying on RSSI ranging to locate, the accuracy is poor. Therefore, a weighted centroid location algorithm (WCL) based on RSSI has emerged. The ordinary centroid location algorithm considers that all beacon nodes have equal status. In fact, different beacon nodes have different influences on the location of unknown nodes. The WCL algorithm is to reflect the degree of influence of each beacon node on the position of the centroid (i.e., the unknown node) through the weight factor. The triangle centroid positioning algorithm is used here. The pairwise distance between 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:
(17)xl=x1/ρ1+ρ2+x2/ρ2+ρ3+x3/ρ1+ρ31/ρ1+ρ2+1/ρ2+ρ3+1/ρ1+ρ3,yl=y1/ρ1+ρ2+y2/ρ2+ρ3+y3/ρ1+ρ31/ρ1+ρ2+1/ρ2+ρ3+1/ρ1+ρ3.S1x1,y1, S2x2,y2, and S3x3,y3 represent three beacon nodes, and the coordinate of the centroid of the triangle enclosed by them is the position of unknown nodes Nlxl,yl.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].


## 5.3. 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 asNlx,y. The Euclidean distance between Nlx,y and the beacon node Sixi,yi is do=x−xi2+y−yi2. Nlxw,yw represents the location of unknown node estimated by the WCL_RSSI. Similarly, the distance between Nlxw,yw and Sixi,yi is dw=xw−xi2+yw−yi2. Obviously, there is a deviation between do and dw. 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 measuring the distance error. Therefore, the evaluation function fx,y is as follows:
(18)fx,y=min1K∑i=1Kdo−dwhopi2.There areK beacon nodes. The hop number between the beacon node Si and the unknown node is recorded as hopi. Equation (18) expresses the optimization goal, that is, to minimize the root mean square error of the difference between the two distances.


## 5.4. Simulation Results

Assume that in a two-dimensional area of1000m×1000m, 60 beacon nodes are deployed, and the positions of 240 unknown nodes are to be determined. 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.Table 4
The average distance error of each algorism.
WOA-QT(WCL_RSSI)PSO(WCL_RSSI)WOA(WCL_RSSI)QUATRE(WCL_RSSI)WCL_RSSI20.763223.31522.746522.633224.9505Figure 4
The comparison of location errors. (a) PSO and WOA-QT. (b) QUATRE and WOA-QT. (c) WOA and WOA-QT. (d) WCL based on RSSI and WOA-QT.
(a)(b)(c)(d)


## 6. Conclusion

AI and IoT are compatible and symbiotic, who are born to be the best partner. They have broken through the bottlenecks of their respective parallel developments, enabling high-frequency resonance and coordinated development.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.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–40] to promote the birth of more application scenarios of AIoT.



---

*Source: 8822651-2020-10-06.xml*