# Energy Consumption and QoS Optimization Coverage Mechanism in Wireless Sensor Networks Based on Swarm Sensing Algorithm

Authors: Gang Wang; Jiayin Feng; Guolin Li; Jinling Song; Dongyan Jia
Journal: Journal of Sensors
 (2022)

---

## Abstract

Objective. To study energy consumption and QoS optimization coverage mechanism in wireless sensor networks based on swarm sensing algorithm. Methods. The swarm sensor algorithm is reported to optimize the configuration of wireless sensor nodes, improve network service performance, and provide feedback on effective sensor placement. Results. Two WSN coverage optimization schemes were proposed in this essay. The first scheme applied drosophila intelligent algorithm to WSN coverage optimization, and the second scheme integrated particle swarm optimization algorithm and improved firefly algorithm to complement each other. Both schemes can achieve good results in practical application. Scheme one can increase the coverage rate by 6.36% compared with previous schemes, while scheme two can increase it by 6.48%. Both schemes are basically the same, so they can be applied in the optimization of WSN node deployment. Conclusion. As an optimization method, group perception algorithm is inspired by biology. Through the continuous enrichment and development of this algorithm, it has been effectively used in the coverage optimization of the wireless sensor networks.


---

## Body

## 1. Introduction

With the rapid development of wireless technology, wireless sensor networks have come into being. As shown in Figure1. The wireless sensor network consists of several small sensor nodes integrated into a monitoring area, which can monitor real-time, real-time, and stored data on the desired environment or monitor goods. These collected information will be sent out wirelessly and will be sent to the terminal in a self-grouping multi-hop way, so as to realize the physical world, the computing world and human society of the ternary world of mutual connectivity. Wireless sensor networks unite the world of valuable information with a global mission, changing the way people interact with nature [1].Figure 1
Wireless communication technology.Compared with traditional wireless networks and mobile ad hoc networks with similar networking modes, wireless sensor networks have significantly different design objectives, technical requirements, and design requirements. Wireless sensor network (WSN) is data-centered and information-oriented. Nodes usually work in harsh environmental conditions; cannot replenish battery power; and are characterized by large scale, self-organization, reliability, dynamic, data-centric, and application-related characteristics. The application prospect of wireless sensor network is very broad, which can be used in military, health care, environmental monitoring and forecasting, complex machinery monitoring, large workshop and warehouse management, building status monitoring, space exploration, smart home, urban transportation, airport, large farm, industrial park security monitoring, and other fields, and will gradually go deep into all fields of human life [2] (see Figure 2).Figure 2
Wireless sensor network.


## 2. Literature Review

Measuring service quality (QoS) in wireless sensor networks, coverage control directly affects the monitoring performance of sensor networks to the surrounding world. Real-time measurement of network services helps to understand the presence of control and communication in the control area and take improvement strategies by readjust sensor node distribution or increase sensor nodes in the future when blind areas occur [3]. More broadly, it is possible to ensure the reliability of measured data by deploying more sensor nodes in important monitoring areas or to adjust the density of network coverage in real time by deploying several partially or fully mobile sensor nodes to minimize network interference. The optimization of wireless sensor networks can not only provide communication and control area, but also enable the use of electronic communication, planning methods, reliable communication, target location, and other specialized applications. Coverage control technology of wireless sensor networks directly determines the monitoring performance of wireless sensor networks. Regardless of the coverage method, the purpose of coverage optimization is to maximize the economical use of energy carried by sensor nodes and increase the network lifetime. Coverage optimization technology requires reasonable planning of the working status of each node to reduce the number of active sensor nodes, reduce network energy consumption, and optimize network connection performance on the premise of ensuring network coverage performance [4].Sensor node services can be divided into the static deployment and dynamic deployment. Static transmission is the study of how to optimize the service of the wireless sensor networks. The two nodes are deployed to the pre-calculated location, and the sensor will not move once deployed. Dynamic deployment means that sensor nodes can dynamically change their positions to improve coverage after initial deployment. With the development of node design technology, dynamic can be used as a popular research topic for optimization. At the same time, with the development and maturity of the swarm sensing algorithm, in order to improve the coverage of dynamic deployment, the swarm intelligence optimization algorithm was introduced by many scholars to optimize and solve the WSN network coverage optimization problem and achieved good results, for example, artificial bee colony algorithm, as shown in Figure3, firefly algorithm, artificial immune algorithm, particle swarm algorithm, and genetic algorithm [5].Figure 3
Artificial bee colony algorithm.Group perception algorithm, as shown in Figure4, is proposed inspired by creatures in nature. Group perception algorithm can show intelligent characteristics such as autonomy, reactivity, learning, and adaptability. The core idea of group perception algorithm is that a group composed of many simple individuals can realize a certain function or complete a certain task through simple cooperation. A swarm sensing algorithm is an optimization problem, and the dynamic location of sensor nodes is always an optimization problem. Therefore, the introduction of swarm sensing algorithm can improve the location of wireless sensor nodes and improve the performance of the whole network [6].Figure 4
Group perception algorithm.Compared with some traditional coverage optimization methods, swarm sensing algorithm provides many new and effective sensor node deployment methods and uses the power of sensor nodes which is more reasonable and effective, which makes wireless sensor network more play its huge application value. The application of swarm sensing algorithm to optimize the coverage of wireless sensors is receiving more attention and research.


## 3. Coverage Optimization of Wireless Sensor Networks

Resource limitation is not only a prominent feature in wireless sensor networks, but also a major bottleneck hindering large-scale deployment. In view of such a challenge, researchers have put forward energy-saving design goals at all levels of wireless sensor networks, in hardware, such as low-power processor and communication chip, and in software, such as energy-saving operating system and communication protocol. From the optimization level, the network coverage optimization problem belongs to the energy saving optimization at the system level, that is, according to the distribution of monitored areas or targets. The sensor nodes are deployed to ensure that the wireless sensor network covers the monitored area completely or with a large probability and minimize network redundancy and resource waste. Regardless of the application background, it is necessary to ensure that the deployment of sensor nodes can effectively cover the monitored area or target [7]. Through effective optimization of WSN node deployment, as shown in Figure 5, improving the problems caused by initial deployment has become a key issue in wireless sensor network research. The research of network coverage optimization will promote the progress of its closely related applications and enrich the research scope of coverage optimization technology.Figure 5
Node deployment.


### 3.1. Main Indicators

The application of coverage optimization protocol and its algorithm in wireless sensor networks requires an evaluation standard to measure the performance, availability, and effectiveness of coverage optimization strategy and its algorithm, which is crucial to determine a good coverage optimization algorithm [8]. Taking all kinds of situations into consideration, the main indexes for evaluating a coverage optimization algorithm and protocol are as follows:
(1)
Coverage ability. First of all, wireless sensor network is the perception of the surrounding environment, with the monitoring of the target and the acquisition of information as the main goal, and the ability to cover the monitored target and area is the most important. Therefore, the coverage degree of monitored area or monitored target is the primary criterion to measure whether a coverage optimization algorithm is good or not(2)
Energy effectiveness. Energy efficiency is to ensure the survival time of the network, because the wireless sensor network is applied to the very bad environment in many cases. Due to the limited resources of the hardware platform of the node, the number of nodes is very large. According to the actual situation, it is generally impossible to replace the battery of the node to replenish energy. Therefore, the effectiveness of energy is a major challenge faced by the coverage optimization algorithm of wireless sensor networks. Saving energy of nodes to prolong the time of the entire network is an important content of wireless sensor network research and also an important performance index to measure the coverage optimization algorithm(3)
Network connectivity. Wireless sensor network is different from the existing network. It is a network without infrastructure and uses a large number of sensor nodes without connections. Network nodes must communicate and cooperate with each other through wireless multi-hop mode, and nodes use self-organization mode to complete various operations such as collection and query of target information. The connectivity of the network directly determines the quality of service such as perception, sensing, and communication of the network. Therefore, the connectivity of the entire network must be guaranteed so as to ensure the wireless transmission function between nodes and complete multi-hop self-organizing communication of nodes [9](4)
Algorithm accuracy. Different deployment conditions, limited network resources, different coverage target characteristics, and so on affect the coverage optimization algorithm to different degrees. These objective factors make the coverage optimization algorithm can only achieve approximate coverage, which has errors with the theoretical coverage in the implementation process, sometimes even cannot guarantee the complete implementation of the algorithm. Therefore, it is an important part of the program optimization algorithm to reduce errors and improve the accuracy of the algorithm(5)
The complexity of the algorithm. Different algorithm complexity will affect different energy consumption, which usually includes time complexity, communication complexity, and implementation complexity. The complexity of the algorithm is also an important part to measure whether the coverage optimization algorithm of a wireless sensor network is optimized [10](6)
Internet dynamics. In some special application environments, the target is mobile, and the network is dynamic. It is necessary to adjust the information and data grasped by the nodes at any time, which requires the coverage optimization protocols and algorithms of the network to consider the movement of the mobile nodes or monitored targets(7)
Network scalability. In case of node failure or death, or due to the changing requirements of tasks, new sensor nodes must be added to the monitoring area to meet the needs of applications, so as to ensure the scalability of the network(8)
Algorithm implementation strategy. The implementation of WSN coverage optimization algorithm is usually divided into distributed, centralized, and a mixture of the two. Distributed algorithms are generally executed by exploiting local information. This is because of the cost of energy consumption, algorithm execution, and protocol operation of wireless sensor network. However, in some special network operating environments, the mixture of distributed and centralized is more effective, while the centralized algorithm is difficult to be implemented in wireless sensor networks [11]. In addition to the indexes listed above to evaluate the coverage optimization algorithm, other indexes such as coverage multiplicity, overlap rate, node density, and network life should also be considered according to the specific application environment. In different deployment environments, the requirements for covering each metric of the optimization algorithm are also different. Therefore, the design and analysis of protocols and algorithms should be based on the actual environment


### 3.2. Typical Coverage Methods for Wireless Sensor Networks

(1)
Based on the idea of global occupation map, there three geometric methods to realize node self-deployment, namely, vector-based (VC) algorithm, VOR-based (VOR) method, and min max method [12]. All these methods are based on Voronoi diagrams, and their starting point is to fill the covering holes in Voronoi polygons. When the node is moving, the covering cavity in the Voronoi polygon should be calculated first, then the overall covering effect will be increased after the sensor node is moved, and finally the moving distance and direction of the sensor node are determined(2)
Virtual force algorithm. Virtual force algorithm assumes that there are virtual “gravitational force” and “repulsive force” between any two nodes in the network. Under the influence of virtual energy, two nodes move closer or further, so as to achieve uniform deployment of nodes in the network. VFA mainly regards each node in the network as a virtual charged particle with the same charge, and there are interaction forces between nodes within the communication radius, including attraction and repulsion [13]. When the distance between the node i and the node j is between the rated voltage Rs and the rated current Rc, the two nodes are mainly due to the effect of gravity, which is used to shrink the coverage range. When the distance between the node i and the node j is 0-Rs, the energy repulsion between two nodes is usually used for charge diffusion. Under the action of field force, the sensor node can move quickly and finally reach the stable state of force balance(3)
Particle swarm optimization, as shown in Figure6. Particle swarm optimization (PSO) is the kind of intelligent algorithm. PSO is applied to the coverage optimization of WSN for the first time in foreign countries, and all nodes can move freely. In this essay, PSO is used to find the optimal location of sensor nodes, and Voronoi diagram is used to calculate the fitness, instead of the traditional method of calculating coverage by grid points. Traditional grid point methods must be carefully selected to balance execution time and accuracy [14]. In Voronoi diagram, the distance between the vertex of Voronoi diagram and several arbitrary boundary points to the nearest sensor node is greater than the perceived radius of the node, and their difference is taken. All cases are thus calculated to obtain the fitness of the network, and the goal of PSO is to minimize this fitness value. The improved algorithm of particle swarm optimization, the combination of particle swarm optimization with virtual force, and the fusion with other intelligent algorithms have all been applied in the coverage optimization of sensor nodes. Particle swarm optimization is the most successful and extensive intelligent algorithm applied in the coverage optimization of WSNFigure 6
Particle swarm optimization.


## 3.1. Main Indicators

The application of coverage optimization protocol and its algorithm in wireless sensor networks requires an evaluation standard to measure the performance, availability, and effectiveness of coverage optimization strategy and its algorithm, which is crucial to determine a good coverage optimization algorithm [8]. Taking all kinds of situations into consideration, the main indexes for evaluating a coverage optimization algorithm and protocol are as follows:
(1)
Coverage ability. First of all, wireless sensor network is the perception of the surrounding environment, with the monitoring of the target and the acquisition of information as the main goal, and the ability to cover the monitored target and area is the most important. Therefore, the coverage degree of monitored area or monitored target is the primary criterion to measure whether a coverage optimization algorithm is good or not(2)
Energy effectiveness. Energy efficiency is to ensure the survival time of the network, because the wireless sensor network is applied to the very bad environment in many cases. Due to the limited resources of the hardware platform of the node, the number of nodes is very large. According to the actual situation, it is generally impossible to replace the battery of the node to replenish energy. Therefore, the effectiveness of energy is a major challenge faced by the coverage optimization algorithm of wireless sensor networks. Saving energy of nodes to prolong the time of the entire network is an important content of wireless sensor network research and also an important performance index to measure the coverage optimization algorithm(3)
Network connectivity. Wireless sensor network is different from the existing network. It is a network without infrastructure and uses a large number of sensor nodes without connections. Network nodes must communicate and cooperate with each other through wireless multi-hop mode, and nodes use self-organization mode to complete various operations such as collection and query of target information. The connectivity of the network directly determines the quality of service such as perception, sensing, and communication of the network. Therefore, the connectivity of the entire network must be guaranteed so as to ensure the wireless transmission function between nodes and complete multi-hop self-organizing communication of nodes [9](4)
Algorithm accuracy. Different deployment conditions, limited network resources, different coverage target characteristics, and so on affect the coverage optimization algorithm to different degrees. These objective factors make the coverage optimization algorithm can only achieve approximate coverage, which has errors with the theoretical coverage in the implementation process, sometimes even cannot guarantee the complete implementation of the algorithm. Therefore, it is an important part of the program optimization algorithm to reduce errors and improve the accuracy of the algorithm(5)
The complexity of the algorithm. Different algorithm complexity will affect different energy consumption, which usually includes time complexity, communication complexity, and implementation complexity. The complexity of the algorithm is also an important part to measure whether the coverage optimization algorithm of a wireless sensor network is optimized [10](6)
Internet dynamics. In some special application environments, the target is mobile, and the network is dynamic. It is necessary to adjust the information and data grasped by the nodes at any time, which requires the coverage optimization protocols and algorithms of the network to consider the movement of the mobile nodes or monitored targets(7)
Network scalability. In case of node failure or death, or due to the changing requirements of tasks, new sensor nodes must be added to the monitoring area to meet the needs of applications, so as to ensure the scalability of the network(8)
Algorithm implementation strategy. The implementation of WSN coverage optimization algorithm is usually divided into distributed, centralized, and a mixture of the two. Distributed algorithms are generally executed by exploiting local information. This is because of the cost of energy consumption, algorithm execution, and protocol operation of wireless sensor network. However, in some special network operating environments, the mixture of distributed and centralized is more effective, while the centralized algorithm is difficult to be implemented in wireless sensor networks [11]. In addition to the indexes listed above to evaluate the coverage optimization algorithm, other indexes such as coverage multiplicity, overlap rate, node density, and network life should also be considered according to the specific application environment. In different deployment environments, the requirements for covering each metric of the optimization algorithm are also different. Therefore, the design and analysis of protocols and algorithms should be based on the actual environment


## 3.2. Typical Coverage Methods for Wireless Sensor Networks

(1)
Based on the idea of global occupation map, there three geometric methods to realize node self-deployment, namely, vector-based (VC) algorithm, VOR-based (VOR) method, and min max method [12]. All these methods are based on Voronoi diagrams, and their starting point is to fill the covering holes in Voronoi polygons. When the node is moving, the covering cavity in the Voronoi polygon should be calculated first, then the overall covering effect will be increased after the sensor node is moved, and finally the moving distance and direction of the sensor node are determined(2)
Virtual force algorithm. Virtual force algorithm assumes that there are virtual “gravitational force” and “repulsive force” between any two nodes in the network. Under the influence of virtual energy, two nodes move closer or further, so as to achieve uniform deployment of nodes in the network. VFA mainly regards each node in the network as a virtual charged particle with the same charge, and there are interaction forces between nodes within the communication radius, including attraction and repulsion [13]. When the distance between the node i and the node j is between the rated voltage Rs and the rated current Rc, the two nodes are mainly due to the effect of gravity, which is used to shrink the coverage range. When the distance between the node i and the node j is 0-Rs, the energy repulsion between two nodes is usually used for charge diffusion. Under the action of field force, the sensor node can move quickly and finally reach the stable state of force balance(3)
Particle swarm optimization, as shown in Figure6. Particle swarm optimization (PSO) is the kind of intelligent algorithm. PSO is applied to the coverage optimization of WSN for the first time in foreign countries, and all nodes can move freely. In this essay, PSO is used to find the optimal location of sensor nodes, and Voronoi diagram is used to calculate the fitness, instead of the traditional method of calculating coverage by grid points. Traditional grid point methods must be carefully selected to balance execution time and accuracy [14]. In Voronoi diagram, the distance between the vertex of Voronoi diagram and several arbitrary boundary points to the nearest sensor node is greater than the perceived radius of the node, and their difference is taken. All cases are thus calculated to obtain the fitness of the network, and the goal of PSO is to minimize this fitness value. The improved algorithm of particle swarm optimization, the combination of particle swarm optimization with virtual force, and the fusion with other intelligent algorithms have all been applied in the coverage optimization of sensor nodes. Particle swarm optimization is the most successful and extensive intelligent algorithm applied in the coverage optimization of WSNFigure 6
Particle swarm optimization.


## 4. Wireless Sensor Network Node Deployment Based on Fruit Fly Algorithm

### 4.1. Fruit Fly Algorithm and Its Introduction

The fruit fly algorithm was developed in 2012 by Professor Pan, a scientist from Taiwan, who was inspired by the behavior of the fruit fly. Although fruit flies cannot see food, they can attract many fruit flies in a closed room, indicating that fruit flies themselves have a very accurate system for locating food sources, as shown in Figure7.Figure 7
Food source system.Fruit fly algorithm is one of the best worldwide methods based on fruit fly research. Fruit flying algorithm only requires four correction parameters, while other algorithms have more parameters. For example, particle swarm optimization algorithm needs to adjust 5 parameters, ant colony algorithm needs to adjust 7 parameters, and bacterial foraging algorithm needs to adjust 8 parameters, and the setting of each parameter requires a large number of experiments to obtain empirical values, which undoubtedly increases the complexity of the algorithm. As a new intelligent algorithm, fruit fly algorithm is simple and no less compared to other intelligent algorithms. Fruit fly algorithm is also easy to understand, the code is simple and easy to implement, and the running time is less. The core idea of fruit fly algorithm is to constantly use smell and vision to get close to the food source. Each individual fly starts by detecting the presence of food in a nearby area by smell, locating the general location of the food, and then using vision to accurately fly past that location. In the process of optimization, each individual fruit fly has its own flavor concentration, which is the standard to evaluate the quality of each individual fruit fly algorithm. The flavor concentration is determined by the flavor concentration function, and the flavor concentration of the food is related to the distance of the fruit fly. The farther away the fly is, the less likely it is to smell it, the smaller the individual flavor concentration, and the greater the vice versa. The process of fruit fly searching for food is to continuously move from a location with a low concentration of food to a location with a high concentration of food until it finds the location of food [15, 16]. As shown in Figure 8, the drosophila population flew randomly in all directions from initial position, and then individual drosophila with the highest food flavor concentration in the population was judged. At this point, individual 2 has the maximum flavor concentration, and then the whole population takes the individual’s position as the starting point to re-fly and then judge the flavor concentration. This cycle continues, iterating, gradually approaching the location of the food source.Figure 8
A fruit fly searching for food.


### 4.2. Node Deployment of Wireless Sensor Network Based on Fruit Fly Algorithm

In fact, fruit fly optimization algorithm continuously gathers at the current globally optimal location to conduct more refined local search, which is very suitable for solving the dynamic node deployment problem of WSN. Because the deployment of the optimal sensor node is not unique, that is to say, the sensor node corresponding to each number may not obtain the optimal sensor node deployment at a specific position in the deployment area [17]. In theory, there are countless combinations of sensor nodes in their respective locations to achieve optimal deployment. That said, a further search at the current optimal location generally leads to better deployment. Therefore, it is possible to use the fruit fly algorithm for the implementation of WSN nodes. However, different from traditional FOA, when the fruit fly algorithm is applied to node deployment of WSN, each fruit fly individual represents a sensor node deployment solution, which is directly represented by X(i), which stores the location information of all nodes. Therefore, X(I) can be directly used to calculate a taste concentration of each individual fruit fly. In particular, it should be noted that the judgment value of food taste concentration in this chapter is the coverage rate in WSN node deployment and the functional determination of taste concentration is the function to calculate costs. In each iteration, the fruit fly with the highest concentration of flavor was found, and all individual flies flew toward it using vision. At the same time, for the convenience of discussion, this chapter applies fruit fly algorithm to the node layout of wireless sensor network and makes the following assumptions: Each node has the same structure, and the communication radius of the node is twice the perception radius; each node can obtain its own coordinate information through GPS and other devices. The node has the ability of free movement and can be moved to a specified position. Nodes adopt binary perception model. Coverage is calculated by the ratio of covered grid points to the total grid points, and the grid points that are repeatedly calculated are only calculated once [18].Below are the specific steps of the fruit fly algorithm to implement a wireless sensor network:(1)
Initialize the parameters of the fruit fly algorithm and related parameters of WSN(2)
Each fruit fly provides direction and distance to search for food by olfactory perception as shown in the following formula;(1)Xi,:=X_axis+2∗s∗rand1,2∗d‐s.Here,I represents the fruit fly, d represents the number of sensor nodes, and s represents the long search step.
(1)
Calculate the determination value of taste concentration of each individual fruit fly, even if its coverage rate is shown in the following formula:(2)Smelli=computecoverXi,:.(2)
Finding the most odorous individual in a population of Drosophila; retain its optimal flavor intensity value and correspondingX_axis coordinates, as shown in the following formula:
(3)bestSmellbestIndex=maxSmell.(3)
Determine whether the best flavor intensity value of this iteration is greater than that of the last iteration, as shown in Formula (4). If so, then the drosophila population flies to this position by visual superposition; otherwise, perform Step (6):
(4)X_axis=XbestIndex,:.(4)
Enter the iterative optimization until the termination condition is satisfied


### 4.3. Simulation Experiment

Firstly, the number of sensor nodes was set to 35. In order to overcome the randomness of the experiment and better observe the performance of the algorithm, 15 experiments were conducted independently for the three algorithms. Their average coverage, standard deviation, and best and worst coverage are shown in Tables1 and 2.Table 1
Comparison results of coverage under 35 nodes (a).
Comparison modeInitial deploymentPSOGSOFOAAverage coverage0.70030.80920.79130.9198Best coverage0.72650.87810.85030.9322Worst coverage0.68720.7218-0.72360.9001Table 2
Comparison results of coverage under 35 nodes (b).
Comparison modeInitial deploymentPSOGSOFOAAverage coverage0.70040.80930.79150.9199Best coverage0.72630.87820.85040.9321Worst coverage0.68700.7217-0.72370.9002Then, in order to further visualize the improved performance of the algorithm, a group of data of initial deployment nodes are randomly selected to optimize the nodes using three algorithms.Finally, in order to further verify the influence of different node numbers on the algorithm proposed in this chapter, the number of nodes was set as 10, 15, 20, 25, 30, 40, and 45, respectively. Five independent experiments were conducted for each of the three algorithms, respectively, and the average coverage was compared to obtain the experimental results. When the network nodes are the same, the coverage obtained by FOA algorithm is almost always greater than that of PSO and GSO algorithms; especially if the number of nodes is greater than 20, the advantage is more obvious. At the same time, it can also be seen that the experiment of PSO algorithm is normal when the number of nodes is small, and GSO algorithm is easier to show its own advantages when the number of nodes is large. Therefore, it can be said that the algorithm proposed in this chapter can also achieve good experimental results under different node numbers.


### 4.4. Node Deployment with Obstacles

There may be obstacles in the actual deployment area. In this case, the sensor node cannot reach and pass through the obstacles. To measure the effectiveness of the algorithm mentioned in the problem in this chapter, it is considered that there is a perturbation in the middle of the output region and a problem at its edge [19]. The existence of obstacles does not affect the communication between nodes. Obstacles only prevent the movement of sensor nodes, and sensor nodes can still sense the obstacle area. All experimental parameters are exactly the same as those sections. First, assume that the deployment area has 35 sensor nodes. Assume that the circular obstacle has a radius of 8 and the rectangular obstacle 10X20.As can be seen from the experiments in the above two sections, the coverage optimization scheme based on the fruit fly algorithm proposed in this chapter has significantly improved coverage compared with PSO and GSO. This is because the fruit fly optimization algorithm can continuously conduct more detailed local search at the current global optimal location and the solution of WSN node deployment problem is not unique, so FOA can keep approaching the optimal solution while retaining its own optimal solution. Although the algorithm complexity of FOA is larger than that of GSO, it is much smaller than that of PSO. In coverage optimization with coverage as the main objective, overall consideration, FOA is very suitable for WSN node deployment.It is very important to select optimal parameters for fruit fly algorithm. Therefore, finding an appropriate iteration step value can improve algorithm performance [20]. Now it is easier for the algorithm to obtain the optimal solution by testing the value of S through experiments. The number of sensor node D is set to 30, and the population size and iteration times are the same as those in the above section. Obstacles are not considered here. S is set from 0.1 to 0.4, with an interval of 0.1. The experiment should be repeated for 10 times for each value of S, and the data obtained are shown in Tables 3 and 4.Table 3
Influence of TEST S when the number of sensor nodes is 30 (a).
s0.10.20.30.4Mean0.8120.8410.8520.851Max0.8230.8530.8630.857Min0.7960.8250.8350.846Table 4
Influence of S when the number of sensor nodes is 30 (b).
s0.10.20.30.4Mean0.8100.8400.8510.849Max0.8200.8540.8610.855Min0.7970.8260.8380.845


## 4.1. Fruit Fly Algorithm and Its Introduction

The fruit fly algorithm was developed in 2012 by Professor Pan, a scientist from Taiwan, who was inspired by the behavior of the fruit fly. Although fruit flies cannot see food, they can attract many fruit flies in a closed room, indicating that fruit flies themselves have a very accurate system for locating food sources, as shown in Figure7.Figure 7
Food source system.Fruit fly algorithm is one of the best worldwide methods based on fruit fly research. Fruit flying algorithm only requires four correction parameters, while other algorithms have more parameters. For example, particle swarm optimization algorithm needs to adjust 5 parameters, ant colony algorithm needs to adjust 7 parameters, and bacterial foraging algorithm needs to adjust 8 parameters, and the setting of each parameter requires a large number of experiments to obtain empirical values, which undoubtedly increases the complexity of the algorithm. As a new intelligent algorithm, fruit fly algorithm is simple and no less compared to other intelligent algorithms. Fruit fly algorithm is also easy to understand, the code is simple and easy to implement, and the running time is less. The core idea of fruit fly algorithm is to constantly use smell and vision to get close to the food source. Each individual fly starts by detecting the presence of food in a nearby area by smell, locating the general location of the food, and then using vision to accurately fly past that location. In the process of optimization, each individual fruit fly has its own flavor concentration, which is the standard to evaluate the quality of each individual fruit fly algorithm. The flavor concentration is determined by the flavor concentration function, and the flavor concentration of the food is related to the distance of the fruit fly. The farther away the fly is, the less likely it is to smell it, the smaller the individual flavor concentration, and the greater the vice versa. The process of fruit fly searching for food is to continuously move from a location with a low concentration of food to a location with a high concentration of food until it finds the location of food [15, 16]. As shown in Figure 8, the drosophila population flew randomly in all directions from initial position, and then individual drosophila with the highest food flavor concentration in the population was judged. At this point, individual 2 has the maximum flavor concentration, and then the whole population takes the individual’s position as the starting point to re-fly and then judge the flavor concentration. This cycle continues, iterating, gradually approaching the location of the food source.Figure 8
A fruit fly searching for food.


## 4.2. Node Deployment of Wireless Sensor Network Based on Fruit Fly Algorithm

In fact, fruit fly optimization algorithm continuously gathers at the current globally optimal location to conduct more refined local search, which is very suitable for solving the dynamic node deployment problem of WSN. Because the deployment of the optimal sensor node is not unique, that is to say, the sensor node corresponding to each number may not obtain the optimal sensor node deployment at a specific position in the deployment area [17]. In theory, there are countless combinations of sensor nodes in their respective locations to achieve optimal deployment. That said, a further search at the current optimal location generally leads to better deployment. Therefore, it is possible to use the fruit fly algorithm for the implementation of WSN nodes. However, different from traditional FOA, when the fruit fly algorithm is applied to node deployment of WSN, each fruit fly individual represents a sensor node deployment solution, which is directly represented by X(i), which stores the location information of all nodes. Therefore, X(I) can be directly used to calculate a taste concentration of each individual fruit fly. In particular, it should be noted that the judgment value of food taste concentration in this chapter is the coverage rate in WSN node deployment and the functional determination of taste concentration is the function to calculate costs. In each iteration, the fruit fly with the highest concentration of flavor was found, and all individual flies flew toward it using vision. At the same time, for the convenience of discussion, this chapter applies fruit fly algorithm to the node layout of wireless sensor network and makes the following assumptions: Each node has the same structure, and the communication radius of the node is twice the perception radius; each node can obtain its own coordinate information through GPS and other devices. The node has the ability of free movement and can be moved to a specified position. Nodes adopt binary perception model. Coverage is calculated by the ratio of covered grid points to the total grid points, and the grid points that are repeatedly calculated are only calculated once [18].Below are the specific steps of the fruit fly algorithm to implement a wireless sensor network:(1)
Initialize the parameters of the fruit fly algorithm and related parameters of WSN(2)
Each fruit fly provides direction and distance to search for food by olfactory perception as shown in the following formula;(1)Xi,:=X_axis+2∗s∗rand1,2∗d‐s.Here,I represents the fruit fly, d represents the number of sensor nodes, and s represents the long search step.
(1)
Calculate the determination value of taste concentration of each individual fruit fly, even if its coverage rate is shown in the following formula:(2)Smelli=computecoverXi,:.(2)
Finding the most odorous individual in a population of Drosophila; retain its optimal flavor intensity value and correspondingX_axis coordinates, as shown in the following formula:
(3)bestSmellbestIndex=maxSmell.(3)
Determine whether the best flavor intensity value of this iteration is greater than that of the last iteration, as shown in Formula (4). If so, then the drosophila population flies to this position by visual superposition; otherwise, perform Step (6):
(4)X_axis=XbestIndex,:.(4)
Enter the iterative optimization until the termination condition is satisfied


## 4.3. Simulation Experiment

Firstly, the number of sensor nodes was set to 35. In order to overcome the randomness of the experiment and better observe the performance of the algorithm, 15 experiments were conducted independently for the three algorithms. Their average coverage, standard deviation, and best and worst coverage are shown in Tables1 and 2.Table 1
Comparison results of coverage under 35 nodes (a).
Comparison modeInitial deploymentPSOGSOFOAAverage coverage0.70030.80920.79130.9198Best coverage0.72650.87810.85030.9322Worst coverage0.68720.7218-0.72360.9001Table 2
Comparison results of coverage under 35 nodes (b).
Comparison modeInitial deploymentPSOGSOFOAAverage coverage0.70040.80930.79150.9199Best coverage0.72630.87820.85040.9321Worst coverage0.68700.7217-0.72370.9002Then, in order to further visualize the improved performance of the algorithm, a group of data of initial deployment nodes are randomly selected to optimize the nodes using three algorithms.Finally, in order to further verify the influence of different node numbers on the algorithm proposed in this chapter, the number of nodes was set as 10, 15, 20, 25, 30, 40, and 45, respectively. Five independent experiments were conducted for each of the three algorithms, respectively, and the average coverage was compared to obtain the experimental results. When the network nodes are the same, the coverage obtained by FOA algorithm is almost always greater than that of PSO and GSO algorithms; especially if the number of nodes is greater than 20, the advantage is more obvious. At the same time, it can also be seen that the experiment of PSO algorithm is normal when the number of nodes is small, and GSO algorithm is easier to show its own advantages when the number of nodes is large. Therefore, it can be said that the algorithm proposed in this chapter can also achieve good experimental results under different node numbers.


## 4.4. Node Deployment with Obstacles

There may be obstacles in the actual deployment area. In this case, the sensor node cannot reach and pass through the obstacles. To measure the effectiveness of the algorithm mentioned in the problem in this chapter, it is considered that there is a perturbation in the middle of the output region and a problem at its edge [19]. The existence of obstacles does not affect the communication between nodes. Obstacles only prevent the movement of sensor nodes, and sensor nodes can still sense the obstacle area. All experimental parameters are exactly the same as those sections. First, assume that the deployment area has 35 sensor nodes. Assume that the circular obstacle has a radius of 8 and the rectangular obstacle 10X20.As can be seen from the experiments in the above two sections, the coverage optimization scheme based on the fruit fly algorithm proposed in this chapter has significantly improved coverage compared with PSO and GSO. This is because the fruit fly optimization algorithm can continuously conduct more detailed local search at the current global optimal location and the solution of WSN node deployment problem is not unique, so FOA can keep approaching the optimal solution while retaining its own optimal solution. Although the algorithm complexity of FOA is larger than that of GSO, it is much smaller than that of PSO. In coverage optimization with coverage as the main objective, overall consideration, FOA is very suitable for WSN node deployment.It is very important to select optimal parameters for fruit fly algorithm. Therefore, finding an appropriate iteration step value can improve algorithm performance [20]. Now it is easier for the algorithm to obtain the optimal solution by testing the value of S through experiments. The number of sensor node D is set to 30, and the population size and iteration times are the same as those in the above section. Obstacles are not considered here. S is set from 0.1 to 0.4, with an interval of 0.1. The experiment should be repeated for 10 times for each value of S, and the data obtained are shown in Tables 3 and 4.Table 3
Influence of TEST S when the number of sensor nodes is 30 (a).
s0.10.20.30.4Mean0.8120.8410.8520.851Max0.8230.8530.8630.857Min0.7960.8250.8350.846Table 4
Influence of S when the number of sensor nodes is 30 (b).
s0.10.20.30.4Mean0.8100.8400.8510.849Max0.8200.8540.8610.855Min0.7970.8260.8380.845


## 5. WSN Coverage Based on Particle Swarm Optimization and Improvements to Firefly Algorithms

### 5.1. Hybrid Algorithm Based on Particle Swarm Optimization and Improved Firefly Algorithm

Particle swarm optimization (PSO) is a parallel search algorithm compared with other evolutionary algorithms. It is insensitive to initial values and has memory function, but its local search ability is not strong, and it is prone to premature phenomenon. Firefly algorithm is an algorithm with strong local search ability, but it is sensitive to initial value, with fast convergence in early iteration, slow in late iteration, and no memory. Therefore, this chapter combines these two algorithms and proposes a hybrid algorithm based on the particle swarm optimization and improved firefly algorithm. The hybrid algorithm takes a process of particle swarm optimization as the main body. After adjusting the speed and position of each quote, local firefly search is carried out. In this way, each particle makes full use of its own stored node location information to make appropriate adjustments and then updates the individual and global extreme values. The hybrid algorithm not only uses firefly algorithm to conduct in-depth local search and move adjustment for each particle, but also makes full use of the density information of neighbor nodes of each node for adjustment. Meanwhile, it maintains the global parallel search ability of particle swarm optimization algorithm itself, which makes it easier to obtain the global extreme value. The flow chart of the algorithm is shown in Figure9.Figure 9
PGSO algorithm flow chart.


### 5.2. Experimental Analysis

Algorithm refers to the definition of a problem-solving process and the accuracy and completeness of specific instructions for solving a problem. An algorithm represents a strategic mechanism for solving problems in a practical way. In other words, it is possible to obtain the necessary results within a certain set of strategies within a limited period of time. If the algorithm is faulty or inappropriate for the problem, executing the algorithm will not solve the problem. Different algorithms can work the same in different time, place and function. Algorithm strengths and weaknesses can be measured based on difficulty and time constraints. An algorithm must have five properties: fineness, accuracy, input, output, and feasibility. In order to verify the effectiveness of PGSO hybrid algorithm, MATALAB simulation experiment is carried out on a 2.6GHZ computer. Experimental parameters are set as follows: The deployment area was 50X50, the number of iterations was 500, the sensing radius of the sensor was (rs) =5, the communication radius wasRC=10, the population size was 20, the learning factor C1=C2=2, the inertia weight wmax=0.9, wmin=0.4, the speed was set to 2, the initialfluoresceinconcentrationIOT0=400, the domain threshold nt=6, Luciferase volatile factor RHO=0.9, fitnessextractionratiogamma=0.1, and neighborhoodchangeratebeta=0.58. Firstly, the number of nodes was set to 35, and a group of data of initial deployment nodes were randomly selected to optimize node deployment using PGSO hybrid algorithm, and PSO and GSO were compared.The hybrid algorithm PGSO proposed in this chapter has achieved a coverage rate of 92%, much higher than PSO and GSO, indicating that the hybrid algorithm is easier to find the global optimal solution. In order to overcome the randomness of the experiment, 20 different initial deployment scenarios were independently selected for experimental simulation and compared with PSO and GSO. Tables5 and 6 list their average coverage, standard deviation, and best and worst coverage.Table 5
Comparison of coverage results under 35 nodes (a).
Comparison modeInitial deploymentPSOGSOPGSOAverage coverage0.70030.82340.79950.9213Best coverage0.72620.85750.184960.9337Worst coverage0.68710.71930.72920.9085Table 6
Comparison of coverage results under 35 nodes (b).
Comparison modeInitial deploymentPSOGSOPGSOAverage coverage0.70040.82330.79940.9215Best coverage0.72630.85740.184980.9338Worst coverage0.68700.71940.72910.9084As can be seen from Tables5 and 6, the average coverage rate of PGSO is 92.15%, much higher than that of PSO (82.33%) and GSO (79.94%). Meanwhile, the standard deviation of PGSO is the smallest. Both the best and worst coverage of PGSO are very high, indicating that the improved algorithm proposed in this chapter is more stable and converges faster than the standard PSO and GSO algorithms. In order to further verify the influence of different node numbers on PGSO, the hybrid algorithm proposed in this chapter, the number of nodes was set to 30, 40, and 45, respectively, and 20 independent experiments were carried out, respectively. The experimental results are shown in Figure 10 below.Figure 10
Comparison of optimized coverage of PSO, GSO, and PGSO under different nodes.It can be seen from Figure10 that the coverage of PGSO, the hybrid algorithm proposed in this chapter, is higher than that of PSO and GSO under different node numbers and the number of times required to reach a certain coverage is also the least, that is, the convergence speed of the hybrid algorithm is relatively fast. At the same time, it can also be seen that the algorithm performance is not significantly improved when the number of nodes is very sparse, and the difference between the three algorithms becomes more obvious with the increase of the number of nodes. This shows again that PGSO hybrid algorithm is easier to find a better deployment scheme of sensor nodes. Meanwhile, in the hybrid algorithm PGSO proposed in this chapter, a more refined LOCAL GSO search is required after each particle is updated with velocity and position. Therefore, the algorithm complexity of PGSO is higher than that of PSO and GSO, which is also the price for PGSO to achieve greater coverage improvement.


## 5.1. Hybrid Algorithm Based on Particle Swarm Optimization and Improved Firefly Algorithm

Particle swarm optimization (PSO) is a parallel search algorithm compared with other evolutionary algorithms. It is insensitive to initial values and has memory function, but its local search ability is not strong, and it is prone to premature phenomenon. Firefly algorithm is an algorithm with strong local search ability, but it is sensitive to initial value, with fast convergence in early iteration, slow in late iteration, and no memory. Therefore, this chapter combines these two algorithms and proposes a hybrid algorithm based on the particle swarm optimization and improved firefly algorithm. The hybrid algorithm takes a process of particle swarm optimization as the main body. After adjusting the speed and position of each quote, local firefly search is carried out. In this way, each particle makes full use of its own stored node location information to make appropriate adjustments and then updates the individual and global extreme values. The hybrid algorithm not only uses firefly algorithm to conduct in-depth local search and move adjustment for each particle, but also makes full use of the density information of neighbor nodes of each node for adjustment. Meanwhile, it maintains the global parallel search ability of particle swarm optimization algorithm itself, which makes it easier to obtain the global extreme value. The flow chart of the algorithm is shown in Figure9.Figure 9
PGSO algorithm flow chart.


## 5.2. Experimental Analysis

Algorithm refers to the definition of a problem-solving process and the accuracy and completeness of specific instructions for solving a problem. An algorithm represents a strategic mechanism for solving problems in a practical way. In other words, it is possible to obtain the necessary results within a certain set of strategies within a limited period of time. If the algorithm is faulty or inappropriate for the problem, executing the algorithm will not solve the problem. Different algorithms can work the same in different time, place and function. Algorithm strengths and weaknesses can be measured based on difficulty and time constraints. An algorithm must have five properties: fineness, accuracy, input, output, and feasibility. In order to verify the effectiveness of PGSO hybrid algorithm, MATALAB simulation experiment is carried out on a 2.6GHZ computer. Experimental parameters are set as follows: The deployment area was 50X50, the number of iterations was 500, the sensing radius of the sensor was (rs) =5, the communication radius wasRC=10, the population size was 20, the learning factor C1=C2=2, the inertia weight wmax=0.9, wmin=0.4, the speed was set to 2, the initialfluoresceinconcentrationIOT0=400, the domain threshold nt=6, Luciferase volatile factor RHO=0.9, fitnessextractionratiogamma=0.1, and neighborhoodchangeratebeta=0.58. Firstly, the number of nodes was set to 35, and a group of data of initial deployment nodes were randomly selected to optimize node deployment using PGSO hybrid algorithm, and PSO and GSO were compared.The hybrid algorithm PGSO proposed in this chapter has achieved a coverage rate of 92%, much higher than PSO and GSO, indicating that the hybrid algorithm is easier to find the global optimal solution. In order to overcome the randomness of the experiment, 20 different initial deployment scenarios were independently selected for experimental simulation and compared with PSO and GSO. Tables5 and 6 list their average coverage, standard deviation, and best and worst coverage.Table 5
Comparison of coverage results under 35 nodes (a).
Comparison modeInitial deploymentPSOGSOPGSOAverage coverage0.70030.82340.79950.9213Best coverage0.72620.85750.184960.9337Worst coverage0.68710.71930.72920.9085Table 6
Comparison of coverage results under 35 nodes (b).
Comparison modeInitial deploymentPSOGSOPGSOAverage coverage0.70040.82330.79940.9215Best coverage0.72630.85740.184980.9338Worst coverage0.68700.71940.72910.9084As can be seen from Tables5 and 6, the average coverage rate of PGSO is 92.15%, much higher than that of PSO (82.33%) and GSO (79.94%). Meanwhile, the standard deviation of PGSO is the smallest. Both the best and worst coverage of PGSO are very high, indicating that the improved algorithm proposed in this chapter is more stable and converges faster than the standard PSO and GSO algorithms. In order to further verify the influence of different node numbers on PGSO, the hybrid algorithm proposed in this chapter, the number of nodes was set to 30, 40, and 45, respectively, and 20 independent experiments were carried out, respectively. The experimental results are shown in Figure 10 below.Figure 10
Comparison of optimized coverage of PSO, GSO, and PGSO under different nodes.It can be seen from Figure10 that the coverage of PGSO, the hybrid algorithm proposed in this chapter, is higher than that of PSO and GSO under different node numbers and the number of times required to reach a certain coverage is also the least, that is, the convergence speed of the hybrid algorithm is relatively fast. At the same time, it can also be seen that the algorithm performance is not significantly improved when the number of nodes is very sparse, and the difference between the three algorithms becomes more obvious with the increase of the number of nodes. This shows again that PGSO hybrid algorithm is easier to find a better deployment scheme of sensor nodes. Meanwhile, in the hybrid algorithm PGSO proposed in this chapter, a more refined LOCAL GSO search is required after each particle is updated with velocity and position. Therefore, the algorithm complexity of PGSO is higher than that of PSO and GSO, which is also the price for PGSO to achieve greater coverage improvement.


## 6. Conclusion

This article introduces a swarm detection algorithm to optimize the layout of wireless sensor nodes, improve network service performance, and put forward an effective sensor node deployment method. The experimental results show that group perception algorithm, as an optimization method, is inspired by biology. Through the continuous enrichment and development of this algorithm, it has been effectively used in the coverage optimization of wireless sensor networks.



---

*Source: 4908978-2022-09-28.xml*