A Quantum Annealing Bat Algorithm for Node Localization in Wireless Sensor Networks

Node localization in two-dimensional (2D) and three-dimensional (3D) space for wireless sensor networks (WSNs) remains a hot research topic. To improve the localization accuracy and applicability, we first propose a quantum annealing bat algorithm (QABA) for node localization in WSNs. QABA incorporates quantum evolution and annealing strategy into the framework of the bat algorithm to improve local and global search capabilities, achieve search balance with the aid of tournament and natural selection, and finally converge to the best optimized value. Additionally, we use trilateral localization and geometric feature principles to design 2D (QABA-2D) and 3D (QABA-3D) node localization algorithms optimized with QABA, respectively. Simulation results show that, compared with other heuristic algorithms, the convergence speed and solution accuracy of QABA are greatly improved, with the highest average error of QABA-2D reduced by 90.35% and the lowest by 17.22%, and the highest average error of QABA-3D reduced by 75.26% and the lowest by 7.79%.


Introduction
WSNs are highly researched as an extension of the Internet to the physical environment in the Internet of Things [1]. WSNs are composed of a variety of small smart sensors that can collect, store, and transmit various environmental data according to different needs, facilitating more accurate monitoring of relevant dynamics [2].
In WSNs, only every node is accurately positioned, so that it can play a greater role [3]. Typically, only very few anchor nodes (ANs) in WSNs can be located by GPS or are artificially configured to determine their location, while the location of most unknown nodes (UNs) needs to be determined with the help of node location algorithms [4]. There are various algorithms used for node localization in WSNs, which are mainly classified into range-based localization algorithms and range-free localization algorithms based on whether ranging is required, among which range-based node localization algorithms include received signal strength indicator (RSSI) [5] and time of arrival (TOA) [6]. The range-free node-localization-based algorithms include distance vector hop (DV-Hop) [7] and centroid [8]. Each method has its advantages and disadvantages, and all problems cannot be solved by one fixed method. Therefore, comprehensive consideration of factors such as technical difficulty and environment is an important reference index for selecting appropriate methods.
Among the range-free node-localization-based algorithms, DV-Hop and Centroid algorithms are research hotspots all the time due to their simple structure and easy implementation. DV-Hop uses the number of hops between UNs and ANs and the average distance of each hop segment to estimate the location of UNs, which has the advantage of large localization coverage and less additional hardware [9]. Since ranging is not required, the positioning accuracy of such algorithms is easily affected by the jump range error.
In order to improve the positioning accuracy, reference [9] changed the communication power of nodes and proposed a method of taking the average distance between an unknown node and three adjacent nodes as the reference value of hop distance. Weighted DV-Hop [10] proposed a method of adding the best weighting function to the hop number distance conversion formula, while the centroid algorithm uses the center of mass of an unknown node in a region to predict the position of the node. This method is simple to implement, but the localization accuracy is easily affected by the node density of the region. Therefore, the trilateral center-of-mass localization algorithm [11] used a RSSI-based weighting compensation scheme to eliminate ranging interference to change this situation. The 3D-weighted centroid localization algorithm (3D-WCL) [12], on the contrary, utilized the degree of influence of ANs on UNs to change the weighting factor, and then introduced the weighting factor into the centroid coordinates to reduce this influence.
In the ranging-based node localization algorithm, the localization accuracy is much higher than that of the ranging-free-based localization algorithm under the same conditions because the distance between UNs and ANs is accurately calculated. Therefore, RSSIbased and TOA-based localization algorithms are more widely used in the localization of WSNs, and the localization results are higher. Among them, RSSI-based positioning algorithms have received much attention from scholars because of their excellent performance with no additional hardware devices, low cost, low energy consumption, and easy implementation [13]. Moreover, they have been successfully applied in smart agriculture [14,15], power systems [16], smart buildings [17], military fields [18], and environmental monitoring [19][20][21][22].
Although RSSI-based positioning algorithms have structural and cost advantages under ideal conditions, their positioning accuracy are easily affected and significantly degraded by ranging errors in environments with high interference [23]. However, it is not only the anisotropic noise in the signal path that has an impact on the localization accuracy [24], but also the too small communication radius and sparse anchor nodes are the main causes. Therefore, to further improve the performance of node localization algorithms for WSNs, various heuristic algorithms with high adaptive capability and simple structure, as well as computational efficiency, are improved and are successfully used for node localization in WSNs [25].
In this paper, we propose a quantum annealing bat algorithm (QABA) for node localization in WSNs. The bat algorithm is used as a framework for QABA, and quantum evolutionary strategies and simulated annealing evolutionary mechanisms are combined to help improve the local and global search performance. Then, QABA achieves global and local search equilibrium with the help of tournament and natural selection convergence strategies, and continuously approaches the optimized value. Meanwhile, the RSSI-based 2D and 3D localization models and corresponding algorithms are developed respectively with the quantum annealing bat algorithm as the optimization core. Finally, the performance of the proposed algorithm is tested using 22 test functions and 2D and 3D WSNs node localization problems. The main contributions of this paper are as follows.

•
A quantum annealing bat algorithm that incorporates quantum evolutionary strategies and simulated degenerate evolutionary mechanisms is proposed as a framework for the bat algorithm.

•
The convergent evolutionary strategies of tournament and natural selection are used to approach the optimum to balance the local and global search mechanisms, and QABA's performance is verified with 22 basis test functions. • A 2D localization model and a localization algorithm are developed, and the performance of the algorithm is verified by node localization problems. • A 3D localization model and localization algorithm are developed, and the performance of the algorithm is verified by node localization problems.
The rest of this paper is distributed as follows: Section 2 describes the node localization algorithm for WSNs combined with the heuristic algorithm, as well as the source bat algorithm and its improvement strategy. Section 3 describes our proposed improved algorithm and the related pseudo-code. Section 4 simulates QABA in 22 test functions and 2D and 3D WSNs and analyzes the results. Section 5 summarizes the whole paper and gives future expectations.

Related Works
The node localization algorithm of WSNs combined with a heuristic algorithm has better localization performance in an interference environment, which is a more mainstream research direction at present. The heuristic algorithm is simple in structure and highly portable, and can be used for solving complex problems with multiple models. Especially in the node localization of WSNs, traditional localization algorithms are gradually being replaced by localization algorithms incorporating heuristic algorithms. Among them, the localization algorithms can be classified into 2D localization algorithms and 3D localization algorithms, according to the model structure. Due to the difference in spatial dimensions, they also differ in the difficulty of implementation.
The 2D localization algorithm needs to consider only two dimensions of the optimization search problem, and the fitness function and structure are simpler and more efficient than the 3D localization algorithm. In terms of specific algorithms, in the hybrid optimized localization algorithm (WOA-QT) [26], the co-evolutionary capability of the quasi-affine transform evolutionary algorithm (QUATRE) was fused with the whale optimization algorithm (WOA) to improve localization accuracy, but there was still the problem of falling into local optima. In the particle swarm optimization-based localization algorithm (IDE-NSL-AWSN) [23], ANs were grouped and cooperated with each other to increase the density of ANs, and then the particle swarm optimization algorithm (PSO) was used for localization to improve its localization accuracy and global search capability, but it still suffers from a lengthy structure and increased cost. While the Gaussian-modified RSSI algorithm and the improved whale optimization algorithm were used in the improved whale optimized localization algorithm (IWOA) [27] to reduce the ranging error and perform search localization, which improved the population diversity and node localization accuracy, there was still the problem of falling into local optimum. In addition, the hybrid gray wolf and firefly localization algorithm (GWO-FA) [28] used the concept of a fuzzy logic system to design a distance-free technique with an irregularity of 0.01 to improve the density of ANs, and it combined with GWO-FA to improve localization accuracy; yet, there is still room for improvement in optimizing the speed and accuracy. From the experimental results, the research focus of the above localization algorithm is mainly on how to improve localization accuracy, thus consuming too much energy. However, the firefly optimized localization algorithm (FA) [29], the K-value common line and gray wolf optimized localization algorithm (DCK-GWO) [30], the quantum optimized localization algorithm (QA) [31], and the anti-barrier hybrid localization algorithm (D-PSO and D-C) [32] have been studied in terms of energy consumption and are able to save more energy while obtaining higher accuracy.
The error tolerance of 3D localization algorithms is significantly better than that of 2D localization algorithms in real environments and operating conditions [33]. 3D localization algorithms are also classified as range-based [34] and range-free-based [35][36][37], but the models of localization algorithms are very different. The least squares method (LSM) [38] has advantages in algebraic operations, hence LSM is more used in 3D localization, but its susceptibility to singular matrices leads to the poor accuracy of the algorithm [39]. In contrast, among the 3D node localization algorithms using heuristics, the rotating black hole localization algorithm (RBH) [40], the large-scale robust localization algorithm (MHL-M) [41], and the motion target node localization algorithm [42] have higher adaptability, and their localization performance has been demonstrated in the respective literature. Although many algorithms show better localization performance in a single dimension, they are not validated in both 2D and 3D space at the same time and are not universally applicable.
The above algorithms have been improved by different evolutionary mechanisms, but the research on local search is ignored. Using appropriate local search methods in heuristic algorithms can improve the accuracy and success rate of the algorithms. The hybrid genetic algorithm (HMA) [43] combined with the Memtic algorithm with local search strategy to improve the local exploration capability of the algorithm and obtained higher accuracy in solving the node siting problem. The harmonic search-local search algorithm (HS-LS) [44] proposed a connectivity-based local search method and successfully combined with the Harmonic Search algorithm (HS) to alleviate the problem of sparse network deployment and reduced localization error in WSNs. This shows that the appropriate local search method is very important to improve the solution and positioning ability of the algorithm, and the balance between global search and local search will further strengthen this advantage, which will also guide the research direction of our work.
We introduce the advantages and disadvantages of combining a heuristic algorithm with WSNs from the perspective of improvement strategy and application. Besides the above algorithms, there are many heuristic algorithms with excellent performance waiting to be discovered. One of them is the bat algorithm (BA), with simple structure and high accuracy. BA is a new meta-heuristic algorithm proposed in 2010 by Yang [45], a scholar at the University of Cambridge, inspired by the predatory behavior of bats using acoustic echolocation. The solution success rate of BA is improved by continuously changing the pulse generation and loudness. When the loudness is large and the pulse generation rate is small, it is good for global search, while when the loudness is small and the pulse generation rate is large, it is good for local search. Similar to the same type of particle swarm algorithm (PSO) [46], genetic algorithm (GA) [47], differential evolution algorithm (DE) [48], sine cosine algorithm (SCA) [49], and other heuristics, BA still suffers from low convergence accuracy and the tendency to fall into local optimum when dealing with complex function problems with multiple constraints. Therefore, schemes such as improved operators [50], increased weights [51], and structural reorganization [52] are used by many scholars to improve the performance of BA, with desirable results. In addition, due to its few parameters and strong applicability [53], BA has been successfully used in image recognition [54], vehicle path planning [55][56][57], and wireless sensor networks [58]. The main structure model of the source bat algorithm is as follows.
where f max and f min denote the maximum and minimum values of frequency; β ∈ [0, 1]. During the search process, as the loudness of its acoustic wave A i and the pulse generation rate r i are adjusted, the position equation of BA is updated as follows.
where X new is the new bat position, X old is the global optimized individual position, ε ∈ [0, 1], and A t is the average loudness of the population of the same generation. The loudness A i and the pulse rate r i of BA are updated by the following equations.
where the attenuation coefficient of loudness is α ∈ [0, 1], and the enhancement coefficient of acoustic frequency is γ > 0.

Our Proposed QABA Scheme
Our proposed quantum annealing bat algorithm mainly takes the bat algorithm as the framework, fuses the simulated annealing algorithm and quantum evolution strategy to improve the search capability, and keeps approaching the optimized solution under the guidance of the convergence mechanism of tournament and natural selection. In this section, we focus on the update mechanism and implementation steps of the improved algorithm, as well as the implementation steps of the two-dimensional node localization algorithm and three-dimensional node localization algorithm incorporating the improved algorithm.
3.1. Improved QABA 3.1.1. Quantum Evolution Strategy The quantum evolutionary strategy is an approach to quantum chromosome variation that has significant advantages in convergence and merit seeking of high-dimensional functions [59,60]. The evolutionary strategy of most standard algorithms involves unpredictable variation with the number of iterations, and such evolutionary variation methods often require large population sizes and high population diversity. However, the direction of quantum evolutionary variation can be guided by using the current optimized and local optimized values to distribute the subgenerational population around the optimized individuals, thus allowing the convergence speed and the accuracy of the algorithm to be effectively improved. The quantum evolution equation is as follows.
where P is the guiding quantum chromosome; λ is the scaling factor; Q mean is the mean value of the current population position; Q best and G best are the local optimal individual position and the global optimal individual position, respectively; T is the maximum number of iterations; and µ 1 , µ 2 , δ ∈ [0, 1], N is the population size.

Metropolis Sampling Guidelines
The Metropolis sampling criterion is a key part of the Simulated Annealing Algorithm (SAA) that helps the SAA to direct the population that wanders randomly in space toward the optimal value, thus improving the solution efficiency of the SAA [61,62]. The principle of the criterion is that when the optimal solution is received, the poor solution can also be accepted with a certain probability, so as to increase the diversity of solutions and improve the solution efficiency.

Assisted Convergence Evolutionary Strategy
Although the above evolutionary strategy has a greater advantage in population convergence evolution, it is deficient in the balance between local and global search optimization after population mutation evolution. In order to make the algorithm more coherent in the overall search for optimization and improve the solution efficiency, the population after mutation is assisted to converge. In terms of local and global search balance, a dynamic weight that can dynamically adjust the search range with the iteration and annealing process is added to the speed update formula of BA, which will effectively improve the convergence performance of the algorithm. Larger inertia weights can enhance the global search capability, and smaller inertia weights can enhance the local search capability of the algorithm [63]. The dynamic weight and speed update formula is as follows.
Sensors 2023, 23, 782 where n is a constant, i is the current number of bats, t is the current number of iterations, T is the total number of iterations, ω is the adaptive dynamic weight factor, and X * is the global optimal bat position.
In the assisted convergent evolution scheme, improved tournament and natural selection mechanisms are used to improve the ability to jump out of the local optimum. The traditional tournament selection is to randomly select a number of offspring individuals from the current optimized local position each time, then rank the fitness values of the selected offspring individuals and take the best value of the fitness value into the offspring population. We improve it by randomly selecting several elements of child individuals each time, with the population size as the boundary and the first column of the population as the target, and then recombining these elements into several new individuals. The specific principle is shown in Figure 1.
ity of the algorithm [63]. The dynamic weight and speed update formula is as follows.
where n is a constant, i is the current number of bats, t is the current number of iter ations, T is the total number of iterations, ω is the adaptive dynamic weight factor, and X * is the global optimal bat position.
In the assisted convergent evolution scheme, improved tournament and natural se lection mechanisms are used to improve the ability to jump out of the local optimum. The traditional tournament selection is to randomly select a number of offspring individuals from the current optimized local position each time, then rank the fitness values of the selected offspring individuals and take the best value of the fitness value into the offspring population. We improve it by randomly selecting several elements of child individual each time, with the population size as the boundary and the first column of the population as the target, and then recombining these elements into several new individuals. The spe cific principle is shown in Figure 1. The principle of the natural selection strategy is that during an iterative update, the resulting current locally optimized solution is ranked and divided equally into two. The better half of the solution is retained, while the position of the worse half is replaced with the position of the better half, thus forming a new population. An improved solution is to set up a comparison mechanism, where a smaller probability p is introduced to randomly The principle of the natural selection strategy is that during an iterative update, the resulting current locally optimized solution is ranked and divided equally into two. The better half of the solution is retained, while the position of the worse half is replaced with the position of the better half, thus forming a new population. An improved solution is to set up a comparison mechanism, where a smaller probability p is introduced to randomly accept the worse solution when selecting the offspring population. In this way, the diversity of the population is better preserved, and the effect of the worse solution on the convergence speed and accuracy of the algorithm is eliminated, and the local performance of the algorithm in finding the best is improved. Finally, the pseudo-code of QABA is shown in Algorithm 1.

Two-Dimensional Spatial Node Localization Algorithm
In RSSI-based localization algorithms, the position of UNs can be estimated from the received signal strength [64]. The trilateral localization algorithm is a commonly used node localization algorithm, which implements the basic principle of localization as follows: three ANs are located as P 1 (x 1 , y 1 ), P 2 (x 2 , y 2 ), and P 3 (x 3 , y 3 ) if there exists an unknown node located as Q(x, y) and their distances are known as d 1 , d 2 , and d 3 . Then, the coordinate positions of the three ANs and the corresponding communication radius are used as the center and radius to draw three circles respectively, and their only intersection point is the unknown node position. The specific principle is shown in Figure 2.
From the principle of the classical trilateral localization algorithm, it is known that at least three ANs are needed to achieve the localization of UNs. When the ANs are closer to the UNs, the more they are and the larger the radius, the relatively higher the positioning accuracy is. Algorithm 1: Pseudo-code for the QABA algorithm Input: A, r, f, dimensionality D, α, γ, population size N, gen, initial temperature T, temperature decay coefficient α1. Output: Global optimal position bestX, global optimal fitness value bestY. 1: Distribute the population X, calculate the fitness value Y, and determine bestX and bestY. 2: for t = 1:gen 3: Update X using tournaments and natural selection, and update bestX and bestY. 4: for i = N 5: Update the population according to Equations (1), (3), (12) and (13) and determine the local optimal position pbesX0 and the fitness value pbestY0. 6: Update X with a quantum evolutionary strategy and determine pbestX1 and pbestY1. 7: If pbestY0 < pbestY1 8: Update pbestX and pbestY by taking the smaller one. 9: end if 10: Update pbestX and pbestY with the Metropolis criterion. 11: if pbestX <= Y(i) && rand (0,1) < A(i) 12: Update X(i), Y(i), A(i) and r(i  From the principle of the classical trilateral localization algorithm, it is known that at least three ANs are needed to achieve the localization of UNs. When the ANs are closer to the UNs, the more they are and the larger the radius, the relatively higher the positioning accuracy is.
A suitable and accurate fitness function can guide the search direction of the BA and improve the efficiency of the solution [65]. The fitness function of this model is formulated as follows: where m is the number of ANs involved in localization and 3 m ≥ . ( , ) x y is the location of UNs, ( , ) i i x y is the location of the ith anchor node, and ˆi d is the distance estimate of ANs and UNs. The error between the UNs position and the predicted position is an important indicator of the localization performance of the algorithm. To ensure the authority of the overall localization error, we take the mean value of k errors as the final error. The error equation of the model follows. A suitable and accurate fitness function can guide the search direction of the BA and improve the efficiency of the solution [65]. The fitness function of this model is formulated as follows: where m is the number of ANs involved in localization and m ≥ 3. (x, y) is the location of UNs, (x i , y i ) is the location of the ith anchor node, andd i is the distance estimate of ANs and UNs. The error between the UNs position and the predicted position is an important indicator of the localization performance of the algorithm. To ensure the authority of the overall localization error, we take the mean value of k errors as the final error. The error equation of the model follows. where k is the number of UNs, (x i , y i ) is the actual location of the ith unknown node, and (x i ,ŷ i ) is the estimated location of the ith unknown node. To improve the distance measurement accuracy between UNs and ANs, the average value of M measurements after removing the extreme values is taken as the reference value of the distance. However, due to the limited energy of the sensor nodes themselves, energy will be excessively consumed if each node transmits too much data continuously. The following experiments were done to determine the value of M each time, while satisfying the accuracy. The algorithm parameters were set as follows: noise variance was 0.5, the number of ANs was 18, the number of UNs was 100, and the node radius was 30. The average of 30 consecutive runs of the algorithm at each M value was taken as the error reference value. The values are taken as shown in Figure 3.  According to the localization error curves of the different number of measurements in Figure 3, we can see that the optimal localization error of the algorithm has been approached at the number of 150; thus, we choose the number of 150 for each measurement. In addition, there is the problem that the localization error increases when the number of measurements increases in Figure 3. This is because the presence of too few anchor nodes near the unknown nodes increases the localization error, and the noise we add in each experiment also increases the localization error, while the same phenomenon can occur if our QABA runs unstably.
The 2D spatial localization algorithm is more widely used and has the advantages of easy implementation in the local area and high localization accuracy in practical applications. According to the 2D spatial localization model, we give the pseudo-code of the 2D spatial node localization algorithm with QABA as the core operation. Pseudo-code of QABA-2D is shown in Algorithm 2.  (14) and (15), and obtain the minimum error. According to the localization error curves of the different number of measurements in Figure 3, we can see that the optimal localization error of the algorithm has been approached at the number of 150; thus, we choose the number of 150 for each measurement. In addition, there is the problem that the localization error increases when the number of measurements increases in Figure 3. This is because the presence of too few anchor nodes near the unknown nodes increases the localization error, and the noise we add in each experiment also increases the localization error, while the same phenomenon can occur if our QABA runs unstably.

9: end for
The 2D spatial localization algorithm is more widely used and has the advantages of easy implementation in the local area and high localization accuracy in practical applications. According to the 2D spatial localization model, we give the pseudo-code of the 2D spatial node localization algorithm with QABA as the core operation. Pseudo-code of QABA-2D is shown in Algorithm 2.  (14) and (15), and obtain the minimum error. 9: end for

Three-Dimensional Spatial Node Localization Algorithm
The principle of node localization in 3D space can be described as follows: a known unknown node O(x, y, z) and any three non-coincident ANs A(x 1 , y 1 , z 1 ), B(x 2 , y 2 , z 2 ), and C(x 3 , y 3 , z 3 ) in space can form a spatial tetrahedron with six sides of lengths a, b, c, d, e, f . Figure 4 shows the spatial position of UNs in relation to ANs, where h is the height of the spatial tetrahedron and O (x , y , z ) is the vertical foot of the height of the tetrahedron.  First, the area S of the base of the tetrahedron is found using Heron's formula, as follows.
2 d e f p + + = (17) where S is the area of the tetrahedron base ∆ abc ; d , e , f are the three sides of the base; and P is a component of Herren's formula. The volume V of the tetrahedron is then solved using Euler's tetrahedron formula, as follows.
where V 2 V is the square of the volume of the tetrahedron derived from Euler's tetrahedron formula; a D , b D , and c D are the components of Euler's tetrahedron formula; and the letters a , b , c , d , e , f are the six side lengths of the tetrahedron. Next, the height h of the tetrahedron can be found from the formula for the volume of the tetrahedron, as follows. First, the area S of the base of the tetrahedron is found using Heron's formula, as follows.
where S is the area of the tetrahedron base ∆abc; d, e, f are the three sides of the base; and P is a component of Herren's formula. The volume V of the tetrahedron is then solved using Euler's tetrahedron formula, as follows.
where V V 2 is the square of the volume of the tetrahedron derived from Euler's tetrahedron formula; D a , D b , and D c are the components of Euler's tetrahedron formula; and the letters a, b, c, d, e, f are the six side lengths of the tetrahedron. Next, the height h of the tetrahedron can be found from the formula for the volume of the tetrahedron, as follows.
where h is the height of the tetrahedron, V is the volume of the tetrahedron, and S is the base area of the tetrahedron. The coordinates of the vertical projection O point of the unknown node above the plane H can be found using the trilateral localization algorithm. The position of the point O on the plane H is shown in Figure 5, where L = {l 1 , l 2 , l 3 } is the distance from the O point to the three ANs.
where h is the height of the tetrahedron, V is the volume of the tetrahedron, and S is the base area of the tetrahedron.
The coordinates of the vertical projection O′ point of the unknown node above the plane H can be found using the trilateral localization algorithm. The position of the point O′ on the plane H is shown in Figure 5  We propose the fitness function as follows.
where n is the number of ANs involved in localization.
The z-value of UNs is susceptible to accuracy deviations due to the height h of the spatial tetrahedron. Therefore, from the principle shown in Figure 3, the height h of the tetrahedron is updated using the Pythagorean theorem, as follows.
is the distance from UNs to ANs and ĥ is the average value of h .
Finally, the coordinates of UNs are updated as follows.
, , where z′ is the value of the z-axis of the vertical projection of UNs on the plane H. The error formula we propose to measure the performance of the algorithm is as follows.
where ( , , ) x y z * * * is the real coordinate of Uns. The 3D positioning algorithm is closer to the real situation and has a higher degree of confidence in the positioning effect. We give the pseudo-code of the 3D spatial node localization algorithm using QABA as the core operation according to the 3D spatial localization algorithm model. Pseudo-code of QABA-3D is shown in Algorithm 3. We propose the fitness function as follows.
where n is the number of ANs involved in localization.
The z-value of UNs is susceptible to accuracy deviations due to the height h of the spatial tetrahedron. Therefore, from the principle shown in Figure 3, the height h of the tetrahedron is updated using the Pythagorean theorem, as follows.
where R = {a, b, c} is the distance from UNs to ANs andĥ is the average value of h. Finally, the coordinates of UNs are updated as follows.
x = x, y, z +ĥ (25) where z is the value of the z-axis of the vertical projection of UNs on the plane H. The error formula we propose to measure the performance of the algorithm is as follows.
where (x * , y * , z * ) is the real coordinate of Uns. The 3D positioning algorithm is closer to the real situation and has a higher degree of confidence in the positioning effect. We give the pseudo-code of the 3D spatial node localization algorithm using QABA as the core operation according to the 3D spatial localization algorithm model. Pseudo-code of QABA-3D is shown in Algorithm 3. Calculate the distance dua between UNs and all ANs, and select the three smallest ANs.

5:
Calculate the area of the triangle Sabc according to Equations (16) and (17). 6: Calculate the volume Vabc of the space tetrahedron according to Equations (18)-(21). 7: Calculate the height dh of the tetrahedron according to Equation (22). 8: If the three anchor nodes are not co-linear, jump out of the loop. 9: end while 10: Add noise interference to the high dh of the tetrahedron. 11: Use the Pythagorean theorem to find the distance from the vertical foot O' to the three ANs. 12: Use QABA to solve Equations (23) and (26). 13: Correct the position of UNs with Equations (24) and (25). 14: Update the positioning error again. 15: end for

Test Functions Simulation Results and Analysis
We selected 22 standard Benchmark test functions [66,67] to verify the computational performance of the QABA algorithm. In order to make the selected test functions representative to fully test the performance of QABA, these functions have the following characteristics. Functions F1-10 are unimodal functions that can fully test the ability of QABA to converge to the global optimum; Functions F11-18 are multimodal functions that can verify the ability of QABA to jump out of the local optimum; Functions F19-22 are fixed dimensional functions that can test the ability of QABA to solve for a specific value in a fixed dimension. The dimensionality and optimal values of the functions are shown in Table 1, and information such as the specific formula of the functions can be found in the literature [66,67]. To further demonstrate the superiority of QABA, its operational results were compared with the Improved Quantum Annealing Bat Algorithm (IQBA) [68], Group Evolution Hybrid Bat Algorithm (LMBA) [69], Bat Differential Hybrid Algorithm (BADE) [70], Adaptive Weighted Mean Particle Swarm Algorithm (MAWPSO) [71], Differential Evolution Algorithm (DE) [48], Sine Cosine Algorithm (SCA) [49], and Bat Algorithm (BA) [45], under the same conditions. Each function is run 30 times consecutively in the experiment, and the optimized value (OV), average value (AV), and standard deviation (SD) are selected to verify the algorithm performance. The population size of QABA is 30, the maximum number of iterations is 200, the initial temperature T0 = 3000, the loudness is 0.9, the frequency range is [−1,1], the temperature decay coefficient and the decay coefficient of loudness are 0.9, and the enhancement coefficient of pulse occurrence is 0.6. The environment in which the algorithm runs is Matlab R2016b. The population size and maximum number of iterations of the other algorithms are the same as those of this paper, and other parameters are shown in the respective original papers. The symbols '+', '−', and '=' in Tables 2 and 3 indicate that the other algorithms have 'better results', 'worse results', or 'similar results' than/as QABA, respectively.         As shown in Table 2, QABA converged to near the minimum for all 22 tested functions, and 12 functions converged to the theoretical optimum. In addition, 13 functions had better results compared to IQBA and LMBA, and 9 functions had similar results. Compared with BADE, 14 functions had better results, and 8 functions had similar results. Compared with MAWPSO, there were 12 functions with better results and 10 functions with similar results. Compared with DE and BA, there were 15 functions with better results and 7 functions with similar results. Compared with SCA, there were 16 functions with better results and 6 functions with similar results.
In Table 3, the mean and standard deviation of 8 algorithms in 22 functions show that our proposed QABA had a strong advantage in terms of finding accuracy. Among them, QABA converged to the theoretical optimum in the mean value of 5 out of 10 unimodal functions. Eight functions performed better than IQBA, LMBA, BADE, MAWPSO, DE, SCA, and BA in the test; just two functions performed similarly to DE in the search for the optimized value; and one function performed similarly to the other six algorithms.
Among the eight multimodal functions, QABA converged to the theoretical optimum in two functions. Among them, four functions had similar solving performance and four functions had better find ability compared to IQBA; three functions had similar solving ability and five functions had better finding ability compared to MAWPSO; and only seven functions had better solve performance and one function had similar solving ability compared to LMBA, BADE, DE, SCA, and BA.
Among the four fixed-dimensional functions, QABA had better performance in finding the optimized performance for two functions and similar solving ability for two functions compared with IQBA. Compared with LMBA and BADE, both had higher computing performance for only one function and similar computing ability for three functions. Compared with the other five algorithms, the solving performance was better for all four functions.
The above results demonstrate that the algorithm structure of QABA, with BA as the framework and incorporating quantum evolution and annealing convergence strategies, has a great advantage in the optimization of high-dimensional functions. It also shows that the quantum annealing strategy can substantially improve the algorithm's optimization-seeking accuracy and population diversity, and the tournament-and natural selection-assisted convergence strategies can also effectively regulate the local and global search balance problems. However, the population diversity variation mechanism of QABA still needs to be improved when solving negative value functions, especially fixed dimensional functions with large peak variations.
To better demonstrate the results of the above analysis, the convergence curves of the 8 algorithms in 22 functions are plotted in Figures 6-8. Due to the high convergence accuracy (10 −100 or more) of our proposed QABA and other algorithms, the conventional linear curve plots can no longer distinguish the convergence speed and accuracy of the eight algorithms. We use the linear type (y = k x, where the slope k is negative) in the 22 functions in Figures 6-8 only in functions f10, f18, f20-22. When the curve is steeper, it means that the smaller the value of y corresponding to the X-axis in the curve, the better the accuracy and convergence speed of the algorithm. The Y-axis coordinates of the remaining 17 functions are presented in logarithmic form (y = loga x ), and the Y-axis still varies linearly with the X-axis.
As can be seen in Figure 6, the fitness values in Figure 6a decrease as the number of iterations increases. Among them, QABA has converged to 10 −80 at the number of iterations close to 25, while the other algorithms only converge to around 10 −10 . Moreover, it is known from the nature of the logarithmic function that its independent variable (natural numbers) takes values in the range of (0,+∞), where the bottom number of the logarithmic function is 10 and the natural numbers are the fitness values. Since the natural numbers cannot be taken to 0 in the logarithmic functions, QABA stops changing with the number of iterations after converging to 0. This also explains why QABA stops changing when it iterates around 25 in Figure 6a, while other functions can be shown in full. Similarly, in Figure 6b-f, there are cases where QABA is already much more accurate than the other algorithms when the number of iterations is less than 200. Moreover, in Figure 6a-f, the fitness value of QABA is always the smallest when the number of iterations is the same, thus further indicating that the convergence speed and solution accuracy of QABA are significantly better than other algorithms.
As can be seen from Figure 7, QABA has converged to 0 in Figure 7c,e,g,h when the number of iterations is less than 50, and it always has the smallest fitness value in the other functions, as well, indicating that QABA has a higher convergence speed and accuracy than the other algorithms.
Sensors 2023, 23, x FOR PEER REVIEW 1 fitness value of QABA is always the smallest when the number of iterations is the thus further indicating that the convergence speed and solution accuracy of QAB significantly better than other algorithms.  It can be seen from Figure 8 that the fitness values of QABA and the other algorithms decrease with the increase of the number of iterations. Among them, QABA has a worse average accuracy than DE, except in function Figure 8d. Yet, in other functions, its fitness value is always no greater than other algorithms in the same number of iterations, thus indicating that QABA has a higher convergence speed and accuracy.

Simulation Analysis of 2D Spatial Positioning in WSNs
In the previous chapter, the advantages of QABA in terms of finding accuracy and convergence speed were demonstrated by the operation of standard functions. To further verify the localization performance of QABA in real 2D space, the actual localization results of the QABA and BA algorithms were first compared. Then, the localization errors of QABA-2D were compared with IQBA-2D, LMBA-2D, BADE-2D, MAWPSO-2D, DE-2D, SCA-2D, and BA-2D after different communication radii, a different number of ANs, and adding different noise variances. The 8 algorithms of the 2D localization algorithm were simulated in a 100 m × 100 m area with the number of UNs 100. Other variables were shown specifically in the experiments, and other parameters of the source algorithm remain unchanged.

Positioning Effect and Analysis of QABA and BA
To demonstrate the improved performance of QABA over BA, the actual localization effect of both was plotted in Figure 9. In the simulation, the number of ANs for both was 30, the number of UNs was 100, and the node communication radius was 30. As can be seen from Figure 7, QABA has converged to 0 in Figure 7c,e,g,h when the number of iterations is less than 50, and it always has the smallest fitness value in the other functions, as well, indicating that QABA has a higher convergence speed and accuracy than the other algorithms. From Figure 9, it can be seen that all 100 UNs were pinpointed successfully in QABA-2D, while only some nodes were localized in BA-2D, and the localization accuracy was poor. Thus, it can be proved that the QABA-2D algorithm improves the solution performance of the algorithm by improving the search structure, and it has higher localization accuracy than BA-2D in node localization in 2D space. It can be seen from Figure 8 that the fitness values of QABA and the other algorithms decrease with the increase of the number of iterations. Among them, QABA has a worse average accuracy than DE, except in function Figure 8d. Yet, in other functions, its fitness value is always no greater than other algorithms in the same number of iterations, thus indicating that QABA has a higher convergence speed and accuracy.

Positioning Effect and Analysis of QABA and BA
To demonstrate the improved performance of QABA over BA, the actual localization effect of both was plotted in Figure 9. In the simulation, the number of ANs for both was 30, the number of UNs was 100, and the node communication radius was 30.
From Figure 9, it can be seen that all 100 UNs were pinpointed successfully in QABA-2D, while only some nodes were localized in BA-2D, and the localization accuracy was poor. Thus, it can be proved that the QABA-2D algorithm improves the solution performance of the algorithm by improving the search structure, and it has higher localization accuracy than BA-2D in node localization in 2D space.

Effect of Communication Radius on Positioning Accuracy
The communication radius affects localization accuracy mainly by influencing whether the algorithm can select a suitable anchor node for localization [72]. To explore a suitable communication radius, we set the communication radius interval of the anchor

Effect of Communication Radius on Positioning Accuracy
The communication radius affects localization accuracy mainly by influencing whether the algorithm can select a suitable anchor node for localization [72]. To explore a suitable communication radius, we set the communication radius interval of the anchor nodes to 10-50 m in our experiments. A total of 8 localization algorithms were used to localize 100 UNs under the interference condition, with the number of ANs 18 and the noise variance 0.5. Finally, the mean values of 30 consecutive runs under each communication radius range were taken to compare the performance of the 8 localization algorithms.
As can be seen in Figure 10, the positioning accuracy of the eight localization algorithms showed an overall trend of improvement with the increase of the communication radius. The reason for the accuracy improvement is that the distance between ANs and UNs is shortened by increasing the node communication radius, and the number of nodes involved in localization is increased, which makes ranging more accurate. In addition, the increase of the communication radius allows anchor nodes that fit the model better to be found, which can also improve the positioning accuracy. Among them, from the trend of the error curve, QABA-2D had the best positioning performance and the highest accuracy, IQBA-2D had the worst positioning performance and the lowest accuracy, and the positioning performance of the other six positioning al gorithms was closer to that of QABA-2D. From the average of 9 positioning errors, the average error of QABA-2D was 1.21 m, which was 90.35%, 71.06%, 62.16%, 63.87% 47.91%, 25.83%, and 71.43% lower than the average error of the other 7 algorithms. Thus it is proved that the QABA algorithm is superior to the other algorithms in finding the best performance, and it can save more energy and improve the working time for sensor nodes.

Effect of ANs Number on Positioning Accuracy
A suitable number of anchor nodes can help the algorithm select more favorable an chor nodes for localization, thus improving localization accuracy and reducing energy consumption. In order to explore this issue, we set the variation interval of the number o anchor nodes to 9-30 in our experiments. A total of 8 localization algorithms were used to localize 100 UNs under interference conditions, with nodes' communication radius of 30 and noise variance of 0.5. Finally, the mean values of 30 consecutive runs at each number of ANs were taken to compare the performance of the 8 localization algorithms.
From Figure 11, it can be obtained that the positioning accuracy of the eight position ing algorithms shows an overall trend of improvement with the increase of the communi cation radius. The increase in accuracy is due to the increase in the number of ANs, which indirectly shortens the distance between ANs and UNs, and the interference of other fac tors on the ranging accuracy is reduced. In addition, the increase in the number of anchor nodes likewise enables the algorithm to select more suitable anchor nodes for localization Among them, from the trend of the error curve, QABA-2D had the best positioning performance and the highest accuracy, IQBA-2D had the worst positioning performance and the lowest accuracy, and the positioning performance of the other six positioning algorithms was closer to that of QABA-2D. From the average of 9 positioning errors, the average error of QABA-2D was 1.21 m, which was 90.35%, 71.06%, 62.16%, 63.87%, 47.91%, 25.83%, and 71.43% lower than the average error of the other 7 algorithms. Thus, it is proved that the QABA algorithm is superior to the other algorithms in finding the best performance, and it can save more energy and improve the working time for sensor nodes.

Effect of ANs Number on Positioning Accuracy
A suitable number of anchor nodes can help the algorithm select more favorable anchor nodes for localization, thus improving localization accuracy and reducing energy consumption. In order to explore this issue, we set the variation interval of the number of anchor nodes to 9-30 in our experiments. A total of 8 localization algorithms were used to localize 100 UNs under interference conditions, with nodes' communication radius of 30 and noise variance of 0.5. Finally, the mean values of 30 consecutive runs at each number of ANs were taken to compare the performance of the 8 localization algorithms.
From Figure 11, it can be obtained that the positioning accuracy of the eight positioning algorithms shows an overall trend of improvement with the increase of the communication radius. The increase in accuracy is due to the increase in the number of ANs, which indirectly shortens the distance between ANs and UNs, and the interference of other factors on the ranging accuracy is reduced. In addition, the increase in the number of anchor nodes likewise enables the algorithm to select more suitable anchor nodes for localization and achieve reduced localization errors. Sensors 2023, 23, x FOR PEER REVIEW 21 of 28 Figure 11. Relationship between the number of ANs and positioning error.
Among them, from the trend of the error curve, QABA-2D had the best positioning performance and the highest accuracy, IQBA-2D had the worst positioning performance and the lowest accuracy, and the positioning performance of the other six positioning algorithms was closer to QABA-2D. The average error of QABA-2D was 1.25 m, which was 89.55%, 69.51%, 61.66%, 60.19%, 46.58%, 17.22%, and 70.59% lower than the average error of the other 7 algorithms. Thus, it is demonstrated that the improved structure and assisted convergence strategy of QABA improves the population diversity and overall search performance compared with other algorithms, and it is able to obtain higher localization accuracy with a smaller number of ANs and improve the lifetime of working nodes.

The Effect of Different Levels of Interference on Positioning Accuracy
Different levels of noise cause different effects on the localization algorithms. Since the experiments are performed in a simulation environment, when we consider adding a certain noise with a signal-to-noise ratio value of SNR to a known signal, it is added not in the form of db, but in the form of heteroskedasticity. The study in the literature [24] also proved that the magnitude of the noise variance is proportional to the distance; hence, we set the range of the noise variance to 0.1-1 to verify the effect of noise on localization accuracy under different path loss. A total of 8 localization algorithms were used to localize 100 UNs, with a node communication radius of 30 and a number of ANs of 18. Finally, the mean values of 30 consecutive runs under each noise interference were taken to compare the performance of the 8 localization algorithms.
As can be seen in Figure 12, the positioning accuracy of the eight positioning algorithms decreases as the noise variance increases. The reason for the decrease in accuracy is that the noise interference becomes larger, and the accuracy of ranging between ANs and UNs is reduced. Among them, from the trend of the error curve, QABA-2D had the best positioning performance and the highest accuracy, IQBA-2D had the worst positioning performance and the lowest accuracy, and the positioning performance of the other six positioning algorithms was closer to QABA-2D. The average error of QABA-2D was 1.25 m, which was 89.55%, 69.51%, 61.66%, 60.19%, 46.58%, 17.22%, and 70.59% lower than the average error of the other 7 algorithms. Thus, it is demonstrated that the improved structure and assisted convergence strategy of QABA improves the population diversity and overall search performance compared with other algorithms, and it is able to obtain higher localization accuracy with a smaller number of ANs and improve the lifetime of working nodes.

The Effect of Different Levels of Interference on Positioning Accuracy
Different levels of noise cause different effects on the localization algorithms. Since the experiments are performed in a simulation environment, when we consider adding a certain noise with a signal-to-noise ratio value of SNR to a known signal, it is added not in the form of db, but in the form of heteroskedasticity. The study in the literature [24] also proved that the magnitude of the noise variance is proportional to the distance; hence, we set the range of the noise variance to 0.1-1 to verify the effect of noise on localization accuracy under different path loss. A total of 8 localization algorithms were used to localize 100 UNs, with a node communication radius of 30 and a number of ANs of 18. Finally, the mean values of 30 consecutive runs under each noise interference were taken to compare the performance of the 8 localization algorithms.
As can be seen in Figure 12, the positioning accuracy of the eight positioning algorithms decreases as the noise variance increases. The reason for the decrease in accuracy is that the noise interference becomes larger, and the accuracy of ranging between ANs and UNs is reduced. Among them, from the trend of the error curve, QABA-2D had the best positioning performance and was least affected by interference, IQBA-2D had the worst positioning performance and the lowest accuracy and the positioning performance of the other six positioning algorithms was closer to QABA-2D. The average error of QABA-2D was 1.28 m, which is 89.19%, 69.74%, 62.57%, 60.00%, 45.53%, 20.50%, and 71.74% lower than the average error of the other 7 algorithms. Thus, it is proved that the QABA-2D algorithm Among them, from the trend of the error curve, QABA-2D had the best positioning performance and was least affected by interference, IQBA-2D had the worst positioning performance and the lowest accuracy and the positioning performance of the other six positioning algorithms was closer to QABA-2D. The average error of QABA-2D was 1.28 m, which is 89.19%, 69.74%, 62.57%, 60.00%, 45.53%, 20.50%, and 71.74% lower than the average error of the other 7 algorithms. Thus, it is proved that the QABA-2D algorithm has the advantage of superior seeking performance and distance processing method, which can reduce the influence of interference on positioning accuracy.
In addition, it can be seen from the different algorithms' localization error variations that QABA using the quantum evolution strategy proposed in this paper has excellent performance in localization accuracy, while the IQBA algorithm has larger errors in localization. This is because the frequency of the guiding quantum chromosome of the quantum evolution strategy in this paper is quantized by BA, which enables the algorithm to obtain higher accuracy in high-dimensional optimization with the same population of individuals. However, the population being quantized will lead to the reduction of the population diversity of the algorithm, and it is easy to fall into local optimum, thus the solution accuracy of IQBA is poor. The tournament-assisted mechanism of QABA and BA cooperation can guarantee that the population diversity of the algorithm is not destroyed, thus making QABA more accurate and applicable in different problems.

Simulation Analysis of 3D Spatial Positioning in WSNs
In the previous section, it was demonstrated using real simulation data that the various improved strategies of QABA still have excellent performance in 2D spatial localization. However, 3D spatial localization increases the complexity of the model, the dimensionality of the fitness function becomes larger, and the variety of combinations of UNs locations increases substantially compared to 2D spatial localization.
All these changes put the localization performance of QABA-3D to the test. To prove that QABA still has advantages in 3D spatial localization, QABA-3D is simulated and compared with IQBA-3D, LMBA-3D, BADE-3D, MAWPSO-3D, DE-3D, SCA-3D, and BA-3D for localization errors, under the same conditions. Where ANs were randomly distributed in a stereoscopic area of 100 m × 100 m × 100 md, the number of UNs was 100, the communication radius was 50, and other variables were shown in specific experiments.

QABA-3D and BA-3D Positioning Effect and Analysis
In the experiment, the number of ANs was 30, the number of UNs was 100, the node communication radius was 50, and all ANs were randomly placed at 1m from the ground. The actual positioning effect is shown in Figure 13. From Figure 13, the positions of 100 UNs were successfully located by QABA-3D and show excellent localization accuracy. In contrast, only a very small number of nodes were precisely located by BA-3D, and the overall localization accuracy was poor. The experiment illustrates that QABA-3D still has better localization performance and higher accuracy than the source BA-3D in 3D node localization, thus further demonstrating the effectiveness of QABA's auxiliary strategies, such as improved structure and tournament.

Effect of Different Number of ANs on Positioning Accuracy
An appropriate amount of anchor nodes can help the algorithm select better anchor nodes for localization, thus improving the localization accuracy. In 3D localization, if the anchor nodes are selected closer to the unknown nodes and they form a more regular From Figure 13, the positions of 100 UNs were successfully located by QABA-3D and show excellent localization accuracy. In contrast, only a very small number of nodes were precisely located by BA-3D, and the overall localization accuracy was poor. The experiment illustrates that QABA-3D still has better localization performance and higher accuracy than the source BA-3D in 3D node localization, thus further demonstrating the effectiveness of QABA's auxiliary strategies, such as improved structure and tournament.

Effect of Different Number of ANs on Positioning Accuracy
An appropriate amount of anchor nodes can help the algorithm select better anchor nodes for localization, thus improving the localization accuracy. In 3D localization, if the anchor nodes are selected closer to the unknown nodes and they form a more regular spatial tetrahedron, the localization error will be smaller. To investigate the influence of the number of anchor nodes on the localization accuracy, we set the distribution of the number of anchor nodes in the range of 5-30 and the noise variance at 0.5 in our experiments, and 100 unknown nodes were localized. Among them, each anchor node number variable was run 30 times individually, and the average value of the localization errors of 30 times was taken to compare the localization performance of QBAB-3D with other localization algorithms. The localization errors are shown in Figure 14. ment illustrates that QABA-3D still has better localization performance and higher accuracy than the source BA-3D in 3D node localization, thus further demonstrating the effectiveness of QABA's auxiliary strategies, such as improved structure and tournament.

Effect of Different Number of ANs on Positioning Accuracy
An appropriate amount of anchor nodes can help the algorithm select better anchor nodes for localization, thus improving the localization accuracy. In 3D localization, if the anchor nodes are selected closer to the unknown nodes and they form a more regular spatial tetrahedron, the localization error will be smaller. To investigate the influence of the number of anchor nodes on the localization accuracy, we set the distribution of the number of anchor nodes in the range of 5-30 and the noise variance at 0.5 in our experiments, and 100 unknown nodes were localized. Among them, each anchor node number variable was run 30 times individually, and the average value of the localization errors of 30 times was taken to compare the localization performance of QBAB-3D with other localization algorithms. The localization errors are shown in Figure 14.  As can be seen in Figure 14, the overall localization accuracy of the different algorithms increases with the increase in the number of ANs. The accuracy improvement is due to the increase in the number of ANs, and the distance between UNs and ANs is shortened, which leads to the reduction of the ranging error. Meanwhile, the increase in the number of anchor nodes will enable the algorithm to select more suitable anchor nodes, making the spatial tetrahedral structure composed of unknown and anchor nodes more regular, thus improving the search efficiency.
From the error curve, the localization accuracy of QABA-3D was always the highest; the localization performance of BADE-3D, MAWPSO-3D, DE-3D, and SCA-3D was similar to that of QABA-3D; and the localization performance of IQBA-3D, LMBA-3D, and BA-3D was poor. In terms of the average error, the localization error of QABA-3D was 2.25 m, which is 70.16%, 74.32%, 40.48%, 36.97%, 7.79%, 27.65%, and 67.53% lower than other localization algorithms, respectively. The results illustrate that the improved strategy of QABA is still applicable in 3D spatial localization to obtain higher accuracy and reduce node energy consumption with fewer ANs.

The Effect of Different Levels of Noise on Positioning Accuracy
Similar to 2D localization, we set the range of noise to 0.1-1 in our experiments to investigate the effect of noise on localization accuracy under different path loss. The number of anchor nodes was 15, and the number of unknown nodes was 100. Each noise variable was run 30 times continuously, and the average of 30 times was taken to predict the performance of QABA-3D with other localization algorithms. The localization error curves are shown in Figure 15.
As can be seen in Figure 15, the overall localization accuracy of the different algorithms decreases as the noise variance increases. The decrease in accuracy is due to the increase in noise variance, which decreases the ranging error between UNs and ANs, which in turn affects the accuracy of the high spatial tetrahedra involved in localization.
Similar to 2D localization, we set the range of noise to 0.1-1 in our experiments to investigate the effect of noise on localization accuracy under different path loss. The number of anchor nodes was 15, and the number of unknown nodes was 100. Each noise variable was run 30 times continuously, and the average of 30 times was taken to predict the performance of QABA-3D with other localization algorithms. The localization error curves are shown in Figure 15. As can be seen in Figure 15, the overall localization accuracy of the different algorithms decreases as the noise variance increases. The decrease in accuracy is due to the increase in noise variance, which decreases the ranging error between UNs and ANs, which in turn affects the accuracy of the high spatial tetrahedra involved in localization.

Conclusions
In this paper, 2D and 3D localization algorithms are designed for the localization of nodes in different dimensions of wireless sensor networks using trilateral localization and geometric feature principles, and a quantum annealing bat algorithm (QABA) is proposed to improve the localization accuracy and applicability. Quantum evolution and simulated annealing convergence evolution strategies are incorporated into QABA, with the bat algorithm as a framework to improve the overall operational structure. Meanwhile, to balance the overall search and convergence problems of the algorithm, tournament and natural selection mechanisms are introduced to assist in fast convergence optimization. In the simulation of 22 standard functions, QABA outperformed the comparison algorithm on average for 14 functions, and was close to the other algorithms for 8 functions.
In addition, the QABA-2D localization algorithm and QABA-3D localization algorithm, which use QABA as the operation core, also show excellent localization accuracy and applicability in 2D and 3D spatial localization. The simulation results show that the average positioning error of QABA-2D in 2D space positioning was reduced by 17.22-90.35% compared with other algorithms, and the average positioning error of QABA-3D in 3D space was reduced by 7.79-75.26% compared with other algorithms. Thus, the results show that the proposed QABA not only has excellent performance in the standard function test, but also has excellent solution accuracy and applicability in node localization optimization of wireless sensor networks.
Future efforts are directed to simplify the algorithm structure and expand the application scope. Although the accuracy and convergence speed of QABA can be significantly improved by using multiple mechanisms in conjunction with each other, there are problems of lengthy structure and time-consuming operations. We will continue to find more efficient and concise evolutionary strategies to improve the performance of QABA and apply it to more complex combinatorial optimization problems.
Author Contributions: Conceptualization, J.Z. and C.L.; methodology, S.Y. and J.Z.; software, S.Y.; validation, C.L., J.Z. and S.Y.; formal analysis, J.Z.; data curation, S.Y.; writing-original draft preparation, S.Y.; writing-review and editing, S.Y. and J.Z.; funding acquisition, C.L. All authors were involved in the discussion and review of the manuscript and agreed to publish it. All authors have read and agreed to the published version of the manuscript.