Unmanned aerial vehicle inspection path optimization method and system for multi-region task
By obtaining a unified inspection task feature vector and using a pre-trained task feature encoder and differentiable clustering to generate mapping intervals, combined with an improved ant colony algorithm to optimize the mapping table, the problem of heterogeneous and dynamically changing task features in multi-region UAV inspections is solved, achieving accurate matching of path generation strategies, reducing risks and improving efficiency.
Patent Information
- Application Number
- CN202611664523.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-27
- Publication Date
- 2026-11-24
AI Technical Summary
In existing multi-regional UAV inspections, the mission characteristics are heterogeneous and dynamically changing, and the mapping interval and path generation strategy are not accurately matched, resulting in a high risk of mission timeout, insufficient battery life and communication interruption.
By obtaining a unified inspection task feature vector, an initial mapping interval is generated using a pre-trained task feature encoder and differentiable clustering. The mapping table is then optimized using an improved ant colony algorithm to generate a path generation strategy, including task priority sorting, charging node insertion, and communication blind spot avoidance rules.
It improves the matching accuracy and environmental adaptability of multi-region UAV inspection path generation strategies, reduces the risks of mission timeouts, insufficient battery life, and communication interruptions, and enhances the reliability and overall efficiency of UAV inspection path optimization.
Smart Images

Figure CN123159641A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of unmanned aerial vehicle (UAV) inspection technology, and more specifically to a method and system for optimizing UAV inspection paths for multi-area missions. Background Technology
[0002] With the continuous expansion of infrastructure such as power grids, oil and gas pipelines, and communication base stations, drone inspection missions are characterized by multi-regional, multi-task types, and dynamic changes. Multi-regional inspections may include infrared thermography, visible light inspection, and lidar scanning, each with different requirements for time windows, communication quality, and endurance. Furthermore, the communication environment in the inspection area is complex, the distance between the mission location and the drone's current location changes continuously as the drone advances, and the urgency of the mission dynamically changes as the time window deadline approaches.
[0003] Currently, multi-area UAV inspection path generation largely relies on manual experience or fixed rules. Information such as task type, time window, communication quality, and spatial distance is scattered and inconsistent in scale, making it difficult to accurately match task classification with path strategies. This easily leads to unreasonable task execution order, untimely insertion of charging nodes, and insufficient avoidance of communication blind spots, resulting in task timeouts, insufficient battery life, and communication interruptions. Therefore, how to accurately match multi-area UAV inspection paths with path generation strategies based on dynamic task characteristics while considering task timeliness, battery life safety, and communication reliability has become a pressing technical problem that needs to be solved. Summary of the Invention
[0004] This invention provides a method and system for optimizing UAV inspection paths for multi-regional tasks. This invention solves the technical problems in existing multi-regional UAV inspection systems, such as heterogeneous and dynamically changing task characteristics, inaccurate matching between mapping intervals and path generation strategies, difficulty in balancing task timeliness, endurance safety, and communication reliability in online path generation, leading to high risks of task timeouts, insufficient endurance, and communication interruptions.
[0005] In view of the above problems, the present invention provides a method for optimizing UAV inspection paths for multi-area missions, including: Obtain the inspection task feature vectors of multiple inspection tasks. The inspection task feature vectors include task type, remaining time of time window, communication quality and distance to the current node. The inspection task feature vectors corresponding to the multiple inspection tasks are input into the pre-trained task feature encoder, and the task embedding vectors corresponding to the multiple inspection tasks are output. Differentiable clustering is performed on the output task embedding vectors to obtain multiple initial mapping intervals and corresponding soft partition boundaries. A mapping table is constructed that includes multiple mapping intervals, each mapping interval corresponding to a path generation strategy. The path generation strategy includes a task priority sorting rule, a charging node insertion rule, and a communication blind spot avoidance rule. Using the soft partition boundary as the initial partition boundary, an improved ant colony algorithm is used to perform offline optimization of the partition boundaries of the multiple mapping intervals to obtain the optimized mapping table. During the online phase, the mapping interval to which the current inspection task belongs is determined in the optimized mapping table based on the inspection task feature vector of the current inspection task, the corresponding path generation strategy is obtained, and the UAV inspection path is generated according to the path generation strategy.
[0006] This invention also provides a UAV inspection path optimization system for multi-area missions, including: The task feature acquisition module is used to acquire the inspection task feature vectors of multiple inspection tasks. The inspection task feature vectors include task type, remaining time of time window, communication quality and distance to the current node. The task encoding and clustering module is used to input the inspection task feature vectors corresponding to the multiple inspection tasks into the pre-trained task feature encoder, output the task embedding vectors corresponding to the multiple inspection tasks, and perform differentiable clustering on the output task embedding vectors to obtain multiple initial mapping intervals and corresponding soft partition boundaries. The mapping table construction module is used to construct a mapping table including multiple mapping intervals, each mapping interval corresponding to a path generation strategy, wherein the path generation strategy includes task priority sorting rules, charging node insertion rules and communication blind spot avoidance rules; The offline optimization module is used to optimize the partition boundaries of the multiple mapping intervals offline using the soft partition boundary as the initial partition boundary and an improved ant colony algorithm to obtain the optimized mapping table. The online path generation module is used in the online phase to determine the mapping interval to which the current inspection task belongs based on the inspection task feature vector in the optimized mapping table, obtain the corresponding path generation strategy, and generate the UAV inspection path according to the path generation strategy.
[0007] One or more technical solutions provided in this invention have at least the following technical effects or advantages: This invention unifies multi-regional inspection tasks into a single inspection task feature vector, encompassing task type, remaining time window, communication quality, and distance to the current node. It automatically obtains task embedding vectors, initial mapping intervals, and soft partitioning boundaries using a pre-trained task feature encoder and differentiable clustering. Then, using the soft partitioning boundaries as initial boundaries, an improved ant colony algorithm is employed to offline optimize the mapping table. This ensures accurate correspondence between the mapping intervals and path generation strategies, including task priority ranking rules, charging node insertion rules, and communication blind spot avoidance rules. In the online phase, the current task embedding vector is matched to its corresponding mapping interval, and the appropriate strategy is invoked to generate the UAV inspection path. This effectively eliminates the dimensional differences of heterogeneous task features while preserving task type semantics, fully capturing the correlation between multiple inspection tasks. Mapping interval partitioning and path strategy matching are driven by historical data and the quality of path generation from the validation set, reducing the subjectivity of manually setting boundaries and rule weights. It balances path length, task timeliness, endurance safety, and communication reliability, improving the matching accuracy, real-time performance, and environmental adaptability of multi-regional UAV inspection path generation strategies. This reduces the risks of task timeouts, insufficient endurance, and communication interruptions, ultimately enhancing the reliability and overall efficiency of UAV inspection path optimization.
[0008] In summary, this invention solves the technical problems in existing multi-area UAV inspections, such as heterogeneous and dynamically changing task characteristics, inaccurate matching between mapping intervals and path generation strategies, difficulty in balancing task timeliness, endurance safety, and communication reliability in online path generation, which lead to high risks of task timeouts, insufficient endurance, and communication interruptions. Attached Figure Description
[0009] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0010] Figure 1 This is a flowchart illustrating the UAV inspection path optimization method for multi-regional tasks provided in this embodiment of the invention. Figure 2 This is a schematic diagram of the fitness calculation process in the UAV inspection path optimization method for multi-regional tasks provided in this embodiment of the invention; Figure 3 This is a schematic diagram of the structure of the UAV inspection path optimization system for multi-regional tasks provided in an embodiment of the present invention.
[0011] The components represented by each number in the attached diagram are explained below: Task feature acquisition module 11, task encoding and clustering module 12, mapping table construction module 13, offline optimization module 14, and online path generation module 15. Detailed Implementation
[0012] This invention provides a method and system for optimizing UAV inspection paths for multi-regional tasks, specifically addressing the technical problems in existing multi-regional UAV inspections, such as heterogeneous and dynamically changing task characteristics, inaccurate matching between mapping intervals and path generation strategies, difficulty in balancing task timeliness, endurance safety, and communication reliability in online path generation, which lead to high risks of task timeouts, insufficient endurance, and communication interruptions.
[0013] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0014] Example 1, as Figure 1 As shown, this invention provides a method for optimizing UAV inspection paths for multi-area missions, including: S100: Obtain the inspection task feature vectors of multiple inspection tasks. The inspection task feature vectors include task type, remaining time of time window, communication quality, and distance to the current node.
[0015] Currently, in multi-area drone inspections, task type, time window, communication quality, and spatial distance are often distributed across different systems or provided by different sensors, resulting in inconsistent dimensions. This makes direct comparison difficult when used for path optimization, and can easily lead to situations where only distance is considered, ignoring the urgency of the time window and the risk of communication blind spots. Representing task type with simple numbers introduces meaningless numerical relationships; failing to dynamically update the remaining time of the time window can misclassify tasks nearing their deadline as low priority; excluding communication quality from feature construction can cause drones to enter communication blind spots, leading to task interruption; and failing to update the current node distance with the drone's position can cause the path strategy to become disconnected from real-time status. Therefore, obtaining a unified, dynamic, and dimensionally consistent feature vector that simultaneously represents task type, remaining time window, communication quality, and current node distance is a pressing technical problem that needs to be solved.
[0016] Step S100 in the method provided in this embodiment of the invention includes: The task type, time window deadline, communication quality parameters, and task location of each inspection task are obtained. The task type includes infrared temperature measurement tasks, visible light inspection tasks, and lidar scanning tasks. The communication quality parameters are used to characterize the communication signal strength at the task location. Calculate the remaining time of the time window for each inspection task based on the time window deadline and the current time; Based on the task location and the current node location, calculate the distance between each inspection task and the current node location. The task type is encoded to obtain the encoded task type. The remaining time of the time window, the communication quality parameter, and the current node distance are normalized to obtain the normalized remaining time of the time window, the normalized communication quality parameter, and the normalized current node distance. The encoded task type, the normalized remaining time of the time window, the normalized communication quality parameters, and the normalized current node distance are concatenated to form the inspection task feature vector for each inspection task.
[0017] In this embodiment of the invention, when obtaining the feature vectors of multiple inspection tasks, the task type, time window deadline, communication quality parameters, and task location of each inspection task are first determined. The task types include infrared temperature measurement tasks, visible light inspection tasks, and lidar scanning tasks. Infrared temperature measurement tasks typically target equipment with heat-generating risks such as transformers, switchgear, and cable joints; visible light inspection tasks typically target visual defects such as insulator damage, hardware corrosion, and foreign objects in the passageway; and lidar scanning tasks typically target 3D modeling of the line corridor and distance measurement of tree obstacles.
[0018] Furthermore, the mission location is represented using latitude and longitude coordinates in the CGCS2000 geodetic coordinate system. Longitude and latitude are in decimal, retaining six decimal places, while altitude is in meters, retaining one decimal place. Six decimal places correspond to approximately 0.1-meter resolution on the ground, meeting the needs of UAV inspection positioning and distance calculation. For multi-region missions, the mission locations in each region are converted to the CGCS2000 coordinate system to avoid inconsistencies in coordinate references between regions. The current node location is also represented using CGCS2000 latitude and longitude coordinates and altitude. When calculating the distance between the mission location and the current node location, the horizontal distance of the great circle is first calculated based on the latitude and longitude of the two points, and then the spatial distance is calculated by combining the altitude difference. The horizontal distance uses the Haversine formula, where the spatial distance is equal to the square root of the sum of the squares of the horizontal distance and the squares of the altitude difference. This method is suitable for multi-regional spans and different altitude scenarios, and does not require zonal projection.
[0019] Meanwhile, communication quality parameters are obtained by querying historical coverage maps from ground stations. During the UAV's historical flight, the ground station records the reference signal received power, latitude and longitude, altitude, and timestamp of the airborne communication module once per second. The reference signal received power is measured in decibels and milliwatts. The ground station divides the inspection area into 10m x 10m grids and further divides it into altitude layers every 10m above the ground, establishing a historical coverage map database. Each grid and each altitude layer stores the median reference signal received power over the past thirty days. This median is chosen because it balances the timeliness of the communication environment with the number of samples, and it can suppress transient fading and anomalous sampling. When querying the mission location, the latitude and longitude of the mission location are mapped to the corresponding grid, and the mission execution altitude is mapped to the corresponding altitude layer. The median value of this grid and altitude layer is then used as the communication quality parameter.
[0020] If the grid where the task is located has no historical samples, the median average of the eight adjacent grids at the same height level is taken as the communication quality parameter. If there are still no samples in the adjacent grids, -100 dBmW is taken as the default communication quality parameter. The default value is a conservative setting to prevent tasks lacking communication data from being misjudged as having high communication quality in subsequent priority calculations and path generation.
[0021] Furthermore, the time window deadline can be set based on the urgency of the task, equipment status, inspection cycle, and power grid safety requirements. In one specific implementation, the time window deadline is directly determined using the median of the response times for similar historical tasks. The task trigger time is the time the inspection task is generated, triggered by the inspection plan, online monitoring alarm, manual reporting, or the expiration of the last inspection, and synchronized with the ground station clock. The historical response time is the difference between the actual completion time of a historical task and the task trigger time. The actual completion time is the time when the UAV completes data collection and sends back confirmation. The historical database records the task type, equipment type, defect level, power supply guarantee level, task trigger time, and actual completion time.
[0022] When matching the current task, historical task records with the same task type, equipment type, defect level, and power supply guarantee level are selected. Using the power supply guarantee level as the matching condition rather than a correction coefficient directly reflects power grid safety requirements and avoids manually setting coefficients. The statistical time range is the most recent year, covering seasonal changes and load cycles, ensuring good sample timeliness. If there are fewer than thirty valid records in the most recent year, the range is broadened to include records of the same task type and equipment type. Thirty records is the minimum sample size to stabilize the median; too few records result in large fluctuations in the median. Records with a historical response time of less than one minute or more than forty-eight hours are removed. Records with a response time of less than one minute are usually false triggers or duplicate records, while records with a response time of more than forty-eight hours usually include interruptions across scheduling cycles and do not represent normal inspection execution capabilities.
[0023] Sort the remaining historical response times in ascending order and take the median as the allowable response time. Let the target time window fulfillment rate be R. The allowable response time is taken as the R quantile of the historical response times for similar tasks, where R is obtained from historical data statistics. Calculate the percentage of similar tasks completed within the original time window over the past year and use this percentage as R. For example, if the historical on-time completion rate is 93%, then R is 0.93, and the allowable response time is taken as the 93rd quantile of the historical response times.
[0024] Furthermore, the time window deadline = task trigger time + allowed response time. The remaining time of the time window = time window deadline - current time. If the calculation result is less than zero, the remaining time of the time window is set to zero, and the task is marked as timed out. If the task has not yet entered the executable time window, the remaining time can also be set to the time remaining until the start of executable execution. This calculation method can dynamically reflect the urgency of the task and avoid scheduling delays caused by using a fixed time window.
[0025] Furthermore, the current node position is taken from the current location of the drone. When calculating the distance between each inspection task and the current node position, a great circle distance can be selected based on the coordinate type. For multi-area inspections, the current node position is updated as the drone advances, so the current node distance is also updated dynamically. Distance calculation can be performed before each path generation, or during task insertion or path replanning.
[0026] Furthermore, when encoding task types, one-hot encoding can be used. For infrared temperature measurement tasks, the dimension representing infrared temperature measurement in the corresponding 3D vector is set to 1, and the other dimensions are set to 0; for visible light inspection tasks, the dimension representing visible light inspection is set to 1, and the other dimensions are set to 0; for lidar scanning tasks, the dimension representing lidar scanning is set to 1, and the other dimensions are set to 0. The encoding dimensions remain consistent during the training and online phases.
[0027] Furthermore, when normalizing the remaining time of the time window, max-min normalization can be used. The maximum time window can be the scheduling period. The normalized remaining time of the time window = current remaining time window / maximum time window, and is limited to between 0 and 1. The principle of setting the maximum time window is to make the time urgency of different tasks comparable. If the maximum time window is set too small, a large number of tasks will have their normalized values saturated to 1; if it is set too large, it will weaken the differences between urgent tasks. Therefore, the maximum time window can be determined based on the historical task distribution and scheduling period, and recalculated when the inspection task type or scheduling strategy changes.
[0028] Simultaneously, when normalizing communication quality parameters, the effective range of communication signal strength can be determined first. The normalized communication quality is calculated as (communication quality parameter - minimum effective value) / effective range, and is limited to between 0 and 1. The effective range of communication quality is set based on the receiving sensitivity and saturation strength of the UAV data link. Receiving sensitivity determines the minimum effective value, and saturation strength determines the maximum effective value. If the actual communication quality is lower than the minimum effective value, the normalized value is set to 0, indicating a high risk of communication blind spots; if the actual communication quality is higher than the maximum effective value, the normalized value is set to 1, indicating good communication conditions.
[0029] Then, when normalizing the distance to the current node, the maximum span of the inspection area can be used as a benchmark. The maximum span can be the diagonal length of the inspection area. If the task distance exceeds the maximum span, it is normalized to 1. Setting the maximum span makes the distances of different regions and scales comparable, while avoiding distortion of the overall feature distribution caused by individual long-distance tasks. For multi-region tasks, the maximum span can be set uniformly for all regions, which is beneficial for maintaining the same scale in subsequent clustering and mapping table matching.
[0030] Finally, the encoded task type, normalized remaining time window, normalized communication quality parameters, and normalized current node distance are concatenated into a feature vector for each inspection task. The concatenation order can be fixed as task type encoding first, followed by remaining time window, communication quality parameters, and current node distance. If the task type encoding dimension is three-dimensional, the final feature vector dimension will be six-dimensional. The dimension of the feature vector should remain consistent during the training and online phases of the task feature encoder so that the pre-trained task feature encoder can process it directly.
[0031] This invention, through a unified acquisition of task type, time window deadline, communication quality parameters, and task location, and calculation of the remaining time of the time window and the distance to the current node, and then by encoding the task type, normalizing the remaining time of the time window, communication quality, and the distance to the current node, can convert heterogeneous inspection tasks into fixed-dimensional numerical vectors, eliminate dimensional differences, and preserve task type semantics. This allows the task feature encoder, differentiable clustering, and mapping table matching to obtain stable input, thereby improving the accuracy of multi-region task clustering and the matching precision of path generation strategies, reducing the risks of task timeouts, communication interruptions, and insufficient endurance, and enhancing the real-time performance, reliability, and adaptability of UAV inspection path optimization.
[0032] S200: Input the inspection task feature vectors corresponding to the multiple inspection tasks into the pre-trained task feature encoder, output the task embedding vectors corresponding to the multiple inspection tasks, and perform differentiable clustering on the output task embedding vectors to obtain multiple initial mapping intervals and corresponding soft partitioning boundaries.
[0033] Currently, feature encoding for UAV inspection tasks largely relies on manual rules or independent encoding, failing to consider the correlations between multiple inspection tasks. This leads to a disconnect between encoder training objectives and path generation quality, making it difficult for task embedding vectors to accurately represent task urgency, communication risks, and spatial reachability. Furthermore, mapping interval partitioning often employs hard clustering or manually set boundaries. Hard clustering boundaries are non-differentiable, making joint optimization with the task feature encoder impossible. Boundary values depend on experience, easily causing mismatches between mapping intervals and path generation strategies. This results in increased total path length, decreased time window satisfaction, and reduced endurance feasibility and communication quality satisfaction. Therefore, how to obtain task embedding vectors with task-related expressive capabilities through supervised pre-training and automatically determine mapping intervals and soft partitioning boundaries through differentiable clustering has become a pressing technical problem to be solved.
[0034] In step S200 of the method provided in this embodiment of the invention, the pre-training process of the task feature encoder includes: Obtain historical inspection task samples, which include multiple historical inspection task feature vectors and path generation quality labels corresponding to the multiple historical inspection task feature vectors. Each historical inspection task feature vector is obtained by concatenating historical task type encoding, remaining time of historical time window, historical communication quality, and historical current node distance. An initial task feature encoder is constructed, comprising a multi-head self-attention layer, a feedforward network layer, an output layer, and a prediction layer. The multi-head self-attention layer is used to calculate the attention weights between tasks in the sequence composed of multiple historical inspection task feature vectors. The feedforward network layer is used to perform nonlinear transformation on the attention weights. The output layer is used to output multiple historical task embedding vectors. The prediction layer is used to perform average pooling on the multiple historical task embedding vectors to obtain a sequence-level embedding vector, and predict the path generation quality based on the sequence-level embedding vector. Using the feature vectors of the multiple historical inspection tasks as input, the embedding vectors of the multiple historical tasks as intermediate output, and the path generation quality label as supervision signal, the prediction layer maps the embedding vectors of the multiple historical tasks to the predicted path generation quality, and supervises the training of the initial task feature encoder based on the loss between the predicted path generation quality and the path generation quality label. When the loss is less than a preset loss threshold, the training is considered to have converged, and a pre-trained task feature encoder is obtained.
[0035] In this embodiment of the invention, the pre-training of the task feature encoder first acquires historical inspection task samples. These samples come from a UAV inspection history database, which records the task type, time window deadline, task trigger time, actual completion time, communication quality parameters, task location, current node location, actual generated inspection path, and path execution result for each inspection task. The statistical time range of the historical database is the most recent year, covering seasonal changes, load changes, and communication environment changes. If the number of samples in the most recent year is less than one thousand, the statistical time range is expanded to the most recent two years. Setting the number of samples to one thousand is to ensure that the multi-head self-attention layer can learn stable inter-task relationships; if the number of samples is too small, the attention weights are prone to overfitting.
[0036] Each historical inspection task feature vector is obtained by concatenating the historical task type code, the remaining time of the historical time window, the historical communication quality, and the historical distance to the current node. The historical task type code uses one-hot encoding, and the encoding dimension is consistent with the online stage. The remaining time of the historical time window, the historical communication quality, and the historical distance to the current node are normalized according to the aforementioned normalization method, and the concatenation order is fixed as historical task type code, remaining time of the historical time window, historical communication quality, and historical distance to the current node. If there are three types of historical tasks, the historical inspection task feature vector is six-dimensional.
[0037] Furthermore, the path generation quality label is determined based on the actual execution results of historical inspection tasks. In one specific implementation, historical inspection task data is first acquired. Historical data records the task type, inspection area, remaining time window, actual completion time, time window fulfillment flag, endurance feasibility flag, and communication fulfillment flag. The actual completion time is the moment when the UAV completes the data collection for the task and sends back confirmation. Historical inspection tasks are matched by binning according to task type, inspection area, and remaining time window. The bin boundaries for the remaining time window are taken as the 25%, 50%, and 75% quantiles of the remaining time window for similar historical tasks. If the number of historical tasks in a bin is less than thirty, the bin is merged with adjacent bins. Thirty tasks is the minimum sample size to ensure statistical stability of empirical quantiles.
[0038] Within each bin, historical tasks whose time window satisfaction, endurance feasibility, and communication satisfaction are all equal to one are first selected, forming a set of hard-constraint successful tasks. For historical tasks that fail in hard constraints, the path generation quality label is directly set to zero. For each historical task in the hard-constraint successful task set, its actual completion time is obtained; the number of historical tasks in that bin whose completion time is later than the actual completion time of that historical task is counted, and this number is divided by the total number of hard-constraint successful tasks in that bin to obtain the path generation quality label for that historical task. The label value ranges from zero to one. The earlier the completion, the more tasks with later completion times there are, and the larger the label. The later the completion, the fewer tasks with later completion times there are, and the smaller the label. If there are tasks with the same completion time, these tasks can be included in the denominator but not in the numerator. If the number of hard-constraint successful tasks in a bin is zero, the empirical quantile of hard-constraint successful tasks of the same task type and the same inspection area is taken.
[0039] It should be noted that the binning described above is based on task type, inspection area, and remaining time window. These three dimensions are the main confounding factors affecting path generation quality. Within the same bin, historical tasks share the same task type, inspection area, and similar remaining time window. Furthermore, the set of successful tasks meeting hard constraints has filtered out historical tasks that do not meet time window, endurance, and communication requirements. Therefore, the bin completion time ranking reflects the efficiency differences of path generation strategies under the premise of satisfying hard constraints and can serve as an effective measure of path generation quality. The path generation quality label is a relative ranking within the bin, used to supervise the encoder's learning of the relative relationships between multiple historical inspection tasks within the same bin. The matching of the mapping interval and the path generation strategy is itself a relative comparison, and the relative ranking within the bin is consistent with this relative comparison. Further, since the remaining time windows of historical tasks within the same bin are the same or similar, the bin path generation quality label does not depend on the remaining time window of the historical task. The encoder cannot obtain the bin label solely from the remaining time window of the historical task. For different bins, the path generation quality label is only meaningful within its own bin and is not compared directly across bins. The encoder calculates the attention weights between tasks by using a multi-head self-attention layer to calculate the sequence of feature vectors from multiple historical inspection tasks. Then, it predicts the path generation quality by performing average pooling on the embedding vectors of multiple historical tasks through the prediction layer to obtain the sequence-level embedding vector. This allows the encoder to learn the relationships between multiple inspection tasks, as well as task type, communication quality, and distance information to the current node, rather than relying solely on the single-task feature mapping of the remaining time in the historical time window.
[0040] Furthermore, an initial task feature encoder is constructed. This encoder comprises a multi-head self-attention layer, a feedforward network layer, an output layer, and a prediction layer. The multi-head self-attention layer is used to calculate attention weights between tasks on a sequence composed of feature vectors from multiple historical inspection tasks. The number of heads in the multi-head self-attention layer can be set to 8, with each head having a dimension of 64, resulting in a total embedding dimension of 512. Setting the number of heads to 8 allows for the capture of different relationships, such as task type association, time window urgency association, communication quality association, and spatial distance association. Setting the dimension of each head to 64 ensures sufficient expression space for each attention head while controlling computational cost.
[0041] Then, a feedforward network layer is used to perform a non-linear transformation on the attention weights. This feedforward network layer can consist of two fully connected layers: the first fully connected layer has a dimension of 1024, and the second fully connected layer has a dimension of 512. The activation function used is a Gaussian error linear unit. The output layer outputs multiple historical task embedding vectors, mapping the output of the feedforward network layer to a 128-dimensional task embedding vector. The prediction layer predicts the path generation quality based on these historical task embedding vectors. The prediction layer first performs average pooling on the historical task embedding vectors to obtain a sequence-level embedding vector, which is then mapped to the predicted path generation quality through two fully connected layers. The first fully connected layer can have a dimension of 64, and the second fully connected layer can have a dimension of 1. The output layer uses a Sigmoid function to ensure that the predicted path generation quality falls between zero and one.
[0042] Furthermore, using multiple historical inspection task feature vectors as input, multiple historical task embedding vectors as intermediate output, and path generation quality labels as supervision signals, a prediction layer maps the multiple historical task embedding vectors to predicted path generation quality. The initial task feature encoder is then trained in a supervised manner based on the loss between predicted path generation quality and path generation quality labels. The loss function is mean squared error, the optimizer is an adaptive moment estimation optimizer, the learning rate is set to 0.001, the batch size is set to 32, and the number of training epochs is set to 200. The learning rate of 0.001 is chosen to balance convergence speed and training stability; the batch size of 32 is used to balance gradient estimation variance and memory usage; and the number of training epochs is set to 200 to ensure sufficient model convergence, while also incorporating an early stopping mechanism to avoid overfitting.
[0043] The training is considered converged when the loss is less than a preset loss threshold, resulting in a pre-trained task feature encoder. The preset loss threshold is set to 0.001 because the path generation quality labels are normalized to zero to one, and a mean squared error of 0.001 corresponds to a root mean square error of approximately 0.0316, meaning a prediction quality error of approximately 3.16%, which meets the accuracy requirements for path generation strategy matching. An early stopping mechanism is also implemented: training stops when the validation set loss does not decrease for twenty consecutive rounds. The validation set is randomly selected from historical inspection task samples at a ratio of 20%.
[0044] In step S200 of the method provided in this embodiment of the invention, the output task embedding vector is subjected to differentiable clustering to obtain multiple initial mapping intervals and corresponding soft partition boundaries, including: Step 1: Randomly select multiple task embedding vectors from the task embedding vectors as multiple initial cluster centers, or initialize multiple cluster centers according to the distribution characteristics of the task embedding vectors, wherein each cluster center is a vector in the space where the task embedding vectors are located; Step 2: Calculate the soft assignment probability of the task embedding vector to each of the plurality of cluster centers, wherein the soft assignment probability is used to characterize the degree to which the task embedding vector belongs to the cluster center; Step 3: Update the multiple cluster centers according to the soft assignment probability, and repeat steps 2 to 3 until the multiple cluster centers converge; Step 4: Determine multiple initial mapping intervals based on the converged cluster centers. For each pair of adjacent initial mapping intervals, determine a set of equal probability points where the task embedding vector has an equal probability of belonging to the two adjacent initial mapping intervals based on the soft assignment probability, and determine the set of equal probability points as the soft partition boundary between the two adjacent initial mapping intervals.
[0045] In this embodiment of the invention, the output task embedding vectors are subjected to differentiable clustering to obtain multiple initial mapping intervals and corresponding soft partition boundaries. The task embedding vectors are output by a pre-trained task feature encoder, and the number of task embedding vectors is equal to the number of inspection tasks participating in the clustering. The inspection tasks participating in the clustering can come from historical inspection task samples or from the current set of inspection tasks to be executed. The elbow method is used to determine the number of cluster centers, and the sum of squares within clusters is calculated for different numbers of cluster centers. The number of cluster centers corresponding to the locations where the rate of decrease in the sum of squares within clusters significantly slows down is selected as the number of cluster centers.
[0046] During the initialization phase, multiple task embedding vectors are randomly selected from the task embedding vectors as initial cluster centers, or multiple cluster centers are initialized based on the distribution characteristics of the task embedding vectors. Each cluster center is a vector in the space where the task embedding vectors reside. When initializing based on distribution characteristics, principal component analysis can be performed on the task embedding vectors first, and the first three principal component directions can be selected. Initial cluster centers are then selected based on the quantiles along these three principal component directions. The dimension of the initial cluster centers is consistent with the dimension of the task embedding vectors; both are vectors of the same dimension. If the dimension of the task embedding vectors is 128, then each cluster center is also a 128-dimensional vector.
[0047] In the soft assignment calculation phase, the soft assignment probability of the task embedding vector to each of the multiple cluster centers is calculated. The soft assignment probability characterizes the degree to which the task embedding vector belongs to a cluster center. The soft assignment probability can be calculated using a Gaussian form. Specifically, for the task embedding vector and the cluster center, the squared Euclidean distance between them is first calculated, then divided by the temperature parameter, and the negative value is used as the exponent. Finally, all cluster centers are normalized. The temperature parameter is set to 1.0 because a temperature parameter of 1.0 ensures that the soft assignment probability distribution is neither too sharp nor too smooth. If the temperature parameter is too small, the soft assignment probability approaches hard assignment, weakening gradient information; if the temperature parameter is too large, the soft assignment probability becomes too uniform, reducing the discriminative power of the cluster centers. The soft assignment probability ranges from zero to one, and the sum of the soft assignment probabilities of all cluster centers is one.
[0048] During the cluster center update phase, multiple cluster centers are updated based on the soft assignment probability. For each cluster center, its soft assignment probability with respect to all task embedding vectors is used as a weight, and a weighted average is calculated across all task embedding vectors to obtain the updated cluster center. This soft assignment calculation phase and cluster center update phase are repeated until multiple cluster centers converge. The convergence condition is set to a change in cluster center value less than 0.0001, or reaching the maximum number of iterations (300). The change in cluster center value is set to 0.0001 because the normalized task embedding vectors have a limited numerical range, and this threshold indicates that the cluster centers are basically stable. The maximum number of iterations is set to 300 to prevent convergence failure under extreme distributions. If the change threshold is not met even after reaching the maximum number of iterations, the current cluster center is output as the converged cluster center.
[0049] During the boundary determination phase, multiple initial mapping intervals are determined based on the converged cluster centers. Each initial mapping interval corresponds to a cluster center and its assigned region in the task embedding space. For every two adjacent initial mapping intervals, a set of equally probable points is determined based on the soft assignment probability, where the task embedding vector has an equal probability of belonging to the two adjacent initial mapping intervals. Adjacent initial mapping intervals can be determined based on the Euclidean distance between the cluster centers. If there are no other cluster centers between two cluster centers, then the initial mapping intervals corresponding to these two cluster centers are considered adjacent initial mapping intervals.
[0050] The set of points with equal probability can be determined by sampling. Specifically, points are taken at equal intervals on the line segment connecting two adjacent cluster centers, and the soft assignment probability of each point belonging to each of the two cluster centers is calculated. When the two soft assignment probabilities are equal, the point is recorded as an equal probability point. Sampling continues along the direction perpendicular to the connecting line at that point to obtain multiple equal probability points, forming the set of equal probability points. When using Gaussian soft assignment, the set of equal probability points is the perpendicular bisector of the hyperplane connecting the two cluster centers. This set of equal probability points is determined as the soft partition boundary between two adjacent initial mapping intervals, and multiple soft partition boundaries together constitute the initial partition boundary set.
[0051] It should be noted that when calculating the soft assignment probability using the Gaussian form, the soft assignment probability of two adjacent cluster centers is equal—equivalent to the squares of the distances from the task embedding vector to the two cluster centers being equal. The temperature parameter cancels out on both sides of the equation. Therefore, the unique point of equal probability along the connecting line is the midpoint of the connecting line, and the set of equal probability points is the perpendicular bisector hyperplane of the line connecting the two cluster centers, which is not required to be closed into a complete boundary. Numerical sampling is only used to approximately determine the perpendicular bisector hyperplane; if the sampling does not yield an equal probability point that can determine the perpendicular bisector hyperplane, then the perpendicular bisector hyperplane is directly determined by the midpoint of the connecting line and the direction of the connecting line as the soft partition boundary.
[0052] This invention employs a multi-head self-attention layer to calculate attention weights between tasks, capturing the correlations between multiple inspection tasks in terms of task type, remaining time in the time window, communication quality, and distance to the current node. Supervised training using a prediction layer and path generation quality labels directly correlates task embedding vectors with path generation quality, improving the discriminative ability of task embedding vectors. Differentiable clustering is used to calculate soft assignment probabilities and update cluster centers, preserving gradient information and working in conjunction with the task feature encoder. Equal-probability point sets determine soft partition boundaries, automatically determining the mapping interval boundaries based on task embedding vector distribution and soft assignment probabilities, reducing the subjectivity of manually setting boundaries. This provides accurate and data-driven initial partition boundaries for subsequent mapping table construction and improved offline optimization of the ant colony algorithm, improving the matching accuracy of multi-region UAV inspection path generation strategies, reducing the risks of task timeouts, insufficient battery life, and communication interruptions, and enhancing the reliability and adaptability of UAV inspection path optimization.
[0053] S300: Construct a mapping table including multiple mapping intervals, each mapping interval corresponding to a path generation strategy, wherein the path generation strategy includes task priority sorting rules, charging node insertion rules and communication blind spot avoidance rules.
[0054] Currently, in multi-area drone inspections, there is often a lack of correspondence between mapping intervals and path generation strategies. Task priority ranking often relies on a single distance or fixed order, charging node insertion depends on human experience, and communication blind spot avoidance lacks clear rules, easily leading to task timeouts, insufficient battery life, and communication interruptions. Therefore, how to construct a correspondence between mapping intervals and path generation strategies, and configure a path generation strategy for each mapping interval that includes task priority ranking rules, charging node insertion rules, and communication blind spot avoidance rules, has become an urgent technical problem to be solved.
[0055] In step S300 of the method provided in this embodiment of the invention, a mapping table including multiple mapping intervals is constructed, each mapping interval corresponding to a path generation strategy, including: The number of mapping intervals in the mapping table is determined based on the number of the plurality of initial mapping intervals, and the number of mapping intervals in the mapping table is equal to the number of the plurality of initial mapping intervals; A path generation strategy is configured for each mapping interval in the mapping table. The path generation strategy includes a task priority sorting rule, a charging node insertion rule, and a communication blind spot avoidance rule.
[0056] The path generation strategy includes task priority ranking rules, charging node insertion rules, and communication blind spot avoidance rules, including: The task priority ranking rule is as follows: calculate the task priority score based on the remaining time of the time window, the communication quality, and the distance to the current node, and sort the multiple inspection tasks from high to low according to the task priority score. The shorter the remaining time of the time window, the higher the communication quality, and the smaller the distance to the current node, the higher the task priority score. The charging node insertion rule is as follows: when the remaining battery power of the drone is lower than the battery threshold and the distance between the next inspection task and the current node is greater than the distance threshold, a charging node is inserted before the next inspection task. The communication blind spot avoidance rule is as follows: when the communication quality of the inspection area is lower than the communication quality threshold, the execution order of the inspection task or the direction of the inspection path is adjusted so that the inspection task that relies on real-time communication avoids the inspection area where the communication quality is lower than the communication quality threshold.
[0057] In this embodiment of the invention, the mapping table includes multiple mapping intervals. The number of mapping intervals is determined by the number of initial mapping intervals obtained from differentiable clustering, and the two are equal. For example, if eight initial mapping intervals are obtained from differentiable clustering, then the mapping table has eight rows, each recording the mapping interval index, cluster center, soft partition boundary, and path generation strategy identifier. The mapping interval index ranges from zero to seven. The cluster center is a 128-dimensional vector in the task embedding space; the soft partition boundary can be stored as hyperplane parameters or boundary point sets between adjacent cluster centers; the path generation strategy identifier points to a set of strategies in the strategy library. The strategy library predefines multiple sets of strategies, each set of strategies including task priority ranking rules, charging node insertion rules, and communication blind spot avoidance rules.
[0058] Furthermore, when configuring a path generation strategy for each mapping interval in the mapping table, the strategy type can be determined based on the position of the corresponding cluster center in the task embedding space. If the cluster center has a smaller value in the remaining time dimension of the time window, a time window priority strategy is configured; if the cluster center has a smaller value in the communication quality dimension, a communication avoidance priority strategy is configured; if the cluster center has a larger value in the current node distance dimension, a battery life priority strategy is configured. The configuration process is completed offline, and queries are performed directly online. The number of mapping intervals is equal to the initial number of mapping intervals, ensuring that each task group obtained from clustering has a corresponding path generation strategy, avoiding coarse strategy matching caused by multiple task groups sharing the same strategy.
[0059] The task priority ranking rule calculates a task priority score based on the remaining time of the time window, communication quality, and distance to the current node. Let T be the normalized remaining time of the time window, C be the normalized communication quality, and D be the normalized distance to the current node. A smaller T indicates a more urgent time window, a larger C indicates higher communication quality, and a smaller D indicates a closer distance. The task priority score S = W1 × (1 - T) + W2 × C + W3 × (1 - D). W1, W2, and W3 are weights, and their sum is one.
[0060] In one specific implementation, the weights in task priority ranking are determined through ranking learning based on historical task samples within the mapping interval. For each historical task sample, time window urgency, communication advantage, and distance advantage are calculated. Time window urgency = 1 - normalized remaining time of the time window; communication advantage = normalized communication quality; distance advantage = 1 - normalized distance to the current node. Labels are assigned using historical completion time empirical quantiles. Within the set of historical tasks that satisfy the time window, battery life, and communication requirements, the proportion of historical tasks with completion times later than the current task is statistically analyzed, with earlier completions resulting in larger labels.
[0061] Let the priority score = weight 1 × time window urgency + weight 2 × communication advantage + weight 3 × distance advantage, where all three weights are not less than zero and their sum is one. Take any two samples from the historical samples of the same mapping interval; if one sample's label is greater than the other, its priority score is expected to be higher. Use the sum of pairwise ranking losses plus a weighted sum of squares regularization term as the total loss, with a regularization coefficient of 0.01. Use a 0.01 step grid search to find weight combinations that satisfy the constraints, and select the combination with the minimum total loss as the weight for that mapping interval. If a mapping interval has fewer than thirty historical samples, use the weights learned from all mapping intervals of the same strategy type. During the cold start phase, each of the three weights can be temporarily set to one-third; automatically switch weights after accumulating more than thirty samples.
[0062] Furthermore, after calculating the priority score for each inspection task, they are sorted from highest to lowest score. If two tasks have the same score, the one with the shorter remaining time window is given priority; if the remaining time window is still the same, the one with the smaller distance to the current node is given priority.
[0063] Furthermore, the charging node insertion rule is executed during path generation. First, the drone's remaining battery power, current node position, next inspection task position, and nearest available charging node position are obtained. Then, the distance between the next inspection task position and the current node position is calculated as the next task distance. If the drone's remaining battery power is below a battery threshold, and the next task distance is greater than the distance threshold, a charging node is inserted before the next inspection task. The battery threshold is determined by the sum of the battery power required for return and a safety margin. The battery power required for return is equal to the distance from the next inspection task position back to the nearest charging node or takeoff / landing point divided by the drone's range per unit battery power. The range per unit battery power is given by the drone model parameters, for example, 100 meters of flight per 100% battery power.
[0064] The safety margin is set at 5% because the power required for return is usually estimated based on straight-line distance, standard wind speed, normal temperature, battery health, and rated load. In reality, the return may encounter headwinds, low temperatures, battery aging, load changes, obstacle avoidance, hovering, communication interruptions, and replanning, resulting in higher power consumption than estimated. The 5% safety margin is used to cover these normal fluctuations, ensuring that the drone retains a small amount of power after returning, avoiding forced landings or crashes due to power estimation errors.
[0065] Meanwhile, the distance threshold is determined by subtracting a safety margin from the drone's current remaining battery power's flight distance. For example, if the current remaining battery power is 30%, the flight range per unit of battery power is 100 meters, the flight distance is 3,000 meters, and the safety margin is 20% of the current flight distance, then the distance threshold is 2,400 meters. If the next mission distance is greater than 2,400 meters, the distance condition is met. When both conditions are met, a charging node is inserted before the next inspection mission. The charging node is selected from the nearest charging station that is available for charging. The insertion position is after the current node and before the next inspection mission in the path sequence. If the charging node is not on a straight line between the current node and the next inspection mission, the path will first fly to the charging node, charge, and then fly to the next inspection mission. If the drone's remaining battery power is lower than the return battery power, a charging node will be forcibly inserted even if the next mission distance is not greater than the distance threshold. If the drone's remaining battery power is higher than the battery power threshold, a charging node will not be inserted.
[0066] Furthermore, the communication blind spot avoidance rule first obtains the communication quality of the inspection area. Communication quality is obtained from historical coverage maps of ground stations, measured in decibels and milliwatts. If the communication quality of an inspection area is below a communication quality threshold, it is determined to be a communication blind spot. Inspection tasks relying on real-time communication include lidar scanning tasks and visible light inspection tasks requiring real-time video transmission. Infrared temperature measurement tasks have small data volumes and can be temporarily stored before transmission, thus having a lower reliance on real-time communication.
[0067] In one specific implementation, the communication quality threshold is obtained based on historical communication data. First, the reference signal received power, data packet loss rate, retransmission count, and communication interruption duration during the UAV's historical flight are collected. The reference signal received power is statistically analyzed in 1 dB / mW bins. Samples with a data packet loss rate not exceeding 5% and a communication interruption duration not exceeding one second are marked as reliable transmission samples. For each reference signal received power bin, the proportion of reliable transmission samples in that bin to the total number of samples in that bin is calculated to obtain the reliable transmission success rate. Each bin is traversed from low to high to find the first bin with a reliable transmission success rate not lower than the target success rate, and the reference signal received power corresponding to that bin is used as the communication quality threshold. The target success rate is determined based on the task communication requirements. For tasks relying on real-time communication, such as lidar scanning and real-time video transmission, the target success rate is 98%; for tasks that can be temporarily stored and then transmitted, such as infrared thermometry, the target success rate is 95%.
[0068] When a communication blind spot coincides with an inspection task that relies on real-time communication, the execution order or path of the inspection tasks should be adjusted. When adjusting the execution order, inspection tasks relying on real-time communication should be moved to a time period or area where communication quality is higher than the communication quality threshold, prioritizing tasks with higher communication quality. When adjusting the path, the inspection path should fly along grids where communication quality is higher than the communication quality threshold. If it is necessary to pass through a communication blind spot, a detour path should be selected, with the increased distance not exceeding 20% of the original path distance. This 20% setting balances communication reliability and path efficiency, avoiding excessively long detours that could lead to insufficient endurance. If the increased distance from the detour exceeds 20%, the task should be suspended, and other tasks should be executed first, resuming execution once communication quality is restored.
[0069] This invention improves the matching accuracy of multi-region UAV inspection path generation strategies by ensuring that the number of mapped intervals in the mapping table is equal to the initial number of mapped intervals and configuring a differentiated path generation strategy for each mapped interval. This enables different task groups to be matched with strategies that are suitable for their characteristics. By combining the remaining time of the time window, communication quality, and current node distance through task priority scores, charging nodes are automatically inserted based on power and distance thresholds through charging node insertion rules. The execution order or path direction is adjusted based on communication quality thresholds through communication blind spot avoidance rules. This reduces the risk of task timeouts, insufficient battery life, and communication interruptions, and improves the reliability and adaptability of UAV inspection path optimization.
[0070] S400: Using the soft partition boundary as the initial partition boundary, the partition boundary of the multiple mapping intervals is optimized offline using an improved ant colony algorithm to obtain the optimized mapping table.
[0071] Currently, the boundaries of mapping intervals are mostly defined by clustering or manually, without offline optimization on a validation set targeting path generation quality. This easily leads to a mismatch between the boundaries and the path generation strategy. If ant colony optimization is directly applied to continuous boundary optimization, the lack of candidate boundary value discretization and heuristic information settings makes it prone to low search efficiency and getting trapped in local optima. If fitness is directly based on the normalized value of the total path length, it will favor longer paths; if only a single metric is used, it is difficult to balance time window satisfaction, endurance feasibility, and communication quality satisfaction. Therefore, how to optimize the mapping interval boundaries offline using an improved ant colony algorithm with validation set path generation quality as the objective has become a pressing technical problem.
[0072] Step S400 in the method provided in this embodiment of the invention includes: The soft partitioning boundaries corresponding to the multiple initial mapping intervals are used as the initial partitioning boundaries of the improved ant colony algorithm. The partition boundaries of multiple mapping intervals in the mapping table are encoded as path nodes in the improved ant colony algorithm, wherein each ant in the improved ant colony algorithm corresponds to a set of partition boundary combinations, and the partition boundary combinations are the boundary values between two adjacent mapping intervals in the mapping table. The pheromone concentration and number of ants in the improved ant colony algorithm are initialized, and the heuristic information of the improved ant colony algorithm is determined according to the value range of the dividing boundary of multiple mapping intervals in the mapping table. For each ant, the state transition probability is determined based on the pheromone concentration and the heuristic information. The next path node is selected from the current path node according to the state transition probability until a path is completed. The path corresponds to a set of partitioning boundary combinations. The fitness of the improved ant colony algorithm is calculated by using the path generation quality of the mapping table on the validation set as the fitness of the path corresponding to each ant. The pheromone concentration is updated based on the fitness of each ant's corresponding path, wherein the pheromone concentration increases more for paths with higher fitness. Repeat the steps of determining the state transition probability for each ant based on the pheromone concentration and the heuristic information, up to updating the pheromone concentration based on the fitness of the path corresponding to each ant, until the maximum number of iterations is reached. Output the partition boundary combination corresponding to the path with the highest fitness, and update the partition boundaries of multiple mapping intervals in the mapping table based on the partition boundary combination corresponding to the path with the highest fitness to obtain the optimized mapping table.
[0073] In this embodiment of the invention, multiple soft partition boundaries obtained from differentiable clustering are first acquired, with each soft partition boundary located between the cluster centers of two adjacent mapping intervals. For every two adjacent mapping intervals, the soft partition boundary is represented as a split point along the direction of the line connecting the two cluster centers, and the initial position of the split point is the intersection of the soft partition boundary and the connecting line. The adjustable range of the split point is set to ±10% of the distance between the two cluster centers. ±10% is to avoid exceeding the adjacent cluster centers during boundary optimization, while retaining sufficient local adjustment space.
[0074] The adjustable range of the dividing point for each adjacent mapping interval is discretized into multiple candidate boundary values. Five candidate boundary values are selected, corresponding to the minimum, -5% position, initial position, 5% position, and maximum value of the range, respectively. These five candidate values strike a balance between search accuracy and computational complexity. Each candidate boundary value serves as a path node. If there are eight mapping intervals in the mapping table, there are seven adjacent boundaries, with each boundary corresponding to five candidate path nodes.
[0075] Furthermore, each ant corresponds to a set of boundary combinations. When generating the path for an ant, a candidate boundary value is selected for each adjacent boundary in the order of their selection. After all adjacent boundaries have been selected, a complete set of boundary combinations is obtained, which is used to update the boundaries between adjacent mapping intervals in the mapping table.
[0076] When initializing the pheromone concentration, set the pheromone concentration of all path nodes to 1.0 and the number of ants to 20. The number of ants is set to 20 because the number of candidate boundary combinations is relatively large, and 20 ants can cover different boundary combinations without making the computational cost of a single iteration too high. The maximum number of iterations is set to 100, which allows pheromone to accumulate sufficiently while avoiding excessively long offline optimization time. The pheromone evaporation coefficient is set to 0.1 because it preserves historical good path information and avoids the search getting trapped in local optima too early. The pheromone increment coefficient is set to 0.1, so that the increment of a single ant in a single iteration is between 0 and 0.1, and the total increment of 20 ants in a single round is between 0 and 2, which matches the initial pheromone concentration of 1.0 and the evaporation coefficient of 0.1, reflecting fitness differences without causing instantaneous pheromone saturation. The pheromone importance factor in the state transition probability is set to 1.0, and the heuristic pheromone importance factor is set to 2.0. The heuristic pheromone importance factor is set to 2.0 to make the initial search more dependent on the proximity of the boundary value to the soft partition boundary, thus accelerating convergence.
[0077] The heuristic information is determined based on the distance between the candidate boundary value and the soft partition boundary. The closer the candidate boundary value is to the soft partition boundary, the greater the heuristic information. The heuristic information can be calculated by dividing one by the absolute value of the distance between the candidate boundary value and the soft partition boundary. This setting allows ants to prioritize candidate boundary values that are close to the initial soft partition boundary, while retaining the ability to explore better boundaries through pheromones.
[0078] For each ant, the state transition probability is determined based on pheromone concentration and heuristic information. The state transition probability equals the pheromone importance factor of the pheromone concentration raised to the power of the pheromone importance factor of the heuristic information raised to the power of the power of the pheromone importance factor, divided by the sum of the values corresponding to all candidate path nodes. The next path node is selected from the current path node according to the state transition probability until a path is completed. Each path corresponds to a set of partitioning boundary combinations.
[0079] Furthermore, the fitness of the path generation quality of the mapping table on the validation set is used as the fitness value to calculate the fitness of the path corresponding to each ant. During fitness calculation, the partition boundary combination selected by the ant is written into the mapping table to obtain the current candidate mapping table. The validation inspection task feature vectors from the validation set are input into the pre-trained task feature encoder to obtain the validation task embedding vectors. Based on the validation task embedding vectors, the mapping interval to which the ant belongs in the current candidate mapping table is determined, resulting in the corresponding path generation strategy. Validation inspection paths are generated according to the path generation strategy, and the path generation quality of the current candidate mapping table on the validation set is calculated. This path generation quality is used as the fitness value of the path corresponding to that ant.
[0080] Furthermore, the pheromone concentration is updated based on the fitness of each ant's corresponding path. First, the pheromone concentration at all path nodes is volatilized; the post-vaporization pheromone concentration equals the original pheromone concentration multiplied by one minus the pheromone volatilization coefficient. Then, pheromone is added to each path node traversed by each ant. The amount of pheromone increase is equal to the pheromone increment coefficient multiplied by the fitness. The increase is directly proportional to fitness; the higher the fitness of a path, the more pheromone is added to the path nodes it traverses; the lower the fitness of a path, the less pheromone is added to the path nodes it traverses.
[0081] Repeat the steps from determining the state transition probability based on pheromone concentration and heuristic information to updating the pheromone concentration based on fitness, until the maximum number of iterations is reached. Output the partition boundary combination corresponding to the path with the highest fitness. Update the partition boundaries of multiple mapping intervals in the mapping table based on this partition boundary combination to obtain the optimized mapping table.
[0082] The fitness of the improved ant colony algorithm is determined by the path generation quality of the mapping table on the validation set, and the fitness of each ant's corresponding path is calculated. Figure 2 As shown, it includes: Obtain a verification set, which includes feature vectors of multiple verification inspection tasks corresponding to each verification inspection task. For each of the plurality of verification inspection tasks, the feature vector of the verification inspection task corresponding to the verification inspection task is input into the pre-trained task feature encoder to obtain the embedding vector of the verification inspection task corresponding to the verification inspection task. The mapping interval to which the verification inspection task belongs is determined in the mapping table according to the embedding vector of the verification task to obtain the path generation strategy corresponding to the verification inspection task. The verification inspection path of the verification inspection task is generated according to the path generation strategy corresponding to the verification inspection task. The mapping table is obtained on the verification set. The total path length, time window satisfaction rate, endurance feasibility, and communication quality satisfaction rate are obtained. The total path length is determined based on the direction of the verification inspection path of each verification inspection task in the verification set. The time window satisfaction rate is determined based on the comparison between the actual execution time of each verification inspection task in the verification set and the time window deadline. The endurance feasibility is determined based on the comparison between the remaining battery power of the UAV and the battery power threshold during the execution of each verification inspection task in the verification set. The communication quality satisfaction rate is determined based on the comparison between the communication quality at the execution time of each verification inspection task in the verification set and the communication quality threshold. The total path length is normalized to obtain the normalized total path length. The total path length score is obtained by subtracting the normalized total path length from 1. The time window satisfaction rate, the endurance feasibility and the communication quality satisfaction rate are normalized to obtain the normalized time window satisfaction rate, the normalized endurance feasibility and the normalized communication quality satisfaction rate, respectively. The path generation quality is obtained by weighting and summing the total path length score, the normalized time window satisfaction rate, the normalized endurance feasibility, and the normalized communication quality satisfaction rate according to preset weights, and the path generation quality is used as the fitness of the improved ant colony algorithm.
[0083] In this embodiment of the invention, fitness calculation first involves obtaining a validation set. The validation set is randomly divided from historical inspection task samples at a ratio of 20%. This 20% ratio is set to ensure that the validation set can independently evaluate the generalization ability of the mapping table, while not reducing too many historical samples available for training. If the total number of historical inspection task samples is less than 150, the number of tasks in the validation set is set to 30. Thirty is the minimum sample size to ensure statistical stability of path generation quality. The validation set does not overlap with the training set of the task feature encoder.
[0084] Furthermore, for each verification inspection task in the validation set, a verification inspection task feature vector is obtained. The construction method of the verification inspection task feature vector is consistent with that of the online stage, including the verification task type encoding, the remaining time of the verification time window, the verification communication quality, and the distance between the verification task and the current node. The verification inspection task feature vector is input into a pre-trained task feature encoder to obtain the verification task embedding vector. The mapping interval to which the verification task belongs is determined in the candidate mapping table based on the verification task embedding vector. The determination method is to calculate the distance between the verification task embedding vector and the cluster centers of each mapping interval in the candidate mapping table, and take the mapping interval to which the cluster center with the smallest distance belongs as the mapping interval to which the verification inspection task belongs. The path generation strategy corresponding to the mapping interval is obtained, and the verification inspection path of the verification inspection task is generated according to the task priority sorting rule, charging node insertion rule, and communication blind spot avoidance rule in the path generation strategy.
[0085] Next, obtain the total path length of the mapping table on the validation set. The total path length is equal to the sum of the validation inspection path lengths of all validation inspection tasks in the validation set. First, determine the maximum allowed total path length, which is equal to the number of validation tasks multiplied by the length of the diagonal of the bounding rectangle of the inspection area. Normalize the total path length to obtain the normalized total path length: Normalized total path length = Total path length / Maximum allowed total path length, and is limited to between zero and one: If the total path length is greater than or equal to the maximum allowed total path length, the normalized total path length is 1; if the total path length is zero, the normalized total path length is 0. Then, subtract the normalized total path length from 1 to obtain the total path length score: Total path length score = 1 - Normalized total path length. The shorter the total path length, the larger the total path length score, and the total path length score ranges from 0 to 1.
[0086] Then, the time window satisfaction rate of the mapping table on the validation set is obtained. For each validation inspection task, the actual execution time and the time window deadline are obtained. If the actual execution time is not later than the time window deadline, the validation inspection task is determined to satisfy the time window. The time window satisfaction rate = the number of validation inspection tasks that satisfy the time window / the total number of validation inspection tasks. The value of the time window satisfaction rate ranges from zero to one, and the larger the value, the higher the degree of time window satisfaction.
[0087] Obtain the endurance feasibility of the mapping table on the validation set. For each validation inspection task, obtain the minimum remaining battery power and battery threshold of the drone during execution. The battery threshold is the sum of the battery power required for return and the safety margin. If the minimum remaining battery power is not lower than the battery threshold, the validation inspection task is determined to meet the endurance requirements. Endurance feasibility = number of validation inspection tasks that meet the endurance requirements / total number of validation inspection tasks. The value of endurance feasibility ranges from zero to one, with a larger value indicating a higher degree of endurance feasibility.
[0088] Obtain the communication quality satisfaction rate of the mapping table on the validation set. For each validation inspection task, obtain the communication quality and communication quality threshold at the execution time. If the communication quality at the execution time is not lower than the communication quality threshold, the validation inspection task is determined to meet the communication quality requirements. Communication quality satisfaction rate = number of validation inspection tasks that meet the communication quality requirements / total number of validation inspection tasks. The communication quality satisfaction rate ranges from zero to one; a higher value indicates a higher degree of communication quality satisfaction.
[0089] Finally, the total path length score, normalized time window satisfaction rate, normalized endurance feasibility, and normalized communication quality satisfaction rate are weighted and summed according to preset weights to obtain the path generation quality. In one specific implementation, the preset weights are preferentially determined by fitting historical data to obtain historical path generation records. Each record includes the total path length score, normalized time window satisfaction rate, normalized endurance feasibility, normalized communication quality satisfaction rate, and a comprehensive execution result label. The comprehensive execution result label is calculated by dividing the number of tasks that simultaneously meet the time window, endurance, and communication requirements after this path generation by the total number of tasks. This label is determined by hard constraints, does not depend on weights, and ranges from 0 to 1.
[0090] Then, a linear weighted model is constructed: the predicted path generation quality value = weight 1 × total path length score + weight 2 × normalized time window satisfaction rate + weight 3 × normalized endurance feasibility + weight 4 × normalized communication quality satisfaction rate. All four weights are not less than 0, and their sum equals 1. The weights are determined using a grid search, with the objective of minimizing the mean square error between the predicted value and the overall execution result label. The weight step size is 0.05. All weight combinations satisfying the constraints are traversed, and the combination with the smallest mean square error is selected as the preset weight. If the number of historical records is less than 50, the default weights are used: 0.25 for the total path length score, 0.25 for the normalized time window satisfaction rate, 0.25 for the normalized endurance feasibility, and 0.25 for the normalized communication quality satisfaction rate.
[0091] This invention uses soft partitioning boundaries as initial partitioning boundaries, discretizes the boundary values of each adjacent mapping interval into candidate path nodes, assigns a set of partitioning boundary combinations to each ant, and performs path search based on pheromone concentration and heuristic information. This reduces the difficulty of continuous boundary optimization and improves search efficiency. By using the path generation quality of the validation set as fitness, and integrating the path length score after inverse normalization, time window satisfaction rate, endurance feasibility rate, and communication quality satisfaction rate, the partitioning boundary optimization can simultaneously consider path length, task timeliness, endurance safety, and communication reliability. This reduces the subjectivity of manually setting boundaries, improves the matching accuracy between the mapping table and the path generation strategy, reduces the risk of task timeouts, insufficient endurance, and communication interruptions, and enhances the reliability and adaptability of multi-area UAV inspection path optimization.
[0092] S500: During the online phase, the mapping interval to which the current inspection task belongs is determined in the optimized mapping table based on the inspection task feature vector of the current inspection task, the corresponding path generation strategy is obtained, and the UAV inspection path is generated according to the path generation strategy.
[0093] Currently, online path generation largely relies on fixed rules, leading to inaccurate matching between task feature vectors and mapping intervals. The path generation strategy cannot dynamically adjust based on task type, remaining time window, communication quality, and distance to the current node. This easily results in unreasonable task execution order, untimely charging node insertion, and insufficient avoidance of communication blind spots, ultimately causing task timeouts, insufficient battery life, and communication interruptions. Therefore, accurately determining the mapping interval and generating the UAV inspection path based on the current inspection task feature vector in the optimized mapping table has become a pressing technical problem that needs to be solved.
[0094] Step S500 in the method provided in this embodiment of the invention includes: Obtain the inspection task feature vector of the current inspection task, and input the inspection task feature vector of the current inspection task into the pre-trained task feature encoder to obtain the task embedding vector of the current inspection task. Calculate the distance between the task embedding vector of the current inspection task and the cluster centers corresponding to multiple mapping intervals in the optimized mapping table, and determine the mapping interval to which the cluster center with the smallest distance from the task embedding vector of the current inspection task belongs; Obtain the path generation strategy corresponding to the mapping interval to which the current inspection task belongs; The execution order between the current inspection task and other inspection tasks is determined according to the task priority sorting rules in the path generation strategy. The insertion position of the charging node in the inspection path is determined according to the charging node insertion rules in the path generation strategy. The direction of the inspection path in the communication blind spot is determined according to the communication blind spot avoidance rules in the path generation strategy, and the UAV inspection path is generated.
[0095] In this embodiment of the invention, the inspection task feature vector of the current inspection task is first obtained during the online phase. The current inspection task can be the task with the shortest remaining time window in the set of inspection tasks to be executed; the method of obtaining the inspection task feature vector is the same as described above, including task type encoding, normalized remaining time window, normalized communication quality, and normalized current node distance; the current node position is the current position of the UAV.
[0096] Then, the feature vector of the current inspection task is input into the pre-trained task feature encoder to obtain the task embedding vector. If there are multiple tasks to be executed, the feature vectors of multiple inspection tasks can be combined into a sequence and input into the encoder together, and then the embedding vector corresponding to the current inspection task can be obtained.
[0097] Furthermore, the distances between the task embedding vector of the current inspection task and the cluster centers corresponding to multiple mapping intervals in the optimized mapping table are calculated using Euclidean distance. The cluster center dimension is consistent with the task embedding vector dimension. The optimized mapping table stores the cluster centers of each mapping interval and the optimized partition boundaries. The mapping interval to which the cluster center with the smallest distance belongs is determined as the mapping interval to which the current inspection task belongs. If two cluster centers have the same distance, priority is given to the one with the shorter remaining time window. Prioritizing the one with the shorter remaining time window allows for the matching of urgent tasks with a time window priority strategy.
[0098] Furthermore, the path generation strategy corresponding to the mapping interval to which the current inspection task belongs is obtained. The path generation strategy includes task priority ranking rules, charging node insertion rules, and communication blind spot avoidance rules. The strategies corresponding to different mapping intervals differ in weight, threshold, or rule parameters. If multiple inspection tasks to be executed belong to different mapping intervals, the mapping interval to which each task belongs and the corresponding path generation strategy are determined separately, and priority scores are calculated according to the strategies corresponding to each task, and then they are uniformly ranked.
[0099] Furthermore, the execution order of the current inspection task and other inspection tasks is determined according to the task priority ranking rules. Tasks are ranked from highest to lowest priority score; if scores are the same, the task with the shorter remaining time window takes precedence. Simultaneously, the insertion position of the charging node in the inspection path is determined according to the charging node insertion rules in the path generation strategy, and the direction of the inspection path in communication blind spots is determined according to the communication blind spot avoidance rules in the path generation strategy, thus generating the UAV inspection path.
[0100] The online phase can be executed before each inspection path generation. If task insertion or path replanning occurs, the feature vector of the current inspection task is reacquired, re-input to the encoder, the mapping interval is redefined, the path generation strategy is reacquired, and the UAV inspection path is regenerated. Tasks that have already been completed are no longer included. Tasks that are currently being executed but have not yet been completed are still included as pending tasks.
[0101] This invention obtains the task embedding vector of the current inspection task through a pre-trained task feature encoder, calculates the distance between the cluster centers in the optimized mapping table to determine the mapping interval, obtains the corresponding path generation strategy, determines the execution order according to the task priority sorting rule, determines the charging node insertion position according to the charging node insertion rule, and determines the direction in the communication blind zone according to the communication blind zone avoidance rule. This enables online path generation to dynamically match with task features, improves the matching accuracy and real-time performance of multi-region UAV inspection path generation strategies, reduces the risk of task timeout, insufficient battery life and communication interruption, and enhances the reliability and adaptability of UAV inspection path optimization.
[0102] In summary, the embodiments of the present invention have at least the following technical effects: This invention unifies multi-regional inspection tasks into a single inspection task feature vector, encompassing task type, remaining time window, communication quality, and distance to the current node. It automatically obtains task embedding vectors, initial mapping intervals, and soft partitioning boundaries using a pre-trained task feature encoder and differentiable clustering. Then, using the soft partitioning boundaries as initial boundaries, an improved ant colony algorithm is employed to offline optimize the mapping table. This ensures accurate correspondence between the mapping intervals and path generation strategies, including task priority ranking rules, charging node insertion rules, and communication blind spot avoidance rules. In the online phase, the current task embedding vector is matched to its corresponding mapping interval, and the appropriate strategy is invoked to generate the UAV inspection path. This effectively eliminates the dimensional differences of heterogeneous task features while preserving task type semantics, fully capturing the correlation between multiple inspection tasks. Mapping interval partitioning and path strategy matching are driven by historical data and the quality of path generation from the validation set, reducing the subjectivity of manually setting boundaries and rule weights. It balances path length, task timeliness, endurance safety, and communication reliability, improving the matching accuracy, real-time performance, and environmental adaptability of multi-regional UAV inspection path generation strategies. This reduces the risks of task timeouts, insufficient endurance, and communication interruptions, ultimately enhancing the reliability and overall efficiency of UAV inspection path optimization.
[0103] In summary, this invention solves the technical problems in existing multi-area UAV inspections, such as heterogeneous and dynamically changing task characteristics, inaccurate matching between mapping intervals and path generation strategies, difficulty in balancing task timeliness, endurance safety, and communication reliability in online path generation, which lead to high risks of task timeouts, insufficient endurance, and communication interruptions.
[0104] Example 2, as Figure 3 As shown, based on the same inventive concept as the UAV inspection path optimization method for multi-area tasks provided in Embodiment 1, this embodiment of the invention also provides a UAV inspection path optimization system for multi-area tasks, including: The task feature acquisition module 11 is used to acquire the inspection task feature vectors of multiple inspection tasks. The inspection task feature vectors include task type, remaining time of time window, communication quality and distance to the current node. The task encoding and clustering module 12 is used to input the inspection task feature vectors corresponding to the multiple inspection tasks into the pre-trained task feature encoder, output the task embedding vectors corresponding to the multiple inspection tasks, and perform differentiable clustering on the output task embedding vectors to obtain multiple initial mapping intervals and corresponding soft partitioning boundaries. The mapping table construction module 13 is used to construct a mapping table including multiple mapping intervals, each mapping interval corresponding to a path generation strategy, wherein the path generation strategy includes task priority sorting rules, charging node insertion rules and communication blind spot avoidance rules; The offline optimization module 14 is used to optimize the partition boundaries of the multiple mapping intervals offline using the soft partition boundary as the initial partition boundary and an improved ant colony algorithm to obtain an optimized mapping table. The online path generation module 15 is used in the online phase to determine the mapping interval to which the current inspection task belongs based on the inspection task feature vector in the optimized mapping table, obtain the corresponding path generation strategy, and generate the UAV inspection path according to the path generation strategy.
[0105] In one embodiment, the task feature acquisition module 11 is specifically used for: The task type, time window deadline, communication quality parameters, and task location of each inspection task are obtained. The task type includes infrared temperature measurement tasks, visible light inspection tasks, and lidar scanning tasks. The communication quality parameters are used to characterize the communication signal strength at the task location. Calculate the remaining time of the time window for each inspection task based on the time window deadline and the current time; Based on the task location and the current node location, calculate the distance between each inspection task and the current node location. The task type is encoded to obtain the encoded task type. The remaining time of the time window, the communication quality parameter, and the current node distance are normalized to obtain the normalized remaining time of the time window, the normalized communication quality parameter, and the normalized current node distance. The encoded task type, the normalized remaining time of the time window, the normalized communication quality parameters, and the normalized current node distance are concatenated to form the inspection task feature vector for each inspection task.
[0106] In one embodiment, the task encoding and clustering module 12 is specifically used for: The pre-training process of the task feature encoder includes: Obtain historical inspection task samples, which include multiple historical inspection task feature vectors and path generation quality labels corresponding to the multiple historical inspection task feature vectors. Each historical inspection task feature vector is obtained by concatenating historical task type encoding, remaining time of historical time window, historical communication quality, and historical current node distance. An initial task feature encoder is constructed, comprising a multi-head self-attention layer, a feedforward network layer, an output layer, and a prediction layer. The multi-head self-attention layer is used to calculate the attention weights between tasks on the sequence composed of multiple historical inspection task feature vectors. The feedforward network layer is used to perform nonlinear transformation on the attention weights. The output layer is used to output multiple historical task embedding vectors. The prediction layer is used to predict the path generation quality based on the multiple historical task embedding vectors. Using the feature vectors of the multiple historical inspection tasks as input, the embedding vectors of the multiple historical tasks as intermediate output, and the path generation quality label as supervision signal, the prediction layer maps the embedding vectors of the multiple historical tasks to the predicted path generation quality, and supervises the training of the initial task feature encoder based on the loss between the predicted path generation quality and the path generation quality label. When the loss is less than a preset loss threshold, the training is considered to have converged, and a pre-trained task feature encoder is obtained.
[0107] Differentiable clustering is performed on the output task embedding vectors to obtain multiple initial mapping intervals and corresponding soft partition boundaries, including: Step 1: Randomly select multiple task embedding vectors from the task embedding vectors as multiple initial cluster centers, or initialize multiple cluster centers according to the distribution characteristics of the task embedding vectors, wherein each cluster center is a vector in the space where the task embedding vectors are located; Step 2: Calculate the soft assignment probability of the task embedding vector to each of the plurality of cluster centers, wherein the soft assignment probability is used to characterize the degree to which the task embedding vector belongs to the cluster center; Step 3: Update the multiple cluster centers according to the soft assignment probability, and repeat steps 2 to 3 until the multiple cluster centers converge; Step 4: Determine multiple initial mapping intervals based on the converged cluster centers. For each pair of adjacent initial mapping intervals, determine a set of equal probability points where the task embedding vector has an equal probability of belonging to the two adjacent initial mapping intervals based on the soft assignment probability, and determine the set of equal probability points as the soft partition boundary between the two adjacent initial mapping intervals.
[0108] In one embodiment, the mapping table construction module 13 is specifically used for: Construct a mapping table comprising multiple mapping intervals, each corresponding to a path generation strategy, including: The number of mapping intervals in the mapping table is determined based on the number of the plurality of initial mapping intervals, and the number of mapping intervals in the mapping table is equal to the number of the plurality of initial mapping intervals; A path generation strategy is configured for each mapping interval in the mapping table. The path generation strategy includes a task priority sorting rule, a charging node insertion rule, and a communication blind spot avoidance rule.
[0109] The path generation strategy includes task priority ranking rules, charging node insertion rules, and communication blind spot avoidance rules, including: The task priority ranking rule is as follows: calculate the task priority score based on the remaining time of the time window, the communication quality, and the distance to the current node, and sort the multiple inspection tasks from high to low according to the task priority score. The shorter the remaining time of the time window, the higher the communication quality, and the smaller the distance to the current node, the higher the task priority score. The charging node insertion rule is as follows: when the remaining battery power of the drone is lower than the battery threshold and the distance between the next inspection task and the current node is greater than the distance threshold, a charging node is inserted before the next inspection task. The communication blind spot avoidance rule is as follows: when the communication quality of the inspection area is lower than the communication quality threshold, the execution order of the inspection task or the direction of the inspection path is adjusted so that the inspection task that relies on real-time communication avoids the inspection area where the communication quality is lower than the communication quality threshold.
[0110] In one embodiment, the offline optimization module 14 is specifically used for: Using the soft partition boundary as the initial partition boundary, an improved ant colony algorithm is used to perform offline optimization of the partition boundaries of the multiple mapping intervals to obtain an optimized mapping table, including: The soft partitioning boundaries corresponding to the multiple initial mapping intervals are used as the initial partitioning boundaries of the improved ant colony algorithm. The partition boundaries of multiple mapping intervals in the mapping table are encoded as path nodes in the improved ant colony algorithm, wherein each ant in the improved ant colony algorithm corresponds to a set of partition boundary combinations, and the partition boundary combinations are the boundary values between two adjacent mapping intervals in the mapping table. The pheromone concentration and number of ants in the improved ant colony algorithm are initialized, and the heuristic information of the improved ant colony algorithm is determined according to the value range of the dividing boundary of multiple mapping intervals in the mapping table. For each ant, the state transition probability is determined based on the pheromone concentration and the heuristic information. The next path node is selected from the current path node according to the state transition probability until a path is completed. The path corresponds to a set of partitioning boundary combinations. The fitness of the improved ant colony algorithm is calculated by using the path generation quality of the mapping table on the validation set as the fitness of the path corresponding to each ant. The pheromone concentration is updated based on the fitness of each ant's corresponding path, wherein the pheromone concentration increases more for paths with higher fitness. Repeat the steps of determining the state transition probability for each ant based on the pheromone concentration and the heuristic information, up to updating the pheromone concentration based on the fitness of the path corresponding to each ant, until the maximum number of iterations is reached. Output the partition boundary combination corresponding to the path with the highest fitness, and update the partition boundaries of multiple mapping intervals in the mapping table based on the partition boundary combination corresponding to the path with the highest fitness to obtain the optimized mapping table.
[0111] The fitness of the improved ant colony algorithm is calculated using the path generation quality of the mapping table on the validation set as the fitness of the path corresponding to each ant, including: Obtain a verification set, which includes feature vectors of multiple verification inspection tasks corresponding to each verification inspection task. For each of the plurality of verification inspection tasks, the feature vector of the verification inspection task corresponding to the verification inspection task is input into the pre-trained task feature encoder to obtain the embedding vector of the verification inspection task corresponding to the verification inspection task. The mapping interval to which the verification inspection task belongs is determined in the mapping table according to the embedding vector of the verification task to obtain the path generation strategy corresponding to the verification inspection task. The verification inspection path of the verification inspection task is generated according to the path generation strategy corresponding to the verification inspection task. The mapping table is obtained on the verification set. The total path length, time window satisfaction rate, endurance feasibility, and communication quality satisfaction rate are obtained. The total path length is determined based on the direction of the verification inspection path of each verification inspection task in the verification set. The time window satisfaction rate is determined based on the comparison between the actual execution time of each verification inspection task in the verification set and the time window deadline. The endurance feasibility is determined based on the comparison between the remaining battery power of the UAV and the battery power threshold during the execution of each verification inspection task in the verification set. The communication quality satisfaction rate is determined based on the comparison between the communication quality at the execution time of each verification inspection task in the verification set and the communication quality threshold. The total path length is normalized to obtain the normalized total path length. The total path length score is obtained by subtracting the normalized total path length from 1. The time window satisfaction rate, the endurance feasibility and the communication quality satisfaction rate are normalized to obtain the normalized time window satisfaction rate, the normalized endurance feasibility and the normalized communication quality satisfaction rate, respectively. The path generation quality is obtained by weighting and summing the total path length score, the normalized time window satisfaction rate, the normalized endurance feasibility, and the normalized communication quality satisfaction rate according to preset weights, and the path generation quality is used as the fitness of the improved ant colony algorithm.
[0112] In one embodiment, the online path generation module 15 is specifically used for: Obtain the inspection task feature vector of the current inspection task, and input the inspection task feature vector of the current inspection task into the pre-trained task feature encoder to obtain the task embedding vector of the current inspection task. Calculate the distance between the task embedding vector of the current inspection task and the cluster centers corresponding to multiple mapping intervals in the optimized mapping table, and determine the mapping interval to which the cluster center with the smallest distance from the task embedding vector of the current inspection task belongs; Obtain the path generation strategy corresponding to the mapping interval to which the current inspection task belongs; The execution order between the current inspection task and other inspection tasks is determined according to the task priority sorting rules in the path generation strategy. The insertion position of the charging node in the inspection path is determined according to the charging node insertion rules in the path generation strategy. The direction of the inspection path in the communication blind spot is determined according to the communication blind spot avoidance rules in the path generation strategy, and the UAV inspection path is generated.
[0113] It should be noted that the order of the above embodiments of the present invention is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. Furthermore, the above description focuses on specific embodiments of this specification. Additionally, the processes depicted in the accompanying drawings do not necessarily require a specific or sequential order to achieve the desired results. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
[0114] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
[0115] This specification and accompanying drawings are merely illustrative examples of the invention and are intended to cover any and all modifications, variations, combinations, or equivalents within the scope of the invention. Clearly, those skilled in the art can make various alterations and modifications to the invention without departing from its scope. Therefore, if such modifications and modifications fall within the scope of the invention and its equivalents, the invention is intended to include these modifications and modifications.
Claims
1. A method for optimizing a UAV inspection path for a multi-region task, characterized in that, The method includes: Obtain the inspection task feature vectors of multiple inspection tasks. The inspection task feature vectors include task type, remaining time of time window, communication quality and distance to the current node. The inspection task feature vectors corresponding to the multiple inspection tasks are input into the pre-trained task feature encoder, and the task embedding vectors corresponding to the multiple inspection tasks are output. Differentiable clustering is performed on the output task embedding vectors to obtain multiple initial mapping intervals and corresponding soft partition boundaries. A mapping table is constructed that includes multiple mapping intervals, each mapping interval corresponding to a path generation strategy. The path generation strategy includes a task priority sorting rule, a charging node insertion rule, and a communication blind spot avoidance rule. Using the soft partition boundary as the initial partition boundary, an improved ant colony algorithm is used to perform offline optimization of the partition boundaries of the multiple mapping intervals to obtain the optimized mapping table. During the online phase, the mapping interval to which the current inspection task belongs is determined in the optimized mapping table based on the inspection task feature vector of the current inspection task, the corresponding path generation strategy is obtained, and the UAV inspection path is generated according to the path generation strategy. 2.The multi-region task oriented UAV inspection path optimization method of claim 1, wherein, Obtain the inspection task feature vectors for multiple inspection tasks, including: The task type, time window deadline, communication quality parameters, and task location of each inspection task are obtained. The task type includes infrared temperature measurement tasks, visible light inspection tasks, and lidar scanning tasks. The communication quality parameters are used to characterize the communication signal strength at the task location. Calculate the remaining time of the time window for each inspection task based on the time window deadline and the current time; Based on the task location and the current node location, calculate the distance between each inspection task and the current node location. The task type is encoded to obtain the encoded task type. The remaining time of the time window, the communication quality parameter, and the current node distance are normalized to obtain the normalized remaining time of the time window, the normalized communication quality parameter, and the normalized current node distance. The encoded task type, the normalized remaining time of the time window, the normalized communication quality parameters, and the normalized current node distance are concatenated to form the inspection task feature vector for each inspection task. 3.The multi-region task oriented UAV inspection path optimization method of claim 1, wherein, The pre-training process of the task feature encoder includes: A historical inspection task sample is obtained, comprising multiple historical inspection task feature vectors and path generation quality labels corresponding to the feature vectors. Each historical inspection task feature vector is obtained by concatenating the historical task type code, the remaining time of the historical time window, the historical communication quality, and the historical current node distance. The path generation quality label is determined based on the actual execution result of the historical inspection task: historical inspection tasks are binned according to task type, inspection area, and remaining time of the time window, with historical tasks within the same bin having the same or similar remaining time of the time window; historical tasks with all three criteria (time window satisfaction, endurance feasibility, and communication satisfaction) are grouped into a set of hard-constraint successful tasks, while the path generation quality label for historical tasks that fail to meet hard constraints is set to zero; for each historical task in the set of hard-constraint successful tasks, the path generation quality label is obtained by dividing the number of historical tasks in the bin whose completion time is later than the actual completion time of the historical task by the total number of hard-constraint successful tasks in the bin; the path generation quality label is a relative ranking within the bin and does not depend on the remaining time of the historical time window within the bin. An initial task feature encoder is constructed, comprising a multi-head self-attention layer, a feedforward network layer, an output layer, and a prediction layer. The multi-head self-attention layer is used to calculate the attention weights between tasks in the sequence composed of multiple historical inspection task feature vectors. The feedforward network layer is used to perform nonlinear transformation on the attention weights. The output layer is used to output multiple historical task embedding vectors. The prediction layer is used to perform average pooling on the multiple historical task embedding vectors to obtain a sequence-level embedding vector, and predict the path generation quality based on the sequence-level embedding vector. Using the feature vectors of the multiple historical inspection tasks as input, the embedding vectors of the multiple historical tasks as intermediate output, and the path generation quality label as supervision signal, the prediction layer maps the embedding vectors of the multiple historical tasks to the predicted path generation quality, and supervises the training of the initial task feature encoder based on the loss between the predicted path generation quality and the path generation quality label. When the loss is less than a preset loss threshold, the training is considered to have converged, and a pre-trained task feature encoder is obtained.
4. The multi-region task oriented UAV inspection path optimization method according to claim 3, characterized in that, Differentiable clustering is performed on the output task embedding vectors to obtain multiple initial mapping intervals and corresponding soft partition boundaries, including: Step 1: Randomly select multiple task embedding vectors from the task embedding vectors as multiple initial cluster centers, or initialize multiple cluster centers according to the distribution characteristics of the task embedding vectors, wherein each cluster center is a vector in the space where the task embedding vectors are located; Step 2: Calculate the soft assignment probability of the task embedding vector to each of the plurality of cluster centers, wherein the soft assignment probability is used to characterize the degree to which the task embedding vector belongs to the cluster center; Step 3: Update the multiple cluster centers according to the soft assignment probability, and repeat steps 2 to 3 until the multiple cluster centers converge; Step 4: Determine multiple initial mapping intervals based on the converged cluster centers. For each pair of adjacent initial mapping intervals, determine a set of equal probability points where the task embedding vector has an equal probability of belonging to the two adjacent initial mapping intervals based on the soft assignment probability, and determine the set of equal probability points as the soft partition boundary between the two adjacent initial mapping intervals.
5. The UAV inspection path optimization method for multi-regional tasks according to claim 1, characterized in that, Construct a mapping table comprising multiple mapping intervals, each corresponding to a path generation strategy, including: The number of mapping intervals in the mapping table is determined based on the number of the plurality of initial mapping intervals, and the number of mapping intervals in the mapping table is equal to the number of the plurality of initial mapping intervals; A path generation strategy is configured for each mapping interval in the mapping table. The path generation strategy includes a task priority sorting rule, a charging node insertion rule, and a communication blind spot avoidance rule.
6. The UAV inspection path optimization method for multi-regional tasks according to claim 5, characterized in that, The path generation strategy includes task priority ranking rules, charging node insertion rules, and communication blind spot avoidance rules, including: The task priority ranking rule is as follows: calculate the task priority score based on the remaining time of the time window, the communication quality, and the distance to the current node, and sort the multiple inspection tasks from high to low according to the task priority score. The shorter the remaining time of the time window, the higher the communication quality, and the smaller the distance to the current node, the higher the task priority score. The charging node insertion rule is as follows: when the remaining battery power of the drone is lower than the battery threshold and the distance between the next inspection task and the current node is greater than the distance threshold, a charging node is inserted before the next inspection task. The communication blind spot avoidance rule is as follows: when the communication quality of the inspection area is lower than the communication quality threshold, the execution order of the inspection task or the direction of the inspection path is adjusted so that the inspection task that relies on real-time communication is executed in the time period or area when the communication quality is higher than the communication quality threshold, or the inspection path flies along the grid where the communication quality is higher than the communication quality threshold; when the inspection task that relies on real-time communication must pass through the communication blind spot, a detour path is selected, and the increased distance of the detour does not exceed 20% of the original path distance; if the increased distance of the detour exceeds 20% of the original path distance, the inspection task that relies on real-time communication is suspended until the communication quality is restored.
7. The UAV inspection path optimization method for multi-regional tasks according to claim 1, characterized in that, Using the soft partition boundary as the initial partition boundary, an improved ant colony algorithm is used to perform offline optimization of the partition boundaries of the multiple mapping intervals to obtain an optimized mapping table, including: The soft partitioning boundaries corresponding to the multiple initial mapping intervals are used as the initial partitioning boundaries of the improved ant colony algorithm. The partition boundaries of multiple mapping intervals in the mapping table are encoded as path nodes in the improved ant colony algorithm, wherein each ant in the improved ant colony algorithm corresponds to a set of partition boundary combinations, and the partition boundary combinations are the boundary values between two adjacent mapping intervals in the mapping table. The pheromone concentration and number of ants in the improved ant colony algorithm are initialized, and the heuristic information of the improved ant colony algorithm is determined according to the value range of the partition boundaries of multiple mapping intervals in the mapping table. The smaller the distance from the candidate boundary value of the partition boundary of the multiple mapping intervals to the soft partition boundary, the greater the heuristic information. For each ant, the state transition probability is determined based on the pheromone concentration and the heuristic information. The next path node is selected from the current path node according to the state transition probability until a path is completed. The path corresponds to a set of partitioning boundary combinations. The fitness of the improved ant colony algorithm is calculated by using the path generation quality of the mapping table on the validation set as the fitness of the path corresponding to each ant. The pheromone concentration is updated based on the fitness of each ant's corresponding path, wherein the pheromone concentration increases more for paths with higher fitness. Repeat the steps of determining the state transition probability for each ant based on the pheromone concentration and the heuristic information, up to updating the pheromone concentration based on the fitness of the path corresponding to each ant, until the maximum number of iterations is reached. Output the partition boundary combination corresponding to the path with the highest fitness, and update the partition boundaries of multiple mapping intervals in the mapping table based on the partition boundary combination corresponding to the path with the highest fitness to obtain the optimized mapping table.
8. The UAV inspection path optimization method for multi-regional tasks according to claim 7, characterized in that, The fitness of the improved ant colony algorithm is calculated using the path generation quality of the mapping table on the validation set as the fitness of the path corresponding to each ant, including: Obtain a verification set, which includes feature vectors of multiple verification inspection tasks corresponding to each verification inspection task. For each of the plurality of verification inspection tasks, the feature vector of the verification inspection task corresponding to the verification inspection task is input into the pre-trained task feature encoder to obtain the embedding vector of the verification inspection task corresponding to the verification inspection task. The mapping interval to which the verification inspection task belongs is determined in the mapping table according to the embedding vector of the verification task to obtain the path generation strategy corresponding to the verification inspection task. The verification inspection path of the verification inspection task is generated according to the path generation strategy corresponding to the verification inspection task. The mapping table is obtained on the verification set. The total path length, time window satisfaction rate, endurance feasibility, and communication quality satisfaction rate are obtained. The total path length is determined based on the direction of the verification inspection path of each verification inspection task in the verification set. The time window satisfaction rate is determined based on the comparison between the actual execution time of each verification inspection task in the verification set and the time window deadline. The endurance feasibility is determined based on the comparison between the remaining battery power of the UAV and the battery power threshold during the execution of each verification inspection task in the verification set. The communication quality satisfaction rate is determined based on the comparison between the communication quality at the execution time of each verification inspection task in the verification set and the communication quality threshold. The total path length is normalized to obtain the normalized total path length. The total path length score is obtained by subtracting the normalized total path length from 1. The time window satisfaction rate, the endurance feasibility and the communication quality satisfaction rate are normalized to obtain the normalized time window satisfaction rate, the normalized endurance feasibility and the normalized communication quality satisfaction rate, respectively. The path generation quality is obtained by weighting and summing the total path length score, the normalized time window satisfaction rate, the normalized endurance feasibility, and the normalized communication quality satisfaction rate according to preset weights, and the path generation quality is used as the fitness of the improved ant colony algorithm.
9. The UAV inspection path optimization method for multi-regional tasks according to claim 1, characterized in that, During the online phase, the mapping interval to which the current inspection task belongs is determined in the optimized mapping table based on the inspection task feature vector of the current inspection task, and the corresponding path generation strategy is obtained. Then, the UAV inspection path is generated according to the path generation strategy, including: Obtain the inspection task feature vector of the current inspection task, and input the inspection task feature vector of the current inspection task into the pre-trained task feature encoder to obtain the task embedding vector of the current inspection task. Calculate the distance between the task embedding vector of the current inspection task and the cluster centers corresponding to multiple mapping intervals in the optimized mapping table, and determine the mapping interval to which the cluster center with the smallest distance from the task embedding vector of the current inspection task belongs; Obtain the path generation strategy corresponding to the mapping interval to which the current inspection task belongs; The execution order between the current inspection task and other inspection tasks is determined according to the task priority sorting rules in the path generation strategy. The insertion position of the charging node in the inspection path is determined according to the charging node insertion rules in the path generation strategy. The direction of the inspection path in the communication blind spot is determined according to the communication blind spot avoidance rules in the path generation strategy, and the UAV inspection path is generated.
10. A UAV inspection path optimization system for multi-regional missions, characterized in that, The method for optimizing UAV inspection paths for multi-area missions according to any one of claims 1 to 9 includes: The task feature acquisition module is used to acquire the inspection task feature vectors of multiple inspection tasks. The inspection task feature vectors include task type, remaining time of time window, communication quality and distance to the current node. The task encoding and clustering module is used to input the inspection task feature vectors corresponding to the multiple inspection tasks into the pre-trained task feature encoder, output the task embedding vectors corresponding to the multiple inspection tasks, and perform differentiable clustering on the output task embedding vectors to obtain multiple initial mapping intervals and corresponding soft partition boundaries. The mapping table construction module is used to construct a mapping table including multiple mapping intervals, each mapping interval corresponding to a path generation strategy, wherein the path generation strategy includes task priority sorting rules, charging node insertion rules and communication blind spot avoidance rules; The offline optimization module is used to optimize the partition boundaries of the multiple mapping intervals offline using the soft partition boundary as the initial partition boundary and an improved ant colony algorithm to obtain the optimized mapping table. The online path generation module is used in the online phase to determine the mapping interval to which the current inspection task belongs based on the inspection task feature vector in the optimized mapping table, obtain the corresponding path generation strategy, and generate the UAV inspection path according to the path generation strategy.
