Next Article in Journal
Indoor Human Detection from a Building’s Exterior Using 433 MHz Wireless Transceivers
Previous Article in Journal
A Bibliometric Analysis of the Evolution of State-of-the-Art Blockchain Technology (BCT) in the Agrifood Sector from 2014 to 2022
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

A Compact Snake Optimization Algorithm in the Application of WKNN Fingerprint Localization

College of Computer Science and Engineering, Shandong University of Science and Technology, Qingdao 266590, China
*
Author to whom correspondence should be addressed.
Sensors 2023, 23(14), 6282; https://doi.org/10.3390/s23146282
Submission received: 3 June 2023 / Revised: 29 June 2023 / Accepted: 30 June 2023 / Published: 10 July 2023
(This article belongs to the Section Navigation and Positioning)

Abstract

:
Indoor localization has broad application prospects, but accurately obtaining the location of test points (TPs) in narrow indoor spaces is a challenge. The weighted K-nearest neighbor algorithm (WKNN) is a powerful localization algorithm that can improve the localization accuracy of TPs. In recent years, with the rapid development of metaheuristic algorithms, it has shown efficiency in solving complex optimization problems. The main research purpose of this article is to study how to use metaheuristic algorithms to improve indoor positioning accuracy and verify the effectiveness of heuristic algorithms in indoor positioning. This paper presents a new algorithm called compact snake optimization (cSO). The novel algorithm introduces a compact strategy to the snake optimization (SO) algorithm, which ensures optimal performance in situations with limited computing and memory resources. The performance of cSO is evaluated on 28 test functions of CEC2013 and compared with several intelligent computing algorithms. The results demonstrate that cSO outperforms these algorithms. Furthermore, we combine the cSO algorithm with WKNN fingerprint positioning and RSSI positioning. The simulation experiments demonstrate that the cSO algorithm can effectively reduce positioning errors.

1. Introduction

Metaheuristic algorithms are computational algorithms that draw inspiration from the behavioral patterns of various natural creatures. Particle swarm optimization (PSO) is a classical metaheuristic algorithm proposed by Kennedy and Eberhart based on birds’ feeding behavior. It involves a global optimal position and an individual optimal position. In each iteration, these two locations are updated according to the fitness values to obtain the optimal solution to the problem. The PSO algorithm’s attributes, including ease of implementation, fast optimization, and limited parameters, enable its application to numerous fields [1,2,3]. Due to the excellent performance and broad application of PSO, many research endeavors have dedicated substantial efforts to this domain. Zhan et al. proposed adaptive PSO (APSO) by using a parameter adaptation scheme and an elitist learning strategy [4]. Neri et al. proposed compact PSO (cPSO) to reduce memory usage [5]. Zheng et al. proposed compact adaptive PSO (cAPSO) by combining the compact strategy with APSO for mobile sensor localization [6]. Liang et al. proposed comprehensive learning PSO (CLPSO), which uses a novel learning strategy to enable the diversity of the swarm and discourage premature convergence [7]. Hu et al. proposed a multisurrogate assisted binary PSO, which develops a modified strategy for updating the population in binary PSO [8]. Inspired by the hunting behavior of whales, Mirjalili et al. proposed the whale optimization algorithm (WOA), which divides whaling into two phases: surround prey and bubblenet attacking method [9]. The artificial bee colony (ABC) algorithm eliminates the influence of the global best individual by allowing bees to become onlooker bees or employed bees. Employed bees explore the environment around their position, and onlooker bees select an employed bee to follow based on its fitness value, ultimately concluding the algorithm by returning the best fitness value discovered by all bees [10]. The black hole algorithm (BH) was devised by Hatamlou, drawing inspiration from the phenomenon of black holes [11]. Zheng et al. proposed an opposition-based learning black hole (OBH) algorithm to improve the accuracy of mobile wireless sensor network localization [12]. Zheng et al. proposed a new black hole algorithm by developing a compact strategy and an elitist learning strategy to improve the ability to jump out of the local optimum [13]. Zheng et al. also proposed the Levy Flight Edge Regeneration Black Hole algorithm (LEBH) to speed up convergence and enhance optimization capabilities [14]. Furthermore, Pan et al. conducted a comprehensively state-of-the-art investigation of the engineering applications employed by binary metaheuristic algorithms [15].
Wireless sensor networks (WSNs) have been widely used in various fields, such as safety monitoring of underground mines [16], home automation [17], and agriculture [18]. The localization of sensor nodes plays a significant role in such applications of WSNs. WSNs are also used for forest fire detection [19] and environmental monitoring [20]. To obtain accurate information about monitored objects, the positioning and status of sensors are critical for WSNs. The current location service field can be divided into outdoor and indoor. Most outdoor positioning is based on satellite positioning, such as global positioning systems (GPS), the principle of which is to calculate the user’s position information using the relationship between the receiver and the satellite. However, building occlusion weakens satellite signals in indoor environments, leading to inaccurate positioning results [21]. Therefore, accurate indoor localization has become a research frontier in the localization field, offering great potential for research institutions. There are two main categories of WSN-based indoor localization techniques: range-based (arrival-based) and fingerprint-based [22]. In the range-based or arrival-based field, many researchers have introduced several techniques, such as angle of arrival (AOA) [23], time difference of arrival (TDOA) [24], and received signal strength indicator (RSSI) [25,26].
Traditional fingerprint-based localization usually uses RSSI to measure the distance between the transmitter and the receiver and then match the location [27]. However, the accuracy of the matching process is often impacted by various factors, including multipath effects, shadow effects, and non-line-of-sight (NLOS) propagation, which adversely affect localization precision [28]. To improve accuracy, Ma et al. proposed an RSSI ranking fingerprint localization system that considers the ranking of the access point (AP) [29]. Oh et al. proposed an adaptive K-nearest neighbor algorithm in which reference points (RPs) are involved in the positioning process only when their characteristic distances toward the corresponding test point (TP) are under a certain threshold [30].
The SO algorithm has characteristics such as fast convergence speed, strong search capability, robustness, and low algorithm complexity. Wireless sensor nodes have the characteristics of low energy consumption and low memory, requiring low algorithm complexity and a small population size. However, the population size is related to the diversity of the algorithm and therefore affects its performance. In order to reduce the population without affecting algorithm performance, we introduced a compact strategy to the SO algorithm that simulates the population with probability. In this paper, a compact strategy is applied to improve the performance and reduce the memory usage of snake optimization (SO). The compact snake optimization (cSO) algorithm is tested in 28 test functions of CEC2013 and compared with the common heuristic algorithms SO, ABC, fish migration optimization (FMO), grey wolf optimization (GWO), and differential evolution (DE). The simulation results show that cSO achieves better performance. Furthermore, we combine the cSO algorithm with WKNN fingerprint positioning and RSSI positioning. The simulation experiments demonstrate that the cSO algorithm can effectively reduce positioning errors.
The remainder of this paper is organized as follows. Section 2 introduces the SO algorithm, RSSI localization, and the weighted k-nearest neighbor (WKNN) method used in WSN localization. Section 3 provides a detailed explanation of the compact strategy employed in cSO and the combination of cSO and WKNN fingerprint localization. The simulation results are analyzed in Section 4 to discuss the efficiency of the algorithm and its effectiveness when applied to WKNN fingerprint localization. Section 5 provides a summary of the paper.

2. Related Work

2.1. Snake Optimizer

The SO algorithm is a new intelligent optimization algorithm proposed by Hashim et al. that turns the feeding, fighting, and mating behavior of snakes into a mathematical mode [31,32,33,34]. Feeding is divided into two phases: the exploration phase and the exploitation phase. The survival strategies of snakes are complex and intriguing. Unlike other metaheuristic algorithms, snake optimization divides the population into males and females. SO is initialized using randomly generated populations. In addition, as snakes are cold-blooded animals, the temperature has a decisive influence on their feeding and copulatory behavior.
The temperature ( T e m p ) is calculated using the following equation.
T e m p = e x p ( t T ) ,
where t refers to the current iteration, and T is the maximum number of iterations.
The quantity of food (Q) can be defined by Equation (2).
Q = 0.5 × e x p ( t T T ) .
Q < 0.25 indicates inadequate food in the environment, meaning that snakes are in the exploration phase and search randomly for food.
The exploration phase is expressed as follows:
X i , m t + 1 = X r a n d o m , m t ± C 2 × A m × ( ( X m a x X m i n ) × r a n d + X m i n ) ,
X i , f t + 1 = X r a n d o m , f t ± C 2 × A f × ( ( X m a x X m i n ) × r a n d + X m i n ) ,
where X i , m t + 1 and X i , f t + 1 refer to the positions of the i-th male and female, respectively, and X r a n d o m , m t and X r a n d o m , f t refer to the positions of individuals randomly selected from the male or female population. C 2 is set to 0.05, r a n d is a random value ranging from 0 to 1, and t is the current iteration of the algorithm. A m and A f indicate the ability of males and females to find food, which can be represented by Equations (5) and (6), respectively.
A m = e x p ( f r a n d , m f i , m ) ,
A f = e x p ( f r a n d , f f i , f ) ,
where f r a n d , m and f r a n d , f refer to the fitness of X r a n d , m and X r a n d , f , respectively, and f i , m and f i , f are the fitness values of the i-th individual in the male and female groups, respectively.
In the exploitation phase, there is enough food available in the environment. If the temperature > 0.6, snakes continue to search for food. Male and female positions can be updated according to Equation (7).
X i , j t + 1 = X f o o d t ± C 3 × T e m p × r a n d × ( X f o o d X i , j t ) ,
where X i , j is the new position of an individual in both the male and female populations.
If temperature < 0.6, snakes enter a fight-or-mating state.
Fight Mode:
X i , m t + 1 = X i , m t ± C 3 × F M × r a n d × ( X b e s t , f X i , m t ) ,
X i , f t + 1 = X i , f t + 1 ± C 3 × F F × r a n d × ( X b e s t , m X i , f t + 1 ) ,
F M = e x p ( f b e s t , f f i ) ,
F F = e x p ( f b e s t , m f i ) ,
where F M and F F represent males’ and females’ fighting abilities, respectively, and X b e s t , m and X b e s t , f are the positions of the best male and female individuals, respectively. f b e s t , f and f b e s t , m indicate the fitness of X b e s t , f and X b e s t , m , respectively.
Mating Mode:
X i , m t + 1 = X i , m t ± C 3 × M m × r a n d × ( Q × X i , f t X i , m t ) ,
X i , f t + 1 = X i , f t ± C 3 × M f × r a n d × ( Q × X i , m t X i , f t ) ,
M M = e x p ( f i , f f i , m ) ,
M F = e x p ( f i , m f i , f ) ,
where M M and M F represent males’ and females’ mating abilities, respectively.

2.2. RSSI Localization

RSSI is a widely used parameter for indoor localization due to its ability to provide information about the strength of the signal between the transmitter and the receiver [35]. It relies on the signal power measurement from an AP to a device. As radio waves attenuate following the inverse-square law, the distance between the AP and the client device can be estimated by analyzing the relationship between the transmitted and received signal strengths. As the number of available APs increases, it is possible to collect more information.
In recent years, many improved methods based on RSSI localization have been proposed. Jondhale et al. proposed a range-free algorithm based on RSSI measurements, namely support vector regression [36]. The support-vector-regression-based localization scheme estimates target locations directly through field measurements, bypassing the need for distance computations. Shin et al. proposed a crossing assistance system based on RSSI measurement and Bluetooth for outdoor and indoor location tracking [37]. Herein, we use the KNN method and support vector machine to overcome the problems of the system to enable accurate outdoor positioning.
For RSSI distance measurement, the receiver determines the distance from the transmitter by measuring the energy of the radio frequency signal. Using the distance information, the location of TP can be obtained by the methods of trilateration, least squares, etc. When a wireless signal is transmitted in the atmosphere, the signal strength decreases with distance due to various factors. The mathematical relationship between signal strength change and propagation distance is expressed as follows:
R S S I = A + 10 × n × l g d d 0 + N 0 ,
where R S S I indicates the signal strength at a distance of d from the sending node; A is the signal strength at a distance of d 0 from the sending node, which is generally derived from experience or hardware specification definitions; d is the distance between nodes; n is the signal attenuation index; d 0 is the reference distance, usually sets to 1 m; and N 0 is a Gaussian random noise variable.
We use R S S I i to represent the RSSI between TP and the i-th AP. The distance ( d i ) between TP and the i-th AP is shown in Equation (17).
d i = 10 R S S I i A 10 × n .

2.3. Fingerprint Localization

Fingerprint localization is an important indoor localization technology, with many scholars conducting research in this area. Hoang et al. proposed recurrent neural networks for WiFi fingerprinting indoor localization [38]. Ahmed Shokry et al. proposed a quantum fingerprint-based localization algorithm to enable large-scale location tracking systems [39]. Fingerprint localization involves two stages: offline training and online positioning. Before these two stages, depending on the size of the target area, the distribution density of RPs is selected appropriately. The location of each RP is determined based on density and the size of the target area. In the offline training stage, the receiver collects the RSSI from different APs at each arranged RP. Then, the collected data are stored in a database to construct and calibrate the radio map. During the online positioning stage, we use the nearest neighbor (NN), k-nearest neighbor (KNN), and WKNN methods to locate the TP. The introduction of WKNN is as follows. The collected RSSI between the i-th RP and M APs can be represented as
R S S I i = ( R S S I i 1 , , R S S I i M ) , i = 1 , , N .
The characteristic distance between the TP and the i-th RP is as follows:
D i = ( j = 1 M ( R S S I t j R S S I r i j ) r ) 1 r ,
where R S S I t j represents the RSSI between TP and the j-th AP, and R S S I r i j represents the RSSI between the i-th RP and the j-th AP. The calculation result corresponds to the Manhattan distance (MD) and Euclidean distance (ED) when r = 1 and r = 2, respectively. Distances from all RPs to TP are calculated and ranked, and the closest K RPs are selected. We use p 1 = ( x 1 , y 1 ) , p 2 = ( x 2 , y 2 ) ,…, p k = ( x k , y k ) to represent the coordinates of RPs. The estimated location of TP ( x t , y t ) is calculated by the following equation.
x t = i = 1 k ω i x i , y t = i = 1 k ω i y i ,
where ω i represents the weight of p i , as shown in Equation (21).
ω i = D i j = 1 k D j , i = 1 , 2 , k ,
where D i represents the distance between the TP and the i-th RP.

3. Application of cSO for Partition WKNN Fingerprint Localization

This section mainly introduces the compact strategy and its application to the snake optimizer algorithm. Then, we apply the cSO algorithm to indoor positioning algorithms to verify its performance and the improvement of the cSO algorithm in terms of positioning accuracy.

3.1. Compact Strategy

The main objective of the compact strategy is to minimize memory usage while maintaining or even enhancing the performance of the original algorithm. Naturally, reducing memory usage leads to improved running speed. In order to reduce memory usage and improve running speed when running the SO algorithm, we introduce the compact strategy into the SO algorithm. Populationless is the most prominent feature of compact algorithms. A virtual population is used instead of the actual population. The virtual population is a probability model that represents the overall movement state of the population. The perturbation vector is defined as P V t = ( μ t , σ t ) , where t is the current iteration. μ and σ are the mean and standard deviation of the probability distribution function (PDF), respectively. The PDF and cumulative distribution function (CDF) are computed by Equations (22) and (23), respectively.
P D F = e ( x μ ) 2 2 σ 2 × 2 π σ × ( e r f ( μ + 1 2 σ ) e r f ( μ 1 2 σ ) ) .
C D F = x e ( x μ ) 2 2 σ 2 × 2 π σ × ( e r f ( μ + 1 2 σ ) e r f ( μ 1 2 σ ) ) d x .
The iterative update of the perturbation vector is based on comparison to identify the winner and loser. The following equations are used to update μ and σ .
μ t + 1 = μ t + 1 N p ( w i n n e r l o s e r ) ,
σ t + 1 = ( σ t ) 2 + ( μ t ) 2 + 2 N p ( w i n n e r 2 l o s e r 2 ) ,
where N p is the number of virtual populations, and t represents the current iteration.
The pseudocode of the cSO is shown in Algorithm 1. X m c t and X f c t represent the t-th male and female individual generated from PV, respectively. X n e w m t and X n e w f t are the t-th male and female individual generated by the updating formula, respectively. X m t and X f t are the t-th male and female individual of the population, respectively.
Algorithm 1. cSO pseudocode
1:
Initialize Problem Setting (Dim, UB, LB, Curr_iter t = 0 , Max_iter T)
  Initialize X m , X f randomly
2:
while ( t T ) do
   X m c t = generateFrom (PV)
  Calculate the fitness value of X m c
   X f c t = generateFrom (PV)
  Calculate the fitness value of X m c
  Define Temp using Equation (1)
  Define Q using Equation (2)
3:
    if ( Q < 0.25 ) then
  Execution Exploration Phase using Equations (3) and (4)
4:
    else if ( Q > 0.6 ) then
  Execution Exploration Phase using Equation (7)
5:
    else
6:
         if ( r a n d > 0.6 ) then
  Perform fight mode using Equations (8) and (9)
7:
         else
  Perform mating mode using Equations (12) and (13)
8:
         end if
9:
    end if
  [ w i n n e r , l o s e r ] = compare (fitness ( X m c t ) , fitness( X n e w m t ))
   X m t = w i n n e r
  Update the PV disturbance vector by Equations (24) and (25)
  [ w i n n e r , l o s e r ] = compare (fitness ( X f c t ) , fitness( X n e w f t ))
   X f t = w i n n e r
  Update the PV disturbance vector by Equations (24) and (25)
10:
end while

3.2. Partition Method

In order to reduce positioning errors, a partition positioning method is proposed in this paper. Dividing indoor space into corresponding areas according to different rooms. Place RPs at an appropriate density based on area. Unlike ordinary fingerprint localization, partitioned fingerprint localization first determines the partition based on the closest RP to TP, and then selects the K RPs closest to TP from the selected partition for calculation. The partitioning method can eliminate the interference of RPs outside the region and limit the RPs used to calculate the final coordinates to the partition where TP is located, thereby effectively reducing the error of fingerprint localization.

3.3. A Combination of the cSO Algorithm with RSSI Localization and Partition WKNN Fingerprint Localization

In the first phase of localization, this paper combines cSO with RSSI localization and uses cSO to discover the coordinate of TP and reduce the localization error. To improve positioning accuracy, we use the following fitness function.
f i t n e s s = i = 1 4 ( d R A ( i ) d T A ( i ) ) 2 4 ,
where d R A represents the distance between the calculated result and APs, and d T A is the distance between TP and APs.
In order to measure the accuracy of localization results, we use Equation (27) to calculate the error.
e r r o r = ( x x t ) 2 + ( y y t ) 2 ,
where ( x , y ) represents the coordinates of computed results, and ( x t , y t ) represents the actual coordinates of TP.
In the second phase of localization, another TP coordinate is obtained via partition WKNN fingerprint localization.
In the final phase of positioning, the coordinates obtained from the first two stages are weighted and summed to obtain the final coordinates; the formula is shown in Equation (28).
( x , y ) = C 1 × ( x r , y r ) + C 2 × ( x p , y p ) ,
where C 1 and C 2 are both set to 0.5. The coordinates ( x r , y r ) and ( x p , y p ) represent the results computed by cSO-based RSSI positioning and partition WKNN fingerprint localization, respectively.

4. Results and Discussion

In this section, we deploy simulation experiments of the algorithm and the new positioning method. The simulation results of the cSO are tested under 28 test functions of CEC2013 [40]. These functions are divided into three main types: unimodal functions, basic multimodal functions, and composition functions. They can evaluate the performance differences between the new algorithm and other algorithms. In addition, we deploy simulation experiments for WSN localization. The simulation outcomes of cSO-based localization indicate that the cSO algorithm can significantly decreases the positioning error.

4.1. Simulation Results on CEC2013

In this section, cSO is compared with SO, GWO, FMO, DE, and ABC to evaluate the its performance. Additionally, the performance of each algorithm is compared with that of the cSO algorithm using the Wilcoxon signed rank test with a significance level of α = 0.05. Table 1 displays a comparison of the performance of cSO and that of typical heuristic algorithms. The algorithms used for comparison have a maximum number of iterations of 1000, a population of 30, and dimensions of 30. The maximum number of iterations for cSO is 15,000, the population size is 2, and the dimension is set to 30. The search range requirement in CEC2013 is [−100, 100]. Table 1 presents a performance comparison of cSO and common heuristic algorithms. The symbol “>” indicates that cSO outperforms the other heuristic algorithm, the “=” symbol indicates that the performance of cSO is comparable to that of the other heuristic algorithm, and the “<” symbol indicates that the performance of cSO is inferior to that of the other heuristic algorithm. The final row of Table 1 summarizes the comparison results across all test functions. Table 1 shows that the test performance of cSO is better than that of SO in 17 functions and the same as that of SO in 1 function. The test performance of cSO is better than that of ABC in all functions. The test performance of cSO is better than that of FMO in 25 functions and worse than that of FMO in 3 functions. The test performance of cSO is better than that of GWO in 21 functions, the same as that of GWO in 1 function, and worse than that of DE in 6 functions. Compared with DE, the test performance of cSO is better than that of DE in 16 functions, the same as that of DE in 2 functions, and worse than that of DE in 10 functions. Therefore, the combination of the SO algorithm with the compact strategy results in significantly improved performance compared to common heuristic algorithms.
To further illustrate the algorithm’s effectiveness, we employ convergence curves for evaluation. However, as the convergence of some algorithms is quite similar, the performance differences are not obvious in the convergence curves. Therefore, we choose several representative scattered curves for display. Figure 1 indicates the convergence process of the algorithm on several test functions. The X-axis represents the number of iterations, while the Y-axis represents the fitness values of the different algorithms. A lower fitness value indicates a better performance on the respective test function. Figure 1 shows that the proposed cSO algorithm outperforms other heuristic algorithms on test functions f 4 , f 5 , f 7 , f 8 , f 13 , f 16 , f 17 , f 18 , f 20 , and f 26 . In the unimodal functions of CEC2013, cSO achieves the optimal value on f 4 and f 5 . In the f 4 function, the cSO algorithm outperforms the other five algorithms at the beginning of the iteration and maintains a more stable downward trend as the iteration progresses. In the f 5 function, except for the poor performance of the ABC algorithm, cSO, SO, FMO, DE, and GWO can all find a good value at the beginning of the iteration and gradually decrease with the iteration. Although Figure 1b shows that cSO is equal to SO, FMO, and DE in the final results, Table 1 shows that cSO still outperforms them in terms of optimal values. In the basic multimodal functions of CEC2013, cSO achieves the lowest results on f 8 , f 13 , f 16 , f 17 , f 18 , and f 20 . On the f 8 and 16 functions, the other five algorithms have similar convergence curves and results, and cSO is significantly better than them throughout the entire iteration cycle. On the f 13 and 18 functions, ABC and FMO fall into local optima after a brief search at the beginning of the iteration. SO, GWO, and DE continue to search for optima with each iteration, ultimately achieving better results than the first two algorithms. The cSO achieves a good result in the early stages of the algorithm and gradually decreases with each iteration, ultimately obtaining the best value among all algorithms. In the first 300 iterations of the f 17 function, ABC, FMO, and SO have similar convergence curves. After 300 iterations, SO produces better results and significantly reduces the function value, while ABC and FMO fall into local optima. The function value of GWO decreases with iterations, showing a smooth convergence curve. The initial value of DE is not good, but a good result is quickly achieved at the beginning of the iteration, and the function value decreases significantly and continues to decrease as the iteration progresses. The cSO achieves a good result at the beginning and continues to decline for the first 200 iterations, then tends to stagnate. At the beginning of function f 20 , all algorithms have an almost identical function value. The function value of cSO rapidly decreases, and the convergence curve becomes smoother as the iteration progresses. SO, DE, and GWO have similar convergence curves in the first 200 iterations. Afterwards, the function values of GWO slowly decrease, while DE has a lower convergence curve. The function value of SO rapidly decreases during the 200th to 500th iterations, then tends to stagnate. In the composition functions of CEC2013, cSO achieves the optimal value on f 26 . The cSO quickly finds the result closest to the optimal value among all algorithms in the first 100 iterations, then converges. The convergence curve of GWO is gentle, and the final result is the worst. FMO exhibits a steeper convergence curve than GWO and obtains a slightly better value than GWO. SO and ABC continuously achieve better results in the first 400 iterations, with the convergence curve rapidly decreasing, then tending to flatten out. The DE makes significant progress in the first 200 iterations, followed by a slow decline in the curve.

4.2. Simulation Results of the New Localization Method

To verify the effectiveness of the cSO algorithm in indoor positioning, we compare the new positioning method with RSSI localization and cSO-based RSSI localization by simulation.
In the simulation experiment, a two-dimensional positioning area with a length of 300 m and a width of 300 m is set. Four APs are set at the four vertices of the experimental area, with coordinates of ( 0 , 0 ) , ( 300 , 0 ) , ( 300 , 300 ) , and ( 0 , 300 ) . The simulation experiments are carried out using MATLAB 2022a. In order to avoid obtaining the same distance from AP at two centrally symmetric RPs in the positioning area, the transmission powers of the four APs are set to different values in the simulation experiment.
With the aim of verifying the performance of the cSO algorithm proposed in this paper, the performances of RSSI localization based on SO, ABC, FMO, GWO, and DE are compared. Six sets of coordinates of TP are randomly generated, and we use six algorithms to estimate the position of TP and calculate the error.
Then, three groups of controlled experiments are designed according to the number of partitions, RP density, and noise. Each experiment contains six groups of data. In these three simulation experiments, RPs are evenly deployed in the positioning area, and TPs are randomly placed within the experimental field.

4.2.1. RSSI Localization Experiment

Simulation experiments are conducted to further validate the reliability of the proposed approach. We randomly place six TPs in the experimental area, as shown in Figure 2. Then, RSSI localization combined with each of the six algorithms is used for calculation, the results of which are shown in Table 2. Based on the experimental data, we can conclude that cSO is superior to other algorithms.

4.2.2. Partition Experiment

In the partition experiment, we divide the experimental area into four, five, six, seven, eight, and nine small areas. The different partitions are shown in Figure 3. Table 3 shows the effect of different numbers of partitions on localization error. Table 3 shows that even partitions have better errors than odd partitions in partition WKNN fingerprint localization because even partitions divide the simulation area more evenly. In addition, for a fixed simulation area, too many partitions cause the error to increase. Four-partition WKNN localization is more accurate than RSSI positioning in all partitions. Benefiting from the precise partitioning of WKNN fingerprint localization, the accuracy of the new method is superior to that of cSO-based RSSI localization in all experiments.

4.2.3. Density Experiment

For the purpose of investigating the impact of node density on experimental data, each test has a different density, with RP spacing is set to one, two, three, four, five, and six. Table 4 shows that the best density is 3 m between RPs. Excessive density leads to increased computational complexity and incorrect distance calculation. Low density results in too few RPs, making it difficult to accurately calculate the distance between RPs and TPs.

4.2.4. Noise Experiment

With the intention of verifying the effect of noise on positioning accuracy, six groups with different noise levels (three, four, five, six, seven, and eight) are set up in this experiment. Table 5 shows that as the noise increases, the errors of all localization methods also increase. Noise directly affects the positioning errors of localization methods.

5. Conclusions

In this paper, we propose cSO as an improvement of WSN localization, which employs a compact strategy. By conducting experiments on 28 classical test functions, we comprehensively evaluated the proposed algorithm’s performance. The simulation results demonstrate that the novel algorithm achieves competitive performance and good stability. Furthermore, we applied the cSO algorithm to localization and compared its performance with that of WKNN fingerprint localization, RSSI localization, and cSO-based RSSI localization. The results show that the cSO algorithm and fitness function proposed in this article can effectively reduce positioning errors.
In the future, we plan to propose new strategies and explore the potential benefits of combining new algorithms with the WSN localization method. These efforts have the potential to yield excellent results.

Author Contributions

Conceptualization, W.Z. and S.P.; methodology, S.P. and N.L.; software, L.X.; investigation, S.P. and Q.C.; writing—original draft preparation, W.Z. and S.P. All authors have read and agreed to the published version of the manuscript.

Funding

This research study received no external funding.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

The data are contained within the article.

Conflicts of Interest

The authors declare no conflict of interest.

Abbreviations

The following abbreviations are used in this manuscript:
PSOParticle swarm optimization
APSOAdaptive particle swarm optimization
cPSOCompact particle swarm optimization
CLPSOComprehensive learning particle swarm optimization
WOAWhale optimization algorithm
ABCArtificial bee colony
BHBlack hole
OBHOpposition-based learning black hole
LEBHLevy flight edge regeneration black hole
WSNWireless sensor network
GPSGlobal positioning system
AOAAngle of arrival
TDOATime difference of arrival
RSSIReceived signal strength indicator
NLOSNon-line of sight
APAccess point
RPReference point
TPTest point
SOSnake optimization
cSOCompact snake optimization
FMOFish migration optimization
GWOGrey wolf optimization
DEDifferential evolution
WKNNWeighted k-nearest neighbor
NNNearest neighbor
KNNK-nearest neighbor
MDManhattan distance
EDEuclidean distance
PDFProbability distribution function
CDFCumulative distribution function

References

  1. Kennedy, J.; Eberhart, R. Particle swarm optimization. In Proceedings of the ICNN’95-International Conference on Neural Networks, Perth, WA, Australia, 27 November–1 December 1995; IEEE: Perth, WA, Australia, 1995; Volume 4, pp. 1942–1948. [Google Scholar]
  2. Chu, S.C.; Roddick, J.F.; Pan, J.S. A parallel particle swarm optimization algorithm with communication strategies. J. Inf. Sci. Eng 2005, 21, 809–818. [Google Scholar]
  3. Lee, S.H.; Cheng, C.H.; Lin, C.C.; Huang, Y.F. PSO-Based Target Localization and Tracking in Wireless Sensor Networks. Electronics 2023, 12, 905. [Google Scholar] [CrossRef]
  4. Zhan, Z.H.; Zhang, J.; Li, Y.; Chung, H.S.H. Adaptive particle swarm optimization. IEEE Trans. Syst. Man, Cybern. Part B (Cybern.) 2009, 39, 1362–1381. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  5. Neri, F.; Mininno, E.; Iacca, G. Compact particle swarm optimization. Inf. Sci. 2013, 239, 96–121. [Google Scholar] [CrossRef]
  6. Zheng, W.M.; Liu, N.; Chai, Q.W.; Chu, S.C. A Compact Adaptive Particle Swarm Optimization Algorithm in the Application of the Mobile Sensor Localization. Wirel. Commun. Mob. Comput. 2021, 2021, 1–15. [Google Scholar] [CrossRef]
  7. Liang, J.J.; Qin, A.K.; Suganthan, P.N.; Baskar, S. Comprehensive learning particle swarm optimizer for global optimization of multimodal functions. IEEE Trans. Evol. Comput. 2006, 10, 281–295. [Google Scholar] [CrossRef]
  8. Hu, P.; Pan, J.S.; Chu, S.C.; Sun, C. Multi-surrogate assisted binary particle swarm optimization algorithm and its application for feature selection. Appl. Soft Comput. 2022, 121, 108736. [Google Scholar] [CrossRef]
  9. Mirjalili, S.; Lewis, A. The whale optimization algorithm. Adv. Eng. Softw. 2016, 95, 51–67. [Google Scholar] [CrossRef]
  10. Karaboga, D.; Basturk, B. On the performance of artificial bee colony (ABC) algorithm. Appl. Soft Comput. 2008, 8, 687–697. [Google Scholar] [CrossRef]
  11. Hatamlou, A. Black hole: A new heuristic optimization approach for data clustering. Inf. Sci. 2013, 222, 175–184. [Google Scholar] [CrossRef]
  12. Zheng, W.M.; Xu, S.L.; Pan, J.S.; Chai, Q.W.; Hu, P. An Opposition-Based Learning Black Hole Algorithm for Localization of Mobile Sensor Network. Sensors 2023, 23, 4520. [Google Scholar] [CrossRef]
  13. Zheng, W.M.; Xu, S.L.; Pan, J.S.; Chai, Q.W.; Hu, P. A Compact Black Hole Algorithm for Localization of Mobile Sensor Network. 2022. Available online: https://www.researchsquare.com/article/rs-1343477/v1 (accessed on 29 June 2023).
  14. Zheng, W.M.; Liu, N.; Chai, Q.W.; Liu, Y. Application of improved black hole algorithm in prolonging the lifetime of wireless sensor network. Complex Intell. Syst. 2023, 1–13. [Google Scholar] [CrossRef]
  15. Pan, J.S.; Hu, P.; Snášel, V.; Chu, S.C. A survey on binary metaheuristic algorithms and their engineering applications. Artif. Intell. Rev. 2022, 56, 6101–6167. [Google Scholar] [CrossRef]
  16. Sadeghi, S.; Soltanmohammadlou, N.; Nasirzadeh, F. Applications of wireless sensor networks to improve occupational safety and health in underground mines. J. Saf. Res. 2022, 83, 8–25. [Google Scholar] [CrossRef]
  17. Patil, M.B.K.; Sankapal, M.S.; Mulla, M.R.M. Wsn Based Home Automation System. Int. J. Innov. Eng. Res. Technol. 2016, 3, 1–3. [Google Scholar]
  18. Bayih, A.Z.; Morales, J.; Assabie, Y.; de By, R.A. Utilization of Internet of Things and Wireless Sensor Networks for Sustainable Smallholder Agriculture. Sensors 2022, 22, 3273. [Google Scholar] [CrossRef]
  19. Dampage, U.; Bandaranayake, L.; Wanasinghe, R.; Kottahachchi, K.; Jayasanka, B. Forest fire detection system using wireless sensor networks and machine learning. Sci. Rep. 2022, 12, 46. [Google Scholar] [CrossRef]
  20. Ouni, R.; Saleem, K. Framework for Sustainable Wireless Sensor Network Based Environmental Monitoring. Sustainability 2022, 14, 8356. [Google Scholar] [CrossRef]
  21. Basiri, A.; Lohan, E.S.; Moore, T.; Winstanley, A.; Peltola, P.; Hill, C.; Amirian, P.; e Silva, P.F. Indoor location based services challenges, requirements and usability of current solutions. Comput. Sci. Rev. 2017, 24, 1–12. [Google Scholar] [CrossRef] [Green Version]
  22. Luo, J.; Xiao, J.; Li, C. An Improved WKNN Algorithm Based on Flexible K Selection Strategy and Distance Compensation for Indoor Localization. Arab. J. Sci. Eng. 2022, 47, 13917–13925. [Google Scholar] [CrossRef]
  23. Niculescu, D.; Nath, B. Ad hoc positioning system (APS) using AOA. In Proceedings of the IEEE INFOCOM 2003, Twenty-Second Annual Joint Conference of the IEEE Computer and Communications Societies (IEEE Cat. No. 03CH37428), San Francisco, CA, USA, 30 March–3 April 2003; Volume 3, pp. 1734–1743. [Google Scholar]
  24. Kaune, R. Accuracy studies for TDOA and TOA localization. In Proceedings of the 2012 15th International Conference on Information Fusion, Singapore, 9–12 July 2012; IEEE: Singapore, 2012; pp. 408–415. [Google Scholar]
  25. Malyavej, V.; Kumkeaw, W.; Aorpimai, M. Indoor robot localization by RSSI/IMU sensor fusion. In Proceedings of the 2013 10th International Conference on Electrical Engineering/Electronics, Computer, Telecommunications and Information Technology, Krabi, Thailand, 15–17 May 2013; pp. 1–6. [Google Scholar]
  26. Cheng, L.; Wu, C.D.; Zhang, Y.Z. Indoor robot localization based on wireless sensor networks. IEEE Trans. Consum. Electron. 2011, 57, 1099–1104. [Google Scholar] [CrossRef]
  27. Yu, Y.; Chen, R.; Liu, Z.; Guo, G.; Ye, F.; Chen, L. Wi-Fi fine time measurement: Data analysis and processing for indoor localisation. J. Navig. 2020, 73, 1106–1128. [Google Scholar] [CrossRef]
  28. Jun, J.; He, L.; Gu, Y.; Jiang, W.; Kushwaha, G.; Vipin, A.; Cheng, L.; Liu, C.; Zhu, T. Low-overhead WiFi fingerprinting. IEEE Trans. Mob. Comput. 2017, 17, 590–603. [Google Scholar] [CrossRef]
  29. Ma, Z.; Wu, B.; Poslad, S. A WiFi RSSI ranking fingerprint positioning system and its application to indoor activities of daily living recognition. Int. J. Distrib. Sens. Netw. 2019, 15, 1550147719837916. [Google Scholar] [CrossRef]
  30. Oh, J.; Kim, J. AdaptiveK-nearest neighbour algorithm for WiFi fingerprint positioning. Ict Express 2018, 4, 91–94. [Google Scholar] [CrossRef]
  31. Hashim, F.A.; Hussien, A.G. Snake Optimizer: A novel meta-heuristic optimization algorithm. Knowl.-Based Syst. 2022, 242, 108320. [Google Scholar] [CrossRef]
  32. Liu, X.; Tian, M.; Zhou, J.; Liang, J. An efficient coverage method for SEMWSNs based on adaptive chaotic Gaussian variant snake optimization algorithm. Math. Biosci. Eng. MBE 2022, 20, 3191–3215. [Google Scholar] [CrossRef]
  33. Fu, H.; Shi, H.; Xu, Y.; Shao, J. Research on Gas Outburst Prediction Model Based on Multiple Strategy Fusion Improved Snake Optimization Algorithm With Temporal Convolutional Network. IEEE Access 2022, 10, 117973–117984. [Google Scholar] [CrossRef]
  34. Li, T.; Deng, Z.; Wang, G.; Yan, J. Time Difference of Arrival Location Method Based on Improved Snake Optimization Algorithm. In Proceedings of the 2022 IEEE 8th International Conference on Computer and Communications (ICCC), Chengdu, China, 9–12 December 2022; IEEE: Chengdu, China, 2022; pp. 482–486. [Google Scholar]
  35. Zanca, G.; Zorzi, F.; Zanella, A.; Zorzi, M. Experimental comparison of RSSI-based localization algorithms for indoor wireless sensor networks. In Proceedings of the Workshop on Real-World Wireless Sensor Networks, Glasgow, Scotland, 1 April 2008; pp. 1–5. [Google Scholar]
  36. Jondhale, S.R.; Mohan, V.; Sharma, B.B.; Lloret, J.; Athawale, S.V. Support vector regression for mobile target localization in indoor environments. Sensors 2022, 22, 358. [Google Scholar] [CrossRef]
  37. Shin, K.; McConville, R.; Metatla, O.; Chang, M.; Han, C.; Lee, J.; Roudaut, A. Outdoor localization using BLE RSSI and accessible pedestrian signals for the visually impaired at intersections. Sensors 2022, 22, 371. [Google Scholar] [CrossRef]
  38. Hoang, M.T.; Yuen, B.; Dong, X.; Lu, T.; Westendorp, R.; Reddy, K. Recurrent neural networks for accurate RSSI indoor localization. IEEE Internet Things J. 2019, 6, 10639–10651. [Google Scholar] [CrossRef] [Green Version]
  39. Shokry, A.; Youssef, M. A Quantum Algorithm for RF-based Fingerprinting Localization Systems. In Proceedings of the 2022 IEEE 47th Conference on Local Computer Networks (LCN), Clearwater Beach, FL, USA, 22–25 October 2012; pp. 18–25. [Google Scholar] [CrossRef]
  40. Liang, J.J.; Qu, B.; Suganthan, P.N.; Hernández-Díaz, A.G. Problem Definitions and Evaluation Criteria for the CEC 2013 Special Session on Real-Parameter Optimization; Technical Report; Computational Intelligence Laboratory, Zhengzhou University: Zhengzhou, China; Nanyang Technological University: Singapore, 2013; Volume 201212, pp. 281–295. [Google Scholar]
Figure 1. Performance comparison between cSO and common heuristic algorithms.
Figure 1. Performance comparison between cSO and common heuristic algorithms.
Sensors 23 06282 g001
Figure 2. Two-dimensional map of the experimental field.
Figure 2. Two-dimensional map of the experimental field.
Sensors 23 06282 g002
Figure 3. Different partitions of the experimental field.
Figure 3. Different partitions of the experimental field.
Sensors 23 06282 g003
Table 1. Performance comparison between cSO and common heuristic algorithms, as well as the Wilcoxon signed rank test of each algorithm at a significance level of α = 0.05.
Table 1. Performance comparison between cSO and common heuristic algorithms, as well as the Wilcoxon signed rank test of each algorithm at a significance level of α = 0.05.
FunctioncSO SO ABC FMO GWO DE
f 1 9.38 × 10 2 < 1.40 × 10 3 > 1.11 × 10 4 > 5.33 × 10 2 > 3.39 × 10 2 < 1.39 × 10 3
f 2 2.06 × 10 7 < 1.95 × 10 7 > 3.78 × 10 8 < 6.75 × 10 6 > 3.31 × 10 7 > 8.99 × 10 7
f 3 3.84 × 10 9 = 4.65 × 10 9 > 1.41 × 10 17 > 9.32 × 10 9 > 9.62 × 10 9 < 3.79 × 10 9
f 4 2.78 × 10 4 > 5.09 × 10 4 > 7.22 × 10 4 > 6.70 × 10 4 > 4.72 × 10 4 > 8.98 × 10 4
f 5 1.00 × 10 3 > 9.74 × 10 2 > 7.48 × 10 3 > 9.86 × 10 2 > 9.15 × 10 1 > 9.95 × 10 2
f 6 7.98 × 10 2 > 7.86 × 10 2 > 1.17 × 10 3 < 8.43 × 10 2 > 6.98 × 10 2 < 8.58 × 10 2
f 7 7.15 × 10 2 > 6.60 × 10 2 > 1.25 × 10 5 > 6.01 × 10 2 > 7.15 × 10 2 > 7.01 × 10 2
f 8 6.79 × 10 2 > 6.79 × 10 2 > 6.79 × 10 2 > 6.79 × 10 2 > 6.79 × 10 2 > 6.79 × 10 2
f 9 5.70 × 10 2 > 5.70 × 10 2 > 5.61 × 10 2 > 5.59 × 10 2 = 5.78 × 10 2 > 5.63 × 10 2
f 10 1.58 × 10 2 < 4.34 × 10 2 > 1.69 × 10 3 < 3.55 × 10 2 > 1.00 × 10 1 < 4.32 × 10 2
f 11 3.38 × 10 2 > 3.05 × 10 2 > 6.90 × 10 1 > 1.40 × 10 2 > 2.72 × 10 2 = 3.66 × 10 2
f 12 7.52 × 10 1 < 9.59 × 10 1 > 1.59 × 10 2 > 2.82 × 10 1 < 1.29 × 10 2 = 7.42 × 10 1
f 13 1.65 × 10 1 > 5.16 × 10 1 > 2.48 × 10 2 > 1.37 × 10 2 > 3.71 × 10 1 > 2.63 × 10 1
f 14 3.78 × 10 3 < 1.78 × 10 3 > 4.76 × 10 3 > 7.37 × 10 3 > 3.86 × 10 3 < 9.23 × 10 2
f 15 6.63 × 10 3 > 7.47 × 10 3 > 7.69 × 10 3 > 7.76 × 10 3 < 5.23 × 10 3 > 7.93 × 10 3
f 16 2.03 × 10 2 > 2.03 × 10 2 > 2.03 × 10 2 > 2.03 × 10 2 > 2.03 × 10 2 > 2.03 × 10 2
f 17 3.98 × 10 2 > 4.5 × 10 2 > 7.37 × 10 2 > 7.03 × 10 2 > 5.13 × 10 2 > 4.06 × 10 2
f 18 6.20 × 10 2 > 6.78 × 10 2 > 9.08 × 10 2 > 8.03 × 10 2 > 6.92 × 10 2 > 6.52 × 10 2
f 19 5.12 × 10 2 < 5.10 × 10 2 > 2.66 × 10 5 > 5.15 × 10 2 > 1.15 × 10 3 < 5.10 × 10 2
f 20 6.12 × 10 2 > 6.13 × 10 2 > 6.15 × 10 2 > 6.15 × 10 2 > 6.14 × 10 2 > 6.14 × 10 2
f 21 1.01 × 10 3 < 9.69 × 10 2 > 2.72 × 10 3 > 1.06 × 10 3 > 1.95 × 10 3 < 9.92 × 10 2
f 22 4.82 × 10 3 < 2.97 × 10 3 > 6.05 × 10 3 > 8.86 × 10 3 > 4.85 × 10 3 < 2.89 × 10 3
f 23 7.23 × 10 3 > 8.17 × 10 3 > 9.36 × 10 3 > 9.44 × 10 3 < 5.66 × 10 3 > 8.96 × 10 3
f 24 1.27 × 10 3 > 1.28 × 10 3 > 1.30 × 10 3 > 1.30 × 10 3 < 1.26 × 10 3 > 1.29 × 10 3
f 25 1.39 × 10 3 < 1.39 × 10 3 > 1.42 × 10 3 > 1.42 × 10 3 < 1.38 × 10 3 < 1.39 × 10 3
f 26 1.44 × 10 3 > 1.50 × 10 3 > 1.48 × 10 3 > 1.49 × 10 3 > 1.53 × 10 3 > 1.47 × 10 3
f 27 2.32 × 10 3 < 2.26 × 10 3 > 2.62 × 10 3 > 2.53 × 10 3 < 2.18 × 10 3 > 2.51 × 10 3
f 28 2.06 × 10 3 > 2.55 × 10 3 > 7.23 × 10 3 > 2.41 × 10 3 > 2.96 × 10 3 < 1.88 × 10 3
< / = / > 10 / 1 / 17 0 / 0 / 28 3 / 0 / 25 6 / 1 / 21 10 / 2 / 16
Table 2. Position error of each algorithm.
Table 2. Position error of each algorithm.
CoordinatescSOSOGWOABCFMODE
(88,265)4.743 m5.564 m7.045 m5.122 m7.128 m6.173 m
(95,272)17.040 m20.676 m28.224 m28.905 m21.632 m30.540 m
(297,161)16.162 m18.501 m21.414 m29.230 m25.908 m27.455 m
(184,98)10.663 m12.734 m12.104 m13.702 m12.880 m13.986 m
(115,84)6.635 m9.897 m9.558 m8.146 m8.753 m9.798 m
(271,56)9.71 m12.344 m13.175 m12.426 m11.441 m11.930 m
Table 3. Position error of each localization method under different partitions.
Table 3. Position error of each localization method under different partitions.
PartitionsWKNNRSSIcSO−RSSINew Method
411.33 m17.37 m11.40 m8.46 m
518.58 m18.91 m11.91 m11.94 m
615.50 m17.12 m11.51 m9.91 m
725.75 m17.10 m11.88 m15.14 m
818.63 m16.42 m11.62 m11.84 m
931.16 m18.12 m12.04 m17.73 m
Table 4. Position error of each localization method under different densities.
Table 4. Position error of each localization method under different densities.
DensityWKNNRSSIcSO−RSSINew Method
111.29 m18.76 m12.94 m9.53 m
212.77 m17.78 m12.37 m9.44 m
311.84 m16.82 m12.02 m8.60 m
414.04 m16.85 m11.00 m9.42 m
516.25 m11.87 m11.11 m8.92 m
613.20 m16.88 m11.81 m9.24 m
Table 5. Position error of each localization method under different noise levels.
Table 5. Position error of each localization method under different noise levels.
NoiseWKNNRSSIcSO−RSSINew Method
310.21 m12.81 m9.06 m6.94 m
49.66 m14.06 m10.05 m7.14 m
512.46 m14.60 m10.70 m8.48 m
613.45 m17.30 m12.54 m8.88 m
714.46 m18.47 m13.05 m10.57 m
817.58 m20.39 m14.33 m12.57 m
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Zheng, W.; Pang, S.; Liu, N.; Chai, Q.; Xu, L. A Compact Snake Optimization Algorithm in the Application of WKNN Fingerprint Localization. Sensors 2023, 23, 6282. https://doi.org/10.3390/s23146282

AMA Style

Zheng W, Pang S, Liu N, Chai Q, Xu L. A Compact Snake Optimization Algorithm in the Application of WKNN Fingerprint Localization. Sensors. 2023; 23(14):6282. https://doi.org/10.3390/s23146282

Chicago/Turabian Style

Zheng, Weimin, Senyuan Pang, Ning Liu, Qingwei Chai, and Lindong Xu. 2023. "A Compact Snake Optimization Algorithm in the Application of WKNN Fingerprint Localization" Sensors 23, no. 14: 6282. https://doi.org/10.3390/s23146282

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop