An Adaptive Immune Ant Colony Optimization for Reducing Energy Consumption of Automatic Inspection Path Planning in Industrial Wireless Sensor Networks

Industrial wireless sensor networks (IWSNs) are usually fixedly deployed in industrial environments, and various sensor nodes cooperate with each other to complete industrial production tasks. The efficient work of each sensor node of IWSNs will improve the efficiency of the entire network. Automated robots need to perform timely inspection and maintenance of IWSNs in an industrial environment. Excessive inspection distance will increase inspection costs and increase energy consumption. Therefore, shortening the inspection distance can reduce production energy consumption, which is very important for the efficient operation of the entire system. However, the optimal detection path planning of IWSNs is an N-P problem, which can usually only be solved by heuristic mathematical methods. This paper proposes a new adaptive immune ant colony optimization (AIACO) for optimizing automated inspection path planning. Moreover, novel adaptive operator and immune operator are designed to prevent the algorithm from falling into the local optimum and increase the optimization ability. In order to verify the performance of the algorithm, the algorithm is compared with genetic algorithm (GA) and immune clone algorithm (ICA). The simulation results show that the inspection distance of IWSNs using AIACO is lower than that of GA and ICA. In addition, the convergence speed of AIACO is faster than that of GA and ICA. Therefore, the AIACO proposed in this paper can effectively reduce the inspection energy consumption of the entire IWSN system.


Introduction
Intelligent manufacturing has emerged with the rapid development of information technology. IWSNs are one of the key technologies of intelligent manufacturing, and they are a combination of IWSNs and the Internet of Things [1][2][3]. Compared with traditional wired industrial sensor networks, it has the characteristics of fast deployment, high flexibility, and self-organization. It has broad application prospects in intelligent dispatching, industrial monitoring, and other fields. However, the battery-powered sensor node limits the overall performance of IWSNs [4][5][6][7]. Therefore, the inspection of IWSNs can effectively ensure the healthy operation of the system. Due to the large scale of IWSNs, the cost of an entire network inspection is very high. Therefore, planning an optimal inspection path is an effective way to reduce inspection costs [8][9][10].
At this stage, there are many path planning algorithms that can be used for automated robot inspections of IWSNs, such as rapidly exploring random tree (RRT) algorithm, Dijkstra algorithm, A * algorithm, GA, and ICA [11][12][13][14][15]. These algorithms can find a relatively good path, but they also have various disadvantages. Dijkstra is not suitable for optimizing combinatorial optimization problems. The RRT algorithm performs random point connection search, and it is difficult to find the optimal path. Although A * has added heuristic ideas, there is a problem that the optimal path cannot be guaranteed. Compared with the first three algorithms, GA and ICA have improved, but due to the slow convergence speed, it is easy to fall into the local optimum, and the algorithm performance is not very good.
Regarding the problems of the above algorithms, this article designs a new AIACO to overcome the above shortcomings. Aiming at the problem of minimizing the inspection overhead faced by IWSNs, applying path planning optimization technology to IWSNs can effectively reduce the overall inspection overhead of the network. AIACO's inspection path optimization can provide a low-cost, highefficiency letter inspection method for IWSNs. The simulation proves AIACO's ability to optimize the inspection path of IWSNs.
The main contributions are as follows: (1) First, this paper proposes an adaptive immune ant colony optimization (AIACO) to solve the optimization problem of automated inspection path planning, design a path planning model for IWSNs, and design a new fitness function to evaluate the performance of the algorithm (2) Secondly, new adaptive operator and immune operator are designed in this paper to enhance the optimization ability of the algorithm. AIACO, which combines adaptive operators and immune operators, has better performance, enhances global search capabilities, and avoids falling into local optimum (3) Finally, we compare the simulation results of AIACO with GA and ICA in the inspection path planning of IWSNs to prove the superior performance of AIACO in path planning and optimization and give detailed data and demonstrations. More importantly, it also provides a new method for the research field of automated inspection path planning The remaining structure of the paper is shown below. Section 2 introduces related research on the optimization of inspection path planning in the field of IWSNs. Section 3 shows the path planning model. Section 4 proposes an adaptive immune ant colony optimization to solve the inspection path planning problem in IWSNs. Section 5 demonstrates the effectiveness of AIACO in solving the task assignment problem through simulation experiments and discusses it. Section 6 is the conclusion part.

Related Work
In recent years, the research on the optimization of inspection path planning of IWSNs has attracted a large number of scholars [16,17]. In IWSNs, an effective inspection program can obtain lower inspection time and lower cost and improve industrial production efficiency [18,19]. There are also many optimization algorithms for path planning, which are basically divided into heuristic algorithms and nonheuristic algorithms.
The paper [20] proposed a weighted pigeon swarm algorithm for UAV trajectory planning in a complex environment and introduced weight coefficients to calculate the speed and position of individuals in the population to improve the quality and efficiency of route planning. However, this algorithm has the problems of being easy to fall into local optimum, slow and unstable convergence speed.
In [21], the authors aimed at the rapid planning of the optimal trajectory of the intelligent aircraft, considering the error constraints and the correction probability constraints, constructing the trajectory planning model of the intelligent aircraft under multiple constraints, and proposed a global search algorithm based on Dijkstra to solve the model. The algorithm proposed by the author improves the basic Dijkstra algorithm by calculating the residual error and constrained flight distance, so that it has better adaptability when solving the trajectory planning problem under multiple constraints. However, Dijkstra is not suitable for solving path planning problems.
In [22], the authors aimed at the problem of low node utilization and large calculation amount in the traditional RRT algorithm. Based on the fast RRT algorithm, they optimized the strategy of reselecting the parent node and pruning range, improved the sampling method, and introduced adaptive Step size; the fast RRT algorithm is improved, making the algorithm time-consuming and path length shorter. At the same time, the node connection screening strategy is added to eliminate the excessive turning angle in the path, and a path can be searched in a high-dimensional environment. However, the fast RRT algorithm still has a large amount of calculation and slow convergence speed, and it is difficult to find the optimal path.
In [23], the authors proposed an improved A * algorithm. The improved algorithm extends the traditional 8neighborhood search to 24 neighborhoods and uses guidance vectors to optimize the number of neighborhoods, eliminate redundant nodes, improve search efficiency, and optimize smooth paths. However, this algorithm has low search freedom, and the planned path length is still very long.
In [24], the authors proposed a mobile robotic arm picking path optimization method based on an improved GA. Through the analysis of the position of the picked items, the mobile robotic arm sorting path model and multistation at a single station are established. Point's traveling salesman (TSP) problem model, using an improved GA to optimize the position coordinates of each station point in the workspace, and plan the shortest path captured by the mobile robot arm and the shortest movement between multistation point path. However, this algorithm still has the problems of premature and slow convergence.
In [25], the author simulated the optimization path planning problem of the biological immune process and established the mathematical model of the ICA. Using the random process theory, the convergence of the Markov chain of the population sequence formed by the ICA is proved. The author verifies that the algorithm's ability to maintain diversity is stronger than general genetic algorithms in searching for local and global solutions. However, this algorithm is easy to fall into the local optimum, and there is a problem of insufficient convergence accuracy.
Aiming at the shortcomings in the above literature, we propose a new solution to solve the problem of IWSN Journal of Sensors inspection path planning optimization, improve the overall inspection speed of the IWSN system, increase the automation efficiency, reduce the cost of industrial production, and improve the industrial production effectiveness.

System Model
In a complex IWSN environment, regarding the network control range and path planning constraints, in order to minimize the inspection path, a mathematical model is designed based on two-dimensional coordinates. This model can realize automatic inspection of sensor nodes in an industrial environment, so that the path of inspection of IWSNs is the shortest. This model can be simply abstracted into an undirected complete graph GðV, EÞ. V represents a node set composed of N sensor nodes, and E represents a set of distances between every two nodes. Assume that N industrial sensor nodes have been installed in the industrial detection environment, represented by integer codes ð1, 2,⋯,N − 1, NÞ, and the two-dimensional coordinates of each sensor node are known. The distance between node i and node j is d i,j , which can be calculated by formula (1), where i x and j x represent the abscissa of nodes i and j, respectively, and i y and j y represent the ordinate of nodes i and j, respectively. The ultimate goal of this paper is to find the shortest inspection path to reduce inspection overhead.
Suppose S n is a set of randomly generated solutions for the inspection path planning, and s represents one of the arbitrary N sensor node sets. The robot inspection starts from s 1 , inspects to s N , and then returns to s 1 . A group of inspection paths is represented by formula (2). The distance between every two nodes of the inspection path is represented by d s n ,s n+1 . The total inspection path length is represented by d sum , which can be calculated by formula (3). ∑ N n=1 d s n ,s n+1 represents the distance from s 1 through all nodes to s N ; d s N ,s 1 represents the distance from s N to s 1 .
In order to explain the model more clearly, suppose there are 8 industrial sensor nodes in total, and a random inspection path is planned. This path is expressed in formula (4). The distance between two of the 8 nodes can be calculated sequentially in vector order, and the total path length can be calculated according to formula (3).
The inspection path planning of IWSNs must not only meet the actual production requirements but also reduce the inspection cost of the entire IWSNs. The shorter the path, the higher the inspection efficiency of the system. The inspection path refers to the trajectory that the robot traverses in one-time inspection of each sensor node in the system. Especially in large-scale IWSNs, the difficulty of inspection increases exponentially as the number of nodes increases. Therefore, an excellent inspection path planning program can achieve lower network inspection costs and higher network operation efficiency.

AIACO for Reducing Energy Consumption of Automatic Inspection Path Planning in IWSNs
Aiming at the problem of inspection path planning in IWSNs, a new optimization algorithm of AIACO is proposed. In the proposed AIACO strategy, new adaptive operators and immune operators are designed. Operators can enable AIACO to plan the shortest inspection path and find the best solution. Basic ant colony optimization often has insufficient convergence accuracy and is easy to fall into local optimum. Therefore, this article proposes an innovative adaptive strategy in AIACO. In the pheromone update stage, the pheromone update can be adjusted in time according to the operation of the algorithm, thereby increasing the global search capability of the entire AIACO. A new clonal immune strategy is designed to accelerate the algorithm convergence. In the ant-cycle model, after evaluating the fitness of each ant in the ant colony, a clone immune method is adopted to clone the elite ants and form a new colony according to the immune mechanism. Therefore, the two new strategies can improve AIACO's ability to solve the inspection path planning problem in IWSNs.
The execution steps of AIACO are shown in Figure 1. Use the following detailed steps to illustrate the algorithm flow chart shown in Figure 1.
Step 1. Design coding rules. Use integer encoding.
Step 2. Initialize the ant colony. Construct an ant colony that meets the path planning model conditions. The ant colony can be abstracted as an integer matrix. Set M ants and N sensor nodes. The matrix can be expressed as matfMNg.
Step 3. Cycle each ant. Generate a set of ant colony solutions.
Step 4. Adjust the volatilization factor. Use an adaptive mechanism to change the exponential factor.
Step 5. Update pheromone. Use dynamically changing volatilization factor to update.
Step 6. Calculate the fitness of the ants. According to the fitness of each individual to evaluate the quality of the program.
Step 7. Clone the elite ants. Clone the most adaptable ants and use immunity to regenerate a new colony. Repeat Step 6.

Journal of Sensors
Step 8. Repeat Steps 3, 4, 5, 6, and 7. Stop when the upper limit of iteration is met.
Step 9. Output the shortest inspection path.
In Algorithm 1, we show the entire IACGA algorithm flow in pseudo code.
This article discusses in detail the process of the proposed AIACO to solve the inspection path planning problem in IWSNs in the following sections. Respectively, explain from the aspects of initialization, calculation of fitness, path selection, new operators, and update pheromone.

Coding Scheme.
One of the first steps to use AIACO to solve IWSN inspection path planning is to design the coding scheme according to the system model. The problem of the inspection path of the wireless sensor network is that the automated robot starts from a sensor node randomly, inspects all nodes, and cannot check repeatedly. Finally, return to the starting point. The ultimate goal of solving the problem is to make the path of the robot the shortest, that is, to minimize the inspection cost. The coding scheme will directly affect the efficiency of the algorithm. This article uses integer coding to improve the performance of the program. The coding design is to use multiple ants of the ant colony to search for paths in parallel and use the intelligence of the group to plan the shortest path. Each path traversed by an ant represents a solution, and S ðM,NÞ represents a set of inspection path plans generated by the ant colony. A single ant is represented by m, and the number of ant colonies is represented by M. N represents all sensor nodes of IWSNs. s m,n represents the sensor node selected by Regarding the intuitive representation of the coding scheme, and set M to 3 and N to 8. The ant colony scheme is represented by formula (6). The three ants represent three different inspection schemes. Coding mainly solves the abstract connection problem between inspection planning and AIACO and uses mathematics and computer programs to solve it. Ant colony initialization is the first encoding when the pheromone is the initial value. We assume that the first search is not affected by pheromone differences, and the free search method can be used to better simulate the natural ant colony looking for food. Therefore, the path planning scheme is generated for M ants. The initial ant colony scheme can be simply described as S = fS 1 , S 2 ,⋯,S M g. The path of the m th ant can be expressed as S m = fs m,1 , s m,2 ,⋯,s m,N g. For example, the specific codes of 3 ants and 8 nodes are reflected in formula (5).
Combined with the data of formula (5), Figure 2 shows the initialization scene. The 8 sensor nodes are initialized as a wireless sensor network. The three ants were randomly placed at the sensor nodes 2, 4, and 7 during initialization, began to plan their respective inspection paths, and finally completed the inspection task. Evaluate the quality of the inspection route plan by calculating the path length.

Fitness Evaluation.
The fitness function is the criterion for evaluating the quality of the inspection path. The fitness function designed in this paper is designed to evaluate the shortest path found by the ant colony. The fitness function basically determines the direction of AIACO's program operation. The shorter the inspection path, the greater the probability of being selected by the ants. Each ant in the ant colony has its own evaluation value. AIACO embodies the search process of natural ants, through the search path, and then leave pheromone on the path. In this article, the evaluation of ants is based on the length of the inspection path. The goal AIACO

Select Path.
When the ants in an ant colony start to search for a path, the visibility and pheromone content on the path are important factors. These two factors determine the ant's choice to go to the next sensor node. In formula (7), τ is the sum of pheromone on the path between two sensor nodes. u represents the visibility between the two sensor nodes. In addition, the inspection rules of the ants in this article are as follows: each ant randomly selects a node and searches from the current node until it has traversed all the nodes and returned to the node where it started. During this search, the ants will leave pheromone on the path they pass. In the algorithm initialization, set the pheromone content in the path to a constant. P ij ðmÞ represents the probability that ant m chooses from node i to the next node j. Λ represents the remaining node set. α and β are the pheromone index constant and the visibility index constant, respectively. In formula (7), the roulette method is used to determine the direction of the ant to the next node.
4.5. Pheromone Update. Pheromone update is an important step for AIACO to solve the problem of inspection path planning. When looking for the best path, the path needs to be selected by calculating pheromone. When ants visit each sensor node, they release pheromone on the path from node i to node j. As the algorithm runs, the entire ant colony will have an impact on the entire sensor network path. During the period, the pheromone content will also volatilize part of the evolution process. In AIACO, after each ant completes an inspection, the pheromone on the path it passes will be updated. The modification method is determined by formulas (8), (9), and (10).
where g represents the number of iterations of the loop and ρ represents the volatilization factor of the pheromone. τ i,j ðg, g + 1Þ represents the updated pheromone result after the end of the g th generation. Δτ i,j represents the pheromone change produced by M ants after the search is over. Δτ m i,j represents the pheromone result updated by the m th ant. However, the result of pheromone update on each path is determined by the pheromone constant Q and the path dis-tance dij. The longer the path length, the smaller the release of pheromone.

Adaptive Strategy.
In the case of large-scale nodes, the traditional ant colony optimization gradually becomes the choice of ants with the accumulation of pheromone, but this path may not be the shortest path. Moreover, the traditional ant colony optimization is often easy to fall into the local optimum. There are two problems with the fixed setting of the volatilization factor. If the setting is too large, the pheromone content will be less after the cycle of the g generation, and it will not be able to be truly fed back to the subsequent ants to choose. If the setting is too small, there will be a large accumulation of pheromone, and the pheromone difference on the path will become larger, leading to premature algorithm.
The purpose of the new adaptive strategy designed in this paper is to prevent premature programs and increase the search space of the ant colony. In the inspection process, the adaptive strategy judges whether to adjust the pheromone volatilization factor according to the concentration of the pheromone in the current network, which affects the path selection probability of the ants, thereby guiding AIACO to a better solution. Therefore, the adaptive mechanism of the proposed algorithm can show better performance when the problem is more complicated. The adaptive update method is determined by formulas (11) and (12).
where c represents a constant and φðθÞ is directly proportional to the convergence factor θ and inversely proportional to c. An increase in the number of convergences of θ will result in an increase in φðθÞ. τ max represents the upper limit of the pheromone concentration, and τ min represents the lower limit of the pheromone concentration. With the operation of the algorithm, AIACO adaptively adjusts the pheromone concentration so that the ant inspection path will not be concentrated quickly. Therefore, AIACO avoids local optima and enhances global search capabilities.

Immune Strategy.
In AIACO, improving the convergence speed of the algorithm is an important task. This paper designs a clonal immune strategy for the stage of population change. When the immune system solves the problem of IWSN inspection path planning, it uses the immune advantage in immunology to respond to antigen stimulation in a timely manner, thereby changing antibodies. The clonal immune strategy better simulates the clone process of the ant colony immune system. The clonal immune strategy can greatly improve the optimization speed of inspection path planning. Immunization can increase the diversity of ant colony programs. After the ant colony search is over, 6 Journal of Sensors the existing ant colony codes are used to find a number of elite ants by evaluating the fitness ranking of the ant colony. These elites are randomly cloned to form a new population for immune mutation operation. Mutation may lead to new schemes, and there is a chance to produce more adaptable ants, which accelerates the algorithm convergence.

Simulation and Discussion
5.1. Experimental Setup. This section will verify the performance of AIACO, ICA, and GA in IWSN inspection path planning through simulation. The experimental hardware equipment is Intel(R) Core (TM) i5 @2.40GHz CPU DELL computer. The simulation software is MATLAB R2018a.
The operating system is Windows 10 version 1909. The experimental termination conditions of the three algorithms are all 100 generations, and the two-dimensional coordinate area is 100 × 100 m 2 . In order to compare the problem-solving capabilities of AIACO with ICA and GA, we set the population size of AIACO, ICA, and GA to 100. In AIACO, set pheromone volatilization factor to 0.95, information heuristic factor to 1, and pheromone weight is 2.5. In ICA, we set the antibody recombination probability to 0.75, the antibody mutation probability to 0.55, and the percentage of clone elites to 10%. In GA, we set the crossover probability to 0.69 and the mutation probability to 0.04. The main experimental parameters of the three algorithms of AIACO, ICA, and GA are listed in Tables 1-3. . Figures 3(a)-3(d) show the inspection path optimization results of AIACO, ICA, and GA under the experimental conditions of four different sensor node numbers. In Figures 3(a)-3(d), AIACO optimizes the inspection path better than ICA and GA. When the algorithm is in the 20th generation, AIACO has basically converged and found a short path relative to ICA and GA. ICA converges faster than GA. In 100 generations, all three algorithms found their shortest paths. From the optimization trend, AIACO's performance is the best compared to ICA and GA. This point proves that the immune cloning operator can improve the convergence speed of the algorithm. In Figure 3(d), the number of sensor nodes is 80, and the trend of AIACO's optimization path is more obvious. It is verified that the new adaptive strategy and immune strategy can make AIACO better solve the problem of minimizing the inspection path of IWSNs.

Discussion of Experimental Results
Figures 4(a)-4(d) compare the shortest path lengths of the three algorithms in 100 generations, and the number of sensor nodes is 20, 40, 60, and 80, respectively. Use the histogram to directly compare the gaps. As can be seen in Figures 4(a)-4(d), in the four cases, the length of the inspection path optimized by AIACO is less than that of ICA and GA. When the sensor node increases, the shortest path length also increases. At the same time, AIACO has better path optimization performance than ICA and GA. When the number of nodes is 60 and 80, the gap between AIACO and ICA and GA is greater. This point illustrates AIACO's network optimization capabilities for large-scale nodes. Therefore, compared with ICA and GA, AIACO has better ability to optimize inspection paths.
Figures 5(a)-5(d) show the path optimization percentages when the number of sensor nodes is 30, 50, 60, and 80, respectively. From the pie chart, we can intuitively see the comparison between AIACO, ICA, and GA on the improvement of the optimization degree of the inspection path. In the case of four different numbers of nodes, the path length optimized by AIACO is larger than that of ICA and GA, accounting for 41%, 44%, 48%, and 49%, respectively. ICA accounts for 34%, 35%, 32%, and 32%, respectively. GA accounts for 25%, 21%, 20%, and 19%, respectively. As the number of nodes increases, AIACO performance will also improve. The adaptive strategy can prevent AIACO from falling into the local optimum, increase the algorithm's global optimization ability, and find a shorter path. Overall, the performance of AIACO in IWSNs is always better than the other two algorithms. Figure 6 shows a comparison of reduced path lengths with sensor nodes of 20, 30, 40, 50, 60, 70, and 80. The data comes from Table 4. It can be seen from Figure 6 that in the seven cases, as the number of nodes increases, the degree of reduction of the path length by the three algorithms increases. From the overall trend, AIACO's optimization performance for inspection paths is better than ICA and   GA. The line graph shows an upward trend. Especially when the number of nodes is 70 and 80, AIACO's performance is better than ICA and GA. Better than self-adjusting the volatilization of pheromone, it promotes AIACO's ability to find the best. The immune clone method makes the new ant colony recombined by elite ants have a higher diversity, which is conducive to finding the shortest path. Overall, AIACO's performance is very superior. Table 4 shows that AIACO, ICA, and GA reduce the length of the inspection path. It can be seen from the data in Table 4 that as the number of sensor nodes increases for each algorithm, the shortened path length also increases. Combining Figure 6 to see similar conclusions more intuitively. Based on Table 4, Table 5 shows the optimized performance of AIACO, ICA, and GA under different node parameter settings in percentage form. The proportion of AIACO's shortened path length is always greater than that of ICA and GA. The highest percentage is 49%, and the corresponding node numbers are 70 and 80, respectively. The percentage of ICA ranks second in total, and GA is the smallest. The factor of AIACO's high performance is that the new operator adjusts the pheromone concentration in real time when the algorithm is running to prevent premature convergence. Compared with AIACO, ICA and GA are easy to fall into the local optimum, and the performance of finding the shortest inspection path is poor.
Suppose the population size is m, and the number of sensor nodes is n. It can be seen from Table 6 that the algorithm complexity of AIACO is Oðm × n 2 Þ, and the algorithm complexity of ICA and GA is Oðm × n 2 + nÞ. In AIACO, ants need to search for each node and then update the pheromone, forming a double cycle. ICA and GA have similar selection and mutation processes, and both are double cycles. Therefore, compared with ICA and GA, AIACO has lower complexity. More importantly, as can be seen from Figure 3, AIACO's convergence speed and optimization performance are better than ICA and GA.
Through the comparison and discussion of simulation results, the effectiveness of the proposed AIACO in solving the problem of automatic inspection path planning in inspection IWSNs is verified. Successfully solve the problem of  Journal of Sensors minimizing inspection path planning in two-dimensional coordinates. Future research will involve inspection path planning in three-dimensional space and more complex industrial environments.

Conclusion
Aiming at the problem of minimizing the inspection path planning of industrial wireless sensor networks (IWSNs), this paper proposes a new adaptive immune ant colony optimization (AIACO). Before the algorithm is executed, the inspection path planning model of IWSNs is established. A new adaptive strategy is designed to dynamically adjust the volatilization of pheromone to prevent the algorithm from premature convergence. A new immune strategy is designed to select elite ants to reorganize new colonies. The immune strategy increases the optimization speed of the algorithm and the diversity of the inspection plan. In addition, we compare the performance of AIACO with ICA and GA in solving IWSN path planning through simulation results and discussed in detail. The result proves that the performance of AIACO is better than that of ICA and GA. This algorithm effectively solves the problem of automatic inspection path planning in IWSNS, can find the shortest path, and reduce the energy consumption of industrial inspection tasks.

Data Availability
The data presented in this study are available on request from the corresponding author. The data are not publicly available due to privacy.

Disclosure
The funders had no role in the design of the study; in the collection, analyses, or interpretation of data; in the writing of the manuscript, or in the decision to publish the results.

Conflicts of Interest
The authors declare no conflict of interest.