A vehicle routing problem solving method and device based on a self-lifting mechanism

By training the model using a self-boosting mechanism and a linear complexity attention mechanism, the problem of efficiently solving large-scale VRP problems is solved, achieving efficient training and low-cost solution in the case of unlabeled data.

CN119886479BActive Publication Date: 2026-02-27SOUTHERN UNIVERSITY OF SCIENCE AND TECHNOLOGY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411723384.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-28
Publication Date
2026-02-27
Estimated Expiration
2044-11-28

AI Technical Summary

Technical Problem

Existing neural combinatorial optimization methods cannot be directly trained for large-scale vehicle routing problems, resulting in poor performance when solving large-scale VRP problems and high computational complexity, making it difficult to achieve efficient solutions in practical applications.

Method used

We employ a self-boosting mechanism, training the model by generating initial pseudo-labels and a local reconstruction strategy, and combining it with a linear complexity attention mechanism to progressively improve the model to solve large-scale VRP problems. We utilize self-boosting learning methods to iteratively generate better solutions in the case of unlabeled data.

Benefits of technology

It achieves efficient model training on large-scale VRP problems, reduces computational costs, improves solution quality, and is applicable to solving large-scale vehicle routing problems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119886479B_ABST
    Figure CN119886479B_ABST
Patent Text Reader

Abstract

The application discloses a vehicle path problem solving method based on a self-promotion mechanism, and 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 the self-promotion mechanism to obtain a trained model; inputting the vehicle path information into the trained model to solve the vehicle path problem and obtain a shortest path. The application enhances and refines the iterative training through local reconstruction, improves the self-promotion mechanism training and reasoning efficiency on large-scale instances through a linear attention mechanism, and greatly reduces the calculation cost.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of artificial intelligence, and particularly relates to a vehicle routing problem solving method and device based on a self-promotion mechanism. BACKGROUND

[0002] Vehicle Routing Problem (VRP) is an important problem in the fields of transportation, distribution and logistics. Its essence is a classical combinatorial optimization problem, involving how to effectively allocate a group of vehicles to visit multiple customer points and minimize the total travel distance or cost under the condition of meeting the constraint conditions, and has important practical value.

[0003] At present, it is still very challenging to solve the vehicle routing problem. 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 vehicle routing problems, which have realized the strategy of learning to solve problems from data, thus eliminating the need for expensive manual algorithm design. Existing neural combinatorial optimization methods usually use supervised learning (Supervised Learning, SL) or reinforcement learning (Reinforcement Learning, RL) methods to train the model. On the one hand, the method based on supervised learning is limited by the difficulty of obtaining sufficient optimal labels, and on the other hand, the method based on reinforcement learning will face serious sparse reward problems when training large-scale problem instances, and has unacceptable GPU memory usage problems. These shortcomings limit the direct training method to train the model only on small-scale (up to 500 nodes) VRP. Existing neural combinatorial optimization methods cannot directly train large-scale vehicle routing problem models, resulting in poor performance in solving large-scale VRP problems, often producing low-quality solutions.

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

[0005] The technical problem to be solved by the present application is to provide a vehicle routing problem solving method and device based on a self-promotion mechanism, which can solve the problem that the prior art cannot directly train large-scale vehicle routing problem models.

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

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

[0008] obtaining vehicle path information;

[0009] generating an initial pseudo-label, obtaining an initial model according to the initial pseudo-label, wherein the initial model comprises an encoder and a decoder, and the decoder updates a set of graph node embedding vectors through a linear attention module;

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

[0011] inputting the vehicle path information into the trained model to solve a vehicle path problem to obtain a shortest path.

[0012] In an implementation manner, the generating an initial pseudo-label, obtaining an initial model according to the initial pseudo-label and the vehicle path information:

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

[0014] generating an initial pseudo-label, training the initial model through the initial pseudo-label, and obtaining an initial solution according to the initial pseudo-label.

[0015] In an implementation manner, the encoder is used for:

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

[0017] performing linear projection on the input node features to obtain node embedding vectors;

[0018] passing the node embedding vectors to the decoder.

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

[0020] performing local reconstruction on the initial solution through the initial model to obtain an enhanced solution;

[0021] taking 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-executing the performing local reconstruction on the initial solution through the initial model to obtain an enhanced solution until a preset termination condition is reached;

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

[0024] In an implementation manner, the locally reconstructing the initial solution by the initial model to obtain an enhanced solution comprises:

[0025] A preset partial solution length is determined.

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

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

[0028] Replacing the initial partial solution in the initial solution with the enhanced partial solution to obtain the enhanced solution.

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

[0030] Selecting a representative node in the partial solution.

[0031] Obtaining a set of graph node embedding vectors and a set of embedding vectors of the representative node through the encoder, wherein the decoder comprises a plurality of linear attention modules.

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

[0033] Combining the updated set of embedding vectors of the representative node and the intermediate set of graph node embedding vectors as inputs of a next linear attention module, and outputting an updated set of graph node embedding vectors through the last linear attention module.

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

[0035] In an implementation manner, the obtaining of the selection probability of each unvisited node according to the updated set of graph node embedding vectors comprises:

[0036] Linearly projecting the updated set of graph node embedding vectors to obtain a projection vector.

[0037] Taking the projection vector as an input of a softmax function to calculate the selection probability of each unvisited node.

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

[0039] a vehicle routing information acquisition module, configured to acquire vehicle routing information;

[0040] an initial model generation module, configured to generate an initial pseudo label, and obtain an initial model according to the initial pseudo label, wherein the initial model comprises an encoder and a decoder, and the decoder updates a set of graph node embedding vectors through a linear attention module;

[0041] a model training module, configured to iteratively train the initial model through a self-boosting mechanism, and obtain a trained model;

[0042] a solving module, configured to input the vehicle routing information into the trained model to solve a vehicle routing problem, and obtain a shortest path.

[0043] In a third aspect, an embodiment of the present application further provides an intelligent terminal, wherein the intelligent terminal comprises a memory, a processor, and a vehicle routing problem solving program based on a self-boosting mechanism stored in the memory and capable of running on the processor, and the processor implements the steps of the vehicle routing problem solving method based on a self-boosting mechanism as described in any one of the above aspects when executing the vehicle routing problem solving program based on a self-boosting mechanism.

[0044] In a fourth aspect, an embodiment of the present application further provides a computer readable storage medium, wherein the computer readable storage medium stores a vehicle routing problem solving program based on a self-boosting mechanism, and the processor implements the steps of the vehicle routing problem solving method based on a self-boosting mechanism when executing the vehicle routing problem solving program based on a self-boosting mechanism.

[0045] Advantages: Compared with the prior art, the present application provides a vehicle routing problem solving method based on a self-boosting mechanism, which firstly generates an initial solution model through a random insertion algorithm, and can directly train on large-scale instances; then, a local reconstruction strategy is adopted to generate an enhanced solution as a pseudo label to guide model training, and the improved model can in turn promote local reconstruction to generate a better solution, and through an iterative cycle, the self-boosting mechanism can continuously improve the performance of the model; at the same time, a 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 DRAWINGS

[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained from these drawings without creative labor.

[0047] Figure 1 is a flow diagram of a vehicle routing problem solving method based on a self-promotion mechanism provided by an embodiment of the present application.

[0048] Figure 2 is a self-promotion learning process diagram provided by an embodiment of the present application.

[0049] Figure 3 is a linear attention mechanism diagram provided by an embodiment of the present application.

[0050] Figure 4 is a linear attention mechanism diagram provided by an embodiment of the present application.

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

[0052] Figure 6 is a principle block diagram of a vehicle routing problem solving device based on a self-promotion mechanism provided by an embodiment of the present application.

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

[0054] In order to make the purpose, technical solutions and effects of the present application more clear and definite, the following will further describe the present application in detail with reference to the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, and are not used to limit the present application.

[0055] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the term “comprising” as used in this specification means the presence of the stated 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 say an element is “connected” or “coupled” to another element, it can be directly connected or coupled to the other element, or there may be intermediate elements. Furthermore, “connected” or “coupled” as used herein can include wireless connections or wireless coupling. The term “and / or” as used herein includes all or any units 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 used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. It should also be understood that terms such as those defined in general dictionaries should be understood to have the same meaning as in the context of the prior art, and should not be interpreted in an idealized or overly formal sense unless specifically defined as herein.

[0057] The Vehicle Routing Problem (VRP) is an important class of combinatorial optimization problems (COPs) with significant practical value in numerous real-world applications. Two classic examples of the VRP include:

[0058] (1) Traveling Salesman Problem (TSP): Given a set of cities and their coordinates, the goal is to find a path that starts from a given city, visits each city exactly once, and returns to the starting city, such that the total distance traveled is minimized. The TSP appears in many practical applications, such as PCB routing, drilling optimization, and lithography path planning.

[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, while each customer has a specific demand for goods. The goal is to plan the delivery route of the vehicle to meet all customer demands, while minimizing the total travel distance of the vehicle, and ensuring that the vehicle's load does not exceed its maximum capacity during delivery (i.e. if the vehicle's goods are delivered or cannot meet the demand of any remaining customer during delivery, it needs to return to the warehouse to replenish goods). CVRP is widely used in various logistics and distribution systems, such as express delivery, goods transportation, waste collection, etc. By optimizing the vehicle's path planning, transportation costs can be significantly reduced, resource utilization can be improved, and overall operational efficiency can be enhanced.

[0060] Among the solutions to the vehicle routing problem, learning-based neural combinatorial optimization methods are a promising approach that can solve different vehicle routing problems (VRP) without the need for expert design. However, existing methods struggle to handle large-scale problems, which severely hinders their practicality in real-world applications.

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

[0062] Exemplary method

[0063] The present embodiment provides a vehicle routing problem solving method based on a self-improvement mechanism. As shown in Figure 1 The method includes the following steps:

[0064] Step S100, obtaining vehicle routing 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, the distance or cost between customer points. The constraint condition is that each customer point must be visited and visited only once, the path of each vehicle must start from the starting point and end at the terminal point, wherein the vehicle can ignore the capacity limit, but still needs to find a path scheme to minimize the total travel distance or cost to visit all customer points. The capacity-limited 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 scheme so that each vehicle starts from a starting point, visits a series of customer points on the way, and finally returns to the starting point.

[0066] Step S200, generating an initial pseudo-label, 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 set of graph node embedding vectors through a linear attention module;

[0067] Specifically, in the embodiment, one VRP instance S can be represented by a graph with n nodes, wherein node i∈{1,...,n} is represented by features 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. A partial solution π p is defined as a contiguous subset of π. The goal of VRP is to find a path with minimum cost (total length).

[0068] In an implementation mode, the step S200 of the embodiment includes the following steps:

[0069] Step S201, 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 broadcast of key information;

[0070] In an implementation mode, the encoder in step S201 is used for:

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

[0072] Step S2012, performing linear projection on the input node features to obtain node embedding vectors;

[0073] Step S2013, passing the node embedding vectors to the decoder.

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

[0075] In this embodiment, the encoder of the model generates the 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 These are learnable parameters.

[0078] Step S202: Generate initial pseudo-labels, train the initial model using the initial pseudo-labels, and obtain the initial solution based on the initial pseudo-labels.

[0079] Specifically, at the beginning of training, the model parameters of the initial solution model are randomly initialized. Pseudo-labels can be generated using simple and general heuristics, such as random insertion or nearest neighbor (KNN) algorithms. Random insertion randomly selects an unvisited node at each step of the solution construction process and inserts it into a position in the current incomplete solution that minimizes the length increase of the incomplete solution. Nearest neighbor (KNN) selects the unvisited node closest to the previous node at each step of the solution construction process and inserts it at the end of the current incomplete solution. In this embodiment, random insertion is used to generate the initial solution to initialize the labels.

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

[0081] Specifically, since existing models typically employ highly complex self-attention mechanisms, applying self-boosting learning to existing models to solve large-scale problems is costly. We propose a linear complexity attention mechanism to overcome this challenge.

[0082] As attached Figure 3 As shown, 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 the model's decisions. This embodiment employs a linear attention model design. Figure 4 As shown, the proposed linear attention mechanism uses a certain number of representative nodes to aggregate key information of the graph and broadcasts this information to all nodes, thereby effectively eliminating 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 of this embodiment includes the following steps:

[0084] Step S301: The initial solution is partially reconstructed using the initial model to obtain an enhanced solution;

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

[0086] Step S3011: Preset the length of the partial solution;

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

[0088] Step S3013: Reorder 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 restricts the learning scope of the model to a local part of the solution through local reconstruction. The model learns and constructs a size of ω ~ Uniform(4, l). max Partial solution of ), where l max is a hyperparameter, representing the upper bound on the length of the partial solutions learned by the model. In this embodiment, the partial solutions are represented as... Where ω represents the length of the sampled partial solution, and the value of ω is in the range [4, l]. maxThis interval, p represents the partial solution. Under the supervision of pseudo labels, the model learns to predict the correct order from to , where the end nodes and of the partial solution are fixed. Therefore, the loss function can be written as follows:

[0091]

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

[0093] Step S302, the enhanced solution is used as a pseudo label, and the initial model is trained 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-executing the step of locally reconstructing the initial solution by 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 includes two steps. First, a solution fragment π max is sampled from π, where ω ~ Uniform(4, l p , and l max determines the maximum length of the partial solution. Since π can be represented as a circle, the sampling direction can be randomly selected, clockwise or counterclockwise. The second step, the model reconstructs the partial solution node by node from the first node to the last node, i.e., rearranges the nodes between the first node and the last node for each partial solution. The new partial solution πp′ with p p The better parts are kept, e.g. the shorter parts, and compared. The kept parts are unmerged back into p to form a complete solution. The quality of the solution can be improved by iteratively local reconstruction.

[0097] To improve the reconstruction efficiency, M non-overlapping partial solutions are reconstructed in parallel. In this embodiment, M is set to where N represents the problem size. Throughout the self-lifting training process, a dataset consisting of multiple instance-solution pairs is maintained. In each self-lifting cycle, the solutions in the dataset are continuously subjected to the local reconstruction process to gradually improve their quality, and the previously explored solutions are avoided from being re-accessed, thereby improving the efficiency.

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

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

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

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

[0102] Step M204, combining the updated set of representative node embedding vectors and the intermediate set of graph node embedding vectors as the input of the next linear attention module, and outputting an updated set of graph node embedding vectors through the last linear attention module;

[0103] Step M205, obtaining a selected probability of each unvisited node according to the updated set of graph node embedding vectors, wherein the selected probability is used to select the next unvisited node.

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

[0105] In an implementation, in the t-th decoding step, for the current partial solution (pi1,..., pim), the starting pi1 and the last node pim-1 are selected as the representative nodes, as they indicate the most important information: the start and end positions of the current partial solution. t-1 t-1 As representative nodes, because they indicate the most important information: the start and end positions of the current partial solution.

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

[0107]

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

[0109]

[0110] where and

[0111] AttnLayer in the above formula is an attention layer, which is widely used in NCO to solve VRP problems. Its role is to enable the model to capture the relationship between nodes. It mainly includes a multi-head attention (MHA) sublayer and a node feed-forward (FF) sublayer. Each sublayer is followed by a skip connection and normalization (Norm). We denote and as the inputs of the attention layer, as the output of the attention layer, which is calculated as follows:

[0112]

[0113] Here, X is usually referred to as the query matrix (Q), while 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, These are learnable parameters. The multi-head attention sublayer applies the single-head attention function in parallel h times, with each single-head attention parameter using 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. These are learnable parameters.

[0120] The formula for the feedforward sublayer is shown below:

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

[0122] in and These are learnable parameters. Equation (1) represents the polymerization process, which will come from... Information fusion into Z (l-1) For each element, obtain Z (l) Equation (2) represents the broadcasting process, which will come from Z. (l) Information broadcast to Each element produces These processes use a specific number of representative nodes to integrate information from all nodes, but avoid exhaustive pairwise computations between all nodes, thus achieving linear computational complexity.

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

[0124]

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

[0126] In one implementation, step M205 of 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, take the projection vector as the input of the softmax function to calculate the selected probability of each unvisited node.

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

[0130]

[0131]

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

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

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

[0135] In an embodiment, the present embodiment solves the shortest path of the CVRP problem, and the steps are as follows:

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

[0137] Establish a feasible CVRP solution representation format. Instead of treating repository access as a separate step, use binary variables to indicate whether a client node accesses the repository or another client node. In a feasible solution, a 1 is assigned to the client node if access is via a repository, and a 0 is assigned if access is 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 repository, can be represented as follows:

[0138]

[0139] The first line shows the sequence of nodes visited, while the second line indicates whether each node was visited after the repository or after another client node. This solution representation scheme aims to maintain consistency across different solution representations. For the CVRP problem, solutions with the same number of client nodes may have different numbers of repository visits, resulting in solutions of the same size having different lengths. This representation scheme prevents such problems.

[0140] Define the encoder: In a CVRP instance S with n nodes, the node features (x1, ..., x2) are defined as follows: n () represents the two-dimensional coordinates and one-dimensional demand of n nodes in the graph. The demand for warehouse nodes is set to 0. For simplicity, we normalize the maximum vehicle capacity D to... Demand δ i Normalization The encoder of the model generates the 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 These are learnable parameters.

[0143] Define the decoder: Add dynamically changing remaining capacity to the embedding vectors of the starting node and the previous node. During construction, the starting node is always the repository node, and the previous node is the client node visited in the previous step. Remaining capacity is represented as... The embedding vectors of the starting node and the previous node are respectively 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 concatenation operator. and These are learnable parameters.

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

[0147]

[0148] in It is the set of embedded nodes that have not been visited.

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

[0150]

[0151] It represents the relationships between all the nodes in the graph. Then, a linear projection and a softmax function are applied to it to generate the selected probability for each unvisited node. Before the softmax calculation, the start and previous nodes are masked:

[0152]

[0153] in It is a learnable parameter. For each customer node, we need to predict whether it arrived from the warehouse or from another customer node; therefore, u here... i It is a two-dimensional vector. The two states corresponding to client node i are: access via warehouse or client node. It corresponds to the symbol in equation (3).

[0154] Then Flattened Apply the softmax function to U′ to generate the selected probability for each action associated with the corresponding unvisited node:

[0155]

[0156] According to p i Determine the most suitable node and its associated actions (accessed via the repository or the last node). Build the complete solution step-by-step by calling the decoder.

[0157] We denote TSP and CVRP instances with 1000 to 100K 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 scales are 10K, 200 and 100, respectively. The customer demands of all scales of CVRP are randomly sampled from the set {1, 2, …, 9}, and the capacities of CVRP1K, CVRP5K, CVRP10K and CVRP50K / 100K are set to 250, 500, 1,000 and 2,000, respectively.

[0158] During the training process, a model is trained on each scale of dataset separately using self-boosting learning method. Each self-boosting learning iteration process includes 100 local reconstructions and 20 rounds of model training for all instances of the training dataset. Due to the device memory limitation, larger scale datasets such as TSP100K and CVRP100K use smaller batch size (i.e. 16). While smaller scale datasets such as TSP1K and CVRP1K use larger batch size (i.e. 512). The batch size used for TSP / CVRPSK, 10K, 50K is 32. During the local reconstruction and training phase, the maximum length of partial solution l max is kept at 1000 to balance time efficiency and effectiveness. A large number of experiments on TSP and CVRP with up to 100K nodes in uniform distribution and real distribution show that SIL has excellent performance.

[0159] Exemplary apparatus

[0160] As shown in Figure 6 , the embodiment also provides a vehicle path problem solving device based on a self-boosting mechanism, which comprises:

[0161] A vehicle path information acquisition module 10 is configured to acquire vehicle path information.

[0162] An initial model generation module 20 is configured to generate an initial pseudo label and obtain an initial model according to the initial pseudo label, wherein the initial model comprises an encoder and a decoder, and the decoder updates a set of graph node embedding vectors through a linear attention module.

[0163] A model training module 30 is configured to iteratively train the initial solution model through local reconstruction and a linear complexity attention mechanism to obtain a complete solution model.

[0164] A solving module 40 is configured to input the vehicle path information into the complete solution model to obtain a shortest path.

[0165] In an implementation, the initial model generating module 10 comprises:

[0166] A model constructing unit is configured to construct an initial model, wherein the initial model comprises an encoder and a decoder, and the decoder comprises a linear attention module configured to aggregate and broadcast key information.

[0167] A model initializing unit is configured to generate initial pseudo labels, train the initial model by the initial pseudo labels, and obtain an initial solution according to the initial pseudo labels.

[0168] In an implementation, the model constructing unit comprises:

[0169] A feature extracting subunit is configured to extract input node features according to the vehicle path information.

[0170] A linear projection subunit is configured to perform linear projection on the input node features to obtain node embedding vectors.

[0171] A vector passing subunit is configured to pass the node embedding vectors to the decoder.

[0172] In an implementation, the model training module 30 comprises:

[0173] A local reconstruction unit is configured to locally reconstruct the initial solution by the initial model to obtain an enhanced solution.

[0174] A model training unit is configured to train the initial model according to the enhanced solution as pseudo labels to obtain a trained model.

[0175] An iterative training unit is configured to update the initial solution according to the enhanced solution, update the initial model according to the trained model, and re-perform the step of locally reconstructing the initial solution by the initial model to obtain an enhanced solution until a preset termination condition is reached.

[0176] An iteration termination unit is configured to obtain the trained model when the preset termination condition is reached.

[0177] In an implementation, the local reconstruction unit further comprises:

[0178] A partial solution length preset subunit is configured to preset a partial solution length.

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

[0180] An enhanced partial solution acquisition subunit is configured to reorder the nodes in the partial solution to obtain an enhanced partial solution.

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

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

[0183] A representative node selection unit is configured to select a representative node in the partial solution.

[0184] A vector acquisition unit is configured to acquire, by the encoder, a set of graph node embedding vectors and a set of representative node embedding vectors, and the decoder includes a plurality of linear attention modules.

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

[0186] A graph node embedding vector set updating unit is configured to combine the updated set of representative node embedding vectors and the intermediate set of graph node embedding vectors as an input of a next linear attention module, and output an updated set of graph node embedding vectors by the last linear attention module.

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

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

[0189] A projection subunit is configured to linearly project the updated set of graph node embedding vectors to obtain a projection vector.

[0190] A selected probability acquisition subunit is configured to take the projection vector as an input of a softmax function to calculate the selected probability of each unvisited node.

[0191] Based on the above embodiments, the application further provides an intelligent terminal, and a principle block diagram of the intelligent terminal can be as shown in Figure 7The intelligent terminal includes a processor, a memory, a network interface, a display screen, and a temperature sensor connected through a system bus. The processor of the intelligent terminal is configured 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 operating system and the computer program in the non-volatile storage medium. The network interface of the intelligent terminal is configured to communicate with an external terminal through a network connection. The computer program is executed by the processor to implement a vehicle routing problem solving method based on a self-enhancing mechanism. The display screen of the intelligent terminal can be a liquid crystal display screen or an electronic ink display screen. The temperature sensor of the intelligent terminal is pre-installed in the intelligent terminal and is configured to detect the operating temperature of the internal device.

[0192] Those skilled in the art can understand that, Figure 7 The block diagram shown in the drawings is only a block diagram of part of the structure related to the present application, and does not limit the intelligent terminal to which the present application is applied. The specific intelligent terminal can include more or fewer components than those shown in the drawings, or combine certain components, or have a different arrangement of components.

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

[0194] Obtaining vehicle routing information;

[0195] 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 set of graph node embedding vectors through a linear attention module;

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

[0197] Inputting the vehicle routing information into the trained model to solve a vehicle routing problem and obtain a shortest path.

[0198] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer readable storage medium, and when the computer program is executed, the processes of the above-mentioned embodiments of the methods can be included. Any reference to memory, storage, operating database or other medium used in each embodiment of the present application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration but not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), 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 application discloses a vehicle path problem solving method based on a self-promotion mechanism, which comprises the following steps: obtaining vehicle path information; generating an initial pseudo label to obtain an initial model according to the initial pseudo label; iteratively training the initial model through a self-promotion 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 application enhances and refines the iterative training through local reconstruction, improves the self-promotion mechanism training and reasoning efficiency on large-scale instances through a linear attention mechanism, and greatly reduces the calculation cost.

[0200] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for solving vehicle routing problem based on self-boosting mechanism, characterized in that, The method comprises: acquiring vehicle path information; generating an initial pseudo label, and obtaining an initial model according to the initial pseudo label, wherein the initial model comprises an encoder and a decoder, and the decoder updates a set of graph node embedding vectors through a linear attention module; iteratively training the initial model through a self-promotion mechanism to obtain a trained model; inputting the vehicle path information into the trained model to solve a vehicle path problem to obtain a shortest path; the generating an initial pseudo label, and obtaining an initial model according to the initial pseudo label and the vehicle path information comprises: constructing an initial model, wherein the initial model comprises an encoder and a decoder, and the decoder comprises a linear attention module, and the linear attention module is used for aggregation and broadcast of key information; generating an initial pseudo label, training the initial model through the initial pseudo label, and obtaining an initial solution according to the initial pseudo label; the iteratively training the initial model through a self-promotion mechanism to obtain a trained model comprises: reconstructing the initial solution locally through the initial model to obtain an enhanced solution; training the initial model according to the enhanced solution as a 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-executing the reconstructing the initial solution locally through the initial model to obtain an enhanced solution step until a preset termination condition is reached; when the preset termination condition is reached, the trained model is obtained.

2. The self-boosting mechanism based vehicle routing problem solving method according to claim 1, characterized in that, the encoder is used for: extracting input node features according to the vehicle path information; performing linear projection on the input node features to obtain node embedding vectors; passing the node embedding vectors to the decoder.

3. The self-boosting mechanism based vehicle routing problem solving method according to claim 1, characterized in that, the reconstructing the initial solution locally through the initial model to obtain an enhanced solution comprises: presetting a partial solution length; sampling the initial solution according to the partial solution length to obtain an initial partial solution; reordering nodes in the initial partial solution to obtain an enhanced partial solution; replacing the initial partial solution in the initial solution with the enhanced partial solution to obtain the enhanced solution.

4. The self-boosting mechanism based vehicle routing problem solving method according to claim 3, characterized in that, the decoder updates a set of graph node embedding vectors through a linear attention module, and the updating comprises: selecting a representative node in the partial solution; obtaining a set of graph node embedding vectors and a set of embedding vectors of the representative node through the encoder, wherein the decoder comprises a plurality of linear attention modules; aggregating the graph node embedding vectors through an attention layer in the linear attention module and the embedding vectors of the representative node to obtain an updated set of representative node embedding vectors, and broadcasting the updated set of representative node embedding vectors to the set of graph node embedding vectors to obtain an intermediate set of graph node embedding vectors, wherein the attention layer comprises a multi-head attention sublayer and a node feedforward sublayer. combining the updated representative node embedding vector set and the intermediate graph node embedding vector set as inputs of a next linear attention module, outputting an updated graph node embedding vector set through the last linear attention module; obtaining a selection probability of each unvisited node according to the updated graph node embedding vector set, wherein the selection probability is used for selecting a next unvisited node.

5. The self-boosting mechanism based vehicle routing problem solving method according to claim 4, characterized in that, The method further includes: projecting the updated graph node embedding vector set to obtain a projection vector; inputting the projection vector into a softmax function to obtain the selection probability of each unvisited node.

6. A vehicle routing problem solving apparatus based on a self-boosting mechanism, characterized by, The apparatus includes: a vehicle path information acquisition module configured to acquire vehicle path information; an initial model generation module configured 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 a graph node embedding vector set through a linear attention module; a model training module configured to iteratively train the initial model through a self-boosting mechanism to obtain a trained model; a solution module configured to input the vehicle path information into the trained model to solve a vehicle path problem and obtain a shortest path; The method further includes: constructing an initial model, wherein the initial model includes an encoder and a decoder, and the decoder includes a linear attention module configured to aggregate and broadcast key information; generating an initial pseudo label, training the initial model through the initial pseudo label, and obtaining an initial solution according to the initial pseudo label; The method further includes: reconstructing the initial solution locally through the initial model to obtain an enhanced solution; training the initial model according to the enhanced solution 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-executing the step of reconstructing the initial solution locally through the initial model to obtain an enhanced solution until a preset termination condition is reached; obtaining the trained model when the preset termination condition is reached.

7. A smart terminal, characterized in that The intelligent terminal includes a memory, a processor, and a vehicle path problem solving program based on a self-boosting mechanism stored in the memory and executable on the processor. When the processor executes the vehicle path problem solving program based on the self-boosting mechanism, the steps of the vehicle path problem solving method based on the self-boosting mechanism according to any one of claims 1-5 are implemented.

8. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a vehicle routing problem solving program based on a self-promotion mechanism, and the vehicle routing problem solving program, when executed by a processor, implements the steps of the vehicle routing problem solving method based on the self-promotion mechanism according to any one of claims 1-5.

Citation Information

Patent Citations

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

    CN114782791A

  • Method and device for generating solution of vehicle path problem

    CN117073703A