Large-scale vehicle path planning method and system based on coarse and fine granularity division, and medium

By employing a coarse-to-fine granularity partitioning strategy and an ensemble learning method, the problems of solution speed and solution quality in large-scale CVRP problems were solved, achieving efficient and stable path planning.

CN121599577APending Publication Date: 2026-03-03ANHUI UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511754360.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-26
Publication Date
2026-03-03

AI Technical Summary

Technical Problem

Existing technologies suffer from slow solution speed, low solution quality, and insufficient model generalization performance when solving large-scale capacity-constrained vehicle routing problems (CVRP), especially when it is difficult to generate high-quality solutions on large-scale datasets.

Method used

A coarse-grained partitioning strategy is adopted. Coarse-grained partitioning is performed by parameterizing the generative flow network, and fine-grained partitioning is performed by combining greedy sampling and attention models to form multiple traveling salesman problems, which are solved in parallel. Finally, the optimal solution is selected through ensemble learning.

Benefits of technology

It significantly improves the solution efficiency and solution quality of large-scale CVRP problems, enhances the model's adaptability to different node distributions and demand scales, and avoids the suboptimal cumulative effects of the traditional divide-and-conquer strategy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121599577A_ABST
    Figure CN121599577A_ABST
Patent Text Reader

Abstract

The invention discloses a large-scale vehicle path planning method and system based on coarse and fine granularity division, and a medium, and belongs to the field of vehicle path planning. Firstly, large-scale vehicle and road problem instance features are extracted, the scale is identified, and a vehicle capacity adjustment strategy is determined; constructing a coarse-grained division model by means of the generative flow network, and obtaining coarse-grained partitions through greedy sampling; the original vehicle capacity is recovered, and a fine-grained division model is used for optimizing grouping to form a TSP sub-problem; after batch processing and coordinate transformation are carried out on the TSP sub-problems, a neural solver is pre-trained for parallel solving; and finally, integrating, learning and comparing the two schemes, and selecting an optimal solution with the shortest total driving distance. According to the method, through a three-level strategy of rough division and frame determination, fine division and fine optimization, and integrated selection of optimum, large-scale problem adaptability, solution efficiency and solution quality are considered, generalization ability is high, engineering practicability is high, and the method can be widely applied to scenes such as logistics distribution and urban freight scheduling.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of vehicle routing technology, specifically involving a large-scale vehicle routing planning method, system, and medium with coarse and fine granular division. It is applicable to scenarios such as logistics distribution and urban freight dispatching that require optimization of multi-vehicle delivery routes, especially for the Capacitated Vehicle Routing Problem (CVRP) with large customer node scale and strict vehicle capacity constraints. Background Technology

[0002] The Capacity-Constrained Vehicle Routing Problem (CVRP) is a classic problem in combinatorial optimization and operations research. Its core requirement is: given a certain number of customer nodes scattered in a geographical space, multiple vehicles with the same load capacity are dispatched from a warehouse node to provide delivery services to customers. Each customer has a specific number of needs. The goal is to design a delivery scheme with the shortest total travel distance, under the premise that "all customer needs are met, the total load of each vehicle does not exceed the capacity limit, and each route starts from the warehouse and eventually returns to the warehouse".

[0003] Existing methods for solving CVRP problems are mainly divided into two categories: exact algorithms and heuristic algorithms. Exact algorithms: The optimal solution can be theoretically obtained through branch and bound, enumeration and other methods. However, when the problem size (number of client nodes) increases dramatically, the number of permutations and combinations to be processed increases exponentially, and the solution time is greatly extended, which cannot meet the real-time requirements of large-scale problems. Heuristic algorithms: Based on rules or metaheuristic search strategies such as saving algorithms, tabu search, and genetic algorithms, feasible solutions can be generated in a reasonable time. However, the heuristic rules of such algorithms are highly dependent on the experience and domain knowledge of human experts, and are easily affected by subjective factors, making it difficult to generate high-quality solutions stably. Neural combinatorial optimization methods: These are learning-based solution methods that have emerged in recent years. They are divided into two categories: “constructive stepwise solution generation” and “iterative stepwise solution improvement”. Although they can quickly obtain high-quality solutions in small-scale combinatorial optimization problems, they are difficult to directly train and apply when faced with large-scale datasets due to the complexity of deep learning model training, computational power and time limitations.

[0004] To address large-scale CVRP, researchers have proposed a "divide and conquer" strategy, breaking it down into two stages: partitioning and solving. The first stage divides the large-scale CVRP into multiple smaller groups of Traveling Salesman Problems (TSPs), and the second stage solves the TSPs in parallel to quickly generate a solution. However, traditional partitioning strategies employ a "constructive step-by-step generation of complete solutions + warehouse node partitioning" approach. If a customer node is assigned to a suboptimal group at a certain step, subsequent nodes will accumulate this negative impact, leading to a significant reduction in the quality of the final solution.

[0005] In summary, existing technologies suffer from drawbacks such as slow solution speed, low solution quality, and insufficient model generalization performance when solving large-scale vehicle routing problems. There is an urgent need for a method that can balance adaptability to large-scale problems, solution efficiency, and solution quality. Summary of the Invention

[0006] To address the aforementioned issues, this invention aims to propose a large-scale vehicle path planning method, system, and medium based on coarse and fine granular partitioning. Through a three-level strategy of "coarse-grained partitioning to define the framework, fine-grained partitioning to refine the optimization, and ensemble learning to select the optimal solution," the contradiction between solution efficiency and solution quality in large-scale CVRP is resolved.

[0007] To achieve the above objectives, the technical solution of the present invention is implemented as follows: A large-scale vehicle path planning method with coarse and fine granularity partitioning includes the following steps: S1. Feature extraction and problem scale identification of large-scale vehicle routing problem instances: Extract the node coordinate features, vehicle capacity features and node customer demand features of the problem instances, and determine the corresponding vehicle capacity adjustment strategy according to the preset problem scale and vehicle capacity mapping relationship. S2. Construction of coarse-grained partitioning model and generation of coarse-grained partitions: A coarse-grained partitioning model is obtained by parameterizing the generated flow network, and a heatmap matrix after feature extraction of the corresponding problem instance is generated. A greedy sampling algorithm is used to gradually select the node with the highest probability from the heatmap matrix for access, forming a coarse-grained partitioning of the problem instance. S3. Fine-grained partitioning and Traveling Salesman Problem (TSP) generation: Keeping the original vehicle capacity constraints unchanged, the set of each coarse-grained partition node is rearranged and optimized and grouped. A heat map matrix is ​​generated through the fine-grained partitioning model. Each node subset is precisely partitioned to meet the original vehicle capacity constraints, forming multiple Traveling Salesman Problems. S4, Batch processing and parallel solution of TSP subproblems: The batch processing of the Traveling Salesman Problem is integrated, and the problem size is unified by filling warehouse nodes. Coordinate transformation is performed on each instance of the Traveling Salesman Problem, and a pre-trained neural solver is used to solve the problem in parallel to determine the partitioning results of coarse and fine granularity. S5. Ensemble Learning and Optimal Solution Selection: Implement an ensemble learning strategy, retain the solution results of both coarse-grained and fine-grained partitioning schemes, compare the solution quality of the two schemes using a greedy selection algorithm, and select the optimal solution as the final output solution.

[0008] Furthermore, step S1 specifically includes: Dataset definition: Example of a problem with a scale of 1000 nodes: The vehicle capacity is set to 200, the customer demand is a random integer in the range of [1,9], the warehouse node demand is 0, and the two-dimensional coordinates of the customer node and the warehouse node follow a uniform distribution in the interval (0,1). For a problem instance with more than 1000 nodes: the vehicle capacity is set to 300, and the customer requirements and node coordinate distribution remain consistent with the 1000-node instance. Vehicle limit calculation: Calculate the total demand of all customer nodes and the ratio of "total demand / standard vehicle capacity" as the upper limit of the required number of vehicles; at the same time, adjust the vehicle capacity according to the node scale: the vehicle capacity of an instance with 1000 nodes is increased by 5 times, and the vehicle capacity of an instance with more than 1000 nodes is increased by 10 times. Feature standardization and transformation: Demand normalization: Divide the demand of each customer node by the original vehicle capacity to eliminate differences in the magnitude of demand. Coordinate transformation: Using the warehouse node as the pole, convert the two-dimensional rectangular coordinates of all nodes to polar coordinates to highlight the positional relationship of the nodes relative to the warehouse; Feature input: The normalization requirement, node polar coordinates, and Euclidean distance between any two nodes are used as input features for the subsequent model.

[0009] Furthermore, step S2 specifically includes: Model parameterization: The network parameters of the coarse-grained partitioning model are initialized based on a Gaussian distribution. Using the large-scale vehicle routing problem instance features obtained in step S1 as input, the probability of selecting the next customer node is calculated using the following formula:

[0010] in This represents the probability value of selecting the next customer node. This is the maximum number of vehicles. It is the arrangement length of each coarse-grained partition. This represents all feasible next steps. This represents the next action to be taken; Greedy sampling grouping: According to the above probability formula, each time the unvisited customer node with the highest probability is selected and assigned to the current group, until the total demand of the group reaches the adjusted vehicle capacity limit. Using warehouse nodes as separators, multiple small-scale vehicle routing problems are formed. Model training and parameter optimization: Use the attention model AM to solve the small-scale vehicle path problem obtained earlier, keep the original vehicle capacity unchanged, and record the target value - total travel distance for each group; Based on the target value, the parameters of the generating stream network are adjusted through backpropagation to minimize the following loss function:

[0011] in The loss value represents the partitioned solution, and AM represents the objective value obtained by using AM to solve small-scale vehicle routing problems. Represents the number of vehicles; The generative flow model is further trained using the trajectory balancing loss TBloss, as shown in the following formula: , In the formula Z θ It is a pre-set control factor, P F (θ) represents the forward loss value of the solution, R(θ) is the average objective value of the solution, and P B (θ) represents the backward loss value of the solution; Coarse-grained partitioning generation: After training, the generative flow model converts the problem features into an (n+1)×(n+1) heatmap matrix. In the formula h ij This represents the probability that two customer nodes belong to the same partition group, and n represents the size of the problem instance. Based on this matrix and the adjusted vehicle capacity, the node with the highest probability is greedily selected to be assigned to the same group, resulting in the final coarse-grained partition.

[0012] Furthermore, step S3 specifically includes: Capacity restoration and group initialization: The amplified vehicle capacity in step S2 is restored to its original value. For each coarse-grained partition, the geographical distribution and demand of customer nodes within the partition are analyzed, and the grouping strategy is initialized to ensure that the total demand of each group does not exceed the original vehicle capacity. Fine-grained heatmap extraction: Based on the client node index inst, extract the fine-grained heatmap matrix of the corresponding partition from the coarse-grained heatmap matrix. ,in This is a fine-grained partitioning matrix; Node selection and path generation: Starting from the repository node, based on... The association probability between nodes is used to iteratively select the unvisited node with the highest probability of being the end node of the current path; if the demand of the next node exceeds the vehicle's remaining capacity, the vehicle immediately returns to the warehouse and starts a new path until all nodes in the partition are visited. TSP subproblem formation: Using warehouse nodes as separators, the previously generated complete path is split into multiple sets of closed-loop paths of "warehouse-customer-warehouse", with each set of paths corresponding to a TSP subproblem.

[0013] Furthermore, step S4 specifically includes: Batch tensor construction: Integrate multiple sets of TSP instances generated by the upper-level coarse and fine granular partitioning model; use the underlying solver to process in parallel, perform a filling operation on each TSP instance, and add warehouse nodes to make all subproblems have a uniform number of nodes, forming a batch tensor B; Coordinate Transformation and Data Augmentation: Coordinate transformation and data augmentation are performed on each TSP instance in the batch tensor B to adapt to the input distribution of the pre-trained neural solver. The Min-Max coordinate transformation method is used to linearly transform the node coordinates to a unit interval. Simultaneously, rotation transformation is introduced as an optional data augmentation strategy to enhance the robustness of the lower-level TSP solver. The coordinate transformation formula is as follows:

[0014]

[0015] The scaling factor x max This represents the maximum x-coordinate among all customer nodes. min This represents the minimum x-coordinate among all customer nodes. y max Represents the maximum value of the y-coordinate among all customer nodes, y min This represents the minimum y-coordinate among all customer nodes; Parallel solution using a pre-trained neural solver: The AM architecture is used as the pre-trained lower-level TSP solver. TSP problem instances are solved based on an encoder-decoder architecture. The encoder contains one linear mapping layer and six attention layers, while the decoder contains one attention layer and attention score calculation operations. The input to each attention layer is the output of the previous layer, as shown in the following formula:

[0016]

[0017] In the formula, MHA is the multi-head attention computation, using 8 heads, and FF is the feedforward network layer. It is the feature embedding of the i-th node in the l-th layer. It is the feature embedding of the i-th node in the (l-1)-th layer; The solver's encoder is configured to generate node embeddings using a multi-layer attention mechanism, while the decoder is based on the current state and historical path information. The solver is optimized through a two-stage training strategy: the first stage involves pre-training on uniformly distributed TSP50 instances, with 100 training epochs and 1,280,000 TSP instances per epoch; the second stage involves further training on a non-uniformly distributed dataset, where the upper bound of the y-coordinate of the training instances dynamically changes within the range of [0.1, 1.0], and the x-coordinate follows a uniform distribution, with a cumulative training epoch of 100 epochs and 1,280,000 TSP instances per epoch. The batch tensor B is input into the pre-trained solver to solve all TSP subproblems in parallel, resulting in partitioning results with coarse and fine granularity.

[0018] Furthermore, step S5 specifically includes: A multi-granularity partitioning process is adopted: First, the vehicle capacity constraints of the problem instances are adjusted according to a preset capacity amplification factor, and then input into a coarse-grained partitioning model to generate a heatmap matrix and perform greedy sampling to form an initial partition solution; subsequently, based on this partition solution, a fine-grained partitioning model is called to further partition each sub-region, generating the first set of Traveling Salesman Problem instances s. MGP ; A single fine-grained partitioning process is adopted: keeping the original vehicle capacity constraints of the problem instances unchanged, the fine-grained partitioning model is directly called to generate a heatmap matrix and greedily sampled to generate a second set of traveling salesman problem instances s. f ; Two sets of TSP instances MGP and s f The solutions are fed into the pre-trained neural solver at the bottom layer for parallel processing, and the complete path scheme and the corresponding objective function value minus the total travel distance are recorded, denoted as cost. MGP and cost f ; A greedy selection algorithm is used to evaluate the solutions generated by the two partitioning schemes mentioned above. The algorithm directly compares the two objective function values ​​and selects the better one, which has a smaller value and represents a shorter total travel distance, as the final output. A minimization selector is designed to represent the greedy algorithm, comparing two total cost values. The decision logic is defined as taking the minimum value between the two, and its decision logic formula is expressed as:

[0019] The algorithm outputs the cost corresponding to the problem instance as the final objective value.

[0020] To achieve the above objectives, the present invention also provides a large-scale vehicle path planning system with coarse and fine granularity, comprising the following modules: The feature extraction and problem scale identification module for large-scale vehicle routing problem instances extracts the node coordinate features, vehicle capacity features, and node customer demand features of the problem instances, and determines the corresponding vehicle capacity adjustment strategy based on the preset problem scale and vehicle capacity mapping relationship. Coarse-grained partitioning model construction and coarse-grained partition generation module: The coarse-grained partitioning model is obtained by parameterizing the generated flow network, and a heat map matrix after feature extraction of the corresponding problem instance is generated. The greedy sampling algorithm is used to gradually select the node with the highest probability from the heat map matrix for access, forming the coarse-grained partitioning of the problem instance. Fine-grained partitioning and Traveling Salesman Problem (TSP) generation module: Keeping the original vehicle capacity constraints unchanged, the partition set of each coarse-grained partition node is rearranged and optimized and grouped. A heat map matrix is ​​generated through the fine-grained partitioning model, and each node subset is precisely partitioned to meet the original vehicle capacity constraints, forming multiple Traveling Salesman Problems; The TSP subproblem batch processing and parallel solution module integrates the batch processing of the Traveling Salesman Problem, achieves a unified problem size by filling warehouse nodes, performs coordinate transformation on each Traveling Salesman Problem instance, uses a pre-trained neural solver for parallel solution, and determines the partitioning results of coarse and fine granularity partitioning. Ensemble learning and optimal solution selection module: Implements an ensemble learning strategy, retains the solution results of both coarse-grained and fine-grained partitioning schemes, compares the solution quality of the two schemes through a greedy selection algorithm, and selects the optimal solution as the final output solution.

[0021] To achieve the above objectives, the present invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, causes the processor to perform the large-scale vehicle path planning method with coarse and fine granular partitioning as described above.

[0022] Beneficial effects: (1) This invention takes into account both large-scale adaptability and solution quality: Through the two-level partitioning strategy of "coarse-grained partitioning (relaxed capacity constraint framework) + fine-grained partitioning (original capacity constraint fine optimization)," it avoids the computing power bottleneck of directly solving large-scale problems, and eliminates the suboptimal cumulative effect of the traditional "divide and conquer" strategy through secondary partitioning, thus significantly improving the solution quality; (2) This invention improves the generalization ability of the model: the model is parameterized by generating flow network and trained by trajectory balance loss to enhance the adaptability of the model to different node distributions and demand scales; the underlying TSP solver further improves the generalization performance of complex scenarios through two-stage training (uniform distribution + non-uniform distribution). (3) The present invention optimizes the solution efficiency: by batch processing and parallel solving of TSP subproblems, the solution time of large-scale problems is greatly shortened; the ensemble learning strategy compares two-way schemes, which ensures the quality of the solution while avoiding the local optimum trap of a single scheme. (4) The present invention has strong engineering practicality: the model input features (normalization requirements, polar coordinates, Euclidean distance) are easy to obtain, and the partitioning and solution process can be implemented through existing deep learning frameworks (such as TensorFlow and PyTorch), and can be directly applied to scheduling systems in actual scenarios such as logistics distribution and urban freight. Attached Figure Description

[0023] The accompanying drawings, which form part of this invention, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute an undue limitation of the invention. In the drawings: Figure 1 This is a flowchart of the large-scale vehicle path planning method with coarse and fine granular division according to an embodiment of the present invention; Figure 2 This is an algorithm framework diagram of the large-scale vehicle path planning method with coarse and fine granular partitioning as described in an embodiment of the present invention. Figure 3 This is a schematic diagram of the structure of a large-scale vehicle path planning system with coarse and fine granular division according to an embodiment of the present invention. Detailed Implementation

[0024] It should be noted that, unless otherwise specified, the embodiments and features described in the present invention can be combined with each other.

[0025] The present invention will now be described in detail with reference to the accompanying drawings and embodiments.

[0026] Example 1 See Figure 1-2 A large-scale vehicle path planning method with coarse and fine granular partitioning includes the following steps: S1. Feature extraction and problem scale identification of large-scale vehicle routing problem instances: Extract the node coordinate features, vehicle capacity features and node customer demand features of the problem instances, and determine the corresponding vehicle capacity adjustment strategy according to the preset problem scale and vehicle capacity mapping relationship. This embodiment statistically analyzes the locations of delivery points, the delivery volume at each point, and the maximum vehicle loading capacity. It adjusts the temporary loading limit of vehicles according to the number of delivery points (e.g., 1000 points as the dividing line) to understand the details of the problem and prepare for subsequent grouping.

[0027] S2. Construction of coarse-grained partitioning model and generation of coarse-grained partitions: A coarse-grained partitioning model is obtained by parameterizing the generated flow network, and a heatmap matrix after feature extraction of the corresponding problem instance is generated. A greedy sampling algorithm is used to gradually select the node with the highest probability from the heatmap matrix for access, forming a coarse-grained partitioning of the problem instance. In this embodiment, an intelligent model is used to roughly divide all delivery points into several large groups, grouping them according to the standard of "temporary capacity expansion". Points that are close to each other and have a high probability are prioritized to be grouped together, thereby quickly reducing the problem size and computational difficulty.

[0028] S3. Fine-grained partitioning and Traveling Salesman Problem (TSP) generation: Keeping the original vehicle capacity constraints unchanged, the set of each coarse-grained partition node is rearranged and optimized and grouped. A heat map matrix is ​​generated through the fine-grained partitioning model. Each node subset is precisely partitioned to meet the original vehicle capacity constraints, forming multiple Traveling Salesman Problems. This embodiment breaks down the large, roughly divided portions into smaller ones based on the actual load capacity of the vehicles, ensuring that each vehicle does not exceed its weight limit. It also breaks down the tasks into small routes that "start from the warehouse and return after delivery," making the grouping meet the actual transportation requirements and turning them into easily solvable problems.

[0029] S4, Batch processing and parallel solution of TSP subproblems: The batch processing of the Traveling Salesman Problem is integrated, and the problem size is unified by filling warehouse nodes. Coordinate transformation is performed on each instance of the Traveling Salesman Problem, and a pre-trained neural solver is used to solve the problem in parallel to determine the partitioning results of coarse and fine granularity. This embodiment organizes all sub-route tasks into a unified format (filling in any missing ones with repository nodes), adjusts coordinates for easier calculation, and uses a pre-trained intelligent model to calculate all sub-tasks simultaneously, improving solution efficiency and quickly obtaining the optimal route for each sub-task.

[0030] S5. Ensemble Learning and Optimal Solution Selection: Implement an ensemble learning strategy, retain the solution results of both coarse-grained and fine-grained partitioning schemes, compare the solution quality of the two schemes using a greedy selection algorithm, and select the optimal solution as the final output solution.

[0031] This embodiment uses both "coarse division followed by fine division" and "direct fine division" methods for calculation, and finally selects the scheme with the shortest total driving distance to ensure that the final route is optimal, which is more reliable than a single method.

[0032] In summary, this embodiment first extracts features and identifies the problem size for large-scale vehicle routing problem instances to determine vehicle capacity adjustment strategies. Then, it constructs a coarse-grained partitioning model using a generative flow network, generates a heatmap matrix, and obtains coarse-grained partitions through greedy sampling. Subsequently, it restores the original vehicle capacity constraints and uses a fine-grained partitioning model to optimize and group the coarse-grained partitions, forming multiple Traveling Salesman Problems (TSPs). After batch processing, integration, and coordinate transformation of the TSP subproblems, a pre-trained neural solver is used for parallel solving. Finally, through an ensemble learning strategy, the solution results of coarse-grained and fine-grained partitioning are compared with those of single fine-grained partitioning, and the optimal solution with the shortest total travel distance is selected. This embodiment, through a three-level strategy of "coarse partitioning to define the framework, fine partitioning to refine the optimization, and ensemble selection to choose the optimal solution," balances adaptability to large-scale problems, solution efficiency, and solution quality. It exhibits strong generalization ability and high engineering practicality, and can be widely applied to scenarios such as logistics distribution and urban freight dispatching.

[0033] In a specific example, step S1 specifically includes: Dataset definition: Example of a problem with a scale of 1000 nodes: The vehicle capacity is set to 200, the customer demand is a random integer in the range of [1,9], the warehouse node demand is 0, and the two-dimensional coordinates of the customer node and the warehouse node follow a uniform distribution in the interval (0,1). For a problem instance with more than 1000 nodes: the vehicle capacity is set to 300, and the customer requirements and node coordinate distribution remain consistent with the 1000-node instance. Vehicle limit calculation: Calculate the total demand of all customer nodes and the ratio of "total demand / standard vehicle capacity" as the upper limit of the required number of vehicles; at the same time, adjust the vehicle capacity according to the node scale: the vehicle capacity of an instance with 1000 nodes is increased by 5 times, and the vehicle capacity of an instance with more than 1000 nodes is increased by 10 times. Feature standardization and transformation: Demand normalization: Divide the demand of each customer node by the original vehicle capacity to eliminate differences in the magnitude of demand. Coordinate transformation: Using the warehouse node as the pole, convert the two-dimensional rectangular coordinates of all nodes to polar coordinates to highlight the positional relationship of the nodes relative to the warehouse; Feature input: The normalization requirement, node polar coordinates, and Euclidean distance between any two nodes are used as input features for the subsequent model.

[0034] In the specific implementation, the dataset and the number of vehicles are determined as follows: the total requirement for 1000 nodes is approximately 1800 units, and the upper limit of the number of vehicles is 1800 ÷ 200 = 9 vehicles; the total requirement for 1500 nodes is approximately 3600 units, and the upper limit of the number of vehicles is 3600 ÷ 300 = 12 vehicles. Feature processing: Customer demand is normalized (demand ÷ original capacity), the polar coordinates of nodes are transformed with the warehouse as the pole, the Euclidean distance between nodes is calculated, and the input features of the model are formed.

[0035] In a specific example, step S2 specifically includes: Model parameterization: The network parameters of the coarse-grained partitioning model are initialized based on a Gaussian distribution. Using the large-scale vehicle routing problem instance features obtained in step S1 as input, the probability of selecting the next customer node is calculated using the following formula:

[0036] in This represents the probability value of selecting the next customer node. This is the maximum number of vehicles. It is the arrangement length of each coarse-grained partition. This represents all feasible next steps. This represents the next action to be taken; Greedy sampling grouping: According to the above probability formula, each time the unvisited customer node with the highest probability is selected and assigned to the current group, until the total demand of the group reaches the adjusted vehicle capacity limit. Using warehouse nodes as separators, multiple small-scale vehicle routing problems are formed. Model training and parameter optimization: Use the attention model AM to solve the small-scale vehicle path problem obtained earlier, keep the original vehicle capacity unchanged, and record the target value - total travel distance for each group; Based on the target value, the parameters of the generator stream network are adjusted through backpropagation to minimize the following loss function:

[0037] in The loss value represents the partitioned solution, and AM represents the objective value obtained by using AM to solve small-scale vehicle routing problems. Represents the number of vehicles; The generative flow model is further trained using the trajectory balancing loss TBloss, as shown in the following formula: , In the formula Z θ It is a pre-set control factor, P F (θ) represents the forward loss value of the solution, R(θ) is the average objective value of the solution, and P B (θ) represents the backward loss value of the solution; Coarse-grained partitioning generation: After training, the generative flow model converts the problem features into an (n+1)×(n+1) heatmap matrix. In the formula h ijThis represents the probability that two customer nodes belong to the same partition group, and n represents the size of the problem instance. Based on this matrix and the adjusted vehicle capacity, the node with the highest probability is greedily selected to be assigned to the same group, resulting in the final coarse-grained partition.

[0038] In the specific implementation, a flow network is initialized based on Gaussian distribution. After inputting features, the network is greedily sampled and grouped according to the probability formula (without exceeding the temporary capacity). 1000 nodes generate 3 coarse partitions, and 1500 nodes generate 5 coarse partitions. The AM model is used to solve small-scale problems, and backpropagation is used to optimize parameters to generate the corresponding heatmap matrix to determine the final coarse partitions.

[0039] In a specific example, step S3 specifically includes: Capacity restoration and group initialization: The amplified vehicle capacity in step S2 is restored to its original value. For each coarse-grained partition, the geographical distribution and demand of customer nodes within the partition are analyzed, and the grouping strategy is initialized to ensure that the total demand of each group does not exceed the original vehicle capacity. Fine-grained heatmap extraction: Based on the client node index inst, extract the fine-grained heatmap matrix of the corresponding partition from the coarse-grained heatmap matrix. ,in This is a fine-grained partitioning matrix; Node selection and path generation: Starting from the repository node, based on... The association probability between nodes is used to iteratively select the unvisited node with the highest probability of being the end node of the current path; if the demand of the next node exceeds the vehicle's remaining capacity, the vehicle immediately returns to the warehouse and starts a new path until all nodes in the partition are visited. TSP subproblem formation: Using warehouse nodes as separators, the previously generated complete path is split into multiple sets of closed-loop paths of "warehouse-customer-warehouse", with each set of paths corresponding to a TSP subproblem.

[0040] In the specific implementation, the original capacity is restored, a coarse partition fine-grained heat map is extracted, and nodes are selected iteratively according to "whether the remaining capacity meets customer needs". If the capacity is exceeded, the new path is opened in the warehouse. 1000 nodes are split into 12 TSP sub-problems, and 1500 nodes are split into 18 TSP sub-problems (each group of requirements is ≤ the original capacity).

[0041] In a specific example, step S4 specifically includes: Batch tensor construction: Integrate multiple sets of TSP instances generated by the upper-level coarse and fine granular partitioning model; use the underlying solver to process in parallel, perform a filling operation on each TSP instance, and add warehouse nodes to make all subproblems have a uniform number of nodes, forming a batch tensor B; Coordinate Transformation and Data Augmentation: Coordinate transformation and data augmentation are performed on each TSP instance in the batch tensor B to adapt to the input distribution of the pre-trained neural solver. The Min-Max coordinate transformation method is used to linearly transform the node coordinates to a unit interval. Simultaneously, rotation transformation is introduced as an optional data augmentation strategy to enhance the robustness of the lower-level TSP solver. The coordinate transformation formula is as follows:

[0042]

[0043] The scaling factor x max This represents the maximum x-coordinate among all customer nodes. min This represents the minimum x-coordinate among all customer nodes. y max Represents the maximum value of the y-coordinate among all customer nodes, y min This represents the minimum y-coordinate among all customer nodes; Parallel solution using a pre-trained neural solver: The AM architecture is used as the pre-trained lower-level TSP solver. TSP problem instances are solved based on an encoder-decoder architecture. The encoder contains one linear mapping layer and six attention layers, while the decoder contains one attention layer and attention score calculation operations. The input to each attention layer is the output of the previous layer, as shown in the following formula:

[0044]

[0045] In the formula, MHA is the multi-head attention computation, using 8 heads, and FF is the feedforward network layer. It is the feature embedding of the i-th node in the l-th layer. It is the feature embedding of the i-th node in the (l-1)-th layer; The solver's encoder is configured to generate node embeddings using a multi-layer attention mechanism, while the decoder is based on the current state and historical path information. The solver is optimized through a two-stage training strategy: the first stage involves pre-training on uniformly distributed TSP50 instances, with 100 training epochs and 1,280,000 TSP instances per epoch; the second stage involves further training on a non-uniformly distributed dataset, where the upper bound of the y-coordinate of the training instances dynamically changes within the range of [0.1, 1.0], and the x-coordinate follows a uniform distribution, with a cumulative training epoch of 100 epochs and 1,280,000 TSP instances per epoch. The batch tensor B is input into the pre-trained solver to solve all TSP subproblems in parallel, resulting in partitioning results with coarse and fine granularity.

[0046] In the specific implementation, the number of nodes in the TSP subproblem is unified by filling the warehouse nodes (1000 nodes correspond to 10 nodes / subproblem, 1500 nodes correspond to 12 nodes / subproblem). After Min-Max coordinate transformation and rotation transformation, the nodes are input into the pre-trained AM solver for parallel solving.

[0047] In a specific example, step S5 specifically includes: A multi-granularity partitioning process is adopted: First, the vehicle capacity constraints of the problem instances are adjusted according to a preset capacity amplification factor, and then input into a coarse-grained partitioning model to generate a heatmap matrix and perform greedy sampling to form an initial partition solution; subsequently, based on this partition solution, a fine-grained partitioning model is called to further partition each sub-region, generating the first set of Traveling Salesman Problem instances s. MGP ; A single fine-grained partitioning process is adopted: keeping the original vehicle capacity constraints of the problem instances unchanged, the fine-grained partitioning model is directly called to generate a heatmap matrix and greedily sampled to generate a second set of traveling salesman problem instances s. f ; Two sets of TSP instances MGP and s f The solutions are fed into the pre-trained neural solver at the bottom layer for parallel processing, and the complete path scheme and the corresponding objective function value minus the total travel distance are recorded, denoted as cost. MGP and cost f ; A greedy selection algorithm is used to evaluate the solutions generated by the two partitioning schemes mentioned above. The algorithm directly compares the two objective function values ​​and selects the better one, which has a smaller value and represents a shorter total travel distance, as the final output. A minimization selector is designed to represent the greedy algorithm, comparing two total cost values. The decision logic is defined as taking the minimum value between the two, and its decision logic formula is expressed as:

[0048] The algorithm outputs the cost corresponding to the problem instance as the final objective value.

[0049] In the specific implementation, comparing the total driving distance of multi-granularity partitioning (sMGP) and single fine-grained partitioning (sf): in a 1000-node scenario, =18.36< =20.44; in a 1500-node scenario, =25.62< =28.15, and the sMGP solution was chosen as the final solution.

[0050] Implementation Results: As can be seen, in both scale scenarios, the method of this embodiment reduces the solution time by more than 80% compared with the traditional accurate algorithm, and reduces the total driving distance by 10%-15% compared with a single fine-grained partition. Moreover, it can stably generate high-quality solutions in both uniform and non-uniform node distributions, and is suitable for large-scale vehicle-road planning needs of different scales.

[0051] Example 2 To achieve the above objectives, this embodiment also provides a large-scale vehicle path planning system with coarse and fine granularity partitioning, including the following modules: The feature extraction and problem scale identification module for large-scale vehicle routing problem instances extracts the node coordinate features, vehicle capacity features, and node customer demand features of the problem instances, and determines the corresponding vehicle capacity adjustment strategy based on the preset problem scale and vehicle capacity mapping relationship. Coarse-grained partitioning model construction and coarse-grained partition generation module: The coarse-grained partitioning model is obtained by parameterizing the generated flow network, and a heat map matrix after feature extraction of the corresponding problem instance is generated. The greedy sampling algorithm is used to gradually select the node with the highest probability from the heat map matrix for access, forming the coarse-grained partitioning of the problem instance. Fine-grained partitioning and Traveling Salesman Problem (TSP) generation module: Keeping the original vehicle capacity constraints unchanged, the partition set of each coarse-grained partition node is rearranged and optimized and grouped. A heat map matrix is ​​generated through the fine-grained partitioning model, and each node subset is precisely partitioned to meet the original vehicle capacity constraints, forming multiple Traveling Salesman Problems; The TSP subproblem batch processing and parallel solution module integrates the batch processing of the Traveling Salesman Problem, achieves a unified problem size by filling warehouse nodes, performs coordinate transformation on each Traveling Salesman Problem instance, uses a pre-trained neural solver for parallel solution, and determines the partitioning results of coarse and fine granularity partitioning. Ensemble learning and optimal solution selection module: Implements an ensemble learning strategy, retains the solution results of both coarse-grained and fine-grained partitioning schemes, compares the solution quality of the two schemes through a greedy selection algorithm, and selects the optimal solution as the final output solution.

[0052] The large-scale vehicle path planning system with coarse and fine granular partitioning in this embodiment has the same advantages over the prior art as the large-scale vehicle path planning method with coarse and fine granular partitioning described above, and will not be repeated here.

[0053] Example 3 To achieve the above objectives, this embodiment also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, causes the processor to perform the large-scale vehicle path planning method with coarse and fine granular division as described above.

[0054] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A large-scale vehicle path planning method with coarse and fine granularity partitioning, characterized in that, Includes the following steps: S1. Feature extraction and problem scale identification of large-scale vehicle routing problem instances: Extract the node coordinate features, vehicle capacity features and node customer demand features of the problem instances, and determine the corresponding vehicle capacity adjustment strategy according to the preset problem scale and vehicle capacity mapping relationship. S2. Construction of coarse-grained partitioning model and generation of coarse-grained partitions: A coarse-grained partitioning model is obtained by parameterizing the generated flow network, and a heatmap matrix after feature extraction of the corresponding problem instance is generated. A greedy sampling algorithm is used to gradually select the node with the highest probability from the heatmap matrix for access, forming a coarse-grained partitioning of the problem instance. S3. Fine-grained partitioning and generation of traveling salesman subproblems: Keeping the original vehicle capacity constraints unchanged, the partition set of each coarse-grained partition node is rearranged and optimized and grouped. A heat map matrix is ​​generated through the fine-grained partitioning model. Each node subset is precisely partitioned to meet the original vehicle capacity constraints, forming multiple traveling salesman subproblems. S4, Batch processing and parallel solution of TSP subproblems: The batch processing of the Traveling Salesman Problem is integrated, and the problem size is unified by filling warehouse nodes. Coordinate transformation is performed on each instance of the Traveling Salesman Problem, and a pre-trained neural solver is used to solve the problem in parallel to determine the partitioning results of coarse and fine granularity. S5. Ensemble Learning and Optimal Solution Selection: Implement an ensemble learning strategy, retain the solution results of both coarse-grained and fine-grained partitioning schemes, compare the solution quality of the two schemes using a greedy selection algorithm, and select the optimal solution as the final output solution.

2. The large-scale vehicle path planning method with coarse and fine granularity partitioning according to claim 1, characterized in that, Step S1 specifically includes: Dataset definition: Example of a problem with a scale of 1000 nodes: The vehicle capacity is set to 200, the customer demand is a random integer in the range of [1,9], the warehouse node demand is 0, and the two-dimensional coordinates of the customer node and the warehouse node follow a uniform distribution in the interval (0,1). For a problem instance with more than 1000 nodes: the vehicle capacity is set to 300, and the customer requirements and node coordinate distribution remain consistent with the 1000-node instance. Vehicle limit calculation: Calculate the total demand of all customer nodes and the ratio of "total demand / standard vehicle capacity" as the upper limit of the required number of vehicles; at the same time, adjust the vehicle capacity according to the node scale: the vehicle capacity of an instance with 1000 nodes is increased by 5 times, and the vehicle capacity of an instance with more than 1000 nodes is increased by 10 times. Feature standardization and transformation: Demand normalization: Divide the demand of each customer node by the original vehicle capacity to eliminate differences in the magnitude of demand. Coordinate transformation: Using the warehouse node as the pole, convert the two-dimensional rectangular coordinates of all nodes to polar coordinates to highlight the positional relationship of the nodes relative to the warehouse; Feature input: The normalization requirement, node polar coordinates, and Euclidean distance between any two nodes are used as input features for the subsequent model.

3. The large-scale vehicle path planning method with coarse and fine granularity partitioning according to claim 1, characterized in that, Step S2 specifically includes: Model parameterization: The network parameters of the coarse-grained partitioning model are initialized based on a Gaussian distribution. Using the large-scale vehicle routing problem instance features obtained in step S1 as input, the probability of selecting the next customer node is calculated using the following formula: in This represents the probability value of selecting the next customer node. This is the maximum number of vehicles. It is the arrangement length of each coarse-grained partition. This represents all feasible next steps. This represents the next action to be taken; Greedy sampling grouping: According to the above probability formula, each time the unvisited customer node with the highest probability is selected and assigned to the current group, until the total demand of the group reaches the adjusted vehicle capacity limit. Using warehouse nodes as separators, multiple small-scale vehicle routing problems are formed. Model training and parameter optimization: Use the attention model AM to solve the small-scale vehicle path problem obtained earlier, keep the original vehicle capacity unchanged, and record the target value - total travel distance for each group; Based on the target value, the parameters of the generator stream network are adjusted through backpropagation to minimize the following loss function: in The loss value represents the partitioned solution, and AM represents the objective value obtained by using AM to solve small-scale vehicle routing problems. Represents the number of vehicles; The generative flow model is further trained using the trajectory balancing loss TBloss, as shown in the following formula: , In the formula Z θ It is a pre-set control factor, P F (θ) represents the forward loss value of the solution, R(θ) is the average objective value of the solution, and P B (θ) represents the backward loss value of the solution; Coarse-grained partitioning generation: After training, the generative flow model converts the problem features into an (n+1)×(n+1) heatmap matrix. In the formula h ij This represents the probability that two customer nodes belong to the same partition group, and n represents the size of the problem instance. Based on this matrix and the adjusted vehicle capacity, the node with the highest probability is greedily selected to be assigned to the same group, resulting in the final coarse-grained partition.

4. The large-scale vehicle path planning method with coarse and fine granularity partitioning according to claim 1, characterized in that, Step S3 specifically includes: Capacity restoration and group initialization: The amplified vehicle capacity in step S2 is restored to its original value. For each coarse-grained partition, the geographical distribution and demand of customer nodes within the partition are analyzed, and the grouping strategy is initialized to ensure that the total demand of each group does not exceed the original vehicle capacity. Fine-grained heatmap extraction: Based on the client node index inst, extract the fine-grained heatmap matrix of the corresponding partition from the coarse-grained heatmap matrix. ,in This is a fine-grained partitioning matrix; Node selection and path generation: Starting from the repository node, based on... The association probability between nodes is used to iteratively select the unvisited node with the highest probability of being the end node of the current path; if the demand of the next node exceeds the vehicle's remaining capacity, the vehicle immediately returns to the warehouse and starts a new path until all nodes in the partition are visited. TSP subproblem formation: Using warehouse nodes as separators, the previously generated complete path is split into multiple sets of closed-loop paths of "warehouse-customer-warehouse", with each set of paths corresponding to a TSP subproblem.

5. The large-scale vehicle path planning method with coarse and fine granularity partitioning according to claim 1, characterized in that, Step S4 specifically includes: Batch tensor construction: Integrate multiple sets of TSP instances generated by the upper-level coarse and fine granular partitioning model; use the underlying solver to process in parallel, perform a filling operation on each TSP instance, and add warehouse nodes to make all subproblems have a uniform number of nodes, forming a batch tensor B; Coordinate Transformation and Data Augmentation: Coordinate transformation and data augmentation are performed on each TSP instance in the batch tensor B to adapt to the input distribution of the pre-trained neural solver. The Min-Max coordinate transformation method is used to linearly transform the node coordinates to a unit interval. Simultaneously, rotation transformation is introduced as an optional data augmentation strategy to enhance the robustness of the lower-level TSP solver. The coordinate transformation formula is as follows: The scaling factor x max This represents the maximum x-coordinate among all customer nodes. min This represents the minimum x-coordinate among all customer nodes. y max Represents the maximum value of the y-coordinate among all customer nodes, y min This represents the minimum y-coordinate among all customer nodes; Parallel solution using a pre-trained neural solver: The AM architecture is used as the pre-trained lower-level TSP solver. TSP problem instances are solved based on an encoder-decoder architecture. The encoder contains one linear mapping layer and six attention layers, while the decoder contains one attention layer and attention score calculation operations. The input to each attention layer is the output of the previous layer, as shown in the following formula: In the formula, MHA is the multi-head attention computation, using 8 heads, and FF is the feedforward network layer. It is the feature embedding of the i-th node in the l-th layer. It is the feature embedding of the i-th node in the (l-1)-th layer; The solver's encoder is configured to generate node embeddings using a multi-layer attention mechanism, while the decoder is based on the current state and historical path information. The solver is optimized through a two-stage training strategy: the first stage involves pre-training on uniformly distributed TSP50 instances, with 100 training epochs and 1,280,000 TSP instances per epoch; the second stage involves further training on a non-uniformly distributed dataset, where the upper bound of the y-coordinate of the training instances dynamically changes within the range of [0.1, 1.0], and the x-coordinate follows a uniform distribution, with a cumulative training epoch of 100 epochs and 1,280,000 TSP instances per epoch. The batch tensor B is input into the pre-trained solver to solve all TSP subproblems in parallel, resulting in partitioning results with coarse and fine granularity.

6. The large-scale vehicle path planning method with coarse and fine granularity partitioning according to claim 1, characterized in that, Step S5 specifically includes: A multi-granularity partitioning process is adopted: First, the vehicle capacity constraints of the problem instances are adjusted according to a preset capacity amplification factor, and then input into a coarse-grained partitioning model to generate a heatmap matrix and perform greedy sampling to form an initial partition solution; subsequently, based on this partition solution, a fine-grained partitioning model is called to further partition each sub-region, generating the first set of Traveling Salesman Problem instances s. MGP ; A single fine-grained partitioning process is adopted: keeping the original vehicle capacity constraints of the problem instances unchanged, the fine-grained partitioning model is directly called to generate a heatmap matrix and greedily sampled to generate a second set of traveling salesman problem instances s. f ; Two sets of TSP instances MGP and s f The solutions are fed into the pre-trained neural solver at the bottom layer for parallel processing, and the complete path scheme and the corresponding objective function value minus the total travel distance are recorded, denoted as cost. MGP and cost f ; A greedy selection algorithm is used to evaluate the solutions generated by the two partitioning schemes mentioned above. The algorithm directly compares the two objective function values ​​and selects the better one, which has a smaller value and represents a shorter total travel distance, as the final output. A minimization selector is designed to represent the greedy algorithm, comparing two total cost values. The decision logic is defined as taking the minimum value between the two, and its decision logic formula is expressed as: The algorithm outputs the cost corresponding to the problem instance as the final objective value.

7. A large-scale vehicle path planning system with coarse and fine granularity partitioning, characterized in that, Includes the following modules: The feature extraction and problem scale identification module for large-scale vehicle routing problem instances extracts the node coordinate features, vehicle capacity features, and node customer demand features of the problem instances, and determines the corresponding vehicle capacity adjustment strategy based on the preset problem scale and vehicle capacity mapping relationship. Coarse-grained partitioning model construction and coarse-grained partition generation module: The coarse-grained partitioning model is obtained by parameterizing the generated flow network, and a heat map matrix after feature extraction of the corresponding problem instance is generated. The greedy sampling algorithm is used to gradually select the node with the highest probability from the heat map matrix for access, forming the coarse-grained partitioning of the problem instance. Fine-grained partitioning and traveling salesman problem generation module: Keeping the original vehicle capacity constraint unchanged, the partition set of each coarse-grained partition node is rearranged and optimized and grouped. A heat map matrix is ​​generated through the fine-grained partitioning model. Each node subset is precisely partitioned to meet the original vehicle capacity constraint, forming multiple traveling salesman problems. The TSP subproblem batch processing and parallel solution module integrates the batch processing of the Traveling Salesman Problem, achieves a unified problem size by filling warehouse nodes, performs coordinate transformation on each Traveling Salesman Problem instance, uses a pre-trained neural solver for parallel solution, and determines the partitioning results of coarse and fine granularity partitioning. Ensemble learning and optimal solution selection module: Implements an ensemble learning strategy, retains the solution results of both coarse-grained and fine-grained partitioning schemes, compares the solution quality of the two schemes through a greedy selection algorithm, and selects the optimal solution as the final output solution.

8. A computer-readable storage medium storing a computer program that, when executed by a processor, causes the processor to perform a large-scale vehicle path planning method with coarse-grained partitioning as described in any one of claims 1 to 6.