Joint Light-Sensitive Balanced Butterfly Optimizer for Solving the NLO and NCO Problems of WSN for Environmental Monitoring

Existing swarm intelligence (SI) optimization algorithms applied to node localization optimization (NLO) and node coverage optimization (NCO) problems have low accuracy. In this study, a novel balanced butterfly optimizer (BBO) is proposed which comprehensively considers that butterflies in nature have both smell-sensitive and light-sensitive characteristics. These smell-sensitive and light-sensitive characteristics are used for the global and local search strategies of the proposed algorithm, respectively. Notably, the value of individuals’ smell-sensitive characteristic is generally positive, which is a point that cannot be ignored. The performance of the proposed BBO is verified by twenty-three benchmark functions and compared to other state-of-the-art (SOTA) SI algorithms, including particle swarm optimization (PSO), differential evolution (DE), grey wolf optimizer (GWO), artificial butterfly optimization (ABO), butterfly optimization algorithm (BOA), Harris hawk optimization (HHO), and aquila optimizer (AO). The results demonstrate that the proposed BBO has better performance with the global search ability and strong stability. In addition, the BBO algorithm is used to address NLO and NCO problems in wireless sensor networks (WSNs) used in environmental monitoring, obtaining good results.


Introduction
Sensor networks play a vital role in the study of intelligent environmental monitoring systems [1,2].Node localization optimization (NLO) and node coverage optimization (NCO) are important problems in WSNs [3][4][5][6], which are the core component of the Internet of Things (IoT) for intelligent management.The emergence of SI optimization algorithms provides novel approaches for many practical optimization problems that are difficult to solve.At present, the global positioning system (GPS) and Beidou navigation system of China can accurately locate the target; however, certain places, such as indoor locales, dense forests, mountains, caves, and underwater situations, satellite positioning technology cannot precisely locate the target due to the interference or even shielding of the signal by the obstruction.Thus, there is great significance involved in studying the NLO and NCO problems in the context of WSNs, along with substantial challenges.Recently, swarm intelligence (SI) optimization algorithms have been widely used in WSN node deployment, positioning, routing, and other problems [7][8][9].It is worth noting that several heuristic algorithms have been proposed based on the social behavior and physiological characteristics of butterflies.
There are a great many species of butterflies [10][11][12], most of which rely on scent perception for foraging and mating; others have strong visual sensitivity, and rely on their vision for foraging [13].In past studies, researchers have been inspired by the inherent characteristics of butterflies, including behaviors such as migration, flight, foraging, and mating.Several swarm intelligence algorithms have been inspired by these behaviors of butterflies, including monarch butterfly optimization (MBO) [14], artificial butterfly optimization (ABO) [15], butterfly optimization algorithm (BOA) [16], and more.MBO is an optimization algorithm proposed by designing a search strategy based on the migration characteristics of monarch butterflies.The ABO algorithm designs the butterfly's flight strategy solely from the artificial point of view, then divides the butterfly population into two categories and updates their positions during flight using the relative position.The BOA established an odor foraging model of butterflies; however, it cannot solve all 23 CEC benchmark functions [17,18].The reason for this is that the odor model generates negative numbers for certain problems, which biases the search range of individuals and leads to optimization with imaginary numbers for certain benchmark functions.
Aiming at the shortcomings of BOA-based modeling and inspired by the literature [19], a novel smell-and light-sensitive balanced butterfly optimizer (BBO) is proposed in this paper, distinguished by a simple structure and conforming to the characteristics of actual butterfly behaviors.The global and local search strategies of the BBO are inspired by the natural characteristics of different species of butterflies.First, different species of butterflies have light-sensing characteristics, which should be considered because their visual function is better than their odor function.Second, the smell perception of butterflies is used in the process of foraging or courtship, and the corresponding odor value from the mathematical point of view is positive.Therefore, the absolute value of smell characteristics is introduced to ensure the rationality of the proposed BBO algorithm.The main contributions of this study are summarized from the above motivation as follows: • According to the smell perception and light perception characteristics of actual butterflies in nature, a novel balanced butterfly optimizer (BBO) is proposed.Inspired by the physical properties of individuals, the search strategy is designed to avoid falling into local optima.

•
The superiority of the BBO is verified by numerical optimization experiments on all 23 CEC benchmark functions, then the results are compared with a variety of advanced SI algorithms.

•
The NLO and NCO problems of WSNs in IoT contexts are modeled; the proposed BBO is used to address these problems, showing better performance than several well-known SI algorithms.

Related Works
Among the existing swarm intelligence algorithms, the Firefly algorithm (FA) [20] is a typical SI method inspired by the photosensitivity characteristic of fireflies in nature.The fruitfly optimization algorithm (FOA) [21] is another typical SI algorithm that uses the social behavior of fruit fly odorant foraging and updates individual positions by smell.In addition, FA [22] and FOA [23] have been applied to the NLO problem of WSNs.Moreover, it is worth noting that the classic intelligent algorithms include GA [24], PSO [25], DE [26], FA [20] and GWO [27], among others [28][29][30][31].DV-Hop localization is a classic non-ranging positioning algorithm; its principle is a distributed positioning method via distance vector hopping and positioning.Kanwar et al. [32] proposed an optimized DV-Hop localization method for sensor node displacement in WSNs using the PSO algorithm.Ouyang et al. [33] proposed an improved GA to optimize the node DV-Hop localization optimization algorithm for the NLO issue.However, the location accuracy of the above methods needs to be further enhanced.
Traditional WSN node localization technologies are mainly categorized into rangebased location [34] and range-free location approaches [35].The typical range-based location approaches use the received signal strength indicator (RSSI) [36], the time of arrival/difference of arrival (TOA/TDOA) [37,38], the angle of arrival (AOA) [39], etc.The typical range-free location approaches include centroid localization (EL), weighted centroid localization (WCL) [40], DV-Hop [32], multidimensional scaling (MDS) localization [41], approximate point-in-triangulation (APIT) localization [42], etc.It is worth noting that the range-based location approaches have higher positioning accuracy than those without ranging, while those without ranging have lower cost, lower power consumption, stronger resistance to measurement noise, and simpler hardware equipment.It is particularly important to note that as long as a range-free location alogorithm can meet the accuracy needs of the application it is generally preferable.A brief summary of NLO and NCO problems using SI algorithms is detailed in Table 1.DV-Hop is a distributed localization algorithm that uses the routing and positioning of the distance vectors of nodes.It is popular due to its simplicity and low equipment requirements.SI algorithms have proven particularly effective when applied to the optimization of traditional localization algorithms.Shi et al. [43] proposed a modified PSO-DV-Hop method and used a path-matching strategy for searching the shortest path between anchor nodes and independently determining the distance of the average hop from unknown nodes to target anchors.Han et al. [44] used the DE algorithm combined with a weighted DV-Hop method in which the second step of the weighted DV-Hop algorithm used the average hop distance, then the location of unknown nodes was optimized by the DE.Zhang et al. [45] used an enhanced sparrow search algorithm (SSA) to optimize the DV-Hop localization method through a multi-hybrid strategy to improve the SSA and a dual communication radius method to modify the minimum number of hops between nodes while reducing the estimated distance error.In [46], a modified DV-Hop was proposed with an enhanced squirrel search algorithm, which was utilized to estimate the distance from unknown nodes to anchor nodes.
The optimization of node coverage plays a crucial role in improving the capabilities of the WSN work area.Notably, SI algorithms have played a significant role in the NCO problem for WSNs.Yang et al. [47] solved the sensor coverage problem with improved FA taking into account the target coverage and network node connectivity.A resampled PSO method was proposed by Wang et al. [48], which was utilized to optimize the node coverage control of WSNs in the IoT context.There are two optimization algorithms inspired by wolf packs which have been used to address the NCO issue.The first is the GWO-EH algorithm [49] and the other is the wolf pack algorithm (WPA) [50] coupled to the coverage-oriented method.Zhang et al. [51] proposed a node coverage optimization method via the hybrid HPSBA using different simulation areas.Quite successful results have been achieved by the aforementioned SI approaches; however, avoiding local optima remains difficult for a number of challenging problems, making the study of novel heuristic algorithms both necessary and significant.
The above summary describes the use of different kinds of SI algorithms to address the NLO and NCO problems of WSNs.Regardless of whether two-dimensional or threedimensional positioning is used for the NLO, shortcomings such as insufficient positioning accuracy and low positioning efficiency are encountered.This study proposes the novel BBO algorithm combined with DV-Hop and applies it to the WSN node localization problem.In addition, the proposed BBO algorithm is used to address the NCO problem in WSNs to modify the node coverage ratio.Notably, the proposed BBO can be used to solve other optimization problems as well.

Node Localization Optimization (NLO) Problem in WSNs
Anchors and unknown nodes are crucial for the NLO problem in WSNs.Anchor nodes are installed with GPS positioning devices, and their coordinates can be known through satellite positioning.The cost and energy consumption of anchor nodes is usually much higher than that of ordinary sensor nodes.The localization method is to locate and optimize the position of an unknown node through an anchor node with a known location.The description of the NLO problem is as follows: (1) there are m anchors with known positions and n unknown nodes with undetermined positions; (2) it is assumed that the anchors and unknown nodes of the sensor network are distributed on the L × L two-dimensional plane and that the nodes are randomly and uniformly distributed; (3) the measurement distance error conforms to a normal distribution and the measurement distance is d ij , meaning that we have where d ij denotes the real distance from node i to node j, the distribution of ε is σ(0, 1), and τ is the error factor.The typical DV-Hop approach without range-based positioning [32] includes three steps: calculating the minimum number of hops (MNH) between anchors; calculating the estimated distance from anchors to unknown nodes; and calculating the unknown node coordinate position.The steps of the basic DV-Hop algorithm can be summarized as follows.
In Step 1, the MNH is calculated through the flooding process, in which the anchors broadcast information to each node of the WSN, then the MNH between the unknown nodes and anchor nodes is calculated, as well as the MNH between the anchor nodes themselves, with each communication representing a hop.
In Step 2, the mean distance per hop Hop i of each anchor node and the estimated distance d u,i are calculated using Formulas (2) and (3), respectively: where (x i , y i ) represents the position coordinates of anchor node i, (x j , x j ) represents the position coordinates of anchor node j, h i,j denotes the MNH from anchor node i to node j, and estimated distance d u,i from anchor node i to unknown node u is formulated as follows: where h u,i represents the MNH from unknown node u to anchor node i.
In Step 3, the fitness function of the node localization optimization algorithm is calculated using Formula (4): where (x u , y u ) represents the estimated position coordinates of the u-th unknown node, (x i , y i ) denotes the position coordinates of the i-th anchor node, d u,i denotes the estimated distance from unknown node u to anchor node i, and m is the number of anchor nodes.

Node Coverage Optimization (NCO) Problem in WSNs
Assuming that the simulation work area is a two-dimensional space and the side length is L, there are n detection points that need to be perceived within the sensing radius of the sensor nodes; we use R s and R c to denote the sensing radius and communication radius, respectively.The Euclidean distance d(i, s) between sensor nodes and target points can be calculated as follows: where (x i , y i ) denotes the position coordinate of the i-th target point and (x s , y s ) denotes the position coordinates of sensor node s.The coverage probability p using the binary perception model [51,52] from sensor node s to target node i is According to the binary perception model, the x-axis and y-axis of the two-dimensional deployment area can be divided into a step length q, that is, each segment length is l = q with an intersection q 2 of the node deployment area.The deployment node coverage rate of the work area is According to the binary perception model and calculation of the node coverage rate of the NCO problem, the mathematical model of this problem can be summarized as a constrained optimization task with four constraints, defined as follows: where p(i, s) denotes the probability of sensing nodes s covering and monitoring target nodes i, q 2 is the intersection of the node deployment area, d(i, s) is the Euclidean distance from sensor node s to the target monitored node i, R s indicates the sensing radius of the sensor node, M denotes the number of deployment nodes in the work area by the node-aware range in theory (that is, the sum of the node's sensing range is equal to the simulation work area), and S represents the sensor node number in the monitoring area, which is greater than or equal to the theoretical number of nodes M.

Theory of the Balanced Butterfly Optimizer (BBO)
The BBO is inspired by the influence of both smell and light signals on the foraging process of butterflies.In addition, it is considered that butterflies are photosensitive and that the smell value is generally positive.The specific algorithm modeling processes are population initialization and individual smell and light perception characteristics, which correspond to global and local search, respectively.

Algorithmic Population Initialization
Assuming that the search space is Dim-dimensional, the expression of the initial position of the population is where X i,j represents the individual initial position denotes the number of initial solutions, Dim denotes the dimension of the problem, UB i,j is the upper boundary value of the search space, LB i,j is the lower boundary value of the search space, and rand i,j represents a random value in (0, 1).

Modeling of the Odor-and Light-Sensitive Properties of Butterflies
In nature, there are many kinds of animals with smell perception, butterflies being a typical one; however, different butterfly species have different characteristics.Common butterflies are generally smell-sensing, while light-sensing butterflies mainly include Vanessa Indica [53], Swallowtail [54], and similar varieties; three of these butterfly species shown in Figure 1.Researchers have proven through experiments that these butterflies are affected by both olfactory and visual signals during foraging [55].Thus, in the design of heuristic algorithms, mathematical modeling based on the conclusions of corresponding biological experiments should be more reasonable and competitive.(1) Smell-Sensitive Properties The smell-sensitive properties of butterflies taking into account the exponential diffusion form of odors can be defined as follows: where Smell i represents the smell in the search process, which must be positive in practice and is represented by an absolute value, F i denotes the fitness value obtained by the objective function, rand denotes a random value in (0, 1), α indicates the smell index, which has a value range pf (0.1, 0.6), and eps represents a non-zero infinite decimal, which prevents the smell value from becoming zero during the search process.
(2) Light-Sensitive Properties The light-sensitive properties of butterflies are affected by the distance between individuals and their food sources or between multiple individuals, which can be defined as follows: where Light i denotes the light sensitivity of butterflies and Light 0 is the initial light sensitivity value, which is set to 1.The light-sensing distance D ij between the searched individual and the food source (or adjacent individuals) can be expressed as

Algorithmic Exploitation
The switching probability (sp) is a control parameter between global and local search in the BBO.In nature, there are more butterfly species that rely mainly on scent for foraging or mating than that forage using light.According to this cognitive law, the value of the parameter sp is set to 0.6 in this study.Two search strategies are considered in this study for the proposed algorithm; the best individual is used to choose a search strategy, with the mean position taken into consideration.For sp > rand, meaning that smell-sensitivity is the main search strategy in this stage, the definition is as follows: where X t i represents the current position of the individuals, rand is a random number in (0, 1), C denotes a hyperparameter, which can be set to a random number between (0, 1) or to a constant, G t best,i is the best individual's search position, and Smell i is the smell sensitivity value in the search process.Alternatively, when light-sensitive is the main search strategy, the position of the individual is updated by where X t j and X t k respectively represent the food source and neighboring individuals of the t-th iteration, rand is a random value in (0, 1), and Light i denotes the light sensitivity value in the search process.

Algorithm Computational Complexity Analysis
Different test platforms lead to differences in optimization time consumption for the same optimization method, meaning that the structure of the proposed BBO, that is, the computational complexity, must be analyzed taking this into account.The assumptions are as follows: N indicates the population size of the proposed algorithm, T represents the maximum number of iterations of the algorithm, and D is the dimension for the optimization problem.The computational complexity of the BBO can be summarized as follows: the initialization complexity of the population is O(ND), the fitness computational complexity is O(ND), the sensitivity selection computational complexity is O(N 2 logN), and the location update of global and local search complexity is O(N 2 logN).In addition, the complexity of the fitness sorting during the iteration of the algorithm is O(N 2 ).Thus, the total computational complexity of BBO is  The main BBO pseudo-code showing the basic operation process is presented in Algorithm 1.

Algorithm 1: Pseudo-code of BBO
Input: The number of individuals NP, the problem dimensional Dim; and the maximum iterations T max .Output: Optimal solution and fitness of the agent.Initialization: The position X of the population, and calculate the fitness F of the initial X. while t = 1 : T max do for i = 1 : NP do Update the individual's smell perception value using Equation (10).for j = 1 : Dim do Update the light perception value and distance between individuals using Equation (11) and Equation ( 12

Analysis of the Numerical Optimization Results
The benchmark functions of the optimization experiment were the CEC function from [17,18], which includes a total of 23 functions, of which F1 to F7 are unimodal functions, F8 to F13 are multimodal functions, and F14 to F23 are fixed-dimensional functions; the corresponding categories are U, M, and Fixed, respectively.Detailed descriptions of all 23 functions are provided in Table 2.The experimental environment was a Windows 10 system with an Intel(R) Core (TM) i5-10210U CPU @2.11 GHz, 16 GB memory, and the Matlab 2018a platform.

Hyperparameter Settings for the Comparison Methods
In this study, 23 benchmark functions were used to verify the performance and effectiveness of the proposed BBO using a random number in (0,1) for the parameter C. BBO was compared with the PSO [25], DE [26], GWO [27], ABO [15], BOA [16], HHO [56], and AO algorithms [30].In addition, the proposed BBO was used for the NLO and NCO problems of WSNs in order to prove its practical applicability.The hyperparameter settings used for the comparison algorithms are presented in Table 3.The code of BBO is released at https://www.researchgate.net/profile/Mengjian-Zhang/research.

Methods
Value Each test benchmark function consisted of 30 independent runs and the T max for the optimization process was set to 1000.The evaluation of the compared SOTA methods included the mean (Mean) and standard deviation (Std) along with the Ranking, as shown in Table 4.Moreover, Table 5 shows the Wilcoxon rank-sum (WSR) test results among the comparison algorithms using a significance level of α = 0.05.

Analysis of Benchmark Function Results
The 2D optimization process of the BBO algorithm for certain test functions (TF1, TF4, TF10, and TF23) was described through a visual experiment.The main aim was to qualitatively observe the behavior of the BBO.The shape of the test function, the search history, and the convergence curves of individuals are shown in Figure 3.The search history presents the location history of individual butterflies during an optimized search process.The convergence curve shows the target value of the optimal obtained in each iteration.
The individuals' search history position in Figure 3 shows that there is a gradual approach to the optimal position during the optimization process.This ensures that the BBO continues to explore and exploit the search space, eventually converging to an optimal point.Compared with the convergence curves for the ABO and BOA in Figure 3, the BBO enhances the initial random population on the test function and ideally improves the accuracy of the approximate optimal value during the iterative process.
Table 4 shows the optimization results of eight comparison algorithms, including a statistical analysis of the Best, Mean, and Ranking of the comparison methods via the statistical results.Here, Best reflects the optimal searchability of BBO for solving numerical optimization problems; the closer the search value is to the value in theory, the better the search performance of the considered approach.The optimization results of the four high-dimensional test functions that reach the theoretical optimal value are TF1, TF3, TF9, and TF11.From the Mean in Table 4, it can be seen that the results of BBO on eight test functions are better than those of the other algorithms, while on nine test functions the optimization results of BBO have the same optimal value as the comparison algorithms.Moreover, the Std objectively shows the stability of the compared methods for solving numerical optimization problems.The results indicate that BBO has high stability and strong generalization ability for numerical optimization problems.From the statistical results of the Friedman test in Table 4, the order of the eight comparison algorithms for the 23 CEC functions is Notably, the optimization results for the BOA on test functions TF8, TF16, TF19, and TF20 are marked NAN.The reason for this is due to the insufficient design of the BOA.The odor perception value of actual butterflies is positive, and the BOA does not take this into account.It is worth noting that this is a crucial motivation behind our proposed BBO algorithm.In the proposed BBO, the individual's smell perception value is positive; thus, there is no NAN in the optimization result value.

Analysis of the NLO Problem Results
The BBO algorithm was used to optimize DV-Hop to address the deficiency of the least squares method for the WSN NLO problem.The BBO-DV-Hop localization optimization method obtained better localization accuracy of an unknown node.The anchor nodes were deployed first, then BBO-DV-Hop was utilized to locate the unknown node's position based on the known coordinates of the anchor nodes.The pseudo-code of the NLO problem via the BBO-DV-Hop algorithm is provided in Algorithm 2.
anchor node and a blue "o" indicating an unknown node.Five comparison algorithms were used to demonstrate the effectiveness of the proposed BBO on the NLO problem in WSNs: PSO, GWO, ABO, BOA, and BBO.Notably, ABO, BOA, and BBO are all inspired by the behaviors of butterflies.The parameters of the comparison methods are shown in Table 3.The maximum iteration T max for solving the NLO problem was set to 200.From Figure 4, the positions of unknown nodes can be calculated from the known positions of the anchor nodes.The initial anchor node positions directly affect the positioning of the entire node structure, with uniform anchor node positions resulting in a uniform deployment network.In Figure 4a, it can be seen that the network is affected by anchor nodes; local nodes are stacked or located too close together, leading to redundant nodes during the networking process.Although the network nodes in Figure 4b have good connectivity, there are a small number of local nodes.In the upper right corner of Figure 4b only two nodes are connected, leading to the loss of node information.Therefore, in node localization the positions of the initial anchor nodes need to be fully considered; certain movable nodes can be deployed among the unknown nodes for greater robustness, thereby improving the overall life and anti-interference ability of the WSN.From Figure 5, it can be seen that in terms of the convergence and speed of the compared localization algorithm the order is BBO > ABO > BOA > GWO > PSO.The location error curve of BBO-DV-Hop in the region is relatively smooth after about twenty iterations, which suggests that the proposed BBO-DV-Hop is not likely to fall into local optimal values and has good global convergence ability.On the other hand, the location errors of the PSO and GWO algorithms are relatively high, and gradually become stable after 20 iterations, which indicates that the performance of the proposed BBO-DV-Hop needs to be further modified.The BOA shows large fluctuations before 100 iterations, which suggests that the stability of the BOA needs to be enhanced.In general, while the use of SI algorithms to optimize the NCO problem is a research direction that has received much attention, not all of these algorithms are effective.In actual node positioning deployment, the relocation and the second positioning of mobile nodes could be considered, and design and research could be carried out in combination with optimization algorithms.In addition, considering the effects on the location of unknown nodes of the number of deployed nodes, rate of anchor nodes, and communication radius, three sets of experiments were designed to compare BBO to PSO, GWO, ABO, and BOA. Figure 6 shows the results of the three experimental parameter settings.
In Figure 6a shows the experimental results for an anchor node rate of 20%, communication radius R a of 30 m, and total number of nodes of 80, 100, 120, 140, 180, and 200.The results show that the trend of LE curves for the compared algorithms is essentially the same.The results obtained with the PSO algorithm fluctuate greatly when the number of nodes is 120 or 140; on the other hand, the BBO algorithm proposed in this study has stable performance, and its LE is the smallest among the compared algorithms.
From Figure 6b, it can be seen that when the number of nodes is 100 and the communication radius R a is 30 m, the anchor point rates are 15%, 20%, 25%, 30%, 35%, 40%, and 45%, respectively, in the node localization optimization simulation experiment.The results show that the LE curves of the compared algorithms are essentially the same.The LE decreases with an increasing anchor node rate, demonstrating that a higher number of anchor nodes allows for more accurate positioning of the unknown nodes.Among the compared algorithms, the location error of PSO is essentially unchanged for anchor node rates of 20%, 25%, and 30%.The proposed BBO algorithm has stable performance, and its location error is the smallest among the compared algorithms.
Figure 6c shows the results of the simulated node localization optimization experiments when the number of nodes is 100, the anchor node rate is 20%, and the communication radius R a is 20 m, 25 m, 30 m, 35 m, 40 m, 45 m, and 50 m.These results show that the LE curves of the compared algorithms are essentially the same.The location error decreases with the increase in the anchor node communication radius when R a is less than or equal to 30 m.Moreover, the location error shows an overall upward trend when R a exceeds 30 m. Again, the proposed BBO algorithm has stable performance and its LE is the smallest among the comparison algorithms.

Analysis of the NCO Problem Results
To verify the effectiveness of the BBO with the parameter C = 1 for solving the NCO problem, we used a deployment area of 100 m × 100 m in the simulation experiments and we performed the following experiments: (1) by randomly deploying 40 and 45 nodes with sensing radius R s = 10 m and communication radius R c = 20 m, we analyzed the coverage optimization performance of BBO over different numbers of iterations using both the time and coverage; (2) BBO's performance when deploying a different number of nodes was analyzed using random deployment of nodes with sensing radius R s = 10 m and communication radius R c = 20 m over 100 iterations; (3) through random deployment, BBO's performance with a different communication radius was analyzed with 20 nodes over 100 iterations.The pseudo-code of the NCO problem based on the BBO algorithm can be seen in Algorithm 3. Calculate the node coverage rate using Equation (7).for i = 1 : NP do Update the individual's smell perception value using Equation (10).for j = 1 : N do Update the light perception value and distance between individuals using Equation (11) and Equation ( 12 7, when the number of nodes is 40 and the sensing radius is 10 m, the coverage results based on the BBO algorithm corresponding to 100, 150, 200, and 500 iterations are 95.79%,96.62%, 96.67%, and 96.99%, respectively.The time consumption of the best position of the output node is 17.17 s, 24.48 s, 31.50 s, and 79.56 s, respectively.The coverage and time consumption of nodes show an increasing trend.The coverage of the points increases by 0.82%, 0.05%, and 0.32%, respectively, year-on-year, while the year-on-year time consumption increases by 7.32 s, 7.01 s, and 48.06 s, respectively.When the number of nodes is 45 and the sensing radius is 10 m, the coverage optimization results based on the BBO algorithm corresponding to 100, 150, 200, and 500 iterations are 97.76%,98.50%, 98.56%, and 98.82%, respectively.The time consumption of the best position of the output node is 21.87 s, 28.38 s, 37.29 s, and 86.35 s, respectively.The coverage and time consumption of nodes show an increasing trend.The year-on-year coverage of the points increases by 0.75%, 0.06%, and 0.26%, respectively, while the year-on-year time consumption increases by 6.51 s, 8.91 s, and 49.06 s, respectively.Based on the two scenarios with the same number of iterations, when the number of nodes increases, the node coverage optimization of BBO is significantly improved, although the time consumption is increased.From Table 8, it can be seen that when the sensing radius is 10 m and the deployment area is 100 m × 100 m, the coverage optimization results based on the BBO algorithm correspond to a node coverage of 95.79%, 97.76%, and 98.29% for 40, 45, and 50 nodes, respectively.The time consumption of the best node position is 17.17 s, 21.87 s, and 25.83 s, respectively.The coverage is 1.96 percentage points higher with 45 nodes than with 40 nodes, and is 0.54 percentage points higher with 50 nodes than with 45 nodes.The year-on-year time consumption increased by 4.70 s and 3.96 s, respectively.In addition, these results show that the optimized coverage is significantly improved when the number of deployment nodes is increased within a certain range.The coverage growth is slow until saturation when the number of nodes is increased in transition.Table 9 shows that when the deployment area is 100 m × 100 m with 20 deployment nodes, the coverage rates obtained with BBO corresponding to a sensing radius of 13 m, 14 m, and 15 m are 91.67%,97.15%, and 99.38%, respectively.The time consumption of the best position of the output node is 6.07 s, 6.13 s, and 5.67 s, respectively.The yearon-year node coverage of the points increases by 6.48% and 2.23%, respectively.The time consumption of the BBO algorithm for node position optimization is less sensitive to the change in the sensing radius, especially when the perception radius is 15 m, and the simulation time consumption decreases by 0.46 s year-on-year.In addition, these experimental results show that when the number of nodes is fixed, an increase in the sensor radius increases coverage and decreases time consumption.Thus, when the deployment area is the same and the sensing radius is excessively large, the number of deployment nodes should be reduced.To assess the superiority of the proposed BBO algorithm for solving the NCO problem, we selected four SI algorithms as comparison methods namely, PSO, GWO, ABO, and BOA, as well as DSA [29] and two improved butterfly optimization algorithms, HPSBA [51] and FBA [19].The simulation parameters for the node coverage optimization problem were as follows: the deployment area was 100 m × 100 m, the number of deployment nodes was 20, and the number of iterations was set to 100.The results on the NCO problem with a changing sensing radius (13 m, 14 m, 15 m) are shown in Table 10.Table 10 shows that for a sensing radius of 14 m, the results with the proposed BBO are significantly better than with the compared methods.The coverage rate of BBO is 91.67%; when the sensing radius is 13 m or 15 m, the coverage rate for the NCO problem achieved with BBO is higher than that achieved with the other algorithms.The performance of BBO in solving the NCO problems is significantly modified, which indicates that it has high application significance.Compared with the BOA, the node coverage rate of BBO with a sensing radius R s of 13 m, 14 m, and 15 m increased by 13.40 percentage points, 12.11 percentage points, and 8.18 percentage points, respectively.In addition, Figures 7 and 8 show the coverage curves for node coverage optimization achieved by the compared algorithms (PSO, GWO, ABO, BOA, DSA, HPSBA, FBA, and BBO).

Conclusions
In this paper we propose a novel algorithm, BBO, inspired by the fact that butterflies have both smell-sensitive and light-sensitive characteristics.We respectively translate these smell and light-sensitive characteristics into the local and global search strategies of the proposed algorithm.In addition, the value of an individual's smell-sensitivity is positive, which is a point that cannot be neglected.Our results show that the proposed BBO has better performance in terms of global search capability and stability than other algorithms used for comparison.In addition, our simulation results indicate that the BBO-DV-Hop localization optimization algorithm proposed in this study has good stability and accuracy on the NLO problem for WSNs.The proposed BBO has superior performance on the NCO problem as well.In both cases, the position of the initial anchor nodes needs to be fully considered in order to ensure the robustness of the network after positioning.In future studies, certain movable nodes can be deployed as unknown nodes to improve the overall lifetime and anti-interference ability of the WSN.
The performance of the proposed BBO can be enhanced to solve high-dimensional optimization problems.In-depth study could lead to more effective improvement strategies which can be applied to engineering optimization, IoT, feature selection, and more.Among these applications, node deployment, routing, dynamic networking optimization, and other problems involving WSNs [57,58] can be solved by SI optimization algorithms.Currently, research on 3D WSNs is a hot topic, with contexts including 3D space, underwater scenarios, complex mountains, forest fire monitoring, and more.

) 4 . 5 .
Flowchart and Pseudo-Code of BBO The flowchart of BBO is presented in Figure 2.There are three main stages of BBO, introduced as follows: Stage 1 represents population initialization and the selection of initial optimal position and fitness values; Stage 2 includes search strategy selection and the process of optimizing the algorithm; and Stage 3 involves selecting the best population of individuals based on the fitness values during the optimization process.The best solution and fitness value are then output after T max iterations.

Figure 2 .
Figure 2. The flowchart of the proposed BBO.

Figure 3 .
Figure 3. Individual historical positions with two-dimensional coordinate and convergence curves of the search process.

Figure 4 .
Figure 4. Schematic of initial node localization optimization and connectivity.

Figure 5 .
Figure 5.Comparison curves of the location error of the compared SI algorithms over 200 iterations.

Figure 6 .
Figure 6.Results of location errors (LE) with different experimental parameters: (a) different number of nodes; (b) different anchor node rate; and (c) different communication radius.

Algorithm 3 :
Pseudo-code of BBO for the NCO problem Input: The hyperparameters of BBO algorithm, and the maximum iterations T max .Output: Optimal positioning coordinates of deployment nodes and best coverage rate.Initial: Total deployment nodes N, node sensing radius R s , and node communication radius R c .while t = 1 : T max do

Figure 7 .
Figure 7. Schematic of node deployment optimization with different SI algorithms.

Figure 8 .
Figure 8. Node coverage rate curves of the compared SI algorithms over 100 iterations.

Table 1 .
A brief summary of NLO and NCO problems using SI algorithms.
Determine whether the updated individual position X exceeds the boundary constraint.Update the best fitness f best corresponding to the best position G best of the individual.

Table 2 .
Descriptions of the 23 benchmark functions.

Table 3 .
Hyperparameter settings used for the comparison methods.

Table 4 .
Means and standard deviations of the compared SI methods for all 23 functions.

Table 5 .
Results of WSR test for the compared SI methods.

Table 6 .
Simulation parameter settings for the NLO problem.

Table 7 .
Coverage with different numbers of iterations.

Table 8 .
Node coverage rate with different number of deployment nodes.

Table 9 .
Node coverage rates with changes in the sensing radius.

Table 10 .
Comparison of algorithms on the NCO problem with a changing sensing radius.