Generative shortest path calculation method and system based on deep learning
Through the generative shortest path calculation method based on deep learning, the problem of high complexity of the shortest path calculation in large-scale urban traffic road networks is solved, and efficient and low-latency shortest path generation is achieved, which significantly improves the computing efficiency and accuracy.
Patent Information
- Application Number
- CN202411694735.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-25
- Publication Date
- 2025-03-14
AI Technical Summary
The existing shortest path algorithm is highly complex in the face of large-scale urban traffic road networks, resulting in high cost and inability to implement real-time computing.
The generative shortest path calculation method based on deep learning is adopted, and the road network structure diagram is encoded into Tokens and the shortest path generation model is constructed. The large-scale shortest path in the dynamic road network is generated using the autoregressive prediction method.
It is realized that large-scale shortest paths are efficiently generated with low latency and low error rates, which is 4 to 5 times faster than existing algorithms, and the average accuracy in shortest distance prediction is 36%.
Smart Images

Figure CN119623632A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of computer software and algorithm technology, and specifically, relates to a generative shortest path calculation method and system based on deep learning. More specifically, it is a generative shortest path SPathGen algorithm based on deep learning, which aims to solve the algorithm problem of effective calculation of the shortest path of traffic roads in the field of urban transportation. Background Art
[0002] The shortest path problem in traffic refers to finding a path with the minimum sum of weights from the starting point to the end point in the traffic network. The weights here can be defined according to actual needs, such as distance, time or transportation costs. This problem is widely used in the fields of traffic planning, network routing, logistics distribution, etc. In practical applications, understanding the concept and algorithm of the shortest path is of great value in solving practical problems. For example, through reasonable traffic road navigation planning, efficient management of congestion in urban traffic can be achieved, and the travel efficiency and travel experience of residents can be improved.
[0003] To solve the shortest path problem in traffic, commonly used algorithms include Dijkstra algorithm.
[0004] Specifically, the Dijkstra algorithm was proposed by Dutch mathematician EWDijkstra in 1959 as a single-source shortest path algorithm suitable for non-negative weighted networks. It can give the shortest path from a specified node in the graph to other nodes in the graph. The algorithm can calculate the shortest path from one vertex to the remaining vertices, solving the problem of shortest path calculation in a weighted graph. The main feature of the Dijkstra algorithm is that it starts from the starting point and adopts a greedy algorithm strategy, traversing the adjacent nodes of the vertex closest to the starting point and not visited each time until the expansion iteration reaches the end point. The complexity of the algorithm is n^2. It can be seen that the time complexity of the algorithm is still relatively high. For a city with a large-scale road network, the cost of calculating the shortest path for millions of vehicles is high and cannot be completed in real time.
[0005] The traditional shortest path calculation algorithms are classified. Specifically, the shortest path algorithm has always been a basic algorithmic problem in graph theory and transportation network practice.
[0006] This paper discusses the exact and approximate algorithms for searching paths, namely the exact shortest path algorithm. Since the classic shortest path algorithms such as Dijkstra cannot be extended to large-scale networks, especially in time-dependent road networks, recent research has mainly improved the algorithm from two perspectives: node-level-based solutions and Hop-based solutions.
[0007] Node hierarchy based solution: First add shortcuts to find important vertices and assign hierarchical indexes to vertices, then build an intermediate subgraph with only links from lower ranked vertices to higher ranked vertices. By further applying bidirectional Dijkstra algorithm from source and destination, the shortest path is generated when the bidirectional searches meet.
[0008] Hop-based methods: Assign a 2-Hop label to each node in the graph. The shortest path between the source and the destination is formed by considering the common vertices in the labels of the two vertices, i.e., the source and the destination. Recent methods further add tree indexing to reduce the search space and speed up the algorithm.
[0009] Exact shortest path algorithms generate the shortest path and calculate the shortest distance at the same time. However, when faced with the real-time shortest path calculation problem for millions of vehicles, these methods may become impractical due to their high time complexity.
[0010] Currently, approximate shortest path algorithms, i.e., to overcome the time complexity of computing the shortest path for large-scale vehicles, improve classical methods by adding heuristic rules, stopping adding shortcuts when there are alternative paths with tolerable longer distances, or restricting the path through a set of landmarks. These methods still suffer from high time complexity when pre-calculating each timestamp of a time-dependent road network.
[0011] Another type of method is the shortest path calculation algorithm based on machine learning, which uses machine learning models to predict the shortest distance by directly using graph features and the starting and ending points as input. However, the current method can only output the distance but not generate the shortest path, which cannot meet the requirements of real-time rescheduling of vehicle routes.
[0012] Patent document US20130163467A1 discloses a SHORTEST PATH DETERMINATION FOR LARGE GRAPHS, which provides a computer-implemented method and system for determining the shortest path between two nodes in a network including multiple nodes, and also provides a non-transitory computer-readable medium including multiple instructions, which, when executed by at least one electronic device, at least cause the at least one electronic device to determine the shortest path between two nodes in the network including multiple nodes. This scheme, which is applicable to a computer-implemented method for determining the shortest routing path between two nodes, involves searching for the shortest path between any two nodes, and cannot meet the requirements of real-time rescheduling of vehicle routes.
[0013] In summary, the current shortest path algorithm has a computational complexity problem. When faced with the problem of calculating the shortest path for millions of vehicles in a city-level traffic road network, the computational cost is very high and becomes impractical. This problem needs to be solved urgently. Summary of the invention
[0014] In view of the defects in the prior art, the object of the present invention is to provide a generative shortest path calculation method and system based on deep learning.
[0015] A generative shortest path calculation method based on deep learning provided by the present invention includes:
[0016] Step S1: Encode the road network structure diagram into Tokens, i.e., road network Token;
[0017] Step S2: Encode the generated trajectory or the empty trajectory to be generated into Tokens; merge the OD information into the trajectory token; the trajectory token and the road network token are independent;
[0018] Step S3: Based on the trajectory token and the road network token, build and train the shortest path generation model;
[0019] Step S4: Obtaining a path reasoning result through the shortest path generation model.
[0020] Preferably, in step S1, the weights of the adjacency matrix of the road network are projected into the latent space, thereby obtaining a vector representation of the road network structure graph, i.e., graph The figure Encoded as Tokens, i.e. road network Token;
[0021] The weights are projected into the latent space, and the mathematical expression is:
[0022]
[0023] Where G represents a weighted graph, Represents the mapping space representation of the road network weighted graph, V represents the vertex set and the candidate token vocabulary, H represents the dimension of the latent variable space, B represents the batch size, which is the number of road networks and trajectories to be processed; MLP represents the linear mapping layer;
[0024] The figure The mathematical expression is:
[0025]
[0026] in, READOUT represents the READOUT function.
[0027] Preferably, in step S2, the sequence of the trajectory Token is expressed mathematically as follows:
[0028] Y={v1,v2,…,v T}
[0029] Among them, Y represents the trajectory generated in the previous step, v i represents the node at the i-th step in the trajectory, v i ∈V, i∈{1,2,...,T};
[0030] Token is a data type, and Y is the symbol of this data type.
[0031] Y′={v′1,v′2,…,v′ T}
[0032] v′ d =embedding(v d )
[0033] Where embedding represents the embedding layer, v′ represents the trajectory Token sequence after embedding, and v′ T It is the embedded node Token. Specifically, Token is a data type, and Y is the symbol of this data type.
[0034] (v o ,v d ) represents the OD pair, i.e., OD information, where v o Indicates the starting node; v d represents the target node; when embedding OD information, for the starting node, let v1 = v o , v1 is the starting node of the trajectory; for the target node, a projection is added to it, and the mathematical expression is:
[0035] v′ d =embedding(v d )
[0036] Among them, v′ d Indicates v d The value in the embedding space, v′ d ∈R B×1×C , C represents the dimension of the embedding space; embedding represents the embedding layer;
[0037] Y′ d =Concat(Broadcast(v′ d ),Y′)
[0038] Among them, Y′ dRepresents the fusion information of the trajectory and the end point, Y′ d ∈R B×T×2C ; Concat represents the concatenation operation on the dimension; Broadcast represents the copy and expansion operation on the channel; Y′ represents the trajectory in the latent variable space; Y′∈R B×T×C , T represents the length of the trajectory;
[0039] Att = Softmax(MLP(Y′ d ))
[0040] Among them, Att represents the attention weight, Att∈R B×T×2 ; Softmax represents the softmax layer;
[0041] Y′ h =Einsum(Att,Reshape(Y′ d ))+Y′+posEmbed
[0042] Among them, Y′ h Represents the trajectory feature of the endpoint information in the fusion, Y′ h ∈R B×T×C ; Einsum represents the Einstein summation symbol; Reshape represents the dimension conversion operation; PosEmbed represents the position encoding.
[0043] Preferably, in step S3, the mathematical expression of the output of the autoregressive step of the shortest path generation model is:
[0044] Y′ out =LayerNorm(Linear(Y′ h ))
[0045] Among them, Y′ out represents the output of the trajectory encoding module, Y′ out ∈R B×T×H ; LayerNorm represents the layer normalization layer; Linear represents the linear layer;
[0046] In step S3, the shortest path generation model is trained by an autoregressive prediction method. When the autoregressive prediction method is implemented, the receiving domain of the shortest generation model is limited to a sliding window, and the training and inference stages are aligned by prefix masking.
[0047] Preferably, the shortest path generation model is coded only with the destination as a condition.
[0048] A generative shortest path calculation system based on deep learning provided by the present invention includes:
[0049] Road network embedding module: encodes the road network structure diagram into Tokens, i.e. road network Token;
[0050] Trajectory embedding module: encodes the currently generated trajectory or the empty trajectory to be generated into Tokens, and integrates the OD information into the trajectory Token;
[0051] Shortest path algorithm module: Based on the trajectory Token and the road network Token, a shortest path generation model is constructed and trained; and a path reasoning result is obtained through the shortest path generation model.
[0052] Preferably, in the road network embedding module, the weights of the adjacency matrix of the road network are projected into the latent space, thereby obtaining a vector representation of the road network structure graph, i.e., graph The figure Encoded as Tokens, i.e. road network Token;
[0053] The weights are projected into the latent space, and the mathematical expression is:
[0054]
[0055] Where G represents a weighted graph, Represents the mapping space representation of the road network weighted graph, V represents the vertex set and the candidate token vocabulary, H represents the dimension of the latent variable space, B represents the batch size, which is the number of road networks and trajectories to be processed; MLP represents the linear mapping layer;
[0056] The figure The mathematical expression is:
[0057]
[0058] in, READOUT represents the READOUT function.
[0059] Preferably, in the trajectory embedding module, the sequence of the trajectory Token is expressed mathematically as follows:
[0060] Y={v1,v2,…,v T}
[0061] Among them, Y represents the trajectory generated in the previous step, v i represents the node at the i-th step in the trajectory, v i ∈V, i∈{1,2,...,T};
[0062] When embedding OD information, for the starting node, let v1 = v o, v1 is the starting node of the trajectory; for the target node, a projection is added to it, and the mathematical expression is:
[0063] v′ d =embedding(v d )
[0064] Among them, v′ d Indicates v d The value in the embedding space, v′ d ∈R B×1×C , C represents the dimension of the embedding space; embedding represents the embedding layer;
[0065] Y′ d =Concat(Broadcast(v′ d ),Y′)
[0066] Among them, Y′ d Represents the fusion information of the trajectory and the end point, Y′ d ∈R B×T×2C ; Concat represents the concatenation operation on the dimension; Broadcast represents the copy and expansion operation on the channel; Y′ represents the trajectory in the latent variable space; Y′∈R B×T×C , T represents the length of the trajectory;
[0067] Att = Softmax(MLP(Y′ d ))
[0068] Among them, Att represents the attention weight, Att∈R B×T×2 ; Softmax represents the softmax layer;
[0069] Y′ h =Einsum(Att,Reshape(Y′ d ))+Y′+PosEmbed
[0070] Among them, Y′ h Represents the trajectory feature of the endpoint information in the fusion, Y′ h ∈R B×T×C ; Einsum represents the Einstein summation symbol; Reshape represents the dimension conversion operation; PosEmbed represents the position encoding.
[0071] Preferably, in the shortest path algorithm module, the mathematical expression of the output of the autoregressive step of the shortest path generation model is:
[0072] Y′ out =LayerNorm(Linear(Y′ h ))
[0073] Among them, Y′ out represents the output of the trajectory encoding module, Y′ out ∈R B×T×H ; LayerNorm represents the layer normalization layer; Linear represents the linear layer;
[0074] In the shortest path algorithm module, the shortest path generation model is trained by an autoregressive prediction method. When the autoregressive prediction method is implemented, the receiving domain of the shortest generation model is limited to a sliding window, and the training and inference stages are aligned by prefix masking.
[0075] Preferably, the shortest path generation model is coded only with the destination as a condition.
[0076] Compared with the prior art, the present invention has the following beneficial effects:
[0077] 1. The shortest path generation model proposed in the present invention is based on a neural network framework and can generate large-scale shortest paths in dynamic road networks.
[0078] 2. The present invention solves the problems of the above-mentioned traditional shortest path algorithm by balancing the road network information and the fixed backtracking window, and effectively generates large-scale shortest paths with low latency and low error rate after training on the shortest path data set.
[0079] 3. The shortest path generation model proposed by the present invention is 4 to 5 times faster than the existing shortest path algorithm; and, compared with the current best approximation algorithm, the average accuracy in shortest distance prediction is 36% higher. BRIEF DESCRIPTION OF THE DRAWINGS
[0080] Other features, objects and advantages of the present invention will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:
[0081] Figure 1 A schematic diagram of the overall module flow of the algorithm provided by the present invention;
[0082] Figure 2 A schematic diagram of an autoregressive inference process with a fixed lookback window length of 4 provided by the present invention;
[0083] Figure 3 A comparison diagram of prefix attention masking with a fixed lookback length of 2 provided by the present invention; wherein the gray area represents the masked attention, the blue area represents the receptive field, (a) is the receptive field of the first attention layer and the theoretical receptive field of the second attention layer; (b) is the actual receptive field of the second attention layer, where the leakage attention comes from the first attention layer;
[0084] Figure 4 Schematic diagram for comparing the Stair Masking strategies provided by the present invention; wherein (a) is a Stair Mask when the backtracking length is fixed to 2, which is equivalent to dividing the entire trajectory into three non-overlapping parts; (b) is a random Mask selection during training, and the area in the red box represents the selected Stair Mask. DETAILED DESCRIPTION
[0085] The present invention is described in detail below in conjunction with specific embodiments. The following embodiments will help those skilled in the art to further understand the present invention, but are not intended to limit the present invention in any form. It should be noted that, for those of ordinary skill in the art, several changes and improvements can also be made without departing from the concept of the present invention. These all belong to the protection scope of the present invention.
[0086] The present invention studies how to effectively calculate the shortest path from the starting point to the end point on a road traffic network where the starting point and the end point are given and the road conditions change over time. Specifically, the present invention proposes a new shortest path generation algorithm SPathGen, which is based on a neural network framework and can generate large-scale shortest paths in dynamic road networks. By balancing the road network information and a fixed backtracking window, the model provided by this solution can effectively generate large-scale shortest paths with low latency and low error rate after being trained on the shortest path dataset, thereby solving the problems of the above-mentioned traditional shortest path algorithms.
[0087] The solution has been subjected to a large number of experiments. The experimental results show that the SPathGen algorithm proposed by the present invention is 4 to 5 times faster than the existing shortest path algorithm; and compared with the current best approximation algorithm, the average accuracy rate in the shortest distance prediction is 36% higher.
[0088] Based on the given weighted urban road network diagram and a series of data containing OD, this solution trains the model through autoregression. The process includes:
[0089] Step 1: Construct a road network embedding layer to encode the road network structure graph into a vector representation.
[0090] Step 2: Construct a path trajectory embedding layer, convert path trajectory nodes into tokens, and encode historical OD information;
[0091] Step 3: Train the SPathGen model using autoregressive learning;
[0092] Step 4: Perform path reasoning between ODs based on the trained model;
[0093] In other words, a generative shortest path calculation method based on deep learning provided by the present invention includes:
[0094] Step 1: Construct a road network embedding layer and encode the road network structure graph into Tokens;
[0095] Step 2: Construct a path trajectory embedding layer, convert the path trajectory nodes into a Token sequence; encode the starting point and end point OD information, and merge the OD information into the trajectory Token;
[0096] Step 3: Construct the SPathGen module through the road network token and trajectory token to jointly infer the path of the historical trajectory at the next moment;
[0097] Step 4: Continue to add new paths in an autoregressive manner until the end point is reached or the preset longest trajectory is reached;
[0098] Step 5: Train the neural network by classifying whether the path inferred each time is the shortest path;
[0099] Problem definition: Define the road network: The road network is modeled as a weighted graph, namely G = (V, E, W), where road intersections and road sections are represented as vertices and edges of the graph, respectively, and each edge is associated with a positive weight, which represents the road length or actual travel time.
[0100] Among them, V represents the vertex set; E represents the edge set; W represents the weight set;
[0101] Specifically, v i is a vertex, v i ∈V; From v i to v j An edge of w ij yes The weight, w ij ∈W.
[0102] The shortest path is defined as follows: the shortest path refers to a sequence of adjacent edges between two vertices or a group of consecutive vertices.
[0103] The present invention uses or Indicates that from v o to v d The path, where v1 = v o ;v t =v d ; Among them, i∈[1,t-1].
[0104] In all these paths, Y *is the shortest path; it expresses how to get from v o to v d In the following sections, unless otherwise stated, we only consider the shortest path in vertex form.
[0105] Definition of Shortest Path Generation: The shortest path generation is to regard the shortest path problem as a conditional generation problem:
[0106] Given a road network G = (V, E, W) and n vertex pairs Aims to be based on G and each i (i∈[1,n]) corresponding to Output the shortest path for each pair, where i represents the i-th OD path trajectory. The generated shortest path is expressed as:
[0107]
[0108] Specifically, the generative shortest path algorithm of the present invention is mainly divided into several parts:
[0109] A network-aware shortest path generation algorithm. Specifically, the present invention introduces a proposed new framework SPathGen, which is an autoregressive conditional generation model.
[0110] Given a weighted graph G and a dataset consisting of a set of OD pairs, the goal is to train a model M θ Generate the sequence Y={v1,v2,…,v t |G,(v o ,v d )};
[0111] The generation process is: i =M θ (G,(v o ,v1,v2,...,v i-1 ,v d )),i∈{1,2,...,t}.
[0112] Among them, v i ∈V, G represents a weighted graph, (v o ,v d ) represents OD pairs, V constitutes a vertex set and also serves as a vocabulary of candidate tokens. The architecture is as follows Figure 1 shown.
[0113] The model proposed in this invention includes three main modules: Figure 1 As shown:
[0114] Specifically, the model is the shortest path generation model, Spathgen is the general name of the model pair, represented by M\theta; \theta is the parameter to be learned by the model; spathgen block is the most important module in spathgen, but it is not generated autoregressively, but the network as a whole is generated autoregressively.
[0115] 1. Road Network embedding layer, which encodes the graph structure into a vector representation
[0116] 2. Trajectories embedding layer, which converts vertices into Tokens and encodes them into OD conditions;
[0117] 3. Multiple SPathGen modules integrate road network information and trajectory information to infer the next path.
[0118] The road network embedding layer, namely Road Network Embedding Layer, is as follows Figure 1 As shown in (a), a GNN-like model is used to encode the graph structure.
[0119] Given an adjacency matrix of a road network stored in the form of a sparse matrix, whose actual shape is (B, |V|, |V|), first project their weights into the latent space:
[0120]
[0121] in, Represent the mapping space representation of the graph G. H represents the dimension of the latent variable space, B represents the batch size, the number of road networks and trajectories processed simultaneously; MLP represents the linear mapping layer. If the weight of the first layer of MLP is As for learning node embeddings, the process is similar to message passing in GNN. Then, a READOUT operation aggregates the node representations to obtain the graph representation
[0122]
[0123] in, READOUT represents the READOUT function; average pooling is used as the READOUT operation. Since the weighted map remains unchanged during the generation process, this layer is only activated in the first step of the autoregressive generation.
[0124] The trajectory embedding layer, i.e., Trajectories embedding layer, converts the current vertex sequence y={v1,v2,…,v T} is converted to a token representation Y′={v′1,v′2,…,v′ T}, and embed OD information, such as Figure 1 (b) as shown.
[0125] To enable the model to distinguish between the start and target nodes, OD pairs are embedded in different ways.
[0126] Specifically, for the starting node, it is used as the first token of the input sequence, that is, v1 = v o ; For the target node, the projection is added after the trajectory is embedded. The mathematical expression is as follows:
[0127] v′ d =embedding(v d )
[0128] Among them, v′ d Indicates v d The value in the embedding space, v′ d ∈R B×1×C , C represents the dimension of the embedding space; embedding represents the embedding layer;
[0129] Y′ d =Concat(Broadcast(v′ d ),Y′)
[0130] Among them, Y′ d Represents the fusion information of the trajectory and the end point, Y′ d ∈R B×T×2C ; Concat represents the concatenation operation on the dimension; Broadcast represents the copy and expansion operation on the channel; Y′ represents the trajectory in the latent variable space; Y′∈R B×T×C , T represents the length of the trajectory;
[0131] Att = Softmax(MLP(Y′ d ))
[0132] Among them, Att represents the attention weight, Att∈R B×T×2 ; Softmax represents the softmax layer;
[0133] Y′ h =Einsum(Att,Reshape(Y′ d ))+Y′+PosEmbed
[0134] Among them, Y′ h Represents the trajectory features of the endpoint information in the fusion, Y′ h ∈R B×T×C ; Einsum represents the Einstein summation symbol; Reshape represents the dimension conversion operation; PosEmbed represents the position encoding;
[0135] Next, a linear layer maps the trajectory embedding to the latent space, which is then fed into the SPathGen block:
[0136] Y′ out =LayerNorm(Linear(Y′ h ))
[0137] Among them, Y′ out represents the output of the trajectory encoding module, Y′ out ∈R B×T×H ; LayerNorm represents the layer normalization layer; Linear represents the linear layer;
[0138] In the shortest path, based on the fact that the path from any node in the path to the destination is still the shortest path, our scheme only encodes the destination as a condition to ensure that trajectories with the same destination will not be affected by the starting point, thereby improving the adaptability of our model.
[0139] The SPathGen algorithm module
[0140] Since changes in traffic times for the same OD query may result in changes in the shortest path, the model must make adaptive predictions based on these changes. However, in order to maintain the efficiency of the model, a balance must be struck between the complexity of the conditional mechanism and computational constraints.
[0141] To achieve this goal, certain restrictions are imposed on the autoregressive predictions and the conditional embedding of the road network is exploited using the adaLN-Zero mechanism.
[0142] Fixed-window training and inference: The computational complexity of self-attention grows quadratically with the number of time steps. A practical approach is to use a sliding window to limit the size of the historical window in the inference phase, and align the training and inference phases by prefix masking. When calculating the attention between different tokens in the Token List, the latter token is only calculated with itself and the previous token. Therefore, even if the length of the trajectory during inference is different from that during training, the receptive field when calculating attention is the same, and there will be no failure problem. Figure 2 As shown in , during autoregressive inference, the receptive field of the model is strictly limited to the sliding window. However, even in Figure 3Under the prefix attention mask in (a), during the training phase, the model can still obtain information outside the entire trajectory through forward propagation, such as Figure 3 (b) This phenomenon is similar to graph convolution, where as the number of convolutions increases, nodes are able to aggregate information from nodes that are multiple steps away.
[0143] To solve this problem, this solution cuts off the connection between different traceback windows and introduces the Stair Masking strategy. Figure 4 (a), where the entire trajectory is divided into non-overlapping sub-trajectories with a length equal to the maximum length of the backtracking window. In this way, tokens within the window can perceive each other, while tokens between windows will be masked from each other, thereby aligning the training and inference stages. However, for a fixed window size n, there are n ways to divide the sub-trajectories. A fixed division will cause the model to overfit a specific trajectory pattern. Therefore, during training, a mask is randomly selected per epoch, such as Figure 4 (b). In other words, Figure 4 As shown in the figure, the Stair Masking strategy only calculates the blue part in the block diagram, and does not calculate the rest. The entire Token List is divided into small token groups consisting of two non-overlapping tokens. In each token group, the first token only pays attention to itself, and the second token only pays attention to itself and the previous token.
[0144] AdaLN-Zero is a mechanism based on conditional generation and zero-initialized residual connections for modeling road network conditions. Figure 1 As shown in (c), the graph embedding vector obtained by MLP projection is divided into parameters γ, β and α; where γ and β are scaling and translation parameters on the dimension, which replace the scaling and translation parameters in layer normalization, enabling layer normalization to adaptively adjust the output according to changes in the road network. α is initialized to a zero vector, and the output is scaled before each residual connection. Zero initialization benefits the training process by initializing each residual block to the identity function. Compared with other conditional mechanisms, such as cross attention or graph convolution on node connections, AdaLN-Zero introduces fewer GFLOPs but significantly improves performance.
[0145] The present invention also provides a generative shortest path calculation system based on deep learning. The generative shortest path calculation system based on deep learning can be implemented by executing the process steps of the generative shortest path calculation method based on deep learning, that is, those skilled in the art can understand the generative shortest path calculation method based on deep learning as a preferred implementation of the generative shortest path calculation system based on deep learning.
[0146] Those skilled in the art know that, in addition to realizing the system and its various devices, modules, and units provided by the present invention in a purely computer-readable program code, it is entirely possible to realize the same functions in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers by logically programming the method steps. Therefore, the system and its various devices, modules, and units provided by the present invention can be considered as a hardware component, and the devices, modules, and units included therein for realizing various functions can also be regarded as structures within the hardware component; the devices, modules, and units for realizing various functions can also be regarded as both software modules for realizing the method and structures within the hardware component.
[0147] The above describes the specific embodiments of the present invention. It should be understood that the present invention is not limited to the above specific embodiments, and those skilled in the art can make various changes or modifications within the scope of the claims, which does not affect the essence of the present invention. In the absence of conflict, the embodiments of the present application and the features in the embodiments can be combined with each other arbitrarily.
Claims
1. A generative shortest path calculation method based on deep learning, characterized in that: include: Step S1: Encode the road network structure diagram into Tokens, i.e., road network Token; Step S2: Encode the currently generated trajectory or the empty trajectory to be generated into Tokens, and fuse the OD information into the trajectory Token; Step S3: constructing and training a shortest path generation model based on the trajectory Token and the road network Token; Step S4: Obtaining a path reasoning result through the shortest path generation model.
2. The generative shortest path calculation method based on deep learning according to claim 1, characterized in that: In step S1, the weights of the adjacency matrix of the road network are projected into the latent space, thereby obtaining a vector representation of the road network structure graph, i.e., graph The figure Encoded as Tokens, i.e. road network Token; The weights are projected into the latent space, and the mathematical expression is: Where G represents a weighted graph, Represents the mapping space representation of the road network weighted graph, V represents the vertex set and the candidate token vocabulary, H represents the dimension of the latent variable space, B represents the batch size, which is the number of road networks and trajectories to be processed; MLP represents the linear mapping layer; The figure The mathematical expression is: in, READOUT represents the READOUT function.
3. The generative shortest path calculation method based on deep learning according to claim 2, characterized in that: In step S2, the sequence of trajectory tokens is expressed as follows: Y={v1,v2,…,v T } Among them, Y represents the trajectory generated in the previous step, v i represents the node at the i-th step in the trajectory, v i ∈V, i∈{1,2,...,T}; When embedding OD information, for the starting node, let v1 = v o , v1 is the starting node of the trajectory; for the target node, a projection is added to it, and the mathematical expression is: v′ d =embedding(v d ) Among them, v′ d Indicates v d The value in the embedding space, v′ d ∈R B×1×C , C represents the dimension of the embedding space; embedding represents the embedding layer; Y′ d =Concat(Broadcast(v′ d ),Y′) Among them, Y′ d Represents the fusion information of the trajectory and the end point, Y′ d ∈R B×T×2C ; Concat represents the concatenation operation on the dimension; Broadcast represents the copy and expansion operation on the channel; Y′ represents the trajectory in the latent variable space; Y′∈R B×T×C , T represents the length of the trajectory; That=Softmax(MLP(Y′ d )) Among them, Att represents the attention weight, Att∈R B×T×2 ; Softmax represents the softmax layer; AND' h =Einsum(Att,Reshape(Y′ d ))+Y ′ +PosEmbed Among them, Y′ h Represents the trajectory feature of the endpoint information in the fusion, Y′ h ∈R B×T×C ; Einsum represents the Einstein summation symbol; Reshape represents the dimension conversion operation; PosEmbed represents the position encoding.
4. The generative shortest path calculation method based on deep learning according to claim 3 is characterized in that: In step S3, the mathematical expression of the output of the autoregressive step of the shortest path generation model is: AND' out =LayerNorm(Linear(Y′ h )) Among them, Y′ out represents the output of the trajectory encoding module, Y′ out ∈R B×T×H ; LayerNorm represents the layer normalization layer; Linear represents the linear layer; In step S3, the shortest path generation model is trained by an autoregressive prediction method. When the autoregressive prediction method is implemented, the receiving domain of the shortest generation model is limited to a sliding window, and the training and inference stages are aligned by prefix masking.
5. The generative shortest path calculation method based on deep learning according to claim 1, characterized in that: The shortest path generation model is coded only with the destination as a condition.
6. A generative shortest path calculation system based on deep learning, characterized in that: include: Road network embedding module: encodes the road network structure diagram into Tokens, i.e. road network Token; Trajectory embedding module: encodes the currently generated trajectory or the empty trajectory to be generated into Tokens, and integrates the OD information into the trajectory Token; Shortest path algorithm module: Based on the trajectory Token and the road network Token, a shortest path generation model is constructed and trained; and a path reasoning result is obtained through the shortest path generation model.
7. The generative shortest path calculation system based on deep learning according to claim 6, characterized in that: In the road network embedding module, the weights of the adjacency matrix of the road network are projected into the latent space, thereby obtaining the vector expression of the road network structure graph, i.e., The figure Encoded as Tokens, i.e. road network Token; The weights are projected into the latent space, and the mathematical expression is: Where G represents a weighted graph, Represents the mapping space representation of the road network weighted graph, V represents the vertex set and the candidate token vocabulary, H represents the dimension of the latent variable space, B represents the batch size, which is the number of road networks and trajectories to be processed; MLP represents the linear mapping layer; The figure The mathematical expression is: in, READOUT represents the READOUT function.
8. The generative shortest path calculation system based on deep learning according to claim 7, characterized in that: In the trajectory embedding module, the sequence of the trajectory Token is expressed as follows: Y={v1,v2,…,v T } Among them, Y represents the trajectory generated in the previous step, v i represents the node at the i-th step in the trajectory, v i ∈V, i∈{1,2,...,T}; When embedding OD information, for the starting node, let v1 = v o , v1 is the starting node of the trajectory; for the target node, a projection is added to it, and the mathematical expression is: v′ d =embedding(v d ) Among them, v′ d Indicates v d The value in the embedding space, v′ d ∈R B×1×C , C represents the dimension of the embedding space; embedding represents the embedding layer; Y′ d =Concat(Broadcast(v′ d ),Y′) Among them, Y′ d Represents the fusion information of the trajectory and the end point, Y′ d ∈R V×T×2C ; Concat represents the concatenation operation on the dimension; Broadcast represents the copy and expansion operation on the channel; Y′ represents the trajectory in the latent variable space; Y′∈R V×T×C , T represents the length of the trajectory; That=Softmax(MLP(Y′ d )) Among them, Att represents the attention weight, Att∈R B×T×2 ; Softmax represents the softmax layer; AND' h =Einsum(Att,Reshape(Y′ d ))+Y′+PosEmbed Among them, Y′ h Represents the trajectory feature of the endpoint information in the fusion, Y′ h ∈R B×T×C ; Einsum represents the Einstein summation symbol; Reshape represents the dimension conversion operation; PosEmbed represents the position encoding.
9. The generative shortest path calculation system based on deep learning according to claim 8, characterized in that: In the shortest path algorithm module, the mathematical expression of the output of the autoregressive step of the shortest path generation model is: AND' out =LayerNorm(Linear(Y′ h )) Among them, Y′ out represents the output of the trajectory encoding module, Y′ out ∈R B×T×H ; LayerNorm represents the layer normalization layer; Linear represents the linear layer; In the shortest path algorithm module, the shortest path generation model is trained by an autoregressive prediction method. When the autoregressive prediction method is implemented, the receiving domain of the shortest generation model is limited to a sliding window, and the training and inference stages are aligned by prefix masking.
10. The generative shortest path calculation system based on deep learning according to claim 6, characterized in that: The shortest path generation model is coded only with the destination as a condition.
Citation Information
Patent Citations
Shortest path determination for large graphs
US20130163467A1