Simulating the human mobility and generating large-scale trajectories are of great use in many real-world applications, such as urban planning, epidemic spreading analysis, and geographic privacy protect. Although many previous works have studied the problem of trajectory generation, the continuity of the generated trajectories has been neglected, which makes these methods useless for practical urban simulation scenarios. To solve this problem, we propose a novel two-stage generative adversarial framework to generate the continuous trajectory on the road network, namely TS-TrajGen, which efficiently integrates prior domain knowledge of human mobility with model-free learning paradigm. Specifically, we build the generator under the human mobility hypothesis of the A* algorithm to learn the human mobility behavior. For the discriminator, we combine the sequential reward with the mobility yaw reward to enhance the effectiveness of the generator. Finally, we propose a novel two-stage generation process to overcome the weak point of the existing stochastic generation process. Extensive experiments on two real-world datasets and two case studies demonstrate that our framework yields significant improvements over the state-of-the-art methods.
The two Dataset BJ-Taxi and Porto-Taxi can be download at Baidu Pan with code 5608. Please ensure that the dataset is only used for research purposes, and please cite our paper if our dataset is used. Each dataset has following 3 file:
xx.geo
: the geo file which stores the road segment infomation of the road network.xx.rel
: the rel file which stores the adjacent information between road segments.xx.csv
: the map matched trajectory file.Note: the geo
and rel
file format is defined by our LibCity project, you can refer more information about this two file in docs. In fact, these two files are still in CSV format (you can load it by pd.read_csv
), but we have defined different suffixes to distinguish them.
W. Jiang, W. X. Zhao, J. Wang, and J. Jiang, "Continuous trajectory generation based on two-stage GAN," in Thirty-Seventh AAAI Conference on Artificial Intelligence (AAAI’23), 2023.
@inproceedings{ts_trajgen,
title={Continuous Trajectory Generation Based on Two-Stage GAN},
author={Wenjun Jiang and
Wayne Xin Zhao and
Jingyuan Wang and
Jiawei Jiang},
booktitle = {{AAAI}},
publisher = {{AAAI} Press},
year = {2023}
}
xianshi_mm_train.csv
: the map matched trajectory for training.xianshi_mm_test.csv
: the map matched trajectory for testing.xian.geo
: the geo file of xian road network.xian.rel
: the rel file of xian road network./script/preprocess_pretrain_input.py
pretrain_gat_fc.py
for function H.pretrain_function_g_fc.py
for function G./script/process_kahip_graph_format.py
to generate KaHIP's input../build/kaffpa ./data/xian.graph --k 100 --preconfiguration=strong
to conduct graph partition/script/process_kaffpa_res.py
to process KaHIP's output and generate regions./script/construct_traffic_zone_relation.py
to calculate regions' adjacent relationships./script/map_region_traj.py
to map the road-level traj to region level./script/encode_region_traj.py
to encode the region-level trajectories to pretrain input of models./script/prepare_region_feature.py
to calculate region GAT node feature based on road-level node feature./script/construct_region_dist.py
to calculate gps distance between regions.pretrain_region_function_g_fc.py
to pretrain region-level function G.pretrain_region_gat_fc.py
to pretrain region-level function H.train_gan.py
and train_region_gan.py
to adversarial learning.
our_model_generate.py
to generate trajectories based on the OD-input from the test dataset, .e.g, xianshi_mm_test.csv
.