A cross-city trajectory generation method combining deep learning and shortest path search
By combining deep learning and shortest path search, city-independent semantic representations and travel preferences are learned, solving the problem of difficult trajectory data collection and improving the generalization ability of trajectory generation across different cities.
Patent Information
- Application Number
- CN202411902357.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2044-12-23
AI Technical Summary
Existing technologies struggle to capture complex movement patterns due to difficulties in collecting trajectory data, while data-driven methods face challenges from topological changes when extended to new cities, resulting in insufficient generalization ability of trajectory generation.
By combining deep learning and shortest path search, we learn representations related to the local topology of road segments, use a decoupled adversarial domain adaptation algorithm to predict travel costs and generate trajectories, extract city-independent semantic representations, learn travel preferences, and apply shortest path search to generate trajectories.
It improves the generalization ability of trajectory generation, effectively predicts road segment costs and generates reasonable trajectories when cities change, and enhances the accuracy and adaptability of cross-city trajectory generation.
Smart Images

Figure CN119829688B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of trajectory generation technology, and more specifically to a cross-city trajectory generation method that combines deep learning and shortest path search. Background Technology
[0002] Trajectory data mining is crucial for smart city management. However, due to factors such as business conflicts and privacy regulations, collecting large-scale trajectory datasets is challenging, thus there is an urgent need for trajectory generation technology to solve this problem.
[0003] Urban trajectory generation is an active research field, and researchers have proposed various techniques to address the challenge of collecting large-scale trajectory data. These methods can be categorized into two types: knowledge-driven methods and data-driven methods.
[0004] Knowledge-driven methods generate trajectories based on empirical patterns and statistical models of human movement, including gravity models, intervention opportunity models, radiation models, and EPR models. These methods typically use coarse-grained grids to analyze human behavior and derive practically meaningful physical priors. By summarizing human movement behavior empirically, these knowledge-driven methods have achieved significant results in macroscopic traffic trajectory simulation. However, to capture human movement behavior with finer granularity, data-driven methods are gaining increasing importance.
[0005] Data-driven approaches utilize deep neural networks to capture movement patterns in complex trajectory data. Based on different deep neural network architectures, data-driven approaches can be categorized into Seq2Seq-based, GAN-based, VAE-based, and Diffusion-based methods. These methods rely on statistical learning, implicitly modeling human motion behavior through neural network parameters. While they have achieved significant success by learning from large datasets, they also lead to data dependency.
[0006] In summary, existing knowledge-driven methods require less trajectory data but struggle to capture complex movement patterns. In contrast, data-driven methods, while performing better, face challenges when scaling to new cities. In data-driven models, changes in urban topology may prevent previously learned road representations from being effectively transferred to the new network. Summary of the Invention
[0007] In view of this, the present invention provides a cross-city trajectory generation method that combines deep learning and shortest path search. By learning representations related to the local topology of road segments, the method predicts the travel cost of road segments based on the representations and uses shortest path search to generate trajectories, thereby improving the generalization ability of trajectory generation.
[0008] To achieve the above objectives, the present invention adopts the following technical solution:
[0009] This invention discloses a cross-city trajectory generation method combining deep learning and shortest path search, comprising the following steps:
[0010] 1) Obtain the spatial syntactic topological features of the urban road network, which includes the urban road networks of the source city and the target city:
[0011] The Metis algorithm is used to divide the urban road networks of the source city and the target city into several subgraphs. and The divided subgraphs are used to form a road network subgraph set for the source city and a road network subgraph set for the target city, respectively.
[0012] A spatially aware graph attention network is used to aggregate the node features of each subgraph in the road network subgraph set of the source city to generate the aggregated topological features of the source city road network.
[0013] A spatially aware graph attention network is used to aggregate the node features of each subgraph in the road network subgraph set of the target city to generate the aggregated topological features of the target city's road network.
[0014] 2) Learn an invariant topological representation and predict the travel cost to the target city by decoupling the adversarial domain adaptation algorithm:
[0015] Based on the aggregated topological features of the source city road network, semantic latent variables of the source city are extracted using a semantic encoder, and domain latent variables of the source city are extracted using a domain encoder.
[0016] Based on the aggregated topological features of the target city's road network, semantic latent variables of the target city are extracted using a semantic encoder, and domain latent variables of the target city are extracted using a domain encoder.
[0017] The aggregate topological features of the source city and the target city are determined using a domain discriminator.
[0018] By decoupling adversarial training, the information between semantic latent variables and domain latent variables is decoupled, resulting in city-independent semantic representations.
[0019] A travel cost prediction network is constructed, which includes a multilayer perceptron (MLP) and a softplus activation function module connected thereto. The travel cost prediction network is used to predict city-independent semantic representations to obtain the predicted travel cost.
[0020] 3) Generate trajectories based on travel preferences:
[0021] The predicted travel costs and implicit costs are weighted and combined to obtain the travel preferences for the target city. The implicit costs include the preference weights for different routes.
[0022] Through iterative training, the model learns the invariant mapping relationship between travel preferences and various travel costs, and applies it to the target city to generate trajectory data.
[0023] Furthermore, in step 1) obtaining the spatial syntactic topological features of the urban road network, the spatially aware graph attention network SAGAT is used to analyze the subgraph set. The node features of each subgraph are aggregated, specifically including the following steps:
[0024] Construct a spatially aware graph attention network SAGAT, wherein the output layers of SAGAT are connected through a residual block;
[0025] The initial layer of SAGAT transforms the features of the input subgraph nodes through a multilayer perceptron (MLP).
[0026] In the (l+1)th layer of SAGAT, where l≥1, the attention weights between nodes are calculated, and the spatial relationships between nodes are embedded into the attention weights:
[0027]
[0028] Where a, W s W t W e These are learnable parameters. It is section r i The set of neighboring nodes, σ is the Leakly ReLU activation function; u ij Indicates the spatial relationship between two nodes;
[0029] Based on attention weight The aggregated topological features of the urban road network are obtained from the output of the (l+1)th layer of the spatially aware graph attention network SAGAT:
[0030]
[0031] Furthermore, the spatial relationship u between the two nodes in the above method ij include:
[0032] Crossing road segment r i and road section r j The ratio of the number of shortest paths to the total number of shortest paths in the entire network, Bet(r) i ,r j ), road segment turning angle (r) i ,r j), and the travel distance Dist(r) between the center points of the two road segments. i ,r j ).
[0033] Furthermore, the above method predicts city-independent semantic representations to obtain predicted travel costs, specifically including the following steps:
[0034] semantic latent variables Summation domain latent variables Input the travel cost prediction network to obtain the predicted travel cost.
[0035]
[0036] The loss function used to train the travel cost prediction network includes an MSE loss function and a ranking loss function.
[0037] Furthermore, in the above method, the MSE loss function specifically includes the following expression:
[0038]
[0039] Where N s This is the size of the source city dataset; y i It represents the true cost of travel along a route, including travel time and speed.
[0040] Furthermore, in the above method, the ranking loss function specifically includes the following expression:
[0041]
[0042] in, Indicates road segment r i Predicted travel costs are higher than the segment r j Predict the probability of a successful trip; Indicates road segment r i and road section r j The true ranking tag value.
[0043] Furthermore, the above method utilizes a weighted combination of observable and implicit costs to obtain travel preferences for the target city, specifically including:
[0044] Based on observable cost and implied costs The following formula can be used to obtain travel preferences for the target city:
[0045]
[0046] Where w (m) These are learnable weights.
[0047] Furthermore, in the above method, through iterative training, the model learns the invariant mapping relationship between travel preferences and various travel costs, which is then applied to the target city, specifically including:
[0048] Randomly initialize the parameters, including the parameters of the hidden cost prediction network and the combined weights w of various costs. (m) The shortest path search targets the source city, updating parameters based on the search results. The shortest path search employs Dijkstra's algorithm to obtain the road segments r in the source city's urban road network. i To road section r j shortest path
[0049] Calculate the shortest path Sum of preferences:
[0050]
[0051] Actual trajectory τ ij The sum of preference values is:
[0052]
[0053] The unsupervised loss function is defined as follows:
[0054]
[0055] First, predict the preference value for each road segment. Then, input the real trajectory and search for the generated trajectory based on the start and end points. Use the total preference value of the real trajectory minus the total preference value of the generated trajectory as the loss function. Backpropagate to update the initial parameters and complete one iteration. (The parameters trained by decoupling adversarial training are frozen and not updated). In the next round, use the entire network with updated parameters to re-predict the preference value. Repeat this process to obtain loss convergence.
[0056] Once training is complete, when applied to the target city, the trajectory can be generated simply by searching for the shortest path in the target city based on the starting point and the ending point.
[0057] As can be seen from the above technical solution, compared with the prior art, the present invention discloses a cross-city trajectory generation method combining deep learning and shortest path search, which has the following beneficial effects:
[0058] This invention uses spatial syntax to extract topological features, employs a decoupled adversarial domain adaptation algorithm to learn invariant topological representations and predict travel costs, and finally learns urban-invariant human travel preferences to generate trajectories. Compared with existing techniques, this invention significantly improves the generalization ability in the trajectory generation process. Specifically, the proposed method can learn representations related to the local topological structure of road segments, thereby predicting road segment travel costs and using shortest path search to generate trajectories. When cities change, changes in road network connectivity and road segment coding cause existing methods to fail, while this invention can still predict road segment costs and generate reasonable trajectories using shortest path search. Attached Figure Description
[0059] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0060] Figure 1 This is a schematic diagram of the road network topology of two different cities provided for an embodiment of the present invention.
[0061] Figure 2 This is a schematic diagram of the overall network structure of the cross-city trajectory generation method that combines deep learning and shortest path search, as provided in an embodiment of the present invention.
[0062] Figure 3 This is a schematic diagram comparing the frequency heatmaps of road segments on XA data using different methods provided in the embodiments of the present invention. Detailed Implementation
[0063] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0064] The key to cross-city trajectory generation is capturing invariant human movement patterns in different urban environments. Based on existing research, this invention proposes two invariant human movement patterns: (1) People in different cities have similar travel preferences. Generally, people choose the path with the lowest travel cost. By learning the combination of travel costs, we can generate trajectories that conform to human preferences. (2) The topology of the road network affects the function, frequency of use, and degree of congestion of roads, thus determining travel costs. Although the global road network structure differs between different cities, similar local topologies exist. (e.g., Figure 1 As shown, the local road network topologies of the two different cities are similar, making transfer learning possible.
[0065] This invention aims to generate fine-grained, segment-based travel trajectories and generalize them across cities. The following are the necessary symbol definitions used in the patent disclosure.
[0066] Definition 1: Road network (Roadmap): A road network graph is a directed graph G =<R,E> , where R is the set of road segments, This indicates the adjacency relationship between road segments. If road segment r... i and r j If connected via an intersection, then E ij =1; otherwise, E ij =0.
[0067] Definition 2: Road Segment: A road segment is represented by the symbol r. i Let ∈R represent a specific line segment in the urban road network. Each road segment has several characteristics, such as geographic coordinates, road type, and length. The feature vector of a road segment can be represented as... Where D s denoted as the dimension of the feature vector. Based on urban road segments, this paper can construct an urban road network map structure to describe the road network of the entire city.
[0068] Definition 3: Road Segment-based Trajectory: A road segment-based trajectory is a sequence of road segments arranged in chronological order, denoted as τ. The nth trajectory point is represented as... For the corresponding road segment, t n This is a timestamp. In road segment-based trajectories, the road segments corresponding to consecutive trajectory points are connected. This indicates that the trajectory should be a continuous line.
[0069] Definition 4: Travel Demand. Travel demand is a triple D = (r o ,rd ,t o ), where l o For the starting road segment, l d For the target road segment, t o This represents the departure time. Travel demand can be extracted from actual trajectory data, describing the agent's travel goals within the city.
[0070] The objective of this invention is to: given a road network G src Trajectory dataset The source city, and a city that only contains a road network G tgt However, there is a lack of trajectory data. The target city, train a model g θ This enables it to generate a new trajectory dataset. The invention aims to fit human movement patterns in a target city. Specifically, it trains the model on data from the source city to obtain parameters θ, and then applies the trained model to the target city to generate simulated trajectories similar to real trajectory data, formally defined as follows.
[0071] Input: Source city road network G src Trajectory dataset Target city road network G tgt
[0072] Optimization objective: Optimize the model parameters θ (here, parameters refer to the parameters of all neural networks in the entire technical framework diagram, including SAGAT, the travel cost prediction network, the domain discriminator, and the implicit cost prediction network; this is a general, formal description. The optimization process includes decoupled adversarial training and iterative training (preference learning)) to improve the road network G in the target city. tgt The generated trajectory dataset With real data Similar. The following function is optimized during the training phase.
[0073]
[0074] Where L is the optimization objective, which measures the difference between the generated trajectory and the real trajectory.
[0075] Output: Generate trajectory data for the target city using the trained parameters:
[0076]
[0077] This invention proposes a cross-city trajectory generation method based on transfer learning. To achieve cross-city transferability of deep neural network models, this invention proposes methods for extracting city-independent representations, predicting travel costs, learning travel preferences, and searching for the shortest path. The overall architecture of the technical solution of this invention is as follows: Figure 2 As shown, this invention can be divided into three parts: topological feature extraction, travel cost prediction, and trajectory generation based on preference learning. In the topological feature extraction module, spatial syntax is used to construct a series of features, and then an inductive graph attention network is used to aggregate local features. In the travel cost prediction module, supervised training is performed using source city data, and domain adaptation loss is introduced for decoupled adversarial training to improve the prediction performance for the target city. In the travel preference learning module, the obtained preference values are used to find the shortest path, narrowing the gap between the preference values and the predicted path and the actual path, and continuously iteratively updating the preference prediction.
[0078] The extraction of urban road network topology representation based on space syntax mainly includes steps such as space syntax feature computation and representation and feature aggregation based on inductive graph attention network. Each step is described in detail below.
[0079] 1.1 Spatial syntactic feature calculation representation of urban road network:
[0080] In the spatial structure analysis of cities and buildings, topological feature extraction is an important component of spatial morphology research, providing a profound understanding and quantitative description of road network structure. This invention calculates four key spatial syntactic features, including Total Depth, Integration, Connectivity, and Choice (also known as Betweenness Centrality), and the specific calculation methods are as follows.
[0081] 1) Total Depth: Total depth refers to the sum of the step depths from a specific road segment to all other road segments in the network. From road segment r i To another section of road within a certain range j The step depth refers to the total number of hops in the shortest path. The total depth of a road segment is r. i To calculate the sum of step depths for all road segments within a certain range (a specified local radius, such as 10km), this invention selects multiple different local radii to calculate multiple values. The calculation method is as follows:
[0082] SD(r i ,r j = Size(shortestpath(r) i ,r j )),
[0083]
[0084] This indicator can identify which road segments are relatively remote, requiring more travel time and steps to reach. Reducing the overall depth of a specific area can effectively alleviate traffic congestion, especially during peak hours, because it can pinpoint key road segments that may become traffic bottlenecks.
[0085] 2) Integration: Integration reflects the centrality of a road segment within the entire road network, and it is calculated as follows:
[0086]
[0087] Where NC(r) i ) refers to the section r i The total number of road segments that must be traversed to reach all other road segments within a certain range from the starting point. This refers to the total depth of the road segment. A highly integrated road segment means it is more central, with shorter routes and lower travel costs to other parts of the city. Therefore, improving road integration helps increase traffic efficiency and reduce travel time.
[0088] 3) Connectivity: Connectivity refers to the number of direct connections between a road segment and other road segments. Road segments with high connectivity are usually located at the core of the transportation network, serving as intersections of multiple roads. Such road segments typically handle high traffic volumes and are key components of the urban transportation network. Enhancing the connectivity of road segments can improve the overall accessibility of the network, promote smoother traffic flow, and reduce travel delays. Connectivity represents the number of directly connected neighbors of a road segment and can be calculated using the following formula:
[0089]
[0090] 4) Selectivity: Selectivity, also known as betweenness centrality, measures the frequency with which a road segment appears on the shortest path between all pairs of road segments. Road segments with high selectivity play important transit or bridging roles in the network, and are crucial for dispersing traffic congestion, optimizing route selection, and reducing travel time. Improving road selectivity can make it a more efficient traffic flow distribution channel, helping to alleviate pressure on major traffic arteries. Road segment r i The selectivity is calculated by measuring it across all segments for r. j and r k The number of occurrences on the shortest path between them is calculated as follows:
[0091]
[0092] Where δ ijk Indicates from r j to r k Does the shortest path pass through r?i Specifically, it is described as follows:
[0093]
[0094] By utilizing these four topological features in spatial syntax—total depth, integration, connectivity, and selectivity—this invention can comprehensively analyze the spatial structure of urban road networks. In addition to spatial syntax features and basic characteristics of road segments (including length)... type and direction They will be merged into a single feature vector, as shown below:
[0095]
[0096] The time slice index is used to learn how the initial travel cost changes over time, and discrete variables are encoded through an embedding layer.
[0097] 1.2 Feature aggregation based on inductive graph attention network:
[0098] After obtaining initial spatial syntactic topological features, this invention aggregates them using inductive graph attention networks (GATs) to obtain representations containing richer topological information. These representations are not merely simple sets of node features, but rather a comprehensive representation of spatial relationships and topological features learned by neural networks. This process is crucial for capturing the complex structural characteristics of road networks. Inductive graph attention networks require training with diverse graph structure data to enhance the model's generalization ability. Therefore, this invention first divides the entire city's global road network into numerous local subgraphs using a subgraph sampling method, and then designs a spatially aware graph attention network to aggregate features. Specifically, this may include the following:
[0099] Step 1.2.1 Road network sub-map sampling:
[0100] This invention employs the Metis algorithm to divide the entire road network into multiple subgraphs, and randomly selects a subset of these subgraphs for training. Specifically, K subgraphs are sampled each time, with the first subgraph directly selected through a traversal, and the remaining K-1 subgraphs randomly selected. This ensures that each subgraph is sampled, resulting in diverse subgraph combinations as input. Traditional methods perform convolution on the entire graph, leading to performance degradation when the road network structure changes. Subgraph convolution avoids this problem and better utilizes the local topological similarities between different cities. However, subgraph convolution also introduces the challenge of subgraph sampling.
[0101] To extract more diverse and representative samples from a large road network, this invention uses the Metis algorithm, which efficiently divides a large-scale graph into several smaller subgraphs while ensuring that the number of vertices in each subgraph is as balanced as possible and the number of edges between subgraphs is minimized. This balanced partitioning method helps enhance the model's adaptability to different types of road networks. The sampling process is as follows:
[0102]
[0103] in It is a global map of the entire city's road network. It is a subgraph segmented by Metis. It is a subgraph generated by random sampling.
[0104] Step 1.2.2 Spatial Perception Map Attention Convergence:
[0105] After sampling diverse subgraphs, this invention proposes a Spatial Aware Graph Attention Network (SAGAT) to aggregate subgraph features and generate road segment representations with surrounding topological information. Traditional GATs, when aggregating neighbor node information, only utilize node representations to calculate attention coefficients, ignoring the spatial relationships between nodes in urban road networks. For example, from a spatial syntax perspective, the higher the selectivity (betweenness centrality) of the connecting edge between two road segments, the larger the attention coefficient should be. Such spatial relationships are prevalent in different cities; therefore, this study introduces the spatial relationships between road segments into the attention mechanism, enhancing the model's ability to perceive spatial information. In this invention, the input to SAGAT is the node features of each subgraph. Features are aggregated through a series of stacked attention layers to ultimately obtain the subgraph topological feature representation. This process is expressed as follows:
[0106]
[0107] Where h i It corresponds to road segment r i Aggregate topological representation.
[0108] Specifically, this process is achieved through multi-layer attention aggregation. The initial layer input is transformed into a representation by a multi-layer perceptron (MLP), and the calculation method is as follows:
[0109]
[0110] This MLP transformation layer helps to enhance the richness of feature representation in the initial stage of the network, providing better input for subsequent attention mechanisms.
[0111] For layer l+1, the SAGAT network computes attention weights between nodes and embeds spatial relationships into the attention mechanism. In this structure, the model not only focuses on the features of neighboring nodes but also considers the spatial relationships between these nodes, such as corners, driving distances, and betweenness centrality. These spatial relationships reflect the physical connections and relative spatial positions between road segments and are crucial information for understanding the structure of urban road networks. The computation process of this attention mechanism is as follows:
[0112]
[0113] Where a, W s W t W e These are learnable parameters. It is section r i The set of neighboring nodes, σ is the LeaklyReLU activation function. ij The spatial relationship between two nodes is represented as follows:
[0114] u ij =Bet(r) i ,r j )||Angle(r i ,r j )||Dist(r i ,r j ),
[0115] Where Bet refers to passing through r i and r j The ratio of the number of shortest paths to the total number of shortest paths in the entire network. Angle represents the corner of a road segment, while Dist represents the travel distance between the center points of two road segments. The output of the (l+1)th layer of the final spatially aware graph attention network is represented as:
[0116]
[0117] 2. Cross-city travel cost prediction based on decoupled adversarial learning:
[0118] This invention aims to achieve transferable trajectory generation through cross-city travel cost prediction and shortest path search. However, the difference in representation distribution between the source and target cities reduces the model's generalization ability. To address this issue, this invention uses decoupled learning and adversarial domain adaptation to obtain city-independent representations and predicts the travel cost of the target city. This part can be divided into two components: semantic and domain representation decoupling, and ranking loss-based travel cost prediction. Each component will be described in detail below.
[0119] 2.1 Semantic and domain representation decoupling:
[0120] After aggregating topological features, to obtain a city-independent representation, this invention first uses two encoders to decouple information at different levels from the topological representation. This invention assumes that road segment information is determined by two independent latent variables: a semantic latent variable z. (s) and a domain latent variable z (d) These variables were extracted using a semantic encoder and a domain encoder, respectively. (s) Capture semantic information used to predict trajectory costs, while z (d) Includes city-specific domain information, as shown below:
[0121]
[0122] The semantic encoder and domain encoder are each implemented using two multilayer perceptrons (MLPs). This invention uses adversarial domain adaptation techniques to train these representations, which include a predictor for travel cost estimation and a discriminator for city identification. These representations are updated synchronously during the computation and optimization of travel cost prediction.
[0123] In the above steps, a multilayer perceptron (MLP) is used as the discriminator, utilizing discriminative loss. Training is then performed. To achieve adversarial effects, a gradient inverse layer (GRL) needs to be added before the discriminator for semantic latent variables, and another GRL layer needs to be added before the travel cost prediction network for domain latent variables.
[0124] 2.2 Travel cost prediction based on ranking loss:
[0125] Travel cost is represented by the average travel time and speed of a road segment over a specific period, expressed as:
[0126]
[0127] Where m represents the cost type. Using the decoupling latent variable z... i As input (superscripts omitted for simplicity), the travel cost prediction network can be represented as:
[0128]
[0129] The prediction loss function used to train a neural network includes an MSE loss and a ranking loss. The MSE loss is calculated as follows:
[0130]
[0131] Where N s It is the size of the source city dataset, y i It represents the true cost of travel on a route (including travel time and speed), expressed as the average of real datasets.
[0132] In cross-city scenarios, travel costs between different cities often exhibit potential discrepancies, making it difficult to predict the absolute magnitude of travel costs. To address this issue, this invention introduces a ranking loss method. Specifically, this invention predicts the absolute value of travel costs for two road segments r. i The travel cost is higher than r j The probability is
[0133]
[0134] The actual ranking tag value is calculated as follows:
[0135]
[0136] The binary cross-entropy loss is calculated as follows:
[0137]
[0138] The total loss in travel cost forecasting is:
[0139]
[0140] Where λ r It is the balancing weight between the two types of loss.
[0141] 2.3 Decoupling and Adversarial Training:
[0142] To separate domain information from semantic information, this study introduces a domain discriminator to predict the domain labels of road segments. Submap samples are extracted from the source or target city, and domain labels are assigned to each road segment, as shown below:
[0143]
[0144] A label of 1 indicates that the road segment originates from the source city's road network, while a label of 0 indicates that the road segment originates from the target city's road network. Given the latent variable z... i As input, the domain discriminator classifies the source city and the target city as follows:
[0145]
[0146] For this domain discrimination task, the binary cross-entropy loss is used to calculate:
[0147]
[0148] Where N s and N t These represent the size of the source city and target city datasets, respectively.
[0149] Decoupling adversarial training is used to promote and This involves decoupling information between different domains. For semantic latent variables, the ultimate goal is to maximize the domain discriminative loss while minimizing the travel cost prediction loss; for domain latent variables, the goal is the opposite. By using different representations as input, the loss function is calculated as follows:
[0150]
[0151] To further reduce information coupling, this study also introduces orthogonal loss, attempting to maximize the difference between the decoupled representations. The orthogonal loss is calculated as follows:
[0152]
[0153] The overall loss function representing decoupling adversarial training incorporates these losses, and the final loss function is:
[0154]
[0155] Where λ g It is a balancing factor. Through this step of decoupled adversarial training, the model can separate domain-related information from road segment representations, thereby enabling city-independent semantic representations and achieving cross-city travel cost prediction.
[0156] 3. Based on travel preferences, the trajectory is learned:
[0157] Specifically, this section includes:
[0158] 3.1 Travel Preference Prediction:
[0159] After predicting travel costs, a shortest path search algorithm can be used to generate travel trajectories for the target city. Most existing shortest path search models rely on fixed road cost factors, such as travel speed or time, to plan routes. However, relying on a single cost factor often fails to fully capture users' actual travel preferences, which are influenced by more complex factors. To address this issue, this invention proposes modeling travel preferences as a combination of observable and implicit costs. Implicit costs represent factors that are difficult to explain and influence human choices. Observable costs refer to the travel costs predicted in the previous step, including average travel time and average travel speed of road segments; implicit costs are calculated using another multilayer perceptron, as shown in the formula: Updated through iterative training, where z i These are semantic latent variables. Implicit costs can be interpreted as people's preferences for roads. For example, if people prefer to choose wide main roads, then the implicit cost of main roads should be lower. This preference can be mined from trajectory data. These costs are trained using source city data and used for prediction in the target city.
[0160] The predictive model then uses a weighted combination of observable and implicit costs to estimate overall travel preferences, as shown below:
[0161]
[0162] Where w (m) These are learnable weights. p(r) i The smaller the value of ), the better the road segment r. i The higher the preference, the better. This study assumes that this combination of preferences remains consistent across different cities.
[0163] 3.2 Travel Preference Update:
[0164] Preference learning is achieved through unsupervised training. During training, this invention first randomly initializes the parameters and searches for the shortest path. From r... i to r j The shortest path is represented as The sum of their preferences is:
[0165]
[0166] Actual trajectory τ ij The sum of preference values is:
[0167]
[0168] The unsupervised loss function is defined as follows:
[0169]
[0170] Through iterative training, the model learns the invariant mapping relationship between travel preferences and various travel costs, which can then be applied to the target city to generate trajectory data.
[0171] To implement the above methods, the present invention also discloses a specific system or model capable of implementing the above methods, and utilizes a computer system to implement the corresponding methods.
[0172] This invention has been extensively tested on multiple city datasets, validating the model's performance and generalization ability. Experimental results show that, compared to existing trajectory generation methods, this invention has significant performance advantages in cross-city trajectory generation tasks. By comparing with baseline models, this invention not only outperforms other models in terms of generation quality but also demonstrates superior usability of the generated data.
[0173] Experimental verification setup for this invention:
[0174] (1) Datasets: We selected three real-world trajectory datasets to evaluate the performance of this invention. These datasets come from three different cities: BJ, XA, and CD. The road network data for these three cities were obtained from OpenStreetMap (OSM), and road segment trajectory data were acquired by applying a map matching algorithm. The table shows a summary of the corresponding statistical indicators for the three datasets, including the number of road segments and intersection trajectories, as well as the time period for data collection.
[0175] Table 1 Trajectory Dataset Information
[0176]
[0177]
[0178] (2) Baseline Methods for Comparison: To evaluate the proposed method, the following trajectory generation models were selected as baseline comparisons. These models cover both knowledge-driven and data-driven models, and are appropriately modified according to road segment-based trajectory sequences.
[0179] EPR models include Spatial-EPR (SE) and Density-EPR (DE). These models categorize human behavior into two modes: exploration and prioritizing return. They introduce gravity models to simulate the impact of group movement on individuals and set empirical parameters for sampling.
[0180] TrajGen (TG): This method uses a CNN-based GAN to generate synthetic trajectory images, then extracts positional information from the images, and uses a Seq2Seq model to infer the real trajectory sequence.
[0181] SeqGAN(SG): This method is a classic sequence generation method that combines policy gradient and GAN to solve the sequence generation problem.
[0182] SVAE(SV): This method is the first to combine a variational autoencoder with a Seq2Seq model to generate motion trajectory data.
[0183] MoveSim(MS): This method constructs a self-attention-based trajectory generator and designs a discriminator that perceives movement patterns, training the generator in a reinforcement learning paradigm.
[0184] TS-TrajGen(TT): This method combines the A* search algorithm and neural networks to model agent policies and proposes a two-stage adversarial generative network to effectively generate trajectory data.
[0185] DiffTraj(DT): This method utilizes the generative capabilities of diffusion models to reconstruct and synthesize geographic trajectories from white noise through a reverse trajectory denoising process.
[0186] VOLUNTEER (VO): This method uses a variational autoencoder (VAE) to simulate the user's complex spatiotemporal distribution and obtain accurate trajectory simulation.
[0187] (3) Evaluation Metrics: From a macro-similarity perspective, this method focuses on the overall statistical distribution of the trajectory dataset. This method evaluates the quality of the generated data by comparing the similarity of movement patterns and urban traffic state indicators between the generated data and the real data. Here, the experiment uses Jensen-Shannon divergence (JS divergence) as a similarity metric to measure the performance of the real trajectory dataset. and generate trajectory dataset Similarity between
[0188]
[0189] in It is a statistical measure of a trajectory dataset, where the sample consists of a single trajectory or a road segment. Specifically, the JS divergence is calculated based on the following statistical distribution:
[0190] Distance: Represents the travel distance of a trajectory, i.e., the spatial length.
[0191] Radius: Calculated by the radius of rotation, it represents the spatial range of the trajectory.
[0192] Access frequency (LocFreq): The access frequency distribution for each road segment, used to indicate the popularity of the road.
[0193] From a micro-similarity perspective, this method focuses on measuring the sequence distance between real and generated trajectories with the same travel needs. The average sequence distance is calculated using the following formula:
[0194]
[0195] SeqDist refers to various micro-similarity metrics. In this experiment, four types of trajectory distances were used for calculation:
[0196] Hausdorff distance: measures the maximum deviation between any point in one trajectory set and the nearest point in another trajectory set.
[0197] DTW (Dynamic Time Warping): Minimizes the cumulative distance between corresponding points by aligning them on the time axis.
[0198] EDT (Edit Distance): Measures the minimum number of edit steps required to transform one sequence into another.
[0199] EDR (Edit Distance on True Sequence): A variant of edit distance designed specifically for true value sequences.
[0200] These combined metrics help to comprehensively assess macroscopic and microscopic trajectory similarities, ensuring that the generated data are consistent with real-world patterns in terms of statistical properties and structure.
[0201] (4) Programming and runtime environment: All experiments were conducted on a machine equipped with an NVIDIA GeForce 3090 GPU and running Ubuntu 20.04. The model was implemented using PyTorch 1.12.1. The SAGAT layer had 6 layers. During training, the number of clusters K varied according to the dataset size; each batch of data consisted of 3 clusters; the learning rate was set to 1e-5; and the number of training iterations was 600. The balancing weight in the loss function was: λ r =50, λ r =100 and λ g =50.
[0202] To verify the effectiveness of the present invention, the beneficial effects achieved by the present invention are demonstrated from three aspects: cross-city trajectory generation, downstream task application, and target city fine-tuning.
[0203] Validation of cross-city trajectory generation effect:
[0204] Table 2. Results of Cross-City Trajectory Generation
[0205]
[0206]
[0207] In Table 1, the model proposed in this invention is abbreviated as GTG (Generalizable Trajectory Generator). GTG1 refers to training on the XA dataset and generating on the BJ dataset; training on the BJ dataset and generating on the CD dataset; and training on the CD dataset and generating on the XA dataset. GTG2 refers to training on the BJ dataset and generating on the XA dataset; training on the XA dataset and generating on the CD dataset; and training on the CD dataset and generating on the BJ dataset.
[0208] The overall performance results are shown in Table 1. In the experiments on each dataset, the best results are highlighted in bold, while the second-best results are indicated by underline. From both macro and micro perspectives, this invention demonstrates superior performance compared to all baseline models on the three real-world trajectory datasets, with significant improvements across all metrics. Unlike other deep learning baseline methods that require training on target city data to generate accurate trajectories, this invention operates effectively without training on target cities. This demonstrates the model's generalization ability.
[0209] By further visualizing the thermal images of road segment access frequency, such as Figure 3 As shown, five models with better performance were selected and compared with real data heatmaps. The comparison reveals that the present invention (GTG) achieves the best fit to real trajectory data across various urban regions. Other models exhibit problems such as overall distribution being too low or too high, and varying fit across different regions. This is because these models fail to capture local spatial heterogeneity and the differences in feature distribution between the target city and the source city. These methods fail to capture the common patterns applicable to different urban regions, and their performance deteriorates as the urban road network structure changes. In contrast, the present invention learns more general data patterns through spatial syntax, inductive topological feature extraction, adversarial domain adaptation, and preference learning, thus achieving better performance.
[0210] Downstream task application effect verification:
[0211] The downstream task application effect primarily verifies whether the generated data can completely replace real data for training downstream tasks. This scenario aims to demonstrate the usability of the generated data. We divide the data into three parts: Data-Train, Data-Target, and Data-Test. Data-Train is used to train the trajectory generation model. Data-Target is the set that the trajectory generation model wants to generate. Data-Test is used to test the performance of downstream tasks. Experimental method: First, the trajectory generation model is trained using Data-Train. Then, the trained model is used to create a generated Data-Traget-Gen based on the travel demands in Data-Target. Next, this method uses Data-Traget-Gen and Data-Target to train two downstream models respectively. Finally, Data-Test is used to evaluate the performance differences between the downstream models.
[0212] In this scenario, our method trains downstream application models based on generated trajectory data and validates them on real trajectory data. In this way, we can evaluate the utility of the generated trajectory data, thus demonstrating that the generated trajectory data of this invention can support downstream applications. Specifically, we choose the trajectory next-hop location prediction task as the downstream application task. The trajectory next-hop location prediction task aims to predict the location of a trajectory and is widely used in POI recommendation applications. We select DeepMove and LSTPM as trajectory next-hop location prediction models and train these downstream models using synthetic trajectory data generated in Data-Target. Then, we test the downstream models on real trajectory data from Data-Test.
[0213] Table 3 Application Effects of Downstream Tasks
[0214]
[0215]
[0216] As shown in Table 3, the baseline model exhibits poor performance, while our invention achieves results that most closely resemble the real trajectory dataset used as the training set across all metrics. From a deep learning training perspective, the model's test performance is affected by the difference in distribution between the training and test sets. The trajectory dataset generated by our invention is closer to the distribution of the real trajectory dataset, thus resulting in better generalization performance on both models. From a usage perspective, this indicates that the trajectory data generated by our method is more effective in supporting downstream tasks, which can directly use simulation data for training. This is particularly important in scenarios involving privacy protection and simulation.
[0217] Target city data fine-tuning experiment:
[0218] Considering that the gradual collection of trajectory data is a more realistic application scenario, it would be very beneficial if the trajectory generation capability of the model could be further adjusted in the target city.
[0219] Table 4 Results of the Target City Fine-tuning Experiment
[0220]
[0221]
[0222] We fine-tuned the model using trajectories from the target city to test its improved generative capabilities. The fine-tuning phase included travel cost prediction and preference learning. Experimental results are shown in Table 4. Fine-tuning using target city data improves model performance. Collecting a small amount of trajectory data for fine-tuning before applying the model to new cities can achieve good generative results without incurring excessive costs. In the table, lower values are generally better. Furthermore, the performance of this invention steadily improves across all metrics as the number of fine-tuned trajectories increases.
[0223] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to the method section.
[0224] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A cross-city trajectory generation method combining deep learning and shortest path search, characterized in that, The method comprises the following steps: 1) obtaining spatial syntax topological features of a city road network, the city road network comprising city road networks of a source city and a target city: The source city and the target city are respectively divided into a plurality of subgraphs by using a Metis algorithm and The divided subgraphs are respectively composed into a road network subgraph set of the source city and a road network subgraph set of the target city. aggregating node features of each subgraph in the source city road network subgraph set using a spatial-aware graph attention network to generate aggregated topological features of the source city road network; aggregating node features of each subgraph in the target city road network subgraph set using a spatial-aware graph attention network to generate aggregated topological features of the target city road network; 2) learning an invariant topological representation and predicting a travel cost of the target city by using a decoupled adversarial domain adaptation algorithm: based on the aggregated topological features of the source city road network, extracting semantic latent variables of the source city from the aggregated topological features using a semantic encoder, and extracting domain latent variables of the source city from the aggregated topological features using a domain encoder; based on the aggregated topological features of the target city road network, extracting semantic latent variables of the target city from the aggregated topological features using a semantic encoder, and extracting domain latent variables of the target city from the aggregated topological features using a domain encoder; judging the aggregated topological features of the source city and the target city using a domain discriminator; decoupling information between the semantic latent variables and the domain latent variables by decoupled adversarial training to obtain city-independent semantic representations; constructing a travel cost prediction network comprising a multi-layer perceptron (MLP) and a softplus activation function module connected thereto, and predicting the city-independent semantic representations using the travel cost prediction network to obtain a predicted travel cost; 3) learning to generate trajectories according to travel preferences: combining the predicted travel cost and the implicit cost to obtain a travel preference of the target city, the implicit cost comprising preference weights of different roads; by iterative training, the model learns an invariant mapping relationship between the travel preference and various travel costs, which is applied to the target city to generate trajectory data. 2.The cross-city trajectory generation method combining deep learning and shortest path search according to claim 1, wherein, 1) In the step of obtaining the spatial syntactic topological features of the urban road network, the spatially aware graph attention network SAGAT is used to select the subgraph set. The node features of each subgraph are aggregated, specifically including the following steps: A spatial-aware graph attention network (SAGAT) is constructed, and an output layer of the SAGAT is connected through a residual block; An initial layer of the SAGAT converts subgraph node features inputted through a multi-layer perceptron (MLP); An (l+1)th layer of the SAGAT, l≥1, calculates attention weights between nodes and embeds spatial relationships between nodes into the attention weights: where a, W s ,W t ,W e are learnable parameters, is the set of neighbor nodes of road segment r i , σ is the LeaklyReLU activation function; u ij denotes the spatial relationship between two nodes. According to the attention weight Get the city road network aggregation topology features of the l+1th layer output of the spatial-aware graph attention network SAGAT: 3.The cross-city trajectory generation method combining deep learning and shortest path search according to claim 2, wherein, Spatial relationship u between two nodes ij comprising: passing through road segment r i and road segment r j Bet(r i , r j ), Angle(r i , r j ), and Dist(r i , r j ). 4.The cross-city trajectory generation method combining deep learning and shortest path search according to claim 1, wherein, predicting the city-independent semantic representations to obtain a predicted travel cost, specifically comprising the following steps: Decouple latent variables z i Input the travel cost prediction network to obtain a predicted travel cost A loss function for training the travel cost prediction network comprises an MSE loss function and a ranking loss function. 5.The cross-city trajectory generation method combining deep learning and shortest path search according to claim 4, wherein, The MSE loss function specifically comprises the following expression: where N s is the size of the source city dataset; y i is the true value of the link travel cost, including travel time and speed. 6.The cross-city trajectory generation method combining deep learning and shortest path search according to claim 4, wherein, The ranking loss function specifically comprises the following expression: wherein, denotes a road segment r i predicts a travel cost higher than road segment r j predicts a probability of a travel cost; denotes a road segment r i and a true ranking label value of road segment r j .
7. The cross-city trajectory generation method combining deep learning and shortest path search according to claim 1, characterized in that, The travel preference of the target city is obtained by weighted combination of the observable cost and the implicit cost, specifically comprising: Based on observable costs and implied costs The travel preferences for the target city are obtained by the following equation: where w (m) is a learnable weight.