# Dynamic UAV Inspection Boosted by Vehicle Collaboration Under Harsh Conditions in the IoT Realm
## 4 Algorithm
### Static Planning and Scheduling Algorithm
#### 4.1.5 HGA for Static Optimization  
In the previous section, through the steps of anchor point selection and the division of anchor point task sets, the division of routes within anchor points, UAV route assignment, and vehicle route planning, a feasible greedy initial solution \(S\) was obtained. Next, it is necessary to optimize this solution. Generally, common optimization algorithms such as genetic algorithms and particle swarm optimization simulate the evolutionary processes or group behaviors in nature, which can quickly find high-quality solutions in complex search spaces. This study adopted the HGA (Hybrid Genetic Algorithm) [43] to optimize the greedy initial solution. The HGA, as an optimization algorithm, combines the characteristics of the Genetic Algorithm (GA) with other optimization techniques. By introducing new operational strategies or improving certain aspects of the genetic algorithm, it enhances both the global search ability and local search ability of the algorithm, thereby better solving complex optimization problems. **Input:** Global solution \(S\);  
**Output:** Global solution \(S\);  
```
1:Vehicle sequence list \(trunk\_order\leftarrow\emptyset\)
2:Extract all anchor points \(anchors\) from \(S\)
3:Add the anchor point where the current vehicle is located to the \(truck\_order\) as the starting point, and remove it from \(anchors\)
4:while anchors \(\
eq\emptyset\)do
5: Select an anchor point from the remaining \(anchors\) that, when added to the current \(trunk\_order\), increases the route length the least
6: Add the selected anchor point to the end of \(trunk\_order\), and remove it from \(anchors\)
7:endwhile
8:Reorder the solution sets corresponding to each anchor point in \(S\) according to the \(trunk\_order\) to obtain the final solution
9:Return \(S\);
```  
**Algorithm 4** The Vehicle Route Planning Algorithm  
The HGA (Hybrid Genetic Algorithm) combines the traditional GA (Genetic Algorithm) with local search techniques to enhance algorithm performance. In each iteration, the HGA selects two parent solutions from the initial population, generates multiple offspring populations through genetic operations, evaluates these offspring solutions functionally, and further optimizes them using local search techniques. It then determines whether the optimized offspring solutions should replace the current parent solutions in the new population. This process results in an updated population. Specifically, several different initial greedy solutions are first constructed and added to the global solution set, with the number of solutions recorded. A maximum population size and the number of iterations \(A\) are set. When the number of solutions is less than the population size value, a tournament method is used to select two global parent solutions from the global solution set. Algorithm 5 is then applied to these two parent solutions to generate an HGA-optimized solution, which is added to the global solution set. This process is repeated until the number of solutions reaches the set population size value. Subsequently, the solutions in the global solution set are sorted in ascending order by cost, and less effective solutions are removed. This completes one iteration of the solving process. After repeating these steps \(A\) times, all iterations are completed, and the best solution \(S\) in the global solution set is returned. As shown in Algorithm 5, given two distinct global solutions \(S_{1}\) and \(S_{2}\), all routes are placed into \(routes\) and all anchor points are placed into \(anchors\). The final route set is recorded as \(routes\_final\). The route with the minimum cost (cost defined as route length divided by the number of customer points in the route) is selected from \(routes\) and added to \(routes\_final\). All anchor points or task points included in the selected route are removed from all routes in \(routes\), and empty routes in \(routes\) are deleted. This process is repeated until \(routes\) is empty.