Vehicle path problem solving method and device based on self-lifting mechanism

By adopting the self-elevation mechanism and linear complexity attention mechanism in vehicle path problems, the problem that the existing technology is difficult to directly train large-scale vehicle path problem models is solved, and the ability to efficient model training and solve large-scale VRP problems is achieved.

CN119886479AActive Publication Date: 2025-04-25SOUTHERN UNIVERSITY OF SCIENCE AND TECHNOLOGY
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411723384.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-28
Publication Date
2025-04-25
Estimated Expiration
2044-11-28

AI Technical Summary

Technical Problem

The existing technology is difficult to directly train large-scale vehicle path problem models, resulting in poor performance in solving large-scale VRP problems and producing low-quality solutions.

Method used

Using a method based on the self-improvement mechanism, the model is trained by generating initial pseudo-labels and training the initial model, and using the self-improvement mechanism to iterate the training and reasoning efficiency of the model on large-scale problems is improved.

Benefits of technology

It realizes direct model training on large-scale vehicle path problems, improves the model performance and solution quality, significantly reduces the calculation cost, and is suitable for solving large-scale vehicle path problems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119886479A_ABST
    Figure CN119886479A_ABST
Patent Text Reader

Abstract

The invention discloses a vehicle path problem solving method based on a self-lifting mechanism. The method comprises the following steps: acquiring vehicle path information; generating an initial pseudo label, and obtaining an initial model according to the initial pseudo label; iteratively training the initial model through a self-lifting mechanism to obtain a trained model; and inputting vehicle path information into the trained model to solve a vehicle path problem to obtain a shortest path. According to the method, iterative training is enhanced and refined through local reconstruction, the self-lifting mechanism training and reasoning efficiency on large-scale instances is improved through a linear attention mechanism, and the calculation cost is greatly reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a method and device for solving a vehicle routing problem based on a self-lifting mechanism. Background Art

[0002] The Vehicle Routing Problem (VRP) is an important problem in the field of transportation, distribution and logistics. Its essence is a classic combinatorial optimization problem, which involves how to effectively allocate a group of vehicles to visit multiple customer points and minimize the total driving distance or cost while satisfying constraints. It has important practical value.

[0003] Solving the vehicle routing problem is still very challenging at this stage. Traditional methods usually require deep domain expertise in algorithm design and have high computational complexity, which seriously hinders their practicality on large-scale problems. In recent years, neural combinatorial optimization methods (Nested Clustered Optimization, NCO) have been widely used to solve the vehicle routing problem. They realize the strategy of autonomously learning the problem from data, thus eliminating the need for expensive manual algorithm design. Existing neural combinatorial optimization methods usually use supervised learning (SL) or reinforcement learning (RL) methods to train models. However, on the one hand, supervised learning-based methods are limited by the difficulty of obtaining labels close enough to the optimal. On the other hand, reinforcement learning-based methods face serious sparse reward problems when training large-scale problem instances and have unacceptable GPU memory usage problems. These shortcomings limit direct training methods to training models only on small-scale (up to 500 nodes) VRPs. Existing neural combinatorial optimization methods cannot be directly trained for large-scale vehicle routing problem models, resulting in poor performance when solving large-scale VRP problems and often producing low-quality solutions.

[0004] Therefore, the prior art still needs to be improved and developed. Summary of the invention

[0005] The technical problem to be solved by the present invention is to provide a method and device for solving a vehicle routing problem based on a self-boosting mechanism in response to the above-mentioned defects of the prior art, aiming to solve the problem in the prior art that it is impossible to directly train large-scale vehicle routing problem models.

[0006] The technical solution adopted by the present invention to solve the technical problem is as follows:

[0007] In a first aspect, the present invention provides a method for solving a vehicle routing problem based on a self-lifting mechanism, wherein the method comprises:

[0008] Get vehicle path information;

[0009] Generate an initial pseudo-label, and obtain an initial model according to the initial pseudo-label, wherein the initial model includes an encoder and a decoder, and the decoder updates a graph node embedding vector set through a linear attention module;

[0010] Iteratively train the initial model through a self-boosting mechanism to obtain a trained model;

[0011] The vehicle path information is input into the trained model to solve the vehicle path problem and obtain the shortest path.

[0012] In one implementation, the generating of the initial pseudo-labels obtains an initial model according to the initial pseudo-labels and the vehicle path information:

[0013] Constructing an initial model, wherein the initial model includes an encoder and a decoder, the decoder includes a linear attention module, and the linear attention module is used for aggregation and broadcasting of key information;

[0014] Initial pseudo labels are generated, the initial model is trained by the initial pseudo labels, and an initial solution is obtained according to the initial pseudo labels.

[0015] In one implementation, the encoder is used to:

[0016] Extracting input node features according to the vehicle path information;

[0017] Performing linear projection on the input node features to obtain a node embedding vector;

[0018] The node embedding vector is passed to the decoder.

[0019] In one implementation, iteratively training the initial model through a self-boosting mechanism to obtain a trained model includes:

[0020] Partially reconstructing the initial solution through the initial model to obtain an enhanced solution;

[0021] Using the enhanced solution as a pseudo label, training the initial model according to the pseudo label to obtain a trained model;

[0022] Updating the initial solution according to the enhanced solution, updating the initial model according to the trained model, and re-performing the step of partially reconstructing the initial solution by the initial model to obtain an enhanced solution, until a preset termination condition is reached;

[0023] When the preset termination condition is reached, the trained model is obtained.

[0024] In one implementation, partially reconstructing the initial solution using the initial model to obtain an enhanced solution includes:

[0025] Preset partial solution length;

[0026] Sampling the initial solution according to the length of the partial solution to obtain an initial partial solution;

[0027] Reordering the nodes in the partial solution to obtain an enhanced partial solution;

[0028] The enhanced partial solution is used to replace the initial partial solution in the initial solution to obtain the enhanced solution.

[0029] In one implementation, the decoder updates a set of graph node embedding vectors through a linear attention module, including:

[0030] selecting a representative node from the partial solution;

[0031] Obtaining a graph node embedding vector set and a representative node embedding vector set through the encoder, wherein the decoder includes a plurality of linear attention modules;

[0032] Aggregating the graph node embedding vectors through the attention layer and the representative node embedding vectors in the linear attention module to obtain an updated representative node embedding vector set, and broadcasting the updated representative node embedding vector set to the graph node embedding vector set to obtain an intermediate graph node embedding vector set; wherein the attention layer includes a multi-head attention sublayer and a node feedforward sublayer;

[0033] Combining the updated representative node embedding vector set with the intermediate graph node embedding vector set as the input of the next linear attention module, and obtaining an updated graph node embedding vector set through the output of the last linear attention module;

[0034] According to the updated graph node embedding vector set, the selection probability of each unvisited node is obtained.

[0035] In one implementation, obtaining the selection probability of each unvisited node according to the updated graph node embedding vector set includes:

[0036] Linearly project the updated graph node embedding vector set to obtain a projection vector;

[0037] The projection vector is used as the input of the softmax function to calculate the selection probability of each unvisited node.

[0038] In a second aspect, an embodiment of the present invention further provides a vehicle routing problem solving device based on a self-lifting mechanism, wherein the device comprises:

[0039] A vehicle path information acquisition module is used to acquire vehicle path information;

[0040] An initial model generation module is used to generate an initial pseudo label, and obtain an initial model according to the initial pseudo label, wherein the initial model includes an encoder and a decoder, and the decoder updates the graph node embedding vector set through a linear attention module;

[0041] A model training module, used for iteratively training the initial model through a self-boosting mechanism to obtain a trained model;

[0042] The solution module is used to input the vehicle path information into the trained model to solve the vehicle path problem and obtain the shortest path.

[0043] In a third aspect, an embodiment of the present invention further provides an intelligent terminal, wherein the intelligent terminal includes a memory, a processor, and a vehicle path problem solving program based on a self-lifting mechanism stored in the memory and executable on the processor, and when the processor executes the vehicle path problem solving program based on a self-lifting mechanism, the steps of the vehicle path problem solving method based on a self-lifting mechanism as described in any one of the above items are implemented.

[0044] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein a vehicle routing problem solving program based on a self-lifting mechanism is stored on the computer-readable storage medium, and when the vehicle routing problem solving program based on a self-lifting mechanism is executed by a processor, the steps of the vehicle routing problem solving method based on a self-lifting mechanism as described in any one of the above items are implemented.

[0045] Beneficial effects: Compared with the prior art, the present invention provides a method for solving the vehicle routing problem based on a self-improvement mechanism. First, an initial solution model is generated by a random insertion algorithm, which can be trained directly on large-scale instances. Then, a local reconstruction strategy is adopted to generate enhanced solutions as pseudo-labels to guide model training, and the improved model can in turn promote local reconstruction to generate better solutions. Through iterative cycles, the self-improvement mechanism can continuously improve the performance of the model. At the same time, the linear complexity attention mechanism can significantly reduce the computational cost of training and inference, making it more suitable for solving large-scale vehicle routing problems. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0047] Figure 1 It is a flowchart of a method for solving a vehicle routing problem based on a self-lifting mechanism provided in an embodiment of the present invention.

[0048] Figure 2 It is a schematic diagram of the self-improvement learning process provided by an embodiment of the present invention.

[0049] Figure 3 Schematic diagram of the linear attention mechanism provided by an embodiment of the present invention.

[0050] Figure 4 It is a schematic diagram of a linear attention module provided by an embodiment of the present invention.

[0051] Figure 5 It is a schematic diagram of the model structure provided by an embodiment of the present invention.

[0052] Figure 6 It is a principle block diagram of a vehicle routing problem solving device based on a self-lifting mechanism provided in an embodiment of the present invention.

[0053] Figure 7 It is a block diagram of the internal structure principle of the intelligent terminal provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0054] In order to make the purpose, technical solution and effect of the present invention clearer and more specific, the present invention is further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0055] It will be understood by those skilled in the art that, unless expressly stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present invention refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when we refer to an element as being "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may be intermediate elements. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein includes all or any unit and all combinations of one or more associated listed items.

[0056] It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as generally understood by those skilled in the art in the art to which the present invention belongs. It should also be understood that terms such as those defined in general dictionaries should be understood to have meanings consistent with the meanings in the context of the prior art, and will not be interpreted with idealized or overly formal meanings unless specifically defined as herein.

[0057] The vehicle routing problem (VRP) is an important type of combinatorial optimization problem (COP) that has important practical value in many practical applications. Two examples of classic vehicle routing problems include:

[0058] (1) Traveling Salesman Problem (TSP): Given a set of cities and their coordinates, it is required to find a path starting from a starting city, visiting each city only once, and finally returning to the starting city, so that the total distance traveled is the shortest. The Traveling Salesman Problem appears in many practical applications, such as printed circuit board routing, drilling optimization, and lithography path planning tasks.

[0059] (2) Capacitated Vehicle Routing Problem (CVRP): The task is to deliver goods from a central warehouse to multiple customers. The vehicle has a certain load capacity, and each customer has specific cargo requirements. The goal is to plan the vehicle's delivery route while meeting the needs of all customers, so that the total driving distance of the vehicle is the shortest, while ensuring that the vehicle's load during the delivery process does not exceed its maximum capacity (that is, if the vehicle runs out of goods or cannot meet the needs of any remaining customers during the delivery process, it needs to return to the warehouse to replenish the goods). CVRP is widely used in various logistics and distribution systems, such as express delivery services, freight transportation, waste collection and other fields. By optimizing the vehicle's route planning, transportation costs can be significantly reduced, resource utilization can be improved, and overall operational efficiency can be enhanced.

[0060] Among the solutions to vehicle routing problems, learning-based neural combinatorial optimization methods are a promising approach to solve different vehicle routing problems (VRPs) without expert design. However, existing methods have difficulty handling large-scale problems, which seriously hinders their practical application in real applications.

[0061] This paper proposes a novel self-improved learning (SIL) method to overcome this limitation. Specifically, an effective self-improvement mechanism is proposed to directly train models on large-scale problem instances without any labeled data. With the support of reconstruction methods, this method can iteratively generate better solutions as pseudo-labels to guide effective model training. In addition, this paper designs a linear complexity attention mechanism for the model to efficiently process large-scale problem instances with low computational overhead.

[0062] Exemplary Methods

[0063] This embodiment provides a method for solving the vehicle routing problem based on a self-lifting mechanism. Figure 1 As shown, the method comprises the following steps:

[0064] Step S100, obtaining vehicle path information;

[0065] Specifically, the vehicle routing information in the basic vehicle routing problem includes the number of customer points (excluding the starting point), the number of vehicles, and the distance or cost between customer points. The constraints are that each customer point must be visited and only visited once, and the path of each vehicle must start from the starting point and end at the end point, where the vehicle can ignore the capacity limit, but still needs to find a path plan that minimizes the total driving distance or cost to visit all customer points. The capacity-constrained vehicle routing problem also needs to consider the capacity limit of each vehicle, and the goal of the problem is to find a vehicle allocation plan so that each vehicle starts from a starting point, visits a series of customer points along the way, and finally returns to the starting point.

[0066] Step S200: generating an initial pseudo-label, and obtaining an initial model according to the initial pseudo-label, wherein the initial model includes an encoder and a decoder, and the decoder updates a graph node embedding vector set through a linear attention module;

[0067] Specifically, in this embodiment, a VRP instance S can be represented by a graph with n nodes, where node i∈{1,...,n} is represented by the feature Indicates. Taking TSP as an example, is the coordinate of node i, d x = 2. We define a solution, also called a path π = (π1, π2, ..., π n ), as a permutation of nodes. Partial solution π p Defined as a continuous subset of π. The goal of VRP is to find a path with the minimum cost (total length).

[0068] In one implementation, step S200 in this embodiment includes the following steps:

[0069] Step S201: construct an initial model, wherein the initial model includes an encoder and a decoder, the decoder includes a linear attention module, and the linear attention module is used for aggregation and broadcasting of key information;

[0070] In one implementation, the encoder in step S201 is used to:

[0071] Step S2011, extracting input node features according to the vehicle path information;

[0072] Step S2012: linearly project the input node features to obtain a node embedding vector;

[0073] Step S2013: pass the node embedding vector to the decoder.

[0074] Specifically, Figure 5As shown, the initial solution model uses an encoder-decoder neural network to construct a solution. The encoder is for each input node feature x i Generate node embedding vector h i . Using these node embedding vectors, the decoder captures the correlation between nodes at each step and predicts a selection probability for each unvisited node. The unvisited node corresponding to the maximum selection probability will be added to the end of the current incomplete solution until all nodes are visited, at which time a complete solution is obtained, which is returned as the output of the model. Initially all nodes are unvisited. During the solution construction process, the selected nodes are marked as visited, and the first and most recently visited nodes are called the starting point and previous node, respectively. For example, if the current partial solution at any step t is (π1, π2, ..., π t-1 ), then π1 is the starting point, and π t-1 It is the previous node.

[0075] In this embodiment, the function of the model's encoder is to generate an embedding vector h for each node through linear projection i , i = {1, ..., n}:

[0076] h i =x i W (0) +b (0) ,

[0077] in and is a learnable parameter.

[0078] Step S202: generate initial pseudo labels, train the initial model through the initial pseudo labels, and obtain an initial solution according to the initial pseudo labels.

[0079] Specifically, at the beginning of training, the model parameters of the initial solution model are randomly initialized, and the pseudo-labels can be generated by some simple and general heuristic methods, such as random insertion algorithm, nearest neighbor algorithm (KNN), etc. The random insertion algorithm randomly selects an unvisited point in each step of the solution construction process, and then inserts it into a position in the current incomplete solution, which minimizes the length growth of the current incomplete solution. The nearest neighbor algorithm selects the unvisited node closest to the previous node in each step of the solution construction process, and then inserts it into the end of the current incomplete solution. In this embodiment, a random insertion algorithm is used to generate the initial solution to initialize the label.

[0080] Step S300: iteratively train the initial model through a self-boosting mechanism to obtain a trained model:

[0081] Specifically, since existing models usually adopt self-attention mechanisms with high complexity, it is costly to apply self-boosting learning to existing models to solve large-scale problems. We propose a linear complexity attention mechanism to overcome this challenge.

[0082] As attached Figure 3 As shown in , the self-attention mechanism allows each input node to fully interact with all other nodes to perceive all data information. During the construction process, different nodes contribute differently to model decisions. This embodiment adopts a linear attention model design. Figure 4 As shown, the proposed linear attention mechanism utilizes a certain number of representative nodes to aggregate the key information of the graph and broadcasts this information to all nodes, which effectively eliminates the need for exhaustive pairwise computation between all nodes in the traditional self-attention process, thus achieving linear complexity.

[0083] In one implementation, step S300 in this embodiment includes the following steps:

[0084] Step S301, partially reconstructing the initial solution through the initial model to obtain an enhanced solution;

[0085] In one implementation, step S301 in this embodiment includes the following steps:

[0086] Step S3011, preset partial solution length;

[0087] Step S3012, sampling the initial solution according to the length of the partial solution to obtain an initial partial solution;

[0088] Step S3013, reordering the nodes in the partial solution to obtain an enhanced partial solution;

[0089] Step S3014: Replace the initial partial solution in the initial solution with the enhanced partial solution to obtain the enhanced solution.

[0090] Specifically, this embodiment limits the learning scope of the model to the local part of the solution through local reconstruction. The model learning construction size is ω~Uniform(4,l max ), where l max is a hyperparameter, which is the upper limit of the length of the partial solution learned by the model. In this embodiment, the partial solution is expressed as Where ω represents the length of the sampled partial solution, and the value of ω is in the range [4, l max], p represents the local solution. Under the supervision of pseudo labels, the model learns to predict arrive The correct order of the partial solution is and is fixed. Therefore, the loss function can be written as follows:

[0091]

[0092] in represents the end node of the partial solution, represents the node sequence visited before step t, and θ represents the model parameters. Represents the sequence of nodes visited before step t given the information of instance S at the current step t In the case of a node that represents the end of a partial solution, the model predicts that the next node is a node that represents the partial solution. If this probability is small, the loss will be large, indicating that the model is not performing well at this time; if this probability is large, the loss will be small, indicating that the model is performing well at this time. According to this loss function, an optimizer such as ADAM is used to calculate the gradient value, and then the model parameters are updated using the gradient descent method. In this way, the model gradually learns the construction process of partial solutions. The improved model further strengthens the ability of local reconstruction to generate better solutions.

[0093] Step S302: using the enhanced solution as a pseudo label, and training the initial model according to the pseudo label to obtain a trained model;

[0094] Step S303, updating the initial solution according to the enhanced solution, updating the initial model according to the trained model, and re-performing the step of partially reconstructing the initial solution through the initial model to obtain an enhanced solution, until a preset termination condition is reached;

[0095] Step S304: When the preset termination condition is reached, the trained model is obtained.

[0096] Specifically, each local reconstruction iteration consists of two steps. In the first step, a uniform (4, l max ) solution fragment π p , where l max Determine the maximum length of the partial solution. Since π can be represented as a circle, the sampling direction can be randomly selected, clockwise or counterclockwise. In the second step, the model reconstructs the partial solution node by node from the first node to the last node, that is, rearranges the nodes between the first node and the last node for each partial solution. The resulting new partial solution πp′ With π p The comparison is done and the better parts, e.g., the parts with shorter length, are retained. The retained partial solutions are merged back into π to form a complete solution. By iterative local reconstruction, the quality of the solution can be continuously improved.

[0097] In order to improve the reconstruction efficiency, M non-overlapping partial solutions are sampled and reconstructed in parallel. In this embodiment, M is set to Where N represents the problem size. During the entire self-boosting training process, a dataset consisting of multiple instance-solution pairs is maintained. In each self-boosting cycle, the solutions in the dataset are locally reconstructed to gradually improve their quality, which also avoids revisiting previously explored solutions, thereby improving efficiency.

[0098] In one implementation, the step S200 further includes:

[0099] Step M201, selecting a representative node from the partial solution;

[0100] Step M202: obtaining a graph node embedding vector set and a representative node embedding vector set through the encoder, wherein the decoder includes a plurality of linear attention modules;

[0101] Step M203, aggregating the graph node embedding vectors through the attention layer and the representative node embedding vectors in the linear attention module to obtain an updated representative node embedding vector set, and broadcasting the updated representative node embedding vector set to the graph node embedding vector set to obtain an intermediate graph node embedding vector set; wherein the attention layer includes a multi-head attention sublayer and a node feedforward sublayer;

[0102] Step M204: combining the updated representative node embedding vector set with the intermediate graph node embedding vector set as the input of the next linear attention module, and obtaining an updated graph node embedding vector set through the output of the last linear attention module;

[0103] Step M205: Obtain the selection probability of each unvisited node according to the updated graph node embedding vector set, wherein the selection probability is used to select the next unvisited node.

[0104] Specifically, this embodiment designs a lightweight linear attention mechanism to more effectively integrate information between nodes. Figure 2 As shown in the figure, a certain number of representative nodes are used to adaptively distinguish nodes with larger and smaller influence weights in the graph and aggregate key information. Then, these representative nodes broadcast key information to all nodes, thereby achieving fast and efficient updates.

[0105] In one implementation, in the t-th decoding step, for the current partial solution (π1, ..., π t-1 ), select the starting node π1 and the previous node π t-1 As representative nodes, because they indicate the most important information: the start and end position of the current partial solution.

[0106] Specifically, we therefore designed Figure 3 The linear attention module shown in Figure 2. At the t-th step of decoding, the embedding vectors of the first and last nodes are and The set of embedding vectors of unvisited nodes is Initial representative node embedding vector set Z (0) and graph node embedding vector set for:

[0107]

[0108] where [·,·] is the vertical join operator, is a learnable parameter. Then and Processed by L linear attention modules. For l=1,...,L, the operation performed by the lth linear attention module can be formulated as follows:

[0109]

[0110] in and

[0111] The AttnLayer in the above formula is the attention layer, which is widely used in NCO to solve the VRP problem. Its function is to enable the model to capture the relationship between nodes. It mainly includes the multi-head attention (MHA) sublayer and the node feedforward (FF) sublayer. Each sublayer is followed by a skip connection and normalization (Norm). We will and Represented as the input of the attention layer, is the output of the attention layer, which is calculated as follows:

[0112]

[0113] Here, X is often referred to as the query matrix (Q), and Y is both the key (K) matrix and the value (V) matrix.

[0114] To describe the multi-head attention (MHA) sublayer, we first describe the single-head attention function as follows:

[0115]

[0116] in, is a learnable parameter. The multi-head attention sublayer applies the single-head attention function h times in parallel, and each single-head attention parameter uses independent parameters:

[0117] MHA(A,B)=Concat(head1,...,head h )W O

[0118] head i =Attn i (A, B)

[0119] For each Attn i (A, B), d k =d v =d / h. is a learnable parameter.

[0120] The formula for the feed-forward sublayer is as follows:

[0121] FF(A)=max(0,AW1+b1)W2+b2,

[0122] in and is a learnable parameter. Equation (1) represents the aggregation process, which transforms The information is integrated into Z (l-1) For each element of Z (l) Equation (2) represents the broadcast process, which will come from Z (l) Information broadcast to Each element of These processes use a specific number of representative nodes to integrate all node information with each other, but avoid exhaustive pairwise calculations between all nodes, thereby achieving linear computational complexity.

[0123] The output of the Lth linear attention module is Z(L) and It can be expressed as:

[0124]

[0125] It represents the relationship between the start, previous node, and unvisited nodes. (L) , it only plays the role of aggregating and broadcasting node information during the decoding process and will not participate in the subsequent process.

[0126] In one implementation, step M205 in this embodiment includes the following steps:

[0127] Step M2051, linearly project the updated graph node embedding vector set to obtain a projection vector;

[0128] Step M2052: Use the projection vector as the input of the softmax function to calculate the selection probability of each unvisited node.

[0129] Specifically, linear projection and softmax function are applied to Generate the selected probability of each unvisited node. Before softmax calculation, the starting point and previous node are masked.

[0130]

[0131]

[0132] in is a learnable parameter. Each p i , i≠1or2 represents the probability of an unvisited node being selected. The most suitable node π t According to {p i , i = 1, ..., m} (select the node with the highest probability), where m is the number of unvisited points in the current step. By continuously calling the decoder n times, a complete solution π = (π1, ..., π n ).

[0133] Specifically, the linear attention mechanism utilizes a certain number of representative nodes to aggregate the key information of the graph and broadcasts this information to all nodes, effectively eliminating the need for explicit computation between all nodes in the traditional self-attention process, thus achieving linear complexity.

[0134] Step S400: input the vehicle path information into the trained model to solve the vehicle path problem and obtain the shortest path.

[0135] In one implementation, this embodiment solves the shortest path for the CVRP problem, and the steps are as follows:

[0136] First, define the problem as follows: An instance of the CVRP problem consists of a warehouse node and n customer nodes, where each customer node i has a demand δ that needs to be satisfied i Solving the CVRP problem requires finding a set of subtrips that start and end at the warehouse while ensuring that the sum of customer demands in each subtrip is less than the maximum capacity of the vehicle. The goal of solving the CVRP problem is to minimize the total distance of these subtrips.

[0137] Build a feasible CVRP solution representation format. Instead of treating warehouse access as a separate step, use binary variables to represent whether a client node is accessed via a warehouse or via another client node. In a feasible solution, assign a 1 to a client node if it is accessed via a warehouse and a 0 if it is accessed via another client node. For example, a feasible CVRP solution {0, 1, 2, 3, 0, 4, 5, 0, 6, 7, 0, 8, 9, 10}, where 0 represents a warehouse, can be represented as follows:

[0138]

[0139] The first row shows the sequence of nodes visited, while the second row indicates whether each node was visited after a warehouse or another customer node. This solution representation scheme aims to keep different solution representations consistent. For the CVRP problem, solutions with the same number of customer nodes may have different numbers of warehouse visits, resulting in different lengths of solutions for problems of the same size. This representation scheme prevents such problems.

[0140] Definition of encoder: In a CVRP instance S with n nodes, the node features (x1, ..., x n ) represents the two-dimensional coordinates and one-dimensional demand of n nodes in the graph. The demand of the warehouse node is set to 0. For simplicity, we normalize the maximum capacity of the vehicle D to The demand δ i Normalized to The function of the model's encoder is to generate an embedding vector h for each node through linear projection i , i = {1, ..., n}:

[0141] h i =x i W (0) +b (0) ,

[0142] in and is a learnable parameter.

[0143] Decode the decoder: Add the dynamically changing remaining capacity to the embedding vectors of the start node and the previous node. During the construction process, the start node is always the warehouse node, and the previous node is the customer node visited in the previous step. The remaining capacity is expressed as The embedding vectors of the starting node and the previous node are and The remaining capacity information is fused into the embedding vectors of the starting node and the previous node in the following way:

[0144]

[0145] where [·,·] is the horizontal join operator, and is a learnable parameter.

[0146] Then calculate the initial embedding set Z of the representative nodes (0) The initial embedding set of graph nodes As shown below:

[0147]

[0148] in is the embedding set of unvisited nodes.

[0149] Similar to the case of TSP, the output of the Lth layer of the model is Z(L) and It can be expressed as:

[0150]

[0151] It represents the relationship of the entire graph nodes. Then, linear projection and softmax function are applied to it to produce the selected probability of each unvisited node. Before softmax calculation, the starting and previous nodes are masked:

[0152]

[0153] in is a learnable parameter. For each customer node, we need to predict whether it arrives from the warehouse or from the customer node, so here u i is a two-dimensional vector. Each Corresponding to the two states of client node i: accessed through the warehouse or client node. It corresponds to the symbols in equation (3).

[0154] Then is flattened to Applying a softmax function to U′ yields the chosen probability of each action associated with the corresponding unvisited node:

[0155]

[0156] According to p i Determine the most appropriate node and its associated action (either through the warehouse or the last node visited). Build the complete solution incrementally by calling decoders.

[0157] We denote TSP and CVRP instances with 1,000 to 100,000 nodes as TSP / CVRP1K, 5K, 10K, 50K, and 100K, respectively. The node coordinate values ​​of all instances are uniformly sampled in the region [0, 1]. The training dataset sizes for 1K, 5K / 10K, and 50K / 100K are 10K, 200, and 100, respectively. Customer demands for all CVRP scales are randomly sampled from the set {1, 2, …, 9}, with the capacity of CVRP1K set to 250, the capacity of CVRP5K set to 500, the capacity of CVRP10K set to 1,000, and the capacity of CVRP50K / 100K set to 2,000.

[0158] During the training process, a model is trained using the self-boosting learning method on each dataset of each scale. Each self-boosting learning iteration includes 100 local reconstructions of the solutions of all instances in the training dataset and 20 rounds of model training (one round is the process of training the model by extracting all the data in a dataset batch by batch without repetition). Due to device memory limitations, larger datasets such as TSP100K and CVRP100K use smaller batch sizes (i.e., 16). Smaller datasets such as TSP1K and CVRP1K use larger batch sizes (i.e., 512). Larger datasets such as TSP / CVRPSK, 10K, and 50K use a batch size of 32. During the local reconstruction and training phase, some solutions are trained. max The maximum length of is kept at 1000 to balance time efficiency and effect. Extensive experiments are conducted on TSP and CVRP with up to 100K nodes in uniform distribution and real distribution. The results show that SIL has excellent performance.

[0159] Exemplary Devices

[0160] like Figure 6 As shown in , this embodiment also provides a vehicle path problem solving device based on a self-lifting mechanism, the device comprising:

[0161] The vehicle path information acquisition module 10 is used to acquire the vehicle path information;

[0162] An initial model generation module 20 is used to generate an initial pseudo label, and obtain an initial model according to the initial pseudo label, wherein the initial model includes an encoder and a decoder, and the decoder updates the graph node embedding vector set through a linear attention module;

[0163] A model training module 30, for iteratively training the initial solution model through local reconstruction and linear complexity attention mechanism to obtain a complete solution model;

[0164] The solution module 40 is used to input the vehicle path information into the complete solution model for solution to obtain the shortest path.

[0165] In one implementation, the initial model generation module 10 includes:

[0166] A model construction unit, used to construct an initial model, wherein the initial model includes an encoder and a decoder, the decoder includes a linear attention module, and the linear attention module is used for aggregation and broadcasting of key information;

[0167] The model initialization unit is used to generate initial pseudo labels, train the initial model through the initial pseudo labels, and obtain an initial solution according to the initial pseudo labels.

[0168] In one implementation, the model construction unit includes:

[0169] A feature extraction subunit, used to extract input node features according to the vehicle path information;

[0170] A linear projection subunit, used to perform linear projection on the input node features to obtain a node embedding vector;

[0171] The vector transfer subunit is used to transfer the node embedding vector to the decoder.

[0172] In one implementation, the model training module 30 includes:

[0173] A local reconstruction unit, used for locally reconstructing the initial solution through an initial model to obtain an enhanced solution;

[0174] A model training unit, configured to use the enhanced solution as a pseudo label and train the initial model according to the pseudo label to obtain a trained model;

[0175] an iterative training unit, configured to update the initial solution according to the enhanced solution, update the initial model according to the trained model, and re-execute the step of partially reconstructing the initial solution through the initial model to obtain an enhanced solution, until a preset termination condition is reached;

[0176] The iterative termination unit is used to obtain the trained model when a preset termination condition is reached.

[0177] In one implementation, the local reconstruction unit further includes:

[0178] A partial solution length presetting subunit is used to presetting the partial solution length;

[0179] An initial partial solution acquisition subunit is used to sample the initial solution according to the partial solution length to obtain an initial partial solution;

[0180] An enhanced partial solution obtaining subunit, used for reordering the nodes in the partial solution to obtain an enhanced partial solution;

[0181] The enhanced solution acquisition subunit is used to replace the initial partial solution in the initial solution with the enhanced partial solution to obtain the enhanced solution.

[0182] In one implementation, the initial model generation module 20 further includes:

[0183] A representative node selection unit, used for selecting a representative node from the partial solution;

[0184] A vector acquisition unit, used to acquire a graph node embedding vector set and a representative node embedding vector set through the encoder, wherein the decoder includes a plurality of linear attention modules;

[0185] A node updating unit, configured to aggregate the graph node embedding vectors through the attention layer in the linear attention module and the representative node embedding vectors to obtain an updated representative node embedding vector set, and broadcast the updated representative node embedding vector set to the graph node embedding vector set to obtain an intermediate graph node embedding vector set; wherein the attention layer includes a multi-head attention sublayer and a node feedforward sublayer;

[0186] A graph node embedding vector set updating unit, used to combine the updated representative node embedding vector set with the intermediate graph node embedding vector set as input of the next linear attention module, and obtain an updated graph node embedding vector set through the output of the last linear attention module;

[0187] A selection probability acquisition unit is used to obtain the selection probability of each unvisited node according to the updated graph node embedding vector set, wherein the selection probability is used to select the next unvisited node.

[0188] In one implementation, the selected probability acquisition unit includes:

[0189] A projection subunit, configured to linearly project the updated graph node embedding vector set to obtain a projection vector;

[0190] The selected probability acquisition subunit is used to use the projection vector as the input of the softmax function to calculate the selected probability of each unvisited node.

[0191] Based on the above embodiments, the present invention further provides an intelligent terminal, whose principle block diagram can be shown as follows: Figure 7As shown. The intelligent terminal includes a processor, a memory, a network interface, a display screen, and a temperature sensor connected through a system bus. Among them, the processor of the intelligent terminal is used to provide computing and control capabilities. The memory of the intelligent terminal includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the intelligent terminal is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for solving a vehicle path problem based on a self-lifting mechanism is implemented. The display screen of the intelligent terminal can be a liquid crystal display screen or an electronic ink display screen, and the temperature sensor of the intelligent terminal is pre-set inside the intelligent terminal to detect the operating temperature of the internal equipment.

[0192] Those skilled in the art will understand that Figure 7 The principle block diagram shown in the figure is only a block diagram of a partial structure related to the scheme of the present invention, and does not constitute a limitation on the smart terminal to which the scheme of the present invention is applied. A specific smart terminal may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0193] In one embodiment, a smart terminal is provided. The smart terminal includes a memory, a processor, and a vehicle routing problem solving program based on a self-elevation mechanism stored in the memory and executable on the processor. When the processor executes the vehicle routing problem solving program based on the self-elevation mechanism, the following operation instructions are implemented:

[0194] Get vehicle path information;

[0195] Generate an initial pseudo-label, and obtain an initial model according to the initial pseudo-label, wherein the initial model includes an encoder and a decoder, and the decoder updates a graph node embedding vector set through a linear attention module;

[0196] Iteratively train the initial model through a self-boosting mechanism to obtain a trained model;

[0197] The vehicle path information is input into the trained model to solve the vehicle path problem and obtain the shortest path.

[0198] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing related hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, operating database or other media used in the embodiments provided by the present invention may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double operational data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0199] In summary, the present invention discloses a method for solving a vehicle path problem based on a self-boosting mechanism, the method comprising: obtaining vehicle path information; generating an initial pseudo-label, and obtaining an initial model according to the initial pseudo-label; iteratively training the initial model through a self-boosting mechanism to obtain a trained model; inputting the vehicle path information into the trained model to solve the vehicle path problem and obtain the shortest path. The present invention enhances and refines iterative training through local reconstruction, and improves the training and reasoning efficiency of the self-boosting mechanism on large-scale instances through a linear attention mechanism, greatly reducing the computational cost.

[0200] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for solving vehicle routing problems based on a self-lifting mechanism, characterized in that: The method comprises: Get vehicle path information; Generate an initial pseudo-label, and obtain an initial model according to the initial pseudo-label, wherein the initial model includes an encoder and a decoder, and the decoder updates a graph node embedding vector set through a linear attention module; Iteratively train the initial model through a self-boosting mechanism to obtain a trained model; The vehicle path information is input into the trained model to solve the vehicle path problem and obtain the shortest path.

2. The method for solving the vehicle routing problem based on the self-lifting mechanism according to claim 1 is characterized in that: The generating of the initial pseudo-labels and obtaining an initial model according to the initial pseudo-labels and the vehicle path information includes: Constructing an initial model, wherein the initial model includes an encoder and a decoder, the decoder includes a linear attention module, and the linear attention module is used for aggregation and broadcasting of key information; Initial pseudo labels are generated, the initial model is trained using the initial pseudo labels, and an initial solution is obtained based on the initial pseudo labels.

3. The method for solving the vehicle routing problem based on the self-lifting mechanism according to claim 2 is characterized in that: The encoder is used to: Extracting input node features according to the vehicle path information; Performing linear projection on the input node features to obtain a node embedding vector; The node embedding vector is passed to the decoder.

4. The method for solving the vehicle routing problem based on the self-lifting mechanism according to claim 2 is characterized in that: The iterative training of the initial model through the self-boosting mechanism to obtain a trained model includes: Partially reconstructing the initial solution through the initial model to obtain an enhanced solution; Using the enhanced solution as a pseudo label, training the initial model according to the pseudo label to obtain a trained model; Updating the initial solution according to the enhanced solution, updating the initial model according to the trained model, and re-performing the step of partially reconstructing the initial solution by the initial model to obtain an enhanced solution, until a preset termination condition is reached; When the preset termination condition is reached, the trained model is obtained.

5. The method for solving the vehicle routing problem based on the self-lifting mechanism according to claim 4 is characterized in that: The partially reconstructing the initial solution through the initial model to obtain an enhanced solution includes: Preset partial solution length; Sampling the initial solution according to the partial solution length to obtain an initial partial solution; Reordering the nodes in the initial partial solution to obtain an enhanced partial solution; The enhanced partial solution is used to replace the initial partial solution in the initial solution to obtain the enhanced solution.

6. The method for solving the vehicle routing problem based on the self-lifting mechanism according to claim 5 is characterized in that: The decoder updates the graph node embedding vector set through a linear attention module, including: selecting a representative node from the partial solution; Obtaining a graph node embedding vector set and a representative node embedding vector set through the encoder, wherein the decoder includes a plurality of linear attention modules; Aggregating the graph node embedding vectors through the attention layer in the linear attention module and the embedding vectors of the representative nodes to obtain an updated representative node embedding vector set, and broadcasting the updated representative node embedding vector set to the graph node embedding vector set to obtain an intermediate graph node embedding vector set, wherein the attention layer includes a multi-head attention sublayer and a node feedforward sublayer; Combining the updated representative node embedding vector set with the intermediate graph node embedding vector set as the input of the next linear attention module, and obtaining an updated graph node embedding vector set through the output of the last linear attention module; According to the updated graph node embedding vector set, a selection probability of each unvisited node is obtained, wherein the selection probability is used to select the next unvisited node.

7. The method for solving the vehicle routing problem based on the self-lifting mechanism according to claim 6 is characterized in that: The step of obtaining the selection probability of each unvisited node according to the updated graph node embedding vector set includes: Linearly project the updated graph node embedding vector set to obtain a projection vector; The projection vector is used as the input of the softmax function to calculate the selection probability of each unvisited node.

8. A vehicle routing problem solving device based on a self-lifting mechanism, characterized in that: The device comprises: A vehicle path information acquisition module is used to acquire vehicle path information; An initial model generation module is used to generate an initial pseudo label, and obtain an initial model according to the initial pseudo label, wherein the initial model includes an encoder and a decoder, and the decoder updates the graph node embedding vector set through a linear attention module; A model training module, used for iteratively training the initial model through a self-boosting mechanism to obtain a trained model; The solution module is used to input the vehicle path information into the trained model to solve the vehicle path problem and obtain the shortest path.

9. An intelligent terminal, characterized in that: The intelligent terminal includes a memory, a processor, and a vehicle routing problem solving program based on a self-lifting mechanism stored in the memory and executable on the processor. When the processor executes the vehicle routing problem solving program based on a self-lifting mechanism, the steps of the vehicle routing problem solving method based on a self-lifting mechanism as described in any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a vehicle routing problem solving program based on a self-lifting mechanism. When the vehicle routing problem solving program based on a self-lifting mechanism is executed by a processor, the steps of the vehicle routing problem solving method based on a self-lifting mechanism as described in any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Scene graph generation method based on transformer model and category association

    CN114782791A

  • Multi-constraint vehicle path planning method based on attention mechanism and deep reinforcement learning

    CN115759915A

  • Method and device for generating solution of vehicle path problem

    CN117073703A

  • Vehicle path optimization method and system based on deep reinforcement learning

    CN117371637A

  • Fresh food delivery vehicle path planning method based on multi-agent deep reinforcement learning

    CN118153789A