A Multi-Regional Path-Planning Method for Rescue UAVs with Priority Constraints

: This study focuses on the path-planning problem of rescue UAVs with regional detection priority. Initially, we propose a mixed-integer programming model that integrates coverage path planning (CPP) and the hierarchical traveling salesman problem (HTSP) to address multi-regional path planning under priority constraints. For intra-regional path planning, we present an enhanced method for acquiring reciprocating ﬂight paths to ensure complete coverage of convex polygonal regions with shorter ﬂight paths when a UAV is equipped with sensors featuring circular sampling ranges. An additional comparison was made for spiral ﬂight paths, and second-order Bezier curves were employed to optimize both sets of paths. This optimization not only reduced the path length but also enhanced the ability to counteract inherent drone jitter. Additionally, we propose a variable neighborhood descent algorithm based on K-nearest neighbors to solve the inter-regional access order path-planning problem with priority. We establish parameters for measuring distance and evaluating the priority order of UAV ﬂight paths. Simulation and experiment results demonstrate that the proposed algorithm can effectively assist UAVs in performing path-planning tasks with priority constraints, enabling faster information collection in important areas and facilitating quick exploration of three-dimensional characteristics in unknown disaster areas by rescue workers. This algorithm signiﬁcantly enhances the safety of rescue workers and optimizes crucial rescue times in


Introduction
Unmanned aerial vehicles (UAVs) have been widely used in many domains due to their small size, sensitive control, and high scalability.Especially in the civil field, UAVs equipped with cameras, infrared, LiDAR, or other sensors can conduct various missions, including personnel searches [1], field monitoring [2], and terrain detection [3].As UAVs can survey target areas without causing any damage, they are well-suited to performing information sensing tasks in remote or hazardous environments and complex terrains.By reaching a rescue site before rescue personnel, drones provide timely and precise target information, greatly enhancing the efficiency of rescue operations.To this end, a reasonable path should be planned such that the mobile sensor carried by a UAV can cover a region in a finite time, giving rise to a coverage path-planning (CPP) problem with various constraints, including energy consumption, time consumption, etc.
In recent years, extensive research on the CPP problem for covering single regions with energy constraints and photography constraints has been carried out [4][5][6][7][8].A covered route primarily exhibits various shapes, including round-trip and spiral patterns.However, by their priority levels.However, this planning approach ensures that the accesses are planned in order of priority, but it invariably results in a significant degree of path-length redundancy.In some application scenarios, this strategy may not be the most efficient and effective.Panchamgam et al. [18] proposed a d-relaxed priority model, in which priority was adjusted to a certain extent during the planning process while taking path length into account.The rule of this model is as follows: if p is the highest priority of all unvisited locations, the vehicle is allowed to access one of the positions whose priority is p, p + 1, . .., p + d.The value of the positive integer d can be flexibly controlled to realize the trade-off between path cost and emergency degree.Hà et al. [20] established a d-relaxed priority integer programming model based on [18] and introduced a metaheuristic method based on the framework of iterated local search with problem-tailored operators to find approximate solutions.
In the realm of drone path planning for real-life rescue scenarios, a comprehensive and systematic approach for multi-regional path-planning tasks with priority constraints is lacking.Such a method should have the ability to determine priority sequences and path lengths tailored for evaluating emergency rescue tasks effectively.This paper presents the following contributions: building upon the work presented in [18], we formally define the HTSP-CPP problem and formulate it as a mixed-integer programming model with d-relaxed constraints.In the realm of intra-regional path planning, we present an enhanced BF path coverage method that leverages the minimum width of polygonal regions.This method ensures complete coverage of convex regions by sensors equipped with circular sampling ranges.And simulate a comparison with the spiral path, optimizing both paths using Bezier curves.To optimize inter-regional access order planning, we introduce two different strategies for generating initial solutions, enabling efficient determination of the access sequence for multiple regions, and utilizing the RVND algorithm to optimize the initial solution.Additionally, we propose a distance-priority evaluation rule to assess the trade-off between distance and priority with respect to the solutions.
The structure of this paper is as follows.In Section 2, we present a mixed-integer programming model based on the HTSP-CPP.In Section 3, we discuss the related algorithms and explain the specific algorithm design and process for intra-regional and inter-regional path planning.We also propose a result evaluation index during the experimental design stage, design a specific simulation scheme, and present the simulation and experiment results in Sections 4 and 5.

Mathematical Model of the HTSP-CPP
The sensors integrated into UAVs mainly consist of LiDARs, RGB cameras, NIR cameras, and others.Studies by Salach et al. [21] and Domingo et al. [22] have highlighted LiDARs' superiority in terrain detection and 3D modeling compared to other sensors.However, concerning search and rescue missions, NIR cameras and RGB cameras demonstrate more significant potential.In complete disaster relief operations, UAVs equipped with LiDAR are initially utilized to gather terrain data in affected regions, aiding in disaster severity assessment and the formulation of relief strategies.Subsequently, UAVs outfitted with infrared or optical sensors conduct a secondary search in areas where individuals may be trapped, precisely identifying their locations for efficient rescue efforts.Therefore, the path-planning method should be applicable to various sensor types.However, due to the unique sampling shape of LiDAR, this paper focuses on improving the coverage method based on circular sampling ranges.Table 1 shows the main symbols used in this article.The position of the region in the access sequence

N b
The number of stripes in the region v ij The vertex coordinates of the region

P
The priority matrix w ij The coordinate of the waypoints

R k
The set of regions with the same priority x ij Decision variable, whether there is a connecting path between two regions, i, j

S
The width of the convex region y i pq Decision variable, whether there is a connecting path between two waypoints, p, q, in the region

V i
The vertex set of the region ω The sensor's sampling diameter

W i
The waypoints set of the region ∆d The distance between the UAV's scan lines

Problem Description
We assume that there are n convex polygonal regions with different sizes and shapes to be covered, and these regions are denoted by A i =< V i , C i , p i >, where V i = v i1 , v i2 , . . ., v in i is the vertex coordinates of the clockwise arrangement of polygons, v ij is the coordinates of the j-th vertex of the i-th region, n i is the number of vertices in the i-th region, C i is the central point coordinate of the i-th region, and p i is the priority of the i-th region, where p i ∈ G = {1, . . . ,g}.Now, a UAV equipped with a sensor (LiDAR) is utilized to initiate a comprehensive coverage detection of these n areas starting from the base for acquiring the height and obstacle information of each region.Upon completion of the coverage task, the UAV returns to the base.The ground sampling range of the sensor is circular in shape, as depicted in Figure 1.
Since UAVs maintain a constant flight height regardless of the terrain's ups and downs, this problem can be considered a two-dimensional HTTP-CPP problem.Assum ing that the sensor's sampling footprint can completely cover the target region, the ag gregate flight path length of the UAV is taken as the flight cost, and the access sequenc between regions and the flight path within each region are the decision variables to b optimized for minimizing the flight cost.

Problem Modelling
The path of a UAV is generated by a set of a series of waypoint  , where n is the number of target areas and mi repre sents the number of waypoints in the i-th region, indicating the number of elements in The sampling diameter of the sensor is influenced not only by the sensor's performance, including the field of view angle, the angular resolution, and the maximum detection radius, but also the flight parameters, such as the flight height and velocity.As the flight altitude increases, the sampling range expands while the range that satisfies the required sampling precision decreases.Therefore, there exists a maximum flight altitude that ensures adequate sampling precision.Similarly, there exists a minimum flight altitude that guarantees the minimum required sampling range.When the UAV operates within this permissible altitude range, minor fluctuations in altitude will not impact sampling effectiveness.This allowable range is determined by both task-specific sampling precision requirements and sensor parameters.To simplify matters, we treat the sampling range necessary for achieving the desired precision as a fixed value and introduce a concept of "sampling overlap rate" to ensure that UAV altitude changes during flight do not compromise the task's overall quality of data collection.The sampling diameter is w, and the distance between scan lines is given as: Since UAVs maintain a constant flight height regardless of the terrain's ups and downs, this problem can be considered a two-dimensional HTTP-CPP problem.Assuming that the sensor's sampling footprint can completely cover the target region, the aggregate flight path length of the UAV is taken as the flight cost, and the access sequence between regions and the flight path within each region are the decision variables to be optimized for minimizing the flight cost.

Problem Modelling
The path of a UAV is generated by a set of a series of waypoints where n is the number of target areas and m i represents the number of waypoints in the i-th region, indicating the number of elements in the point set W i .Each waypoint signifies a change in direction for the UAV.It is important to note that the UAV maintains a straight-line trajectory between any two consecutive waypoints.We divide the flight paths into two types: (1) intra-regional paths in a single region and (2) inter-regional paths connecting different regions.a. Intra-regional paths Let y i pq denote the access order of waypoints p, q ∈ {1, 2, • • • , m i } of the intra-regional path for the i-th region and y i pq = 1 indicate that the UAV flies from point p to point q, while y i pq = 0 indicates that there is no connecting path between the waypoints p and q.Then, let e i p and t i p denote the import and export of the i-th region, respectively.When e i p = 1 means that the UAV flies into region i from the waypoint p, e i p = 0 means that the waypoint p is not the entry point in region i.Similarly, when t i p = 1 represents that the UAV flies out of region i from the waypoint p, t i p = 0 represents that the waypoints p is not the exit point in region i.

b. Inter-regional paths
The priority constraints should be imposed on the inter-regional path planning to obtain the optimal access sequence of multiple regions.Intending to cover high-priority regions as extensively as possible while minimizing flight costs, it becomes necessary to slightly relax the priority of individual regions.In this paper, we employ d-relaxed priority to model this problem.The d-relaxed priority approach ensures that during the planning of an inter-regional access sequence, if the current region has a priority of k ∈ G = {1, • • • , g}, the priority of the subsequent region to be accessed should not exceed k + d.When d = 0, regional access should strictly adhere to the order of priority from high to low.Conversely, when d = g − 1, the problem is degraded into an ordinary TSP problem without any priority constraints.By selecting an appropriate value for d, a suitable compromise can be achieved between the distance traveled and the priority of regions.
Suppose the target regions are classified into different groups, R k , according to their priorities, which represent the set of regions with priority level k.When planning the sequence of inter-regional access, an access sequence Order is generated.The value of u i represents the sequence number in which the i-th region is accessed, that is, the index value of region i in Order.Let N = {1, 2, • • • , n} be the set of all area numbers to be accessed and N 0 = {0, 1, 2, • • • , n} be the set of numbers containing the depot, where 0 is the number of the depot.A decision variable x ij (i, j ∈ N 0 ) is introduced to represent the inter-regional access order, and x ij = 1 if the UAV flies from region i to region j, while x ij = 0 if there is no connection path between region i and region j.Therefore, the constraints on u i and x ij can be expressed as follows.
The first constraint states that for any two regions i and j, when region j is not the depot and there exists a path from i to j, then the access order of region j should be after region i.Alternatively, if there is no path from i to j, this inequality is also satisfied when a sufficiently large M is used.The second constraint states that when the priority of region j does not meet the d-relaxed constraint, the access order of region j should be after region i and not in the immediate subsequent access position after region i.

c.
Integer programming model of the HTSP-CPP Consider the following specific scenarios: 1.
In the case where the sensor's sampling range can only cover region i, i.e., m i = 1, meaning there is only one waypoint, w i1 , in region i, which coincides with the center of mass of region i.The UAV enters and exits region i from w i1 simultaneously.In other cases where m i > 0, it is necessary to ensure that the UAV enters and exits region i from different points to avoid redundant path lengths.

2.
When there are multiple regions and each region has only one waypoint, i.e., N > 1, then the problem simplifies to the TSP.

3.
When there is only one region and its area exceeds the sampling range of the sensor, i.e., N = 1 and m 1 > 0, the problem becomes a CPP problem with a starting point and an ending point.
Taking into account the above scenarios, the objective function for this problem is as follows.
where d(a, b) represents the Euclidean distance from a to b and c 0 is the coordinates of the depot.In Equation (4), the first term is the path length between regions, the second term represents the sum of path lengths within all regions, the third term represents the path length from the base to the entrance of the first region, and the fourth term represents the path length from the exit of the last region back to the base.In addition, the following constraints should be imposed on Equation (4): Equations ( 5) and ( 6) specify that the UAV enters and exits each region, including the depot, only once.This implies that each region can be visited only once.Equation (7) represents the relationship between the position variable, u i , and the decision variable, x ij .Equations ( 8)- (11) describe the constraint conditions of d-relaxed priority: Equation (8) defines the relationship between regional positions under the d-relaxed priority constraint and Equation (9) specifies that, when the d-relaxed priority constraint is not satisfied, a region with lower priority cannot be directly transferred to a region with higher priority.Equations (10) and (11) are the constraints of the d-relaxed priority rule when leaving the depot and returning to the depot, respectively.Equations ( 12) and (13) indicate that, apart from the entrance and exit of each region, for each other waypoint, the UAV will fly from one waypoint to another, ensuring that each waypoint can be accessed only once and avoiding the redundant path length caused by repeated access to waypoints.Equation (14) states that each region has one and only one entrance and exit.Equations (15) and (16) ensure the continuity of paths to eliminate subloops within and between regions, and |M| represents the cardinality of set M. Equations ( 17)- (20) specify the value ranges of the decision variables to ensure their effectiveness.

Algorithm Design
Based on the aforementioned analysis, the resolution of the HTSP-CPP problem articulated by Equations ( 4)-( 19) can be solved through the proposed algorithm, which encompasses the following three key steps: (1) Calculation of the inter-regional path and parameters: The initial step involves determining the optimal flight direction for the UAV within each convex polygonal region.This is achieved by calculating the width of the region.Simultaneously, the distance between flight paths is determined based on predefined sampling requirements.This information facilitates the generation of parallel flight lines within the region, subsequently yielding four potential candidate flight entry points; (2) Construction of the priority-constrained TSP: The algorithm designates both the center of each region and the depot as "cities" to be visited.This lays the foundation for formulating a traveling salesman problem with priority constraints.To compute the most efficient order of access, a heuristic algorithm is employed.This step aids in identifying the optimal sequence for visiting the designated cities; (3) Selection of optimal entry points and path generation: Utilizing the determined optimal access order, the algorithm proceeds to select the best entry points within each region.By amalgamating all selected waypoints, a coherent and comprehensive UAV path is formulated, which represents the final output of the algorithm.
In the following subsections, we will delve into the principles and code logic of this algorithm, conducting a comprehensive analysis of its effectiveness in solving HTSP-CPP problems.Additionally, we introduce a region order optimization algorithm and showcase the optimization impact on region access order using distance and priority evaluation criteria.

Calculation of Inter-Regional Paths and Parameters
In this paper, we employ a BF path pattern for comprehensive coverage of the designated region.Notably, executing turns with a UAV entails heightened energy consumption and concomitant augmentation of the overall path length.Consequently, diminishing the frequency of turns stands as a pivotal means of curtailing drone flight costs.Guided by the imperative of turn reduction, this paper embarks on a quest to ascertain the optimal width of convex polygons [23].Subsequently, the UAV's BF path aligns with the vertical direction of the width of these polygons, a strategic alignment that serves to minimize path length across the targeted expanse.a.
Calculate the width of the convex polygon to determine the best flight direction of the UAV The authors of [23] proposed a method for determining the width of a convex polygon, which is defined as the minimum span of the polygon.This characteristic is evident specifically in polygon configurations featuring vertex-edge patterns.Notably, the span between two parallel edges can also represent the width of the polygon, which is recognized as a distinct instance of the vertex-edge scenario.
To calculate the width of a convex polygon, a comprehensive procedure is followed for each of its sides.This involves the calculation of the distances from all vertices to the selected edge.The longest calculated distance corresponds to the height of the chosen edge, thereby identifying the vertex associated with this particular height.By performing this calculation for all sides of the convex polygon and subsequently comparing the computed lengths, the minimum height emerges as the polygon's width, denoted as S. Remarkably, the edge linked with this minimum height establishes the optimal flight direction for the UAV [12].
The optimal flight direction is shown in Figure 2. Herein, the red edge and the green vertex are indicative of the edge and vertex corresponding to the width of the polygon, respectively.Consequently, the optimal flight orientation for the UAV is one that parallels the identified red edge.
computed lengths, the minimum height emerges as the polygon's width, denoted as S. Remarkably, the edge linked with this minimum height establishes the optimal flight direction for the UAV [12].
The optimal flight direction is shown in Figure 2. Herein, the red edge and the green vertex are indicative of the edge and vertex corresponding to the width of the polygon, respectively.Consequently, the optimal flight orientation for the UAV is one that parallels the identified red edge.Dividing the region into strips along the width direction according to the distance between flight lines Due to the circular sampling range of the sensor system, the scenarios depicted in Figure 3a,b are likely to arise when employing the conventional convex polygon coverage method [12].In Figure 3, the red-shaded regions within the red boxes illustrates the uncovered area.The blue arrows denote the flight path, the green dots indicate the starting point of the flight path, and the orange area represents the coverage achieved by the sensor.To address this limitation and ensure comprehensive coverage of both vertices or edges, this paper employs a strategy involving the division of a polygon into multiple strip-like subregions along the width direction [24].The resultant coverage effect is illustrated in Figure 3c.It becomes evident that this approach facilitates the complete coverage of all corners within the designated area, while concurrently adhering to the requisite standards for sampling quality.Due to the circular sampling range of the sensor system, the scenarios depicted in Figure 3a,b are likely to arise when employing the conventional convex polygon coverage method [12].In Figure 3, the red-shaded regions within the red boxes illustrates the uncovered area.The blue arrows denote the flight path, the green dots indicate the starting point of the flight path, and the orange area represents the coverage achieved by the sensor.To address this limitation and ensure comprehensive coverage of both vertices or edges, this paper employs a strategy involving the division of a polygon into multiple strip-like subregions along the width direction [24].The resultant coverage effect is illustrated in Figure 3c.It becomes evident that this approach facilitates the complete coverage of all corners within the designated area, while concurrently adhering to the requisite standards for sampling quality.The width of a strip corresponds to the scanning diameter, w, of the sensor.As shown in Figure 4, the median line that runs parallel to the optimal flight direction in the strip serves as the designated UAV flight trajectory.Furthermore, the intersection points between this median line and the strip delineate the specific path points for the UAV.Notably, the length of the strip plays a pivotal role in dictating the extent of the flight trajectory, thereby ensuring that the sensor can effectively encompass regions at the vertex or edge of the polygon.This strategic arrangement safeguards against scenarios akin to those depicted in Figure 3a,b.
For the i-th strip, which aligns with the best flight direction, the two parallel sides are denoted as i L and ' i L , respectively.Among these, i L corresponds to the side proximal to the bottom, while ( ) where ( ) N denotes the overall quantity of stripes, and its calculation is delineated as follows: The width of a strip corresponds to the scanning diameter, w, of the sensor.As shown in Figure 4, the median line that runs parallel to the optimal flight direction in the strip serves as the designated UAV flight trajectory.Furthermore, the intersection points between this median line and the strip delineate the specific path points for the UAV.Notably, the length of the strip plays a pivotal role in dictating the extent of the flight trajectory, thereby ensuring that the sensor can effectively encompass regions at the vertex or edge of the polygon.This strategic arrangement safeguards against scenarios akin to those depicted in Figure 3a,b.
Drones 2023, 7, x FOR PEER REVIEW 10 of 33 (1) When both edges of the strip intersect the polygon, generating two intersections, as illustrated in Figure 5a, the strip's length is essentially the greater of the distances between the two intersections.Mathematically, the length of the strip is represented by ( ) , d I I ; (2) In instances where the strip is defined by a single edge that intersects with the polygon at two points, depicted in Figure 5b, the strip's length equates to the distance between these two intersection points.This is succinctly expressed as ( ) (3) If a strip encompasses vertices within its scope, as illustrated in Figure 5c, the strip's length is the shortest distance capable of covering the given vertex.This length is symbolized by ( )   For the i-th strip, which aligns with the best flight direction, the two parallel sides are denoted as L i and L i , respectively.Among these, L i corresponds to the side proximal to the bottom, while L i pertains to the side situated further from the bottom.The determination of the strip's position is achieved by calculating the distances, d L i and d L i , from the strip's sides to the base edge.This calculation is performed according to the following equation: where denotes the overall quantity of stripes, and its calculation is delineated as follows: The extent of a strip's length is determined by the minimal measure required for each strip to precisely encompass the polygon.This entails considering three distinct scenarios: (1) When both edges of the strip intersect the polygon, generating two intersections, as illustrated in Figure 5a, the strip's length is essentially the greater of the distances between the two intersections.Mathematically, the length of the strip is represented by d(I 3 , I 4 ); (2) In instances where the strip is defined by a single edge that intersects with the polygon at two points, depicted in Figure 5b, the strip's length equates to the distance between these two intersection points.This is succinctly expressed as d(I 1 , I 2 ); (3) If a strip encompasses vertices within its scope, as illustrated in Figure 5c, the strip's length is the shortest distance capable of covering the given vertex.This length is symbolized by d(I 5 , I 6 ).

c. Generate candidate paths based on the four entry points
Drones 2023, 7, x FOR PEER REVIEW 10 of 33 (1) When both edges of the strip intersect the polygon, generating two intersections, as illustrated in Figure 5a, the strip's length is essentially the greater of the distances between the two intersections.Mathematically, the length of the strip is represented by ( ) (2) In instances where the strip is defined by a single edge that intersects with the polygon at two points, depicted in Figure 5b, the strip's length equates to the distance between these two intersection points.This is succinctly expressed as ( ) , d I I ; (3) If a strip encompasses vertices within its scope, as illustrated in Figure 5c, the strip's length is the shortest distance capable of covering the given vertex.This length is symbolized by ( )  entry points for the current designated region.Subsequently, the UAV embarks on its coverage mission by entering the region through these four flight entry points.This sequential process engenders the creation of four distinct, complete paths confined within the region's bounds, as visually depicted in Figure 6.
With the inter-regional access sequence firmly established, the judicious arrangement of entry points assumes a paramount role in minimizing path lengths.Therefore, subsequent to the formulation of the optimal inter-regional access sequence, a pragmatic selection is made among these four paths.This selection serves as a strategic step toward ultimately deriving the most optimal overall path configuration.
The pseudocode for generating path points within the region is presented in Algo- Once N b parallel scan lines have been determined, the initial and terminal points of the first scan line and the N b -th scan line inherently constitute the four potential flight entry points for the current designated region.Subsequently, the UAV embarks on its coverage mission by entering the region through these four flight entry points.This sequential process engenders the creation of four distinct, complete paths confined within the region's bounds, as visually depicted in Figure 6.
optimal flight direction for the UAV.Subsequently, lines 7-25 provide a comprehensive description of how strip-related parameters are calculated along with the determination of endpoints for parallel scanning lines of the UAV.Moving forward, lines 26-30 ascertain both the set of path points and their corresponding lengths at each of the four inlet points.Ultimately, this function yields four distinct paths and their respective lengths within a given region.For each j in 1 to i n do 3: Calculate the distance between the vertex ij v and all edges of the region, and take its maximum value, denoted as j h , and the corresponding edge denoted as j edge 4: End for EDGE ← the edge corresponding to S 7: // Get the scan lines by calculating strip parameters 8: The length of the strip len ← the maximum value generated by the intersection of the two sides and the middle line of the strip with the region  With the inter-regional access sequence firmly established, the judicious arrangement of entry points assumes a paramount role in minimizing path lengths.Therefore, subsequent to the formulation of the optimal inter-regional access sequence, a pragmatic selection is made among these four paths.This selection serves as a strategic step toward ultimately deriving the most optimal overall path configuration.
The pseudocode for generating path points within the region is presented in Algorithm 1. Lines 1-6 encompass the computation of the region's width and determine the optimal flight direction for the UAV.Subsequently, lines 7-25 provide a comprehensive description of how strip-related parameters are calculated along with the determination of endpoints for parallel scanning lines of the UAV.Moving forward, lines 26-30 ascertain both the set of path points and their corresponding lengths at each of the four inlet points.Ultimately, this function yields four distinct paths and their respective lengths within a given region.// Get the width of the region and the best flight direction 2: For each j in 1 to n i do 3: Calculate the distance between the vertex v ij and all edges of the region, and take its maximum value, denoted as h j , and the corresponding edge denoted as edge j 4: End for 5: EDGE ← the edge corresponding to S 7: // Get the scan lines by calculating strip parameters 8: The length of the strip len ← the maximum value generated by the intersection of the two sides and the middle line of the strip with the region In addition to BF coverage, the spiral coverage method can avoid the frequent acceleration and deceleration of the drone during turning, reducing drone jitter.It is an effective method for obtaining stable terrain data.To generate a spiral flight trajectory, for any convex polygonal region, start by selecting adjacent sides among all edges to form perpendicular bisectors, resulting in the same number of intersection points (coordinates may be identical).Take the average of these coordinates, and the resulting point is marked as the reference point for the polygon.Subsequently, connect the vertices of the polygon to the reference point, calculate the lengths of the resulting line segments, and then divide these lengths by the sensor diameter to obtain the segment count.Assuming the UAV enters from the reference point of the polygon, it first flies toward the farthest vertex from that point for a distance equal to the sensor diameter.Then, it flies in the direction of the second-farthest vertex and continues flying in that direction until it exits the polygonal region, as illustrated in Figure 7.The green lines in Figure 7 represent the connections between reference point and vertices, the blue points denote flight waypoints, and the red lines depict the flight path.In addition to BF coverage, the spiral coverage method can avoid the frequent acceleration and deceleration of the drone during turning, reducing drone jitter.It is an effective method for obtaining stable terrain data.To generate a spiral flight trajectory, for any convex polygonal region, start by selecting adjacent sides among all edges to form perpendicular bisectors, resulting in the same number of intersection points (coordinates may be identical).Take the average of these coordinates, and the resulting point is marked as the reference point for the polygon.Subsequently, connect the vertices of the polygon to the reference point, calculate the lengths of the resulting line segments, and then divide these lengths by the sensor diameter to obtain the segment count.Assuming the UAV enters from the reference point of the polygon, it first flies toward the farthest vertex from that point for a distance equal to the sensor diameter.Then, it flies in the direction of the second-farthest vertex and continues flying in that direction until it exits the polygonal region, as illustrated in Figure 7.The green lines in Figure 7 represent the connections between reference point and vertices, the blue points denote flight waypoints, and the red lines depict the flight path.However, the UAV's motion capabilities in actual flight are limited, making it challenging to precisely follow sharp corners in simulated routes at turning points.Therefore, smoothing out the sharp corners of the flight path becomes essential to save UAV flight time and reduce jitter during turning.
If there are two points, P0 and P2, around the turning point P1 in the UAV flight path, these three points can be used to form a second-order Bezier curve.This is illustrated in Figure 8a, wherein: Therefore, the turning point of the UAV flight path is considered as P1.Two points, denoted as P0' and P2', are selected on the two adjacent edges of point P1 at a sensor sampling radius of w.These three points, P0, P1, and P2, act as control points to create a Bezier curve, resulting in a smoothed UAV flight path, as depicted in Figure 8b.This approach helps reduce the jitter during UAV flight.Additionally, the length of the flight path P0→P0'→P2'→P2 is shorter than the straight flight path from P0→P1→P2.However, the UAV's motion capabilities in actual flight are limited, making it challenging to precisely follow sharp corners in simulated routes at turning points.Therefore, smoothing out the sharp corners of the flight path becomes essential to save UAV flight time and reduce jitter during turning.
If there are two points, P0 and P2, around the turning point P1 in the UAV flight path, these three points can be used to form a second-order Bezier curve.This is illustrated in Figure 8a, wherein: Drones 2023, 7, 692 13 of 32 path, the Bezier curve can optimize the flight path, as depicted in Figure 9a, to the improved path shown in Figure 9b, thus optimizing two consecutive turning movements into a single U-turn.When the drone adopts a spiral trajectory, Bezier curves can optimize the flight path shown in Figure 9c to resemble that shown in Figure 9d, smoothing the turning points in the path.Bezier curves are applicable to both of these coverage methods to reduce the length of the flight path and mitigate the jitter phenomenon caused by a too-small turning radius, almost without compromising the coverage effect.

Construction of the Priority-Constrained TSP
The formulation of the inter-regional access order entails addressing a TSP that accommodates the imposition of priority constraints.In this paper, a meta-heuristic algorithm rooted in the random variable neighborhood descent (RVND) framework [25] is harnessed for this purpose.The algorithmic approach commences by generating an initial solution via the K-nearest neighbors (KNN) heuristic, subsequently adopting the variable neighborhood descent (VND) technique for local search operations.The combi- Therefore, the turning point of the UAV flight path is considered as P1.Two points, denoted as P0' and P2', are selected on the two adjacent edges of point P1 at a sensor sampling radius of w.These three points, P0, P1, and P2, act as control points to create a Bezier curve, resulting in a smoothed UAV flight path, as depicted in Figure 8b.This approach helps reduce the jitter during UAV flight.Additionally, the length of the flight path P0→P0'→P2'→P2 is shorter than the straight flight path from P0→P1→P2.
In the method described above, a special case arises when the distance between P0 (or P2) and P1, determined by the sensor sampling radius, w, is not less than the distance between P1 and the adjacent vertices.More precisely, the distance between the two vertices is less than twice the sensor radius, resulting in an incorrect position for point P0 (or P2), as illustrated in Figure 8c.To address this issue, in such cases, the original point P0 (or P2) can be replaced by the midpoint of the adjacent vertices, as shown in Figure 8d.This optimization scheme ensures the correct placement of the point.Two continuous Bezier curves established by the two vertices of this short edge are then depicted in Figure 8e.
When the UAV utilizes a circular sensor for flight with an improved back-and-forth path, the Bezier curve can optimize the flight path, as depicted in Figure 9a, to the improved path shown in Figure 9b, thus optimizing two consecutive turning movements into a single U-turn.When the drone adopts a spiral trajectory, Bezier curves can optimize the flight path shown in Figure 9c to resemble that shown in Figure 9d, smoothing the turning points in the path.Bezier curves are applicable to both of these coverage methods to reduce the length of the flight path and mitigate the jitter phenomenon caused by a too-small turning radius, almost without compromising the coverage effect.
Drones 2023, 7, x FOR PEER REVIEW 13 of 33 In the method described above, a special case arises when the distance between P0 (or P2) and P1, determined by the sensor sampling radius, w, is not less than the distance between P1 and the adjacent vertices.More precisely, the distance between the two vertices is less than twice the sensor radius, resulting in an incorrect position for point P0 (or P2), as illustrated in Figure 8c.To address this issue, in such cases, the original point P0 (or P2) can be replaced by the midpoint of the adjacent vertices, as shown in Figure 8d.This optimization scheme ensures the correct placement of the point.Two continuous Bezier curves established by the two vertices of this short edge are then depicted in Figure 8e.
When the UAV utilizes a circular sensor for flight with an improved back-and-forth path, the Bezier curve can optimize the flight path, as depicted in Figure 9a, to the improved path shown in Figure 9b, thus optimizing two consecutive turning movements into a single U-turn.When the drone adopts a spiral trajectory, Bezier curves can optimize the flight path shown in Figure 9c to resemble that shown in Figure 9d, smoothing the turning points in the path.Bezier curves are applicable to both of these coverage methods to reduce the length of the flight path and mitigate the jitter phenomenon caused by a too-small turning radius, almost without compromising the coverage effect.

Construction of the Priority-Constrained TSP
The formulation of the inter-regional access order entails addressing a TSP that accommodates the imposition of priority constraints.In this paper, a meta-heuristic algorithm rooted in the random variable neighborhood descent (RVND) framework [25] is harnessed for this purpose.The algorithmic approach commences by generating an initial solution via the K-nearest neighbors (KNN) heuristic, subsequently adopting the variable neighborhood descent (VND) technique for local search operations.The combi-

Construction of the Priority-Constrained TSP
The formulation of the inter-regional access order entails addressing a TSP that accommodates the imposition of priority constraints.In this paper, a meta-heuristic algorithm rooted in the random variable neighborhood descent (RVND) framework [25] is harnessed for this purpose.The algorithmic approach commences by generating an initial solution via the K-nearest neighbors (KNN) heuristic, subsequently adopting the variable neighborhood descent (VND) technique for local search operations.The combination of these strategies effectively yields an approximate optimal solution for the complex problem.a.
Two methods of initial solution generation based on PKNN KNN is a well-established classification algorithm within the realm of machine learning predominantly employed for categorizing samples characterized by similar features.An extension of this, the priority K-nearest neighbors (PKNN) algorithm, draws inspiration from the principles of the KNN algorithm.In the PKNN algorithm, during each iteration, the highest-priority region is chosen from the K-nearest neighboring regions with respect to the current region, serving as the subsequent target for access.The value of K in the PKNN algorithm functions as a limiting factor for the search scope.This algorithm encompasses the capacity to effectively balance priority considerations and path lengths to a reasonable degree.
In this paper, two distinct strategies are advanced for the selection of K-nearest neighbor regions.The following discussion initially outlines the procedural steps intrinsic to the implementation of the first strategy, which is named PKNN-Full, focused on identifying K-neighboring regions across all regions.
Step 1: Introduce a set denoted as C serving as a repository for region numbers that have undergone access alongside a collection E designated to accommodate region numbers that remain unexplored.Simultaneously, establish a collection termed Order designed to retain the region numbers, which are systematically arranged according to the computed access order.Given that UAVs are required to initiate coverage operations from a depot, the initialization phase incorporates the inclusion of the depot within the Order collection.Proceed to formulate a region matrix denoted as D and devise a corresponding priority matrix named P. Within D, each i-th row systematically arranges the sequence numbers of regions in an ascending order, signifying their proximity to region i.Simultaneously, P, having the same dimensions as D, ascribes each individual element to represent the priority attributed to regions occupying corresponding positions in D.
Step 2: The last element in the Order represents the current region.By consulting matrix D, the K-nearest neighboring regions pertaining to the current region are discerned, and their presence in set C is evaluated-this assessment essentially determines whether they have been visited or not.Subsequently, the regions that are yet unvisited are compiled in E, effectively emerging as candidate regions.The respective priorities corresponding to these unvisited regions are simultaneously acquired from matrix P.
Step 3: Select the region with the highest priority from collection E as the subsequent target for access.Incorporate its sequence number into the Order while concurrently removing the region from the set C. In instances where the highest-priority regions exhibit a non-unique presence, the region that is proximate to the current region is elected for access.
Step 4: Iterate through the execution of Step 2 and Step 3 until all the regions within set C have been visited, leading to the eventual emptiness of C.This iterative process culminates in the attainment of an inter-regional access sequence Order.
The ensuing scenarios are anticipated during the implementation of Step 2 and Step 3, each warranting its own resolution strategy, as outlined below: (1) If all K-neighboring regions of the current region have been visited, continue to select the subsequent set of K-neighboring regions for the Step 2 operation; if it is found that all such regions have been visited as well, repeat this process until an unvisited region emerges within any group of K-neighboring regions.This unvisited region is then cataloged within the collection in E, subsequently triggering the commencement of Step 3 operations; (2) In instances where the final set of neighboring regions adjacent to the current region consists of fewer elements than the stipulated value K, it is still treated as a valid set for Step 2 operations; (3) When all neighboring regions in the current region have been visited, the current region is designated as the last region in the sequence of visits.It is subsequently appended to the Order collection, thereby culminating in the aforementioned iterative loop.
The pseudocode for PKNN-Full is presented in Algorithm 2, where lines 1-5 correspond to Step 1, mentioned above.Lines 6-18 constitute a loop body that corresponds to the loop in Steps 2-4, described earlier.Finally, the function outputs the initial solution of the access order.
Algorithm 2: PKNN-Full (A, c 0 , K) Input: All regional parameter set A, when A ← {A 1 • • • A n }, the coordinate of depot c 0 , nearest neighbor parameter K Output: The initial solution of the inter-regional access sequence Order 1: Initialize: Create a set C for the unvisited region set where all region numbers are stored, an empty candidate region set E, and an empty set Order for the access sequence 2: For each i in N 0 do 3: D(i, :) ← region numbers in ascending order of distance from region i 4: P(i, :) ← the priority of the region corresponding to the location in D 5: End for 6: Order ← 7: While C = ∅ 8: cr ← the last element in Order 9: Item = 1 10: Item ← item + 1 13: End while 14: ar ← the number of the area with the highest priority in E according to P 15: Order ← {Order, ar} 16: C ← C set without region ar 17: E ← ∅ 18: End while 19: Return Order The second KNN search strategy, referred to as PKNN-Excluded, involves seeking out the K-nearest regions among the unselected regions.In contrast to the aforementioned procedure, the divergence lies solely within the implementation of Step 2. The modified Step 2 operations are delineated as follows: Step 2: The last element in the set Order denotes the current region.Subsequently, matrix D is consulted to identify the K-nearest regions that remain unvisited in relation to the current region.These K regions are stored in the collection E as candidate regions.Their corresponding priorities are simultaneously extracted from matrix P.
The pseudocode of PKNN-Excluded is presented in Algorithm 3, where only lines 9-13 exhibit variations from Algorithm 2 due to the distinct approach employed for neighborhood region selection.
Algorithm 3: PKNN-Excluded (A, c 0 , K) Input: All regional parameter set A, when A ← {A 1 • • • A n }, the coordinate of depot c 0 , nearest neighbor parameter K Output: The initial solution of the inter-regional access sequence Order 1: Initialize: Create a set C for the unvisited region set where all region numbers are stored, an empty candidate region set E, and an empty set Order for the access sequence 2: For each i in N 0 do 3: D(i, :) ← region numbers in ascending order of distance from region i 4: P(i, :) ← the priority of the region corresponding to the location in D 5: End for 6: Order ← {Order,0} 7: While C = ∅ 8: cr ← the last element in Order 9: While E ∪ C = ∅ 10: F ← D(cr, :) 11: F ← F set without region in Order 12: E ← the first K elements of the set F 13: End while 14: ar ← the number of the area with the highest priority in E according to P 15: Order ← {Order, ar} 16: C ← C set without region ar 17: E ← ∅ 18: End while 19: Return Order The primary objective of the KNN algorithm is to expedite the visitation of regions with higher priority by increasing the value of K.As K varies within the range from 1 to the total number of regions n − 1, the search scope progressively extends from nearby regions to encompass all available regions.In situations where the count of searchable regions equals 1, it signifies that, exclusively, the region closest to the current region qualifies for selection as the next target.This approach indeed facilitates ensuring shorter travel distances to a certain extent.However, as the K value gradually increases towards N − 1, the scope of searchable regions encompasses the entirety of available regions.In such instances, the next target region is attributed to the region characterized by both the highest priority and proximity to the current location.Ultimately, this methodology guarantees the attainment of optimal priority sequencing.Furthermore, when dealing with regions of identical priority, the principle of minimum distance governs the arrangement of access paths, thereby underlining a comprehensive optimization approach.
Within the context of the two KNN search strategies, PKNN-Full incorporates the regions that have been accessed within the process of identifying K neighbors.This strategy proves advantageous when dealing with a limited number of regions in proximity to the current region.Instead of expending additional distance to uncover regions of higher priority, this strategy endeavors to locate regions in closer proximity, thereby optimizing resource utilization.PKNN-Excluded involves identifying K neighbors by excluding regions that have already been accessed.The advantage of this strategy lies in its immunity to disruption from regions already accessed.This prevents regions of higher priority from being overlooked, ensuring consistent access to the region with higher priority.Both strategies demonstrate flexibility in their application.Therefore, the KNN algorithm incorporating these two search strategies avoids the necessity of rigidly defining a standardized or constant K-value selection logic throughout the research process.Instead, it prioritizes adaptability, dynamically employing the most effective strategy to achieve the highest total score for comprehensive coverage of the target region.This approach is centered on optimizing conditions in response to changing variables.In essence, it strives to generate the finest quality and most gratifying search path, thereby offering invaluable, comprehensive assistance in time-sensitive relief operations functioning under tight time constraints.where p min ij and p max ij respectively represent the minimum and maximum values of priorities from region i to region j in the access sequence Order.

c. Disturbance
When the local search cannot improve the current solution, a perturbation operator comes into play, introducing a random perturbation to guide the current solution away from the local optimality.This study uses a straightforward yet efficacious perturbation strategy encompassing two core operations: Relocated (1) and Swap (1-1).These operations align with the d-relaxed constraints and are executed with distinct selection probabilities of p and (1 − p), respectively.
The primary section of the pseudocode for access order optimization is illustrated in Algorithm 4. Lines 1-2 depict the generation of the initial solution, while the subsequent lines focus on RVND optimization.The function incorporates the five neighborhood structures of d-relaxed constraints as predefined parameters.

Algorithm 4: getOrder (A, K)
Input: All regional parameter set A, when A = {A 1 • • • A n }, the coordinate of depot c 0 , nearest neighbor parameter K Output: The inter-regional access sequence Order 1: Order ← PKNN-Excluded (A, c 0 , K) or Order ← PKNN-Full (A, c 0 , K) 2: Dist ← the length of the Order is obtained from the center point of the region 3: Order' ← Order 4: For each t in 1 to 5 do 5: For each i in 1 to n + 1 do 6: For each j in 1 to n + 1 do 7: Order' ← use the neighborhood structure N t to operate on Order 8: Dist' ← the length of the Order' is obtained from the center point of the region 9: If Dist' < Dist then 10: Order ← Order' 11: End if 12: End for 13: End for 14: End for 15: Return Order

Selection of Optimal Entry Points and Path Generation
In this paper, drawing inspiration from the principles of the greedy algorithm, a method is devised to determine the entry points for each region based on the inter-regional access order derived in Section 3.2.Specifically, from the four prospective candidate entry points identified in Section 3.1 for each region, the entry point that is closest to the flight point of the previous region is selected as the entry point of the current region.Subsequently, a meticulous arrangement of endpoints for the flying scan lines is orchestrated in alignment with the designated entry points.This arrangement is integral to facilitating the formation of coherent BF scanning path trajectories, effectively constituting the waypoints in the region.This process culminates in the procurement of a comprehensive collection of waypoints spanning multiple regions.These waypoints encompass both the depot and region-based waypoints, organized according to the order of internal access.
The pseudocode for the function that generates the complete path is illustrated in Algorithm 5.This function takes the outputs of Algorithms 1 and 4 as inputs and sequentially connects the intra-regional paths based on regions by selecting appropriate fly-in points.It should be noted that while Algorithm 1 generates intra-regional paths for a single region, Algorithm 5 requires intra-regional paths for all regions, necessitating running Algorithm 1 separately for each region before executing it.
Algorithm 5: getWaypoint (c 0 , Order, path) Input: Depot coordinates c 0 , access sequence Order, intra-regional waypoints path Output: Complete collection of waypoints PATH 1: PATH ← {PATH; c 0 } 2: For each i in 1 to n + 1 do 3: For each j in 1 to 4 do 4: d j ← the distance between the last coordinate in the PATH and the j-th entry point in the region Order (i) 5: End for 6: Path' ← the entry point corresponding to the minimum value in d  End for 9: Return PATH

Path Evaluation Criteria Based on Priority and Distance
Given that the paths generated in individual regions adhere to specific length criteria, the evaluation metric in question exclusively assesses the effectiveness of the inter-regional access sequence planning algorithm under the ambit of priority constraints.In this paper, we produce two distinct categories of solutions: distance reference solutions without factoring priority and priority reference solutions without factoring distance.These solutions are generated through specific strategies tailored for each approach.Subsequently, the solution derived from the proposed algorithm-which incorporates both distance and priority considerations-is juxtaposed against these two aforementioned solutions.This comparative process yields the distance score and priority score separately.By summing these scores, the overall score for the current solution is computed.A higher score is indicative of superior optimization outcomes.The subsequent sections outline the methodologies employed for distance scoring and priority scoring.

a. Distance scoring strategy
As the strategy overlooks the intra-regional path and the inherent regional priority, a simplification is employed, treating each region as a singular particle and regarding the central point's coordinates as the representative location of the region.Furthermore, the task of planning the paths connecting every region to the depot is regarded as a conventional TSP.
The realm of the general TSP problem is well-established and has been extensively studied.Given reasonable constraints on the number and dimensions of regions, numerous algorithms have been developed to uncover the optimal solution.In this paper, a genetic algorithm is employed to obtain the reference solution Order Re f along with its corresponding distance, Dist Re f .Comparatively, the optimization algorithm proposed herein yields Order as the solution, accompanied by its respective distance, Dist.However, as the algorithm introduced in this paper considers both distance and priority, it necessitates a trade-off, which is manifest as a certain sacrifice in distance length to harmonize the prioritization sequence.As a result, the distance score of the current solution can be expressed as follows: It can be seen that the smaller the distance from Dist, the higher the distance score SC D .

b. Priority scoring strategy
In this paper, we employ the strategy of sequential penalty accumulation for priority scoring.This approach aims to assign a penalty factor, denoted as P f , to each level of Drones 2023, 7, 692 20 of 32 priority.In cases where the priority level is defined as G = {1, 2, • • • , g}, the respective penalty factor is designated as P f = {g, g − 1, • • • , 1}.This assignment illustrates the relationship between priority and penalty factors, with higher priority levels receiving higher penalty factors in accordance with their importance.For a given access sequence Order, let us consider the i-th region, whose priority is represented as p Order[i] = k ∈ G, and it corresponds to a specific penalty factor denoted as P f k .In the context of sequential penalty accumulation, the penalty accumulation process for the Order can be defined as follows: Evidently, when the pathway sequence meticulously adheres to the prioritization levels-meaning that regions endowed with higher priorities are addressed foremost-an optimal outcome marked by the minimal sequence penalty accumulation value, T Re f , can be achieved.The algorithm expounded within this paper considers both distance and priority assignment, which consequently leads to the emergence of heightened penalty accumulation.This augmented penalty accumulation acts as a counterbalance to the distance aspect when weighed against a solution hewing strictly to priority constraints.Consequently, the formulation for the priority score of the prevailing solution can be articulated as follows: c.

Comprehensive scoring strategy
Designating the significance of both spatial distance and priority within the solution, we introduce the distance weight, w D , and the priority weight, w P .In fact, these weights serve to quantify the respective contributions of distance and priority in the solution's evaluation process.Consequently, the comprehensive appraisal of the current solution is encapsulated in the integrated score, which is precisely the weighted mean of the distance score and the priority score: Within the context of this paper, a balanced consideration between the significance of spatial distance and priority is established by fixing both w D and w P at 0.5.This deliberate choice underscores the equivalence of importance attributed to both factors within the solution evaluation framework.Nevertheless, it is important to acknowledge that, in real-world applications, the assignment of the distance weight and the priority weight can be tailored to the precise demands of the scenario at hand.The flexibility to adjust these weights allows for a customized approach that aligns more closely with the specific requirements of the problem under investigation.

Simulation and Experiment
To commence, the initial step involved generating a collection of 20 convex quadrilaterals, each encircled by an external circle with a radius of 50 m.These quadrilaterals were designated as the target regions necessitating access.Subsequently, a random assignment of priority values, ranging from 1 to 3, was applied to each distinct region.This distribution is visually represented in Figure 10, where priority 1 regions are demarcated by the red zones, priority 2 regions are indicated by the yellow zones, and priority 3 regions are highlighted in green.
point for the UAV's coverage task.Similarly, the termination point of this coverage task coincided with the same origin.To govern the UAV's sensory reach, a sensor coverage radius spanning 20 m was employed.Moreover, to ensure a judicious sampling process along the UAV's paths, an overlap rate of 0.1 was instituted.
These defined parameters collectively formed the foundation for the simulation.They served as the bedrock upon which the algorithm's efficacy was scrutinized and validated in a simulated environment.

Obtainment of Three Different Initial Solutions
The simulation entailed the execution and analysis of path-planning results for two distinct initial solutions, employing the set of randomly generated regions.Through this simulated process, an intricate evaluation was performed to dissect both the merits and Within this spatial setup, the point of origin (0, 0) was established as the starting point for the UAV's coverage task.Similarly, the termination point of this coverage task coincided with the same origin.To govern the UAV's sensory reach, a sensor coverage radius spanning 20 m was employed.Moreover, to ensure a judicious sampling process along the UAV's paths, an overlap rate of 0.1 was instituted.
These defined parameters collectively formed the foundation for the simulation.They served as the bedrock upon which the algorithm's efficacy was scrutinized and validated in a simulated environment.

Obtainment of Three Different Initial Solutions
The simulation entailed the execution and analysis of path-planning results for two distinct initial solutions, employing the set of randomly generated regions.Through this simulated process, an intricate evaluation was performed to dissect both the merits and drawbacks of the outcomes.Moreover, a careful examination of the trajectory of scores was undertaken to discern evolving trends.
By subjecting these initial solutions to rigorous simulation, a comprehensive understanding emerged regarding their practical implications.This scrutiny not only dissected the strengths and weaknesses exhibited in the generated paths but also traced the trajectory of scores across the simulation.Such insights contributed significantly to appraising the effectiveness of the path-planning algorithm under scrutiny.a.
The PKNN-Full Strategy The evaluation methodology followed the PKNN-Full strategy to derive distinct metrics: the distance score, the priority score, and the cumulative total score for varying K values, as well as the relationship between these scores and the corresponding K values, which were meticulously examined and are visualized in Figure 11.
As illustrated in the figure, a notable trend emerged where the path's length score exhibited a rapid reduction accompanied by a gradual ascent of the priority score towards full realization coinciding with increasing values of K.This pattern can be attributed to the amplified tendency of the path to preferentially select regions of higher priority as target destinations within the process of augmenting K values.This inclination was further substantiated by the positive correlation between higher K values and an increased availability of alternative regions, thereby ensuring earlier selection of regions with elevated priority status.tory of scores across the simulation.Such insights contributed significantly to appraising the effectiveness of the path-planning algorithm under scrutiny.
a.The PKNN-Full Strategy The evaluation methodology followed the PKNN-Full strategy to derive distinct metrics: the distance score, the priority score, and the cumulative total score for varying K values, as well as the relationship between these scores and the corresponding K values, which were meticulously examined and are visualized in Figure 11.As illustrated in the figure, a notable trend emerged where the path's length score exhibited a rapid reduction accompanied by a gradual ascent of the priority score towards full realization coinciding with increasing values of K.This pattern can be attributed to the amplified tendency of the path to preferentially select regions of higher priority as target destinations within the process of augmenting K values.This inclination was further substantiated by the positive correlation between higher K values and an increased availability of alternative regions, thereby ensuring earlier selection of regions with elevated priority status.
Examining the distinctive instances highlighted in the graphical representation, a pivotal observation arises: a zenith in the total score can be observed at K = 2.This specific point signifies the pinnacle performance achievable through the proposed planning methodology.This outcome is indicative of the path length closely approximating the optimal trajectory length while concurrently maintaining a relatively intact priority hierarchy.
Upon closer inspection, for K = 3 and K = 4, a sustained elevation characterizes both scores, manifesting a harmonious equilibrium.This equilibrium proves especially pertinent in scenarios demanding a balanced consideration of both priority and path dynamics, thus adhering to the requisites of balanced solution paradigms.
Upon entering the domain of K = 8, a notable transition can be observed.Here, while the priority score strictly adheres to the higher-priority sequence delineated by distance-based constraints in the selection of a larger set of neighbors, there is a conspicuous decline in the distance score.Consequently, an overall evaluation slightly inferior to the preceding cases ensued.Examining the distinctive instances highlighted in the graphical representation, a pivotal observation arises: a zenith in the total score can be observed at K = 2.This specific point signifies the pinnacle performance achievable through the proposed planning methodology.This outcome is indicative of the path length closely approximating the optimal trajectory length while concurrently maintaining a relatively intact priority hierarchy.
Upon closer inspection, for K = 3 and K = 4, a sustained elevation characterizes both scores, manifesting a harmonious equilibrium.This equilibrium proves especially pertinent in scenarios demanding a balanced consideration of both priority and path dynamics, thus adhering to the requisites of balanced solution paradigms.
Upon entering the domain of K = 8, a notable transition can be observed.Here, while the priority score strictly adheres to the higher-priority sequence delineated by distancebased constraints in the selection of a larger set of neighbors, there is a conspicuous decline in the distance score.Consequently, an overall evaluation slightly inferior to the preceding cases ensued.
Beginning at K = 16, a distinctive pattern emerges.The trajectory of region selection becomes stabilized, culminating in the attainment of an optimal priority configuration.Subsequent path planning unfolds meticulously, aligning exactly with the priority order specified by distance-based constraints.This configuration finds particular relevance in environments where priority considerations hold substantial weight.
Guided by the principles underpinning the KNN algorithm, it is evident that, as K approaches n − 1, the path progressively attains an optimal priority orientation.To provide a visual portrayal, the comprehensive path corresponding to K = 2 is depicted in Figure 12.The red line in the Figure 12 represents the flight path of the UAV from the depot to the first waypoint, while the remaining flight paths are depicted in black.Various colored polygonal areas represent different priority levels.

b.
The PKNN-Excluded Strategy The evaluation methodology followed the PKNN-Full strategy to derive distinct metrics: the distance score, the priority score, and the cumulative total score for varying K values, as well as the relationship between these scores and the corresponding K values, which were meticulously examined and are visualized in Figure 13.
environments where priority considerations hold substantial weight.
Guided by the principles underpinning the KNN algorithm, it is evident that, as K approaches n -1, the path progressively attains an optimal priority orientation.To provide a visual portrayal, the comprehensive path corresponding to K = 2 is depicted in Figure 12.The red line in the Figure 12 represents the flight path of the UAV from the depot to the first waypoint, while the remaining flight paths are depicted in black.Various colored polygonal areas represent different priority levels.

b. The PKNN-Excluded Strategy
The evaluation methodology followed the PKNN-Full strategy to derive distinct metrics: the distance score, the priority score, and the cumulative total score for varying K values, as well as the relationship between these scores and the corresponding K values, which were meticulously examined and are visualized in Figure 13.The evaluation methodology followed the PKNN-Full strategy to derive distinct metrics: the distance score, the priority score, and the cumulative total score for varying K values, as well as the relationship between these scores and the corresponding K values, which were meticulously examined and are visualized in Figure 13.  Figure 13 showcases the outcomes of the KNN algorithm implemented with the adapted search strategy, and, notably, it attained the highest overall score when K = 2.This algorithm variant yielded a path length marginally shorter than that of the previously discussed search methodologies.Nevertheless, it significantly approximated the optimal path length while concurrently elevating the priority, resulting in similar total scores that signified commendable equilibrium.As K = 3, a conspicuous decline in distance becomes apparent.By the onset of K = 5, the priority score experiences a gradual stabilization at an elevated threshold, which also coincides with a deceleration in the descent of the distance score.Echoing the trend, from K = 16 onwards, the trajectory of region selection stabilizes, and its priority reaches its apex configuration.Illustrating this empirically, the comprehensive path for K = 2 is visually presented in Figure 14.The meanings of the colors in Figure 14 are the same as those in Figure 12.
scores that signified commendable equilibrium.As K = 3, a conspicuous decline in distance becomes apparent.By the onset of K = 5, the priority score experiences a gradual stabilization at an elevated threshold, which also coincides with a deceleration in the descent of the distance score.Echoing the trend, from K = 16 onwards, the trajectory of region selection stabilizes, and its priority reaches its apex configuration.Illustrating this empirically, the comprehensive path for K = 2 is visually presented in Figure 14.The meanings of the colors in Figure 14 are the same as those in Figure 12.

Optimizing Initial Solutions by RVND
Building upon the initial solution, we employed the RVND algorithm for the purpose of optimizing the path.By comparing the outcomes of this optimization process with those of the initial solution, we substantiated the efficacy of the RVND algorithm in curtailing path length while upholding the assured priority score.This comparative analysis served to validate the algorithm's capability in achieving path length reduction without compromising the stipulated priority constraints.The influence of the RVND algorithm on the optimization of the path was examined within the context of the PKNN-Full strategy.Initially, the trend of the total scores was computed across all K values, encompassing the range from 0 to g − 1, during d-relaxation.Subsequently, this trend was juxtaposed with the total score progression exhibited by the initial solution, visualized through a line chart, as depicted in Figure 15a.Analogously, the trend of the optimization's total scores for the PKNN-Excluded strategy was also obtained and illustrated in Figure 15b.This comparative analysis served to shed light on the impact of the RVND algorithm on the optimization efficacy of these strategies.

Optimizing Initial Solutions by RVND
Building upon the initial solution, we employed the RVND algorithm for the purpose of optimizing the path.By comparing the outcomes of this optimization process with those of the initial solution, we substantiated the efficacy of the RVND algorithm in curtailing path length while upholding the assured priority score.This comparative analysis served to validate the algorithm's capability in achieving path length reduction without compromising the stipulated priority constraints.The influence of the RVND algorithm on the optimization of the path was examined within the context of the PKNN-Full strategy.Initially, the trend of the total scores was computed across all K values, encompassing the range from 0 to g − 1, during d-relaxation.Subsequently, this trend was juxtaposed with the total score progression exhibited by the initial solution, visualized through a line chart, as depicted in Figure 15a.Analogously, the trend of the optimization's total scores for the PKNN-Excluded strategy was also obtained and illustrated in Figure 15b.This comparative analysis served to shed light on the impact of the RVND algorithm on the optimization efficacy of these strategies.The simulation results distinctly illustrate the discernible efficacy of the RVND algorithm in enhancing the initial solutions generated by the PKNN-Full strategy.Particularly noteworthy was its performance in scenarios where d = 1, showcasing a pronounced enhancement range across several outcomes and thereby exhibiting conspicuous optimization capabilities.However, in instances where d = 2, the magnitude of priority relaxation was substantial, leading to the compromise of priority's significance in favor of a strictly distance-optimized approach.Consequently, given the prevailing distribution of regional priorities, the total score experienced a reduction due to the abrupt depreciation of the priority score.
Similarly, in cases where d = 0 and the priority order remained unchanged, the RVND algorithm still displayed discernible path-optimization capabilities.Broadly, the RVND algorithm demonstrably possesses the capacity to optimize path outcomes and is capable of ascertaining relatively optimal pathways tailored to specific requirements.This underscores the algorithm's adaptive capabilities in tailoring solutions in accordance with distinct priorities and demands.The impact of the RVND algorithm on optimizing the initial solution generated by the PKNN-Excluded strategy was notably pronounced.Upon juxtaposition with Figure 15, it becomes evident that this strategy is inherently more inclined to prioritize priority performance.Consequently, its total score exhibits a marginal reduction due to its lower distance score, a characteristic that sets it apart from the Full strategy.
In this context, a notable observation emerges: the disparity between the two algorithms in terms of the maximum value of the initial solution at K = 2 was effectively diminished.Additionally, the value of K derived from the initial solution was optimized towards its maximum value.This phenomenon underscores that an algorithm with modest baseline performance can achieve the same peak outcome after undergoing optimization by a superior algorithm.This manifestation illuminates the robust optimization prowess of the RVND algorithm.
When K = 2 and d = 1, the RVND algorithm was used to optimize the two initial solutions, and the complete paths obtained are shown in Figure 16a,b.The meanings of the colors in Figure 16 are the same as those in Figure 12.

Analysis and Comparison of Optimization Results
a. Intra-regional path optimization analysis At the turning points of the intra-regional flight path, replacing the original polyline with Bezier curves and calculating the overall path length as shown in Table 2, through comparative analysis of path length calculations, it can be inferred that Bezier curves can optimize approximately 5% of the path length without affecting the coverage effectiveness within the region.This indicates a notable energy-saving efficiency.Similarly, applying the research conclusions about Bezier curves mentioned in the introduction, several optimization effects can be observed in the overall UAV path after incorporating Bezier curves:

a.
Intra-regional path optimization analysis At the turning points of the intra-regional flight path, replacing the original polyline with Bezier curves and calculating the overall path length as shown in Table 2, through comparative analysis of path length calculations, it can be inferred that Bezier curves can optimize approximately 5% of the path length without affecting the coverage effectiveness within the region.This indicates a notable energy-saving efficiency.Similarly, applying the research conclusions about Bezier curves mentioned in the introduction, several optimization effects can be observed in the overall UAV path after incorporating Bezier curves: (1) Smooth Trajectory: Bezier curves contribute to smoothing the turning angles, reducing the drone's jitter and oscillation during turns, thereby improving flight stability.(2) Energy Saving: Bezier curves effectively reduce motion energy consumption in aspects such as path length and motion control, resulting in energy savings for UAV operations.(3) Ease of Control: The control method is simple and easy to implement, leading to improved operational efficiency for the UAV.Comparing the BF and SP coverage methods, common experimental parameters were set as follows: the minimum circumscribed circle radius of the polygon: 50 m; the sensor scanning radius: 8 m.The number of vertices increased from 4 to 15, with the experiment repeated 20 times for each set of vertices.The average path length for both methods was calculated, and the variation in the average path length is shown in Figure 17.From the figure, it can be observed that, with a small number of polygon edges, the BF path demonstrated better coverage.However, as the number of polygon edges increased, the growth in path length for BF became significantly higher than that for SP.At a vertex count of eight, the two paths were closest, but after reaching nine vertices, the effectiveness of SP surpassed that of BF.
Drones 2023, 7, x FOR PEER REVIEW 27 of 33 a vertex count of eight, the two paths were closest, but after reaching nine vertices, the effectiveness of SP surpassed that of BF.As stated in Section 3.1, both coverage methods can achieve complete coverage within a region, but there will be a certain amount of redundant area.Continuing the analysis of the simulation results, by calculating the coverage area and the polygon area, the redundancy rate of the sensor coverage area for both methods under different vertex conditions was obtained, as shown in Figure 18.It can be observed that the redundancy rate of the BF path remained stable, while the redundancy rate of the SP path, although substantial when the number of polygon vertices was low, significantly decreased as the vertex count increased.Vertex counts of eight and nine were also critical points for the superiority or inferiority of the two methods in terms of redundancy rate.
From the two aforementioned analytical approaches, it can be observed that if the polygon vertices are evenly distributed around the center of the minimum circumscribed circle of the polygon and when the number of polygon vertices is small, the BF path is likely to have better coverage advantages.It can reduce coverage-area redundancy while obtaining a shorter flight path.However, as the number of polygon vertices increases and the polygon shape gradually becomes smoother, with mostly large internal angles, the UAV is more suitable for using the SP path for coverage flight.As stated in Section 3.1, both coverage methods can achieve complete coverage within a region, but there will be a certain amount of redundant area.Continuing the analysis of the simulation results, by calculating the coverage area and the polygon area, the redundancy rate of the sensor coverage area for both methods under different vertex conditions was obtained, as shown in Figure 18.It can be observed that the redundancy rate of the BF path remained stable, while the redundancy rate of the SP path, although substantial when the number of polygon vertices was low, significantly decreased as the vertex count increased.Vertex counts of eight and nine were also critical points for the superiority or inferiority of the two methods in terms of redundancy rate.From the two aforementioned analytical approaches, it can be observed that if the polygon vertices are evenly distributed around the center of the minimum circumscribed circle of the polygon and when the number of polygon vertices is small, the BF path is likely to have better coverage advantages.It can reduce coverage-area redundancy while obtaining a shorter flight path.However, as the number of polygon vertices increases and the polygon shape gradually becomes smoother, with mostly large internal angles, the UAV is more suitable for using the SP path for coverage flight.c.Inter-regional path optimization analysis Through simulating different numbers of regions and priorities, the optimization performance of the RVND algorithm was analyzed, as presented in Table 3.In this table, minDist.represents the length of the shortest generated path, while maxSC P , maxSC D , and maxSC represent the maximum priority score, the maximum distance score, and the maximum total score, respectively.The term Time denotes the computation time under specific computer performance conditions.Additionally, Opt.signifies the optimization rate of the algorithm towards improving initial solution scores, while Gap indicates the difference in scores between two optimal optimization results.
According to the simulation results recorded in Table 3, when the number of regions and priorities is small, the optimization algorithm exhibits limited effectiveness.This can be attributed to the sufficiency of the generation algorithm for initial solutions in this task, resulting in significantly reduced computation time compared to the optimization algorithm.Hence, when dealing with a small number of regions and priorities, employing two PKNN algorithms can yield higher computational speed.Conversely, when confronted with a large number of priorities, the priority factor plays a more pronounced and crucial role in planning outcomes, thereby highlighting the impact of the optimization algorithm.Considering real-world path considerations, it is recommended to utilize the optimization algorithm for path optimization under conditions involving numerous priorities and regions to achieve superior planning results.Although there is no fixed optimal K value due to the influence of regional characteristics, an optimal d value can generally be identified from the simulation results: when facing few priorities, a larger d value brings about greater distance benefits, thus making it preferable as an optimal d value; however, when both region and priority numbers are slightly high simultaneously, the optimal d value often appears around the median among all d values.

UAV Path-Planning Simulation Platform Based on Unity3D
In order to simulate the flight of a UAV in a realistic environment, we have developed a UAV path-planning simulation system using the Unity3D virtual engine.We import a realistic 3D terrain and drone model and add rigid body components to both the terrain and drone.Additionally, for better realism in simulating the environment, it is necessary to incorporate environmental components, such as wind direction, wind speed, lighting, etc.
Unity3D relies on scripts to implement the operational logic of each object within the virtual environment.Therefore, several scripts need to be added, including region drawing, UAV attitude control, motion trajectory display, sensor data access, etc., along with design of the UI interface and control scripts for UI components.All these scripts work together to ensure the smooth operation of the simulation system.The UI interface of this system is depicted in Figure 19.The input data for this simulation system consist of path points and area information obtained from MATLAB planning.Upon running the system, it first generates an area range for the terrain that needs coverage; subsequently, the drone flies through this scene based on waypoints while displaying its real-time trajectory.Furthermore, the position and attitude of the drone can also be observed in real time via the UI panel.

Flight-Path Experiment
The experimental section of this study is based on the MATLAB simulation analysis results discussed earlier.Through the use of a UAV for actual coverage flights in a specified area, the effectiveness of adaptive flight trajectories in practical applications was validated, as shown in Figure 20.We selected a spacious environment near the laboratory, as shown in Figure 20a, designating two nearby open areas for overall coverage.These areas were used to delineate internal regions, and a random location within was chosen as the base position, as illustrated in Figure 20b.In the figure, the region enclosed by the red line is the experimental area, the gray polygon represents the coverage area, and the yellow points indicate the depot of the UAV.The flight path was imported into the UAV remote controller to guide the UAV in flying along the planned path.The re- The input data for this simulation system consist of path points and area information obtained from MATLAB planning.Upon running the system, it first generates an area range for the terrain that needs coverage; subsequently, the drone flies through this scene based on waypoints while displaying its real-time trajectory.Furthermore, the position and attitude of the drone can also be observed in real time via the UI panel.

Flight-Path Experiment
The experimental section of this study is based on the MATLAB simulation analysis results discussed earlier.Through the use of a UAV for actual coverage flights in a specified area, the effectiveness of adaptive flight trajectories in practical applications was validated, as shown in Figure 20.We selected a spacious environment near the laboratory, as shown in Figure 20a, designating two nearby open areas for overall coverage.These areas were used to delineate internal regions, and a random location within was chosen as the base position, as illustrated in Figure 20b.In the figure, the region enclosed by the red line is the experimental area, the gray polygon represents the coverage area, and the yellow points indicate the depot of the UAV.The flight path was imported into the UAV remote controller to guide the UAV in flying along the planned path.The resulting flight path in the simulation program is depicted as blue lines in Figure 20c.After the flight experiment, the flight route from the UAV's flight log was exported and is shown as green lines in Figure 20d.

Conclusions
This paper introduces a comprehensive and easily implementable solution to the UAV path-planning problem under priority constraints.We enhance the coverage approach by employing a BF path, ensuring complete coverage within circular sensor sampling ranges and employing Bezier curves to optimize both the round-trip path and the spiral path.Furthermore, we introduce two initial solution generation techniques for priority paths based on the KNN algorithm.These methods are employed to devise the access sequence between regions, incorporating priority considerations.Through comparisons with planning algorithms lacking priority planning capabilities, our approach demonstrates its ability to intelligently plan paths based on priority orders.
The results of evaluation metrics demonstrate that our proposed method can quickly find high-quality solutions in terms of distance and priority.Furthermore, by optimizing both initial solutions using the RVND algorithm, we enhanced the optimization capabilities of the paths.The simulation results demonstrate the algorithm's strong performance in both distance and priority, indicating its ability to refine solutions from initial states.These outcomes validate the algorithm's effectiveness.Based on our realworld experiments, the algorithm has been demonstrated to exhibit favorable practical prospects in actual application environments.Consequently, the path-planning method presented in this paper holds significant potential for widespread application in the realm of emergency rescue.
Future research will focus on employing intelligent optimization algorithms, such as genetic algorithms, differential evolution, and reinforcement learning, to further en- Comparative analysis of simulation paths in real environments and paths from actual flight experiments demonstrates that the path-planning algorithm used in this study is well-suited for practical applications in real environments.It effectively achieves UAV path planning within and between areas.The algorithm's performance in real-world applications is thus confirmed.Hence, the flight experiments were successful, as the UAV accurately tracked the theoretical and simulated flight trajectories, validating the practicality of the path-planning method proposed in this study.

Conclusions
This paper introduces a comprehensive and easily implementable solution to the UAV path-planning problem under priority constraints.We enhance the coverage approach by employing a BF path, ensuring complete coverage within circular sensor sampling ranges and employing Bezier curves to optimize both the round-trip path and the spiral path.Furthermore, we introduce two initial solution generation techniques for priority paths based on the KNN algorithm.These methods are employed to devise the access sequence between regions, incorporating priority considerations.Through comparisons

Figure 1 .
Figure 1.Ground sampling range of sensor.

Figure 1 .
Figure 1.Ground sampling range of sensor.

Drones 2023, 7 ,
x FOR PEER REVIEW 9 of 33 b.Dividing the region into strips along the width direction according to the distance between flight lines

Figure 3 .
Figure 3. Effects of different coverage methods.(a) The flight line starts on the edge of the polygon.(b) The edge of the sensor is tangent to the edge of the polygon.(c) The method proposed in this paper.

L
pertains to the side situated further from the bottom.The determination of the strip's position is achieved by calculating the distances, the strip's sides to the base edge.This calculation is performed according to the following equation:

Figure 3 .
Figure 3. Effects of different coverage methods.(a) The flight line starts on the edge of the polygon.(b) The edge of the sensor is tangent to the edge of the polygon.(c) The method proposed in this paper.

Figure 6 .
Figure 6.Different entry points of the path.

Algorithm 1 :
getIntraWay ( i A , ω , o) Input: Regional parameter i A , sensor parameter ω , o Output: Complete collection of waypoints path, the path length in the region dist 1: // Get the width of the region and the best flight direction 2:

LL 22 :
← the coordinates of the two endpoints on one side of the strip are deter-← the coordinates of the two endpoints on the other side of the strip are de-For each l in 1 to i m do23:il w ← the coordinates of the midpoints of the lines connecting corresponding

Figure 6 .
Figure 6.Different entry points of the path.

Algorithm 1 :
getIntraWay (A i , ω, o) Input: Regional parameter A i , sensor parameter ω, o Output: Complete collection of waypoints path, the path length in the region dist 1:

Figure 8 .Figure 9 .
Figure 8. Bezier curve and optimized path.(a) A second-order Bezier curve.(b) Determine control points according to parameter ω.(c) A special case.(d) The solution.(e) Two consecutive paths.

Figure 8 .
Figure 8. Bezier curve and optimized path.(a) A second-order Bezier curve.(b) Determine control points according to parameter ω.(c) A special case.(d) The solution.(e) Two consecutive paths.

Figure 8 .Figure 9 .
Figure 8. Bezier curve and optimized path.(a) A second-order Bezier curve.(b) Determine control points according to parameter ω.(c) A special case.(d) The solution.(e) Two consecutive paths.

Figure 9 .
Figure 9. Optimization effects of Bezier curves on BF and spiral paths.(a) BF path without Bezier.(b) BF path with Bezier.(c) Spiral path without Bezier.(d) Spiral with Bezier.

Figure 15 .
Figure 15.Different results of the two strategies: (a) d-value comparison using PKNN-Full; (b) d-Value comparison using PKNN-Excluded.The simulation results distinctly illustrate the discernible efficacy of the RVND algorithm in enhancing the initial solutions generated by the PKNN-Full strategy.Particularly noteworthy was its performance in scenarios where d = 1, showcasing a pronounced enhancement range across several outcomes and thereby exhibiting conspicuous optimization capabilities.However, in instances where d = 2, the magnitude of prior-

Figure 15 .
Figure 15.Different results of the two strategies: (a) d-value comparison using PKNN-Full; (b) d-Value comparison using PKNN-Excluded.

Figure 17 .
Figure 17.Trend: Path length with the number of polygon vertices.Figure 17.Trend: Path length with the number of polygon vertices.

Figure 17 .
Figure 17.Trend: Path length with the number of polygon vertices.Figure 17.Trend: Path length with the number of polygon vertices.

Figure 17 .
Figure 17.Trend: Path length with the number of polygon vertices.

Figure 18 .
Figure 18.Trend: Area redundancy rate with the number of polygon vertices.Figure 18. Trend: Area redundancy rate with the number of polygon vertices.

Figure 18 .
Figure 18.Trend: Area redundancy rate with the number of polygon vertices.Figure 18. Trend: Area redundancy rate with the number of polygon vertices.

Figure 19 .
Figure 19.UI interface of UAV path-planning simulation system.

Figure 19 .
Figure 19.UI interface of UAV path-planning simulation system.

Figure 20 .
Figure 20.Experimental environment and flight experiments.(a) The experimental area.(b) The drone base, scanning area, and polygonal region.(c) The simulated trajectory.(d) The experimental trajectory.

Figure 20 .
Figure 20.Experimental environment and flight experiments.(a) The experimental area.(b) The drone base, scanning area, and polygonal region.(c) The simulated trajectory.(d) The experimental trajectory.

Table 1 .
Summary table of important symbols.
← 2 * N b 22: For each l in 1 to m i do 23:w il ← the coordinates of the midpoints of the lines connecting corresponding points in L k and L k ≥ max p Order[i] , p Order[i+1] − d and p max (i+2)j ≤ min p Order[i] , p Order[i+1] + d (31) 1

Table 2 .
Path length optimization rate of Bezier curve.