Learning-based trajectory indexing and query method based on homogeneous region partitioning on directed road networks
Through the learning trajectory index method based on homogeneous region division on directed road network, using depth-first search and three-dimensional segmented linear model, the problems of low query efficiency and insufficient prediction accuracy are solved, and efficient trajectory query and accurate vehicle walking ordering are achieved.
Patent Information
- Application Number
- CN202311235731.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-22
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2043-09-22
AI Technical Summary
The prior art has low query efficiency on directed road networks, and the prediction accuracy needs to be improved, especially when tilting data, the model prediction is not accurate enough.
By setting up a subsequent array for each directed section, recording the pass ratio, determining the section number with depth priority search, dividing homogeneous area categories according to length and lane number, and training a segmented linear model of three-dimensional space for each second-order homogeneous area category to perform trajectory query.
It improves query performance and prediction accuracy, reduces index size and storage cost, ensures consistency in vehicle walking order, and enhances query efficiency on tilted data.
Smart Images

Figure CN117194434B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a learning trajectory indexing and query method based on homogeneous area division on a directed road network, belonging to the technical field of road network trajectory data indexing. Background Art
[0002] In a big data environment characterized by explosive data growth, massive aggregation, and high-dimensional complexity, traditional index structures face challenges in processing massive amounts of data, including high space costs, low query efficiency, and high storage and access overhead. Learning-based indexing effectively improves indexing performance and reduces storage and access overhead by modeling and learning from underlying data distribution, query load, and other characteristics.
[0003] Multidimensional learned indexes are divided into three categories: indexes based on the Lebesgue measure, indexes based on space-filling curves, and indexes based on data partitioning. Li Pengfei et al. proposed LISA in the paper "LISA: A Learned Index Structure for Spatial Data." This index first divides the multidimensional data space into a grid, and sorts the data according to the grid cells. It then uses a Lebesgue measure-based method to construct a function to reduce the multidimensional data to one-dimensional values. A monotone sharding prediction function is then used to partition the one-dimensional data space into multiple shards, mapping each one-dimensional value to a shard ID. The prediction function uses a piecewise linear model in two-dimensional space. Finally, a local model is trained to assign each shard to the corresponding disk page. The input of the model is the one-dimensional value contained in the shard, and the output is the page address corresponding to the one-dimensional value.
[0004] Based on the index of space-filling curves, Qi Jianzhong et al. proposed the RSMI index in the paper "Effectively Learning Spatial Indices." They proposed a recursive strategy that partitions a large dataset, uses a space-filling curve to obtain the curve value for each partition, and trains a multilayer perceptron to learn the index of each partition. They then introduce a rank-space-based sorting technique within each partition to establish the order of point data, grouping the points into blocks. A multilayer perceptron is trained to learn the distribution of two-dimensional values, where the model input is the point coordinates and the output is the block ID corresponding to the coordinates.
[0005] In their paper "The ML-Index: A multidimensional, learned index for point, range, and nearest-neighbor queries," Davitkova et al. proposed the ML index, which uses a method similar to the iDistance method for dimensionality reduction. The index structure consists of two main parts: the first part calculates the Euclidean distance between each reference point and the data, partitioning data with a close distance to the reference point into the partition corresponding to the reference point. The index then calculates the one-dimensional key value for each data point based on the partition offset and the distance between each data point and the reference point in the partition. The second part uses the RMI model to learn the distribution of the one-dimensional key values. All models are linear models in two-dimensional space.
[0006] Although all three methods convert multidimensional data into one-dimensional data through dimensionality reduction and then train models to learn the distribution of one-dimensional data, these methods often suffer from inaccurate model predictions when encountering skewed data. To better learn the distribution characteristics of multidimensional skewed data, it is necessary to partition the data space based on the data distribution, dividing the skewed data into multiple evenly distributed regions. A lightweight model with controllable error is then trained to learn the distribution relationships of the multidimensional data, thereby improving index query efficiency and reducing index storage size.
[0007] The above problems are issues that should be considered and solved in the process of learning trajectory indexing and query based on homogeneous area division on directed road networks. Summary of the Invention
[0008] The purpose of the present invention is to provide a learning-based trajectory indexing and query method based on homogeneous region division on a directed road network to solve the problems in the prior art of low query efficiency, query performance and prediction accuracy that need to be improved.
[0009] The technical solution of the present invention is:
[0010] A learning-based trajectory indexing and query method based on homogeneous region partitioning on a directed road network includes the following steps:
[0011] S1. Set a subsequent array for each directed road segment, scan all trajectory data on the road network, and record the traffic volume ratio in the subsequent array; after the scan is completed, start a depth-first search from the directed road segment at the center of the road network, and determine a unique directed road segment number according to the depth-first search order;
[0012] S2. Directed road segments are first divided into several classes according to their length. Each class is further divided into several first-order homogeneous regional classes according to the number of lanes. All directed road segments within each first-order homogeneous regional class are divided into several second-order homogeneous regional classes according to the length and number of lanes of the preceding directed road segment. The order of the second-order homogeneous regional classes is determined. Then, within each second-order homogeneous regional class, the trajectory points are sorted first by time and then by road network location to determine the sequence number of the trajectory points within the second-order homogeneous regional class.
[0013] S3. For each second-order homogeneous region class, a piecewise linear model in three-dimensional space is trained as a trajectory point storage location predictor, i.e., a learning trajectory index. During training, a trajectory point is input and the storage location number of the trajectory point within the second-order homogeneous region class is output;
[0014] S4. Obtain the road network range and time range of the original query, perform trajectory query, decompose the query into multiple subqueries based on the second-order homogeneous region class, call the corresponding piecewise linear model for prediction, obtain the subquery result set, filter it, combine all the subquery result sets, and return the original query result set.
[0015] Furthermore, in step S1, the road network is a directed graph consisting of directed road segments and intersections, each directed road segment is represented by three components: directed road segment number, length, and number of lanes, and the trajectory data includes a trajectory name, a trajectory point sequence, and the trajectory passing through the directed road segment, wherein the trajectory point of the trajectory point sequence is represented by two components: road network position and time, wherein the road network position is a floating point number, the integer part is the directed road segment number where the point is located, and the decimal part is the relative position of the point on the directed road segment.
[0016] Furthermore, in step S1 , the traffic volume ratio is the ratio of the number of trajectories that pass through the current and subsequent directional road segments simultaneously to the total number of trajectories that pass through the current directional road segment.
[0017] Furthermore, in step S1, a depth-first search is started from the directed road section at the center of the road network, and a unique directed road section number is determined according to the order of the depth-first search. Specifically, a depth-first search is started from the directed road section at the center of the road network. Each time the depth is probed downward, a subsequent directed road section with a large traffic volume ratio is preferentially selected as the next access target until all directed road sections have been searched by the depth-first search. The directed road section number starts from 0, and the order in which the directed road sections are visited is the directed road section number.
[0018] Furthermore, the directed road segment at the center of the road network is obtained by adding the midpoint coordinates of all directed road segments in the directed road network and calculating the average coordinate. This average coordinate is regarded as the center of the road network, and the directed road segment with the shortest distance from the midpoint of the directed road segment to the center of the road network is regarded as the directed road segment at the center of the road network.
[0019] Furthermore, in step S2, the directed road segments are first divided into several classes according to their length, and each class is further divided into several first-order homogeneous region classes according to the number of lanes. All directed road segments within each first-order homogeneous region class are divided into several second-order homogeneous region classes according to the length and number of lanes of the preceding directed road segment, specifically,
[0020] S21. Count the total length Len of all directional road segments, set N as the number of categories of directional road segments, and calculate the average total length of directional road segments included in each category as Len / N;
[0021] S22. Sort the directed road segments in ascending order by length, then accumulate the lengths of the directed road segments. If the accumulated length is greater than or equal to Len / N, the previously accumulated directed road segment is counted as one class, and the next directed road segment is accumulated again, and so on, until N classes are finally divided.
[0022] S23. After the division in step S22, each directional road segment class is divided into two classes according to the number of lanes: the number of lanes less than or equal to the set number is divided into one class, and the number of lanes greater than or equal to the set number is divided into the other class. Thus, all directional road segments are divided into 2×N first-order homogeneous region classes.
[0023] S24. In each first-order homogeneous region class, the sum of the flow of the predecessor directional sections of all directional sections is counted and recorded as flow sum , let M be the number of second-order homogeneous directed road segment classes, and the average total flow of the predecessor directed road segments contained in each class is flow sum / M;
[0024] S25, sort the directed road sections in ascending order according to the flow of the predecessor directed road sections, and then accumulate the flow of the predecessor directed road sections. If the accumulated flow of the predecessor directed road sections is greater than or equal to flow sum / M, the previously accumulated directed segments are counted as one class, and subsequently accumulated again from the next directed segment;
[0025] S26. Repeat the above steps S24-S25 to divide each first-order homogeneous region class into M second-order homogeneous region classes, so all directed road segments in the road network are divided into 2×N×M second-order homogeneous region classes.
[0026] Furthermore, in step S24, the predecessor directed section flow is the sum of the directed section flows of all predecessor directed sections of the current directed section, the predecessor directed section is the connected directed section that directly enters the current directed section, and the directed section flow is the product of the length of the directed section and the number of lanes.
[0027] Furthermore, in step S3, for each second-order homogeneous region class, a three-dimensional piecewise linear model is trained as a trajectory point storage location predictor, namely, a learning trajectory index, specifically,
[0028] S31. Within each second-order homogeneous region, train a three-dimensional piecewise linear model, input a trajectory point (x, y), where x represents the road network location and y represents the time, and output z represents the sequence number of the trajectory point within the region;
[0029] S32. Set a maximum error threshold θ, connect the sorted trajectory points, the first point, and the last point into a three-dimensional straight line, and use the least squares method to obtain the three-dimensional straight line equation:
[0030]
[0031] Among them, P0(x0,y0,z0) is any point on the three-dimensional line, is the direction vector of the three-dimensional line. Transforming the above equations into a system of equations:
[0032]
[0033] Then traverse all the intermediate points and substitute them into the above equations to get z1 and z2, where z1 and z2 are the z coordinates of the projection points of the three-dimensional line on the xz plane and yz plane respectively, and calculate the predicted value Calculating prediction error And record the maximum prediction error and the maximum error point;
[0034] S33. If the maximum prediction error is greater than θ, segmentation is performed at the maximum error point, and the error point is added to the half with fewer midpoints between the left and right halves. The above steps are repeated in the left and right halves until the maximum prediction error is less than θ, then segmentation is stopped, and a piecewise linear model is finally obtained.
[0035] Furthermore, in step S4, the road network range and time range of the original query are obtained, and a trajectory query is performed. According to the second-order homogeneous region class, the query is decomposed into multiple sub-queries, and the corresponding piecewise linear model is called for prediction. The sub-query result set is obtained, and after screening, all sub-query result sets are combined to return the original query result set. Specifically,
[0036] S41. Get the road network range of the original query [pos S ,pos E ] and time range [t S ,t E ], where pos S is the starting road network position, pos E is the ending position of the road network, t S is the starting time, t E is the end time;
[0037] S42, the road network range in the original query [pos S,pos E ] is decomposed into multiple sub-network ranges according to the second-order homogeneous area class [pos s ,pos e ], where pos s is the starting road network position within the second-order homogeneous region class, pos e is the end road network position within the second-order homogeneous region class, and each sub-road network range [pos s ,pos e ] and time range [t S ,t E ] form a subquery q(pos s ,t S ,pos e ,t E ), each subquery q(pos s ,t S ,pos e ,t E ) corresponds to a second-order homogeneous region class;
[0038] S43. For each subquery q(pos s ,t S ,pos e ,t E ), call the corresponding piecewise linear model, input (pos s ,t S ) and (pos e ,t E ), and get the predicted value and Then, within the corresponding second-order homogeneous region class, combined with the maximum error threshold θ of the piecewise linear model, in the range Obtain the candidate trajectory point set, filter the trajectory points within the sub-query range, and obtain the sub-query result set;
[0039] S44. Repeat step S43 to obtain all sub-query result sets, combine all sub-query result sets, and return the original query result set.
[0040] The beneficial effects of the present invention are:
[0041] First, this learning-based trajectory indexing and query method based on homogeneous region partitioning on directed road networks, compared with existing technologies, divides the road network space according to the similarity of road network traffic volume, can ensure the uniform distribution of trajectory data within each second-order homogeneous region class, reduce model segmentation, improve query performance and prediction accuracy, and enhance index query efficiency.
[0042] Second, a learning-based trajectory indexing and query method based on homogeneous area division on this directed road network performs depth-first search based on connectivity mining labels to determine the unique serial number of the directed road segment, taking into account the vehicle's walking behavior and ensuring that the vehicle walking order is consistent with the road sorting.
[0043] 3. The present invention trains a three-dimensional piecewise linear model for each second-order homogeneous region class, which not only greatly reduces the index size and storage cost, but also controls the prediction error of the model, thereby reducing the number of disk blocks accessed during trajectory query and improving index query performance.
[0044] Fourth, this learning-based trajectory indexing and query method based on homogeneous region division on directed road networks not only ensures the consistency of the ordered order of directed road sections and vehicle movement, but also divides multiple homogeneous regions with uniform distribution, greatly improving the query efficiency of the index on tilted data. At the same time, it ensures the prediction error of the piecewise linear model and improves the query performance of the index. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 1 is a flow chart of a learning-based trajectory indexing and query method based on homogeneous region partitioning on a directed road network according to an embodiment of the present invention;
[0046] Figure 2 is a schematic diagram illustrating a specific example of a learning-based trajectory indexing and query method based on homogeneous region partitioning on a directed road network according to an embodiment;
[0047] Figure 3 is a schematic diagram illustrating directed road segment information in a road network according to a specific example of a learning-based trajectory indexing and query method based on homogeneous region partitioning on a directed road network according to an embodiment;
[0048] Figure 4 This is a schematic diagram illustrating trajectory data in a road network, which is a specific example of a learning-based trajectory indexing and query method based on homogeneous region partitioning on a directed road network according to an embodiment. DETAILED DESCRIPTION
[0049] The preferred embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0050] Example
[0051] A learning-based trajectory indexing and query method based on homogeneous region partitioning on directed road networks, such as Figure 1 , including the following steps,
[0052] S1. Set a subsequent array for each directed road segment, scan all trajectory data on the road network, and record the traffic volume ratio in the subsequent array; after the scan, start a depth-first search from the directed road segment at the center of the road network, and determine the unique directed road segment number according to the order of the depth-first search.
[0053] In step S1, the road network is a directed graph consisting of directed road segments and intersections. Each directed road segment is represented by three components: the directed road segment number, length, and number of lanes. The trajectory point is represented by two components: road network position and time. The road network position is a floating point number. The integer part is the directed road segment number where the point is located, and the decimal part is the relative position of the point on the directed road segment.
[0054] In step S1 , the traffic volume ratio is the ratio of the number of trajectories that pass through the current and subsequent directional road segments simultaneously to the total number of trajectories that pass through the current directional road segment.
[0055] In step S1, a depth-first search is started from the directed road section at the center of the road network, and a unique directed road section number is determined according to the order of the depth-first search. Specifically, the depth-first search is started from the directed road section at the center of the road network. Each time the depth is explored, the subsequent directed road section with a large traffic volume ratio is preferentially selected as the next access target. After all directed roads have been searched by the depth-first search, the directed road section number starts from 0, and the order in which the directed roads are visited is the directed road section number. Among them, the directed road section at the center of the road network is obtained by adding the midpoint coordinates of all directed roads in the directed road network and calculating the average coordinate. This average coordinate is regarded as the center of the road network, and the directed road section with the shortest distance from the midpoint of the directed road section to the center of the road network is regarded as the directed road section at the center of the road network.
[0056] S2. Directed road segments are first divided into several classes according to their length. Each class is then divided into several first-order homogeneous regional classes according to the number of lanes. All directed road segments within each first-order homogeneous regional class are divided into several second-order homogeneous regional classes according to the length and number of lanes of the preceding directed road segment, and the order of the second-order homogeneous regional classes is determined. Then, within each second-order homogeneous regional class, the trajectory points are sorted first by time and then by road network location to determine the sequence number of the trajectory points within the second-order homogeneous regional class.
[0057] In step S2, the directed road segments are first divided into several classes according to their length, and each class is further divided into several first-order homogeneous region classes according to the number of lanes. All directed road segments within each first-order homogeneous region class are divided into several second-order homogeneous region classes according to the length and number of lanes of the preceding directed road segment, specifically,
[0058] S21. Count the total length Len of all directional road segments, set N as the number of categories of directional road segments, and calculate the average total length of directional road segments included in each category as Len / N;
[0059] S22. Sort the directed road segments in ascending order by length, then accumulate the lengths of the directed road segments. If the accumulated length is greater than or equal to Len / N, the previously accumulated directed road segment is counted as one class, and the next directed road segment is accumulated again, and so on, until N classes are finally divided.
[0060] S23. After the division in step S22, each directional road segment class is divided into two categories according to the number of lanes. The number of lanes is less than or equal to 2 and is divided into one category, while the number of lanes is greater than or equal to 3 and is divided into another category. Therefore, all directional road segments are divided into 2×N first-order homogeneous area classes.
[0061] S24. In each first-order homogeneous region class, the sum of the flow of the predecessor directional sections of all directional sections is counted and recorded as flow sum , let M be the number of second-order homogeneous directed road segment classes, and the average total flow of the predecessor directed road segments contained in each class is flow sum / M;
[0062] In step S24, the preceding directed road segment flow rate is the sum of the directed road segment flows of all preceding directed road segments of the current directed road segment. The preceding directed road segment is a connected directed road segment that directly enters the current directed road segment. The directed road segment flow rate is the product of the length of the directed road segment and the number of lanes.
[0063] S25, sort the directed road sections in ascending order according to the flow of the predecessor directed road sections, and then accumulate the flow of the predecessor directed road sections. If the accumulated flow of the predecessor directed road sections is greater than or equal to flow sum / M, the previously accumulated directed segments are counted as one class, and subsequently accumulated again from the next directed segment;
[0064] S26. Repeat the above steps S24-S25 to divide each first-order homogeneous region class into M second-order homogeneous region classes, so all directed road segments in the road network are divided into 2×N×M second-order homogeneous region classes.
[0065] S3. For each second-order homogeneous region class, a three-dimensional piecewise linear model is trained as a trajectory point storage location predictor, namely, a learning trajectory index. During training, the trajectory point is input and the storage location sequence number of the trajectory point within the second-order homogeneous region class is output.
[0066] In step S3, for each second-order homogeneous region class, a three-dimensional piecewise linear model is trained as a trajectory point storage location predictor, namely, a learning trajectory index, specifically,
[0067] S31. Within each second-order homogeneous region, train a three-dimensional piecewise linear model, input a trajectory point (x, y), where x represents the road network location and y represents the time, and output z represents the sequence number of the trajectory point within the region;
[0068] S32. Set a maximum error threshold θ, connect the sorted trajectory points, the first point, and the last point into a three-dimensional straight line, and use the least squares method to obtain the three-dimensional straight line equation:
[0069]
[0070] Among them, P0(x0,y0,z0) is any point on the three-dimensional line, is the direction vector of the three-dimensional line. Transforming the above equations into a system of equations:
[0071]
[0072] Then traverse all the intermediate points and substitute them into the above equations to get z1 and z2, where z1 and z2 are the z coordinates of the projection points of the three-dimensional line on the xz plane and yz plane respectively, and calculate the predicted value Calculating prediction error And record the maximum prediction error and the maximum error point;
[0073] S33. If the maximum prediction error is greater than θ, segmentation is performed at the maximum error point, and the error point is added to the half with fewer midpoints between the left and right halves. The above steps are repeated in the left and right halves until the maximum prediction error is less than θ, then segmentation is stopped, and a piecewise linear model is finally obtained.
[0074] S4. Obtain the road network range and time range of the original query, perform trajectory query, decompose the query into multiple subqueries based on the second-order homogeneous region class, call the corresponding piecewise linear model for prediction, obtain the subquery result set, filter it, combine all the subquery result sets, and return the original query result set.
[0075] S41. Get the road network range of the original query [pos S ,pos E ] and time range [t S ,t E ], where pos S is the starting road network position, pos E is the ending position of the road network, t S is the starting time, t E is the end time;
[0076] S42, the road network range in the original query [pos S ,pos E ] is decomposed into multiple sub-network ranges according to the second-order homogeneous area class [pos s ,pos e ], where pos s is the starting road network position within the second-order homogeneous region class, pos eis the end road network position within the second-order homogeneous region class, and each sub-road network range [pos s ,pos e ] and time range [t S ,t E ] form a subquery q(pos s ,t S ,pos e ,t E ), each subquery q(pos s ,t S ,pos e ,t E ) corresponds to a second-order homogeneous region class;
[0077] S43. For each subquery q(pos s ,t S ,pos e ,t E ), call the corresponding piecewise linear model, input (pos s ,t S ) and (pos e ,t E ), and get the predicted value and Then, within the corresponding second-order homogeneous region class, combined with the maximum prediction error θ of the piecewise linear model, in the range Obtain the candidate trajectory point set, filter the trajectory points within the sub-query range, and obtain the sub-query result set;
[0078] S44. Repeat step S43 to obtain all sub-query result sets, combine all sub-query result sets, and return the original query result set.
[0079] This learning-based trajectory indexing and query method based on homogeneous region partitioning on a directed road network divides the road network space according to the similarity of road network traffic volume, which can ensure the uniform distribution of trajectory data within each second-order homogeneous region class, reduce model segmentation, improve query performance and prediction accuracy, and improve index query efficiency, thus solving the problem of deteriorating query performance of trajectory index on tilted data.
[0080] This method proposes a learning-based trajectory indexing and query method based on homogeneous region partitioning on directed road networks. Based on mining connectivity, a depth-first search is performed to determine the order of directed road segments. First-order homogeneous regions are divided into classes according to the length and number of lanes of the directed road segments. Second-order homogeneous regions are further divided into classes according to the predecessor directed segments. The order of trajectory points is then determined within each second-order homogeneous region class. Finally, a three-dimensional piecewise linear model is trained for each second-order homogeneous region class to fit the mapping relationship between trajectory points and storage numbers. This method constructs a learning-based trajectory index and supports trajectory query.
[0081] This learning-based trajectory indexing and query method based on homogeneous region partitioning on directed road networks performs depth-first search based on connectivity mining labels to determine the unique serial number of directed road segments. It takes into account the movement behavior of vehicles and ensures that the vehicle movement order is consistent with the road order.
[0082] The present invention trains a three-dimensional piecewise linear model for each second-order homogeneous region class, which not only greatly reduces the index size and storage cost, but also controls the prediction error of the model, thereby reducing the number of disk blocks accessed during trajectory query and improving index query performance.
[0083] This learning-based trajectory indexing and query method based on homogeneous region partitioning on directed road networks not only ensures the consistency of the ordered order of directed road segments and vehicle travel, but also divides multiple homogeneous regions with uniform distribution, greatly improving the query efficiency of the index on tilted data. At the same time, it ensures the prediction error of the piecewise linear model and improves the query performance of the index.
[0084] A specific example of the learning trajectory indexing and query method based on homogeneous region division on the directed road network of the embodiment is as follows:
[0085] like Figure 2 As shown, there are a total of 9 directed segments in the road network, namely seg1, seg2, seg3, seg4, seg5, seg6, seg7, seg8 and seg9. The specific information of the directed segments is as follows Figure 3 There are 7 trajectories in total: tra1, tra2, tra3, tra4, tra5, tra6 and tra7. The trajectory data is as follows: Figure 4 The trajectory data includes the trajectory name, trajectory point sequence and the directed road segments that the trajectory passes through. The trajectory points in the trajectory point sequence are composed of two components: road network position and time, as follows:
[0086] p1=(seg1.24,0),p2=(seg1.43,0),p3=(seg1.78,3),p4=(seg1.96,0),p5=(se g4.12,6),p6=(seg4.85,0),p7=(seg2.33,3),p8=(seg3.32,3),p9=(seg6.67, 3), p10=(seg5.31,9), p11=(seg5.90,0), p12=(seg8.35,0), p13=(seg8.68,3) , p14=(seg7.43,3), p15=(seg9.23,12), p16=(seg9.35,0), p17=(seg9.65,15).
[0087] Step S1: Set a subsequent array for each directional segment, scan all trajectory data on the road network, and record the traffic volume ratio in the subsequent array. Each element in the subsequent array is (directional segment name, traffic volume ratio). The subsequent arrays of seg1, seg4 and seg5 are shown in Table 1:
[0088] Table 1 Subsequent arrays of directed segments seg1, seg4 and seg5
[0089] Directed road segment number Subsequent array seg1 [(seg2,0.33),(seg3,0.33),(seg4,0.33)] seg4 [(seg5,0.5),(seg6,0.5)] seg5 [(seg7,0.5),(seg8,0),(seg9,0.5)]
[0090] Subsequent arrays for the remaining directed road segments are empty.
[0091] After the scan is completed, a depth-first search is started from the directed road segment at the center of the road network. The unique directed road segment number is determined according to the depth-first search order. The depth-first search algorithm includes the following steps:
[0092] Add up the midpoint coordinates of all directed road segments and calculate the average coordinate. This average coordinate is regarded as the center of the road network. The directed road segment with the shortest distance from the midpoint to the center of the road network is regarded as the directed road segment in the center of the road network. Start the depth-first search from the directed road segment in the center of the road network. Each time the depth is probed down, the subsequent directed road segment with a large traffic volume ratio is selected as the next access target. After all directed road segments have been searched by depth-first search, the order in which the directed road segments are visited is the directed road segment number, and the directed road segment number starts from 0.
[0093] Assume that seg1 is a directed road segment in the center of the road network. Start depth-first search from the directed road segment seg1 in the center of the road network. When exploring in depth, for node seg1, give priority to the subsequent directed road segment seg2 with a large traffic ratio as the next access target; next, start depth exploration from seg2. If there is no subsequent directed road segment, return to seg1, and then do the same for seg3. Finally, start depth exploration from seg4 and give priority to the subsequent directed road segment seg5 with a large traffic ratio of seg4 as the next access target. After all directed roads have been searched in depth first, the order in which the directed roads are visited is the directed road segment number. The directed road segment number starts from 0, and the specific order is [seg1, seg2, seg3, seg4, seg5, seg7, seg9, seg8, seg6]. The directed road segment numbers are as follows:
[0094] seg1.id=0; seg2.id=1; seg3.id=2; seg4.id=3; seg5.id=4; seg7.id=5;
[0095] seg9.id=6; seg8.id=7; seg6.id=8.
[0096] Renumber each directed road segment according to its sequence number, and the integer part of the corresponding track point network position should also be changed. The final track point data is as follows:
[0097] p1=(0.24,0),p2=(0.43,0),p3=(0.78,3),p4=(0.96,0),p5=(3.12,6),p6=(3.85,0),p7=(1.33,3),p8=(2.32,3),p9=(8.67,3) , p10=(4.31,9), p11=(4.90,0), p12=(7.35,0), p13=(7.68,3), p14=(5.43,3), p15=(6.23,12), p16=(6.35,0), p17=(6.65,15);
[0098] Step S2: Directed road segments are first divided into several classes according to their length. Each class is further divided into several first-order homogeneous region classes according to the number of lanes. All directed road segments within each first-order homogeneous region class are further divided into several second-order homogeneous region classes according to the length and number of lanes of their predecessor directed road segments, and the order of the second-order homogeneous region classes is determined. Then, within each second-order homogeneous region class, the trajectory points are first sorted by time and then by road network position to determine the sequence number of the trajectory points within the second-order homogeneous region class.
[0099] Step S21: Count the total length of all directional road segments (Len=1000), set n=2 as the number of directional road segment classifications, and the average total length of directional road segments included in each class is Len / n=500;
[0100] Step S22: Sort the directed road segments in ascending order by length, then accumulate the lengths of the directed road segments. If the accumulated length is greater than or equal to Len / n=500, the previously accumulated directed road segment is counted as one class. Subsequently, the next directed road segment is accumulated again, and so on. Finally, n=2 classes are divided. The specific classification is as follows:
[0101] [seg4,seg5,seg2,seg3,seg6,seg7],[seg1,seg8,seg9];
[0102] Step S23: After the division in step S22, each directional road segment is divided into two categories based on the number of lanes: those with less than or equal to 2 lanes are divided into one category, and those with more than or equal to 3 lanes are divided into another category. Therefore, all directional road segments can be divided into 2×n=4 first-order homogeneous area categories, which are specifically classified as follows:
[0103] [seg2,seg3,seg6,seg7],[seg4,seg5],[seg8],[seg1,seg9];
[0104] Step S24: In the first-order homogeneous region class [seg2, seg3, seg6, seg7], the sum of the flow rates of the predecessor directional segments of all directional segments is counted.
[0105]
[0106] Assume m = 2 is the number of second-order homogeneous directed road segment classes, and the average total flow of the predecessor directed road segments contained in each class is flow sum / m=750;
[0107] Step S25: Sort the directed road sections in ascending order according to the flow of the predecessor directed road section, and then accumulate the flow of the predecessor directed road section. If the accumulated flow of the predecessor directed road section is greater than or equal to flow sum / m=750, then the previously accumulated directed segments are counted as one class, and the next directed segment is re-accumulated. The last-order homogeneous region class [seg2, seg3, seg6, seg7] is divided into m=2 second-order homogeneous region classes [seg6, seg7, seg2], [seg3];
[0108] Step S26: Repeat the above steps S24-S25 to divide all directed road segments in the road network into 2×n×m=8 second-order homogeneous region classes. The second-order homogeneous region classes are as follows:
[0109] C7=[seg1,seg9],C8=[]. C1=[seg6,seg7,seg2],C2=[seg3],C3=[seg5],C4=[seg4],C5=[seg8],C6=[],
[0110] For example, for the second-order homogeneous area class C7, the trajectory points that fall into C7 are p1, p2, p3, p4, p15, p16 and p17. They are first sorted by time and then by road network position. The order of the trajectory points of C7 is (p1, p2, p4, p16, p3, p15, p17): p1 = (0.24, 0, 0); p2 = (0.43, 0, 1); p4 = (0.96, 0, 2); p16 = (6.35, 0, 3); p3 = (0.78, 3, 4); p15 = (6.23, 12, 5); p17 = (6.65, 15, 6).
[0111] Step S3: For each second-order homogeneous region class, a piecewise linear model in three-dimensional space is learned as a trajectory point storage location predictor, namely a learned trajectory index. During training, the trajectory point is input and the storage location sequence number of the trajectory point within the second-order homogeneous region class is output. The maximum prediction error of the piecewise linear model is calculated.
[0112] Step S31: In each second-order homogeneous region, a piecewise linear model is trained, with the input (x, y) representing (road network location, time), and the output z representing the sequence number of the trajectory point in the region;
[0113] Step S32: Set a maximum error threshold θ = 1.6, connect the sorted trajectory points, the first point and the last point into a three-dimensional straight line, and use the least squares method to obtain the three-dimensional straight line equation
[0114]
[0115] Among them, P0(0.19,3.43,0) is any point on the three-dimensional straight line, is the direction vector of the three-dimensional line. Transforming the above equations into a system of equations:
[0116]
[0117] Then traverse all the intermediate points and substitute them into the above equations to get z1 and z2, where z1 and z2 are the z coordinates of the projection points of the three-dimensional line on the xz plane and yz plane respectively, and calculate the predicted value Calculating prediction error And record the maximum prediction error err max ≈1.98 and the maximum error point p15=(6.23,12);
[0118] Step S33, because the maximum prediction error err max ≈1.98>1.6, then segment at the maximum error point p15, and add the error point to the right half with fewer points. Repeat the above steps in the left half (p1, p2, p4, p16, p3) until the maximum prediction error is less than θ, then stop segmenting. The right half (p15, p17) does not need to be segmented because there are only two points, and finally the piecewise linear model is obtained:
[0119]
[0120] For each second-order homogeneous region class, repeat the above steps to build multiple models.
[0121] Step S4: Obtain the road network range and time range of the original query, perform trajectory query, decompose the query into multiple subqueries based on the second-order homogeneous region class, call the corresponding piecewise linear model for prediction, obtain the subquery result set, filter it, combine all the subquery result sets, and return the original query result set.
[0122] Step S41: Get the original query road network range [pos S ,pos E ]=[0,3) and the time range [t S ,tE ]=[0,3];
[0123] Step S42: The road network range [pos S ,pos E ]=[0,3) decomposed into multiple sub-network ranges according to the second-order homogeneous region class [pos s ,pos e ], where pos s is the starting road network position within the second-order homogeneous region class, pos e is the end road network position within the second-order homogeneous region class, and each sub-road network range [pos s ,pos e ] and time range [t S ,t E ] form a subquery q(pos s ,t S ,pos e ,t E );
[0124] For example, the second-order homogeneous region class C7 = [seg1, seg9], and its corresponding sub-road network range is [0, 1) and [6, 7), so the sub-road network range belonging to C7 in the original query road network range [0, 3) is [pos s ,pos e ]=[0,1), similarly, two other sub-network ranges [1,2) and [2,3) are decomposed. Thus, the original query can be decomposed into three sub-queries q1(0,0,1,3), q2(1,0,2,3) and q1(2,0,3,3). Each sub-query q(pos s ,t S ,pos e ,t E ) corresponds to a second-order homogeneous region class.
[0125] Step S43: For each subquery q(pos s ,t S ,pos e ,t E ), call the corresponding piecewise linear model, input (pos s ,t S ) and (pos e ,t E ), and get the predicted value and Then, within the corresponding second-order homogeneous region class, combined with the maximum error threshold θ of the piecewise linear model, in the range Get the candidate trajectory point set, filter the trajectory points within the subquery range, and get the subquery result set.
[0126] For example, for the subquery q1(0,0,1,3), call the corresponding piecewise linear model and input (0,0) and (1,3) respectively to get the predicted value and Then, within the corresponding second-order homogeneous region class, the maximum error threshold θ=1.6 of the piecewise linear model is combined, and the range That is, within the position [0,5], we obtain the candidate trajectory point set {(0.24,0), (0.43,0), (0.96,0), (6.35,0), (0.78,3), (6.23,12)}, and filter the trajectory points within the subquery range (0,0,1,3) to obtain the subquery result set {(0.24,0), (0.43,0), (0.96,0), (0.78,3)};
[0127] Step S44: Repeat step S43 to obtain all sub-query result sets, combine all sub-query result sets, and return the original query result set {(0.24, 0), (0.43, 0), (0.78, 3), (0.96, 0), (1.33, 3), (2.32, 3))}.
[0128] The foregoing is merely an embodiment of the present invention and is not intended to limit the present invention. It will be apparent to those skilled in the art that various modifications and variations of the present invention are possible. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention are intended to be included within the scope of the claims of the present invention.
Claims
1. A learning-based trajectory indexing and query method based on homogeneous region partitioning on a directed road network, characterized by: The following steps are included: S1. Set a subsequent array for each directed road segment, scan all trajectory data on the road network, and record the traffic volume ratio in the subsequent array; after the scan, start a depth-first search from the directed road segment at the center of the road network, and determine a unique directed road segment number according to the depth-first search order; S2. Directed road segments are first divided into several classes according to their length. Each class is further divided into several first-order homogeneous regional classes according to the number of lanes. All directed road segments within each first-order homogeneous regional class are divided into several second-order homogeneous regional classes according to the length and number of lanes of their predecessor directed road segments. The order of the second-order homogeneous regional classes is determined. Then, within each second-order homogeneous regional class, the trajectory points are sorted first by time and then by road network location to determine the sequence number of the trajectory points within the second-order homogeneous regional class. S21. Count the total length of all directional road segments ,set up The number of categories for directional road segments is , and the average total length of directional road segments contained in each category is ; S22, sort the directed road segments in ascending order by length, and then accumulate the lengths of the directed road segments. If the accumulated length is greater than or equal to , then the previously accumulated directed road segments are counted as one class, and then the next directed road segment is accumulated again, and so on, and finally divided Class; S23. After the division in step S22, each directional road segment is divided into two categories according to the number of lanes. The number of lanes is less than or equal to the set number and is divided into one category, while the number of lanes is greater than or equal to the set number and is divided into another category. Therefore, all directional road segments are divided into a class of first-order homogeneous regions; S24. In each first-order homogeneous region class, the sum of the predecessor directional segment flows of all directional segments is counted and recorded as ,set up is the number of second-order homogeneous directed road segment classes, and the average total flow of the predecessor directed road segments contained in each class is ; S25, sort the directed road sections in ascending order according to the flow of the predecessor directed road sections, and then accumulate the flow of the predecessor directed road sections. If the accumulated flow of the predecessor directed road sections is greater than or equal to , then the previously accumulated directed road segments are counted as one class, and subsequently re-accumulated from the next directed road segment; S26, repeat the above steps S24-S25, and divide each first-order homogeneous region class into second-order homogeneous region classes, so all directed road segments in the road network are divided into a class of second-order homogeneous regions; S3. For each second-order homogeneous region class, a piecewise linear model in three-dimensional space is trained as a trajectory point storage location predictor, i.e., a learning trajectory index. The input during training is the trajectory point, and the output is the storage location sequence number of the trajectory point within the second-order homogeneous region class; S31. In each second-order homogeneous region, train a three-dimensional piecewise linear model and input the trajectory points. ,in, Indicates the road network location, Indicates time, output The sequence number within the region representing the trajectory point; S32. Set a maximum error threshold , connect the sorted trajectory points, the first point and the last point into a three-dimensional straight line, and use the least squares method to obtain the three-dimensional straight line equation: , in, is any point on the three-dimensional line, is the direction vector of the three-dimensional line, and the above equations are transformed into the equation system: , Then traverse all the intermediate points and substitute them into the above equations to get and ,in and The three-dimensional straight lines are Plane and Projection point on the plane Coordinate values, calculate predicted values , calculate the prediction error , and record the maximum prediction error and the maximum error point; S33. If the maximum prediction error is greater than , then segment at the maximum error point, and add the error point to the half with fewer midpoints in the left and right halves, and repeat steps S32 and S33 in the left and right halves until the maximum prediction error is less than Then stop segmentation and finally get the piecewise linear model; S4. Obtain the road network range and time range of the original query, perform trajectory query, decompose the query into multiple subqueries based on the second-order homogeneous region class, call the corresponding piecewise linear model for prediction, obtain the subquery result set, filter it, combine all the subquery result sets, and return the original query result set.
2. The learning-based trajectory indexing and query method based on homogeneous region partitioning on a directed road network according to claim 1, characterized in that: In step S1, the road network is a directed graph consisting of directed road segments and intersections. Each directed road segment is represented by three components: the directed road segment number, the length, and the number of lanes. The trajectory data includes the trajectory name, the trajectory point sequence, and the trajectory passing through the directed road segment. The trajectory point of the trajectory point sequence is represented by two components: the road network position and the time. The road network position is a floating point number, the integer part is the directed road segment number where the point is located, and the decimal part is the relative position of the point on the directed road segment.
3. The learning-based trajectory indexing and query method based on homogeneous region partitioning on a directed road network according to claim 1, characterized in that: In step S1 , the traffic volume ratio is the ratio of the number of trajectories that pass through the current and subsequent directional road segments simultaneously to the total number of trajectories that pass through the current directional road segment.
4. The learning-based trajectory indexing and query method based on homogeneous region partitioning on a directed road network according to claim 1, characterized in that: In step S1, a depth-first search is started from the directed road section at the center of the road network, and a unique directed road section number is determined according to the order of the depth-first search. Specifically, a depth-first search is started from the directed road section at the center of the road network. Each time the depth is probed downward, a subsequent directed road section with a large traffic volume ratio is preferentially selected as the next access target. After all directed roads have been searched by the depth-first search, the directed road section number starts from 0, and the order in which the directed roads are visited is the directed road section number.
5. The learning-based trajectory indexing and query method based on homogeneous region partitioning on a directed road network according to claim 4, characterized in that: The central directed section of the road network is obtained by adding the midpoint coordinates of all directed sections in the directed road network and calculating the average coordinate. This average coordinate is regarded as the center of the road network, and the directed section with the shortest distance from the midpoint of the directed section to the center of the road network is regarded as the central directed section of the road network.
6. The learning-based trajectory indexing and query method based on homogeneous region partitioning on a directed road network according to claim 1, characterized in that: In step S24, the preceding directed road segment flow rate is the sum of the directed road segment flows of all preceding directed road segments of the current directed road segment. The preceding directed road segment is a connected directed road segment that directly enters the current directed road segment. The directed road segment flow rate is the product of the length of the directed road segment and the number of lanes.
7. The learning-based trajectory indexing and query method based on homogeneous region partitioning on a directed road network according to any one of claims 1 to 5, characterized in that: In step S4, the road network range and time range of the original query are obtained, and a trajectory query is performed. According to the second-order homogeneous region class, the query is decomposed into multiple sub-queries, and the corresponding piecewise linear model is called for prediction. The sub-query result set is obtained, and after screening, all sub-query result sets are combined to return the original query result set. Specifically, S41. Obtain the road network scope of the original query and time range ,in, is the starting road network location, To terminate the road network location, is the starting time, is the end time; S42, the road network range in the original query Decompose into multiple sub-network ranges according to the second-order homogeneous area class ,in is the starting road network position within the second-order homogeneous region class, is the end road network location within the second-order homogeneous region class, and the range of each sub-road network is and time range Composing subqueries , each subquery corresponds to a second-order homogeneous region class; S43. For each subquery , call the corresponding piecewise linear model and input and , get the predicted value and , then in the corresponding second-order homogeneous region class, combined with the maximum error threshold of the piecewise linear model , in the range Obtain the candidate trajectory point set, filter the trajectory points within the sub-query range, and obtain the sub-query result set; S44. Repeat step S43 to obtain all sub-query result sets, combine all sub-query result sets, and return the original query result set.
Citation Information
Patent Citations
Segmentation-based hidden Markov model map matching method
CN110095127A
Large-scale trajectory data similarity query method based on multistage index structure
CN113051359A