Application of improved black hole algorithm in prolonging the lifetime of wireless sensor network

Sensor technology is developing rapidly and up to date. The lifetime of the Wireless Sensor Network (WSN) has also attracted many researchers, and the location of the Base Station (BS) plays a crucial role in prolonging the lifetime. The energy consumption in the WSN occurs during transmission of data and selection of cluster-head nodes. A reasonable location of the BS prolongs the lifetime of the WSN. This study proposes a Levy Flight Edge Regeneration Black Hole algorithm (LEBH) to speed up convergence and enhance optimization capabilities. The performance of LEBH and other heuristic algorithms are compared on CEC 2013. The result shows that the LEBH outperforms other heuristics in most cases. In this study, the energy consumption and WSN models are simulated. Subsequently, the proposed LEBH is combined with relocation technology to change the location of the BS to prolong the lifetime. Simulation results show LEBH-BS prolongs the lifetime of the WSN better than random-base and static-base stations and other heuristic algorithms in most cases.


Introduction
Optimisation problems, especially NP problems, are becoming more complex. Heuristic algorithms solve NP problems better than other algorithms. The no-free-lunch theorem has proven that for any problem, there is no optimal algorithm, only the most suitable algorithm [1,2]. To keep up with the development of the epoch, different heuristic algorithms were proposed to solve various optimisation problems. The earliest heuristic algorithm is the genetic algorithm (GA), which optimises the problem by imitating the crossover and mutation process of chromosomes in the biological genetic process [3]. In 1992, Dorigo proposed the ant colony optimisation (ACO) algorithm, which was inspired by the behaviour of ant  [4]. In 1995, Dorigo proposed the particle swarm optimisation (PSO) algorithm, which is the most widely used heuristic algorithm [5]. Between 2003 and 2016, Li Xiaolei, PAssino, Karaboga, Yang, Hatamlou, Mirjalili, Lewis and others successively proposed artificial fish swarm algorithm (AFSA) [6], bacterial foraging algorithm (BFA) [7], artificial bee colony (ABC) [8], firefly algorithm (FA) [9], black hole (BH) [10], bat algorithm (BA) [11], grey wolf optimisation (GWO) [12], ant lion optimisation (ALO) [13], and whale optimisation algorithm (WOA) [14]. In 2019, Weiguo Zhao was inspired by the coordinated symbiosis between various organisms in the artificial ecosystem and proposed an artificial ecosystem-based optimisation (AEO) [15]. In 2020, Fathollahi-Fard was inspired by the unusual mating behaviour of red deer and proposed the red deer algorithm (RDA) [16]. In 2020, Mirjalili was inspired by the changes in the sine and cosine functions in mathematics and proposed the sine-cosine algorithm (SCA) [17]. These algorithms are used to solve various problems in life [18][19][20].
The BH was proposed by Hatamlou based on the characteristics of black holes [10]. The black hole can swallow all the matter around it. Stars entering within the radius of the black hole are swallowed. According to this phenomenon, the BH takes the black hole as the global optimal solution of each iteration, and stars as the individual iteration. The BH has attracted several scholars'attention due to its simple structure [21][22][23]. Salih used BH to train convolutional neural network (CNN) to avoid local minimum traps, thereby improving the performance of CNN [24]. Existing feature selection methods need large amount of calculation. Pashaei proposed a binary BH to solve it [25]. Pashaei embedded the BH into the particle swarm algorithm, and applied it to medical gene selection technology [26].
The WSN effectively collects the information and transmits them to the BS for data analysis. The WSN has been applied to many scenarios, such as forest fire monitoring [27] and coal mining industry [28].The WSN is composed of BS, cluster-head nodes, anchor nodes, and ordinary nodes. Each node is composed of a receiver, controller, transmitter, memory, and battery. The energy of a node is usually limited, and in the form of a battery. However, it is very difficult to replace the battery in some extreme situations such as deep mountains, forests, deep waters, and alpine ice fields. Currently, the nodes under extreme conditions are broadcast by airplanes or warships, and are not replaced after the broadcast until the power is exhausted [29]. Therefore, prolonging the lifetime of the WSN is a crucial research topic [30][31][32].
Nodes consume energy when they receive and transmit information. The distance between BS and every node is a key factor of the energy consumption [33,34]. The position of the BS is crucial in prolonging the lifetime. Therefore, dynamically adjusting the best location of the BS according to the networking situation is a effective manner to prolong the lifetime [35,36].
Akkaya referred to static positioning and other studies and introduced the dynamic scheme of relocating the BS during network operation. Dynamic base station positioning could effectively optimises network functions [37]. Osama proposed a new method to organise network and used the harmony search algorithm to relocate the BS to prolong the life of the WSN [38]. Pant proposed adaptive convergence and relocation methods (AST-EASR) to maximise the network lifetime of WSN [39]. Cayirpunar proposed that some nodes dissipate their energy sub optimally. Thus, the farther node transmits part of its data to a longer distance to reduce the burden of the node closer to the BS [40].
The remainder of this paper is organised as follows. The next section presents the related work. The subsequent section presents the energy consumption and simulation application models followed by which the improvement process of the LEBH is presented. Then the application of the LEBH to simulation application model is presented. The final section concludes the paper.

Related work
The BH and related studies of relocating the BS to prolong the lifetime of the WSN is presented in this section.

Black hole algorithm
The BH is a population-based optimisation algorithm [10]. It has several similarities with other algorithms. For example, in GA, the update of the optimal solution is generated through crossover and mutation [3]; in GWO, the update of the optimal solution is generated by the head wolf [41]. When other grey wolves find a better position than the head wolf, the original head wolf is replaced [12]. The BH is an extension of the PSO. In the BH, the position of the black hole is regarded as the best solution and each star is regarded as a particle. When the algorithm is initialised, several particles and a black hole position are randomly generated. In each iteration process, each particle is affected by gravity of the black hole and gradually moves to it. When a particle enters the range of the black hole, the particle is swallowed and a random particle is regenerated. The black hole position will be replaced when BH find a better position.
In the BH, each particle is regarded as a candidate solution. The fitness values of particles are calculated in each iteration. The best position of black hole represents the best solution. During each iteration, the particles move to the black hole according to Formula (1).
where X g+1 i represents the position of the ith star at the g+1 iteration, and X g i represents the position of the ith star at the g iteration. X B H indicates the location of the black hole. N indicates the total of candidate solutions.
During the movement process, if the particle finds a better position, the particle position replaces the original black hole position to become a new black hole; other particles move to the new black hole position in the next iteration. If the particle reaches the black hole's swallowing radius, the particle is swallowed. To keep the number of particles unchanged, the particle is randomly regenerated. The black hole radius is related to the fitness values of particles and is calculated by Formula (2).
where f itness(B H) represents the fitness value of the black hole. f itness(i) represents the fitness value of the ith particle.
The implementation process of the BH is shown in Algorithm (1).

Related work of prolonging the lifetime of WSN
In [38], it is proposed that energy consumption mainly occurs during the information transmission process between the anchor node and BS; the location of the BS determines the degree of energy consumption. Anchor nodes are grouped according to a routing protocol. A heuristic algorithm of harmony search is used to locate the BS. The simulation experiment proves that the relocation of the BS has a longer lifetime than the random-base and static-base stations.
In [42], it is proposed that a faulty node significantly consumes the energy of the WSN. A mechanism for restoring node connectivity is proposed in [42]. The mechanism recovers the connectivity of the network by moving as few nodes as possible to solve the problem of excessive energy consumption caused by failed nodes. In [43], a clustering method named decentralised fuzzy clustering protocol (DFCP) is proposed. This method divides the anchor nodes better. Initially, the K-means are used to divide the anchor nodes into different clusters and each cluster is divided through the DFCP protocol. The prolonged lifetime of WSN is achieved by optimising the networking protocol. In [44], a distancebased relocation mechanism is proposed. The mechanism reduces the energy consumption of the WSN. In [45], a method of relocating the mobile-base station is proposed. This method guarantees better data transmission and resource optimisation. The study conducts simulation experiments on energy utilization and false alarm rate and the results prove that the method proposed in the study effectively prolongs the lifetime of the WSN. In [46], an exhaustive search algorithm is used to evaluate the necessity of relocating BS in WSN.
A mechanism for locating BS based on available energy resources and the flow of sensor nodes at that time is proposed.
In [47], the issues of when and where to relocate the BS and how to deal with the movement without affecting data traffic were discussed. When the energy consumption by the anchor node exceeds the threshold, the BS moves to a better position under the reasonable cost. This method prolongs the lifetime of the WSN and has been verified in a simulation environment. In [48], a bionic optimisation relocation method is proposed to relocate the sink node. Simulation experiments have proven that this method prolongs the network's life. In [49], a designed technique based on the shortest path between multiple mobile nodes and a single BS was proposed. The position of the BS is dynamically located using relocation technology, which effectively increases the data transmission efficiency. In [50], the existing clustering solutions had low energy efficiency and poor scalability. For these problems, an improved clustering protocol for WSN based on harmony search was proposed. The protocol uses a new objective function to determine the cluster heads to reduce energy consumption. Simulation experiments verify the effectiveness of this method. In [51], a relocation method based on the balance of energy supply was proposed. This algorithm maximises the coverage and minimises the total distance of node movement. Simulation experiments verify the effectiveness of this method.
Although the methods for prolonging network life in various application scenarios mentioned in the numerous documents above are effective, there is room for improvement. The accuracy of the relocation and complexity of the application scenarios need to be further studied. This study applies the optimised BH to relocate the BS in more complex application scenarios to prolong the life of the WSN. The application scenario model is described in detail in the section "Energy consumption and application models".

Energy consumption and application models
This section presents the energy consumption and simulation experiment application models.

Energy consumption model
The transmission and reception of data consumes energy. Energy consumption is related to data size and transmission distance. The formulas for calculating the energy consumption when the message of b bit is transmitted with a transmission distance of d m are shown in Formula (3) and Formula (4).
where E T x indicates the total consumption of the sensor node. E elec indicates the energy consumed by the transceiver when transmitting and receiving b bit data. E f s represents the consumption to transmit data of b bit when the distance is d m in the free space model. E mp represents the consumption for transmitting data of b bit when the distance is d m in the multipath model. The free space model is that the energy is only consumed by the diffusion of the radio wave in the process of propagation, and there is no other way of energy consumption. The multipath model considers that the signal is reflected by some objects during its propagation, which changes the propagation direction, amplitude, polarisation, and phase of the signal. These changed signals arrive at the receiver and overlap with the signals arriving at the receiver through the straight path to cause multipath effect. d 0 represents a threshold selected by the energy consumption model. The formula of d 0 is shown in Formula (5).
The formula for calculating the energy consumed by the receiver and transceiver when receiving but not sending data is shown in Formula (6).
Considering that the data are highly similar when each cluster head broadcasts its cluster to each anchor node, a data aggregation scheme is proposed to reduce unnecessary energy consumption caused by repeated data transmission. Regardless of the number of nodes, this scheme compresses data into B bits. The energy consumption of data aggregation is set to E da = 2n J /bit/message.

Application model
The node types involved in the model include ordinary, anchor, and cluster-head nodes and BS. Taking four clusters as an example, in Fig. 1, black square represents the BS, black triangle represents the anchor node, and black circle represents the ordinary node. The red solid line indicates that after clustering, the anchor node transmits data to the cluster-head node and the blue solid line indicates that the cluster-head node transmits the data to the BS.
The concrete implementation steps in the application model are divided into the following steps: First, the nodes are clustered according to the most reasonable clustering scheme. Second, the cluster head node of each cluster is selected according to the selection strategy. Only anchor nodes with residual energy higher than the average energy in the cluster can participate in the election. The selection  (7).
where C H selec represents the cluster-head node to be selected next time. E cd i represents the residual energy of the candidate anchor node. f 1 represents the sum of distances between the candidate node and other anchor nodes. f 2 represents the distance between the candidate anchor node and the BS. α and q are two control parameter. The formula of f 1 and f 2 are shown in Formulas (8) and (9).
where N c represents the number of anchor nodes that participate in the election. cd i indicates the position of the ith candidate node. n j indicates the position of the jth anchor node. Candidate nodes consume energy when competing for cluster-head node. The formula for calculating energy consumption is shown in Formula (10).
where number represents the number of anchor nodes that participate in the election. e is a constant.
After determining cluster-head nodes, it is necessary to relocate the most suitable location of the BS. The location of the BS minimises the maximum distance from the BS to each cluster-head node. The BS is selected by Formula (11).
where B S loc represents the logical search location of the BS. C H i indicates the position of the ith cluster-head node. C indicates the number of cluster-head nodes. B S obj indicates the location of the BS determined after searching. Subsequently, cluster-head nodes broadcast which cluster other anchor nodes belong to and the data transmission schedule to avoid transmission congestion caused by all nodes of the cluster transmitting data simultaneously. After receiving the broadcast schedule, anchor nodes store it and transmit the collected data according to the time specified in the schedule. During the transmission, anchor nodes activate the radio component at the specified time to realize the data transmission. Cluster nodes receive data and transmit them to the BS for data analysis.
If the anchor node fails or runs out of energy, it exits the WSN. When the anchor node exits the WSN, the entire WSN is rebuilt. Reconstruction improves the re-clustering of nodes, thus, prolonging the lifetime of WSN.

Improvement of black hole algorithm
In this study, Levy Flight and Edge Regeneration strategies are introduced to optimise the original BH.

Levy flight strategy
Levy Flight is a movement with a small probability of large step length and a large probability of small step length. Levy Flight is a non-Gaussian random walk. The figure of Levy Flight is shown in Fig. 2.
The random step size of Levy flight is obtained according to Levy state distribution function. Levy state distribution function is a simple power function and its distribution func-tion is shown in Formula (12) [52].
where s and β represent the step length and an index, respectively.
Mathematically, the simple definition of Levy distribution function is shown in Formula (13).
where μ is location or shift parameter. γ > 0 is a scale parameter. Generally, Levy distribution function is often defined by Fourier transform as shown in Formula (14) [53].
where β is Levy index. α is a scale factor, and it value is between [-1,1]. The step size s of Levy Flight is generally calculated by Mantegna algorithm as shown in Formula (15).
where u and v are drawn from normal distributions. as shown in Formula (16).
The value and calculation of σ u and σ v are shown in Formula (17).
where τ is the standard gamma function. Therefore, step(g) of Levy Flight in BH can be calculated by Formula (18).
where s(g) and step(g) indicates the step length of Levy Flight in the gth iteration and the gth Levy Flight in the BH, respectively. The constant 0.01 makes Levy Flight in the BH not extremely radical. Levy Flight gives each particle a probability to adopt Levy Flight strategy to let the particles find a better solution. The position change of particles after Levy Flight is calculated using Formula (19).

Edge regeneration strategy
Edge regeneration strategy accelerates the convergence speed of BH. The original BH randomly generates new particles in the solution space after the particles enter the radius of the black hole. The Edge Regeneration strategy regenerates particles around the black hole, such that particles approach the optimal solution faster. Two sub-strategies, which are based on random regeneration and normal distribution around the black hole, are used during regeneration. A selection rate c is set for which strategy to use. When the particle is absorbed by the black hole, r is generated randomly. When r is smaller than c, Formula (20) is used to regenerate new particles; otherwise, Formula (21) is used to regenerate new particles. The regeneration formulas of the particle after being absorbed by the black hole are Formula (20) and Formula (21).
where X new represents the location of the regenerated particles. The normrnd represents the standard normal distribution.

The pseudo-code of LEBH
As mentioned above, the implementation process of LEBH is shown in the algorithm (2).

Simulation experiment
First, the performance of LEBH is tested using CEC 2013 [54]. Second, to make the experiments more convincing, clustering experiments are carried out to compare the performance. Then, the relevant parameters of the simulation experiment of prolong the lifetime of the WSN are set and explained. In addition, the LEBH is used to relocate the BS and compare the lifetime with the random-base and static-base stations. Finally, the LEBH-BS and other heuristic algorithms are compared in terms of relocating to compare the lifetime of the WSN.

The performance test of LEBH
The performance of LEBH is tested using CEC 2013.

Algorithm 2 The implementation process of LEBH
f8 -6.79E+02 = -6.79E+02 = -6.79E+02 = -6.79E+02 = -6.79E+02 = -6.79E+02 = -6.79E+02 the dimension and N represents the population size. Table 1 shows the parameter settings. Table 2 shows the results of the Wilcoxon signed rank test results and the performance comparisons. The (<) indicates that the LEBH is worse than another algorithm. The (>) indicates that the LEBH is better than another algorithm. The (=) indicates that the two algorithm is similar. The last line counts the three cases. Table 2 shows that the LEBH performs better than PSO on 23 functions, worse than PSO on four functions, and similar to PSO on one function. The LEBH performs better than GA on 27 functions except f 8. The LEBH performs better than BA on 21 functions, worse than BA on six functions, and similar to BA on one function. The LEBH performs better than WOA on 25 functions except f 8, f 25, f 26. The performance of LEBH is better than SCA on 23 functions, worse than SCA on four functions, and similar to SCA on f 8. The performance of LEBH is better than BH on 22 functions, similar with BH on two functions and worse than BH on four functions.
We select several easily distinguishable function images to evaluate the optimising and convergence abilities of LEBH, PSO, GA, BA, WOA, SCA, and BH because on some test functions, the image difference is small and difficult to distinguish. The results are shown in Fig. 3.
The convergence curves in Fig. 3 represent the convergence process of each algorithm under the test function of CEC2013. At the beginning of the iteration, the faster the curve descends, the better the convergence of the algorithm. At the end of the iteration, the smaller the ordinate value of the curve, the better the optimization ability of the algorithm. Figure 3 selects six test functions with obvious convergence process for display. It can be seen from Fig. 3 that compared with other algorithms, LEBH has a better convergence advan- Fig. 3 Performance comparison between LEBH and common heuristic algorithms tage in the early stage of iteration, and has better optimization ability in the later stage. Figure 3 shows that the proposed LEBH has good performance in most test functions. Taking f 23 as an example, in the first 300 iterations, LEBH converges rapidly, and then LEBH iteratively finds the optimal solution around the convergence range.

Clustering experiments
In this subsection, clustering experiments are taken to test the performance of different algorithms. Clustering is an important way of data analysis. The effect of clustering can reflect the performance of algorithms. In this subsection, four benchmark datasets of Iris, Cmc, Wine, and Seeds are used for algorithm performance analysis. The performance of the algorithm can be evaluated by two indicators: the error rate of clustering (ER) and the sum of intra-cluster distances (SD). The ER represents the rate of wrongly classified data in the clustering process, and the smaller the value, the better the performance of the algorithm. The SD indicates the sum of the distances from each cluster object to the center point of its own class, and the smaller the value, the better the performance of the algorithm. The sum of intra-cluster distances is also the fitness function of the optimization algorithm. The calculation process of ER and SD are shown in Formula 22 and 23.

Error_rate = N umber o f misclassi f ied objects T otal number o f objects
where N represents the total number of the objects, K represents the number of clusters, o i indicates the ith object and c j indicates the jth cluster center. Because the results of ER and SD on the algorithm cluster analysis performance comparison are consistent. The ER is proportional to SD, and the smaller the ER, the smaller the SD. So this paper only shows experimental results of ER. Each group of experiments was carried out 20 times, and the mean value is taken as the result to ensure the accuracy of the experiment. The error rates of each algorithm after clustering on the four datasets are shown in Table 3.
The data from clustering experiments with the lowest clustering error rate in each dataset are marked in bold in Table 3. Table 3 shows that the ERs of LEBH are 8.73%, 59.06% and 28.09% on Irir, Cmc and Wine Respectively. Compared with Kmeans and other intelligent computing algorithms, LEBH can achieve better clustering effect on these three datasets. On the Seeds dataset, the ERs of LEBH and BH are both 10.48%, they have the same clustering effect, and LEBH and BH have better clustering effect than Kmeans and other algorithms. Experimental result shows that LEBH can find the optimal solution of the problem better than other algorithms, while other algorithms may fall into local optimum in the process of optimization.

Experimental parameters of prolong the lifetime of the WSN
This study uses Matlab R2016a to conduct a large number of simulation experiments. Hundred anchor nodes and 100 normal nodes are randomly generated within a 100 m × 100 m range. The position coordinates of any two nodes are not equal, which means that any two sensor nodes are not in the same position. The Bound indicates the size of the two-dimensional experimental site. The N umberof nodes represents that experiments are performed using 100 sensor nodes. The I nitialenergy indicates that initial energy of each sensor node is set to 0.2J. Subsequently, the relevant parameters of the energy consumption model are set and explained. E elec in Formula (3) and Formula (4) represents the energy consumed by the transceiver when transmitting and receiving b bit data and E elec is set to 50 p J /bit. E f s represents the energy consumed to transmit data of b bit when the transmission distance is dm in the free space model, and E f s is set to 10 p J /bit/m 2 . E mp represents the energy consumed to transmit data of b bit when the transmission distance is dm in the free multipath model, and E mp is set to 0.0013 p J /bit/m 4 . b represents the size of each message and b is set to 500bytes/message. α and q in Formula (7) are two constants, which are used to determine the influence degree of residual energy and two distances on the election of a cluster-head node, respectively. q is set to 1000. α is set to 0.75. In Formula (10), a is set to 5n J /number. The initial energy is set to 0.2J . Table 4 shows the setting of parameters.

Simulation experiment of LEBH-BS, Random-BS and Static-BS
This section discusses the effect of using the LEBH to relocate the BS on the lifetime of the WSN and compares it with random-base and static-base station positions. Simulation experiments are performed on the scenario where the energy of the first and last nodes are exhausted, respectively.  The simulation experiment of each scenario is conducted ten times. This prevents accidental influence on experimental results. The experiment results are given in Table 5 and the boldface indicates the best result. Table 5 shows that LEBH-BS has the best performance in both scenarios and has the longest network lifetime. For the first node death scenario, the use of the LEBH-BS method increases the lifetime of the WSN by 68.4% and 117.1%, respectively, compared with the use of random-BS and static-BS. For the last node death scenario, the use of the LEBH-BS method increases the lifetime of the WSN by 62.2% and 94.3% compared with the use of random-BS and static-BS. Notably, the use of random-BS prolong the lifetime of the WSN is better than static-BS. Figure 4 compares the histograms of the WSN lifetime under the two scenarios. Figure 4 shows that the relocation BS can better prolong the lifetime of the WSN compared to random-base and static-base stations. This is mainly because Fig. 4 The histogram of the lifetime comparison of LEBH-BS, random-BS and static-BS sensor networks in two scenarios the relocated BS can find the BS position with the lowest energy consumption when transmitting data. The experimental results of the two scenarios show that the mobile-BS is better than the static-BS in prolonging the lifetime of the WSN. In a mobile BS, relocating the BS is better than random-BS location to prolong the lifetime of the WSN.

Simulation experiment of LEBH-BS and other heuristic algorithms
Subsequently, we discuss the influence of relocation of BS using the proposed LEBH other heuristic algorithms on the lifetime of WSN. Simulation experiments are conducted on the scenario where the energy of the first and last nodes are exhausted, respectively. The simulation experiment of each scene is performed ten times. The simulation experiment results are given in Table 6, and the boldface indicates the best result. Table 6 shows that the use of LEBH to relocate the BS shows the best performance in both scenarios and has the longest network lifetime compared to other heuristic algorithms. For the first node death scenario, the use of the LEBH-BS method increases the lifetime of the WSN by 2.1%, 2.5%, 2.8%, 2.8%, 2.0%, and 2.8%, respectively, compared with the use of PSO-BS, WOA-BS, BH-BS, GA-BS, GWO-BS, and SCA-BS. For the last node death scenario, the use of the LEBH-BS method increases the lifetime of the WSN by 2.3%, 2.0%, 1.7%, 1.4%, 1.3%, and 1.2%, respectively, compared with the use of PSO-BS, WOA-BS, BH-BS, GA-BS, GWO-BS, and SCA-BS. Figure 5 compares the histogram of the maximum sensor network lifetime of BS relocation using different heuristic algorithms in two scenarios. Figure 5 shows that using LEBH-BS for BS relocation prolongs the lifetime of WSN better than using other heuristic algorithms. Because the initial energy is set to 0.2 J per anchor node, the result does not seem to have obvious effect. In fact, the initial energy of each anchor node is larger than the simulation experiment. LEBH-BS prolongs the lifetime of WSN more effectively because it can discover the location of the most energy-saving BS better and more accurately.
Therefore, to illustrate that the LEBH-BS is more meaningful than other heuristic algorithms. For each scenario, the bilateral U test was used for statistical verification. For the exhaustion scenarios of the first and last nodes, the null hypothesis is that the LEBH-BS and other algorithms are independent of identical continuous distributions with equal average value. The confidence level is set to 5%. The verified p value is shown in Table 7. Table 7 shows that all other heuristic algorithms reject the null heuristic in the exhaustion scenario of the first node. Therefore, all other heuristic algorithms have different average values compared with LEBH-BS. In the exhaustion scenario of the last node, GWO-BS and SCA-BS accept the null hypothesis, and other algorithms reject the null hypothesis. Therefore, the averages of GWO-BS and SCA-BS are not significantly different from LEBH-BS and the averages of other algorithms are significantly different from LEBH-BS.  The results obtained by the bilateral U test in statistics show that in most cases, LEBH-BS has better performance than other heuristic algorithms.

Conclusion
This study we improved the original BH and proposed an LEBH. The proposed LEBH is compared with other algorithms in 28 test functions of CEC 2013. The results show that compared with other heuristic algorithms, the LEBH has faster convergence speed and better optimisation ability. In this study, the WSN model was simulated in detail and the energy consumption model was introduced in detail. The LEBH was applied to the relocation technology of BS in the network and simulation experiments were performed in the exhaustion scenarios of the first and last nodes. The results show that the LEBH-BS is better than random-BS and static-BS in prolonging the lifetime of the WSN in both scenarios. Compared with other heuristic algorithms for BS relocation, LEBH-BS prolonged the lifetime of the WSN better than other algorithms in most cases. The LEBH proposed in this study is highly flexible and usable. In future, this algorithm can be applied to more complex sensor networks.
Funding This project is funded by the National Natural Science Foundation of China, No. 619320.

Data availability
The data used to support the findings of this study are included within the article.

Conflict of interest The authors declare no conflict of interest.
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecomm ons.org/licenses/by/4.0/.