1. Introduction
Future queries oriented toward moving objects are pivotal in various real-world applications. For instance, in path planning and navigation, executing a future range query on a map reveals the projected locations of moving vehicles within a specified area. This information aids drivers in circumventing traffic congestion and selecting the optimal route. Additionally, this technology is extremely valuable in fields such as logistics management, traffic control, and emergency response, including safety and disaster relief efforts [
1,
2]. Therefore, decades of research by scholars worldwide has focused on developing specialized index structures for moving objects. These include TPR-tree [
3] and its advanced version, TPR*-tree [
4], which are primarily based on the conventional spatial index structure R-tree [
5] or its derivative, the R*-tree [
6]. These index structures efficiently prune irrelevant data during queries and are highly adaptive to the dynamics of moving objects. However, in the era of big data, these traditional index structures face significant challenges.
The relentless growth in data scale necessitates expansive index structures, which can sometimes surpass the size of the underlying datasets themselves. Research indicates that, in today’s commercial databases, index structures can occupy as much as 55% of server memory [
7]. As data volumes expand, it becomes impractical for main memory to house the entire index structure, necessitating partial offloading to external memory [
8]. This imposes considerable storage pressures on databases and leads to increased I/O operations. The hierarchical nature of these index structures, requiring access from root to leaf nodes, exacerbates the situation. As the volume of data swells, so does the number of tree nodes that must be accessed during queries, significantly slowing down query performance. This issue highlights a critical weakness in traditional R-tree-based index structures in the era of big data. Given these deficiencies, there is a critical need to innovate the index structures for moving objects, ensuring they can cope with the increasing data scales and the stringent demands for query efficiency.
In 2018, Kraska et al. [
9] introduced the concept of a learned index, utilizing a Recursive Model Index (RMI) as an alternative to traditional B-trees. This index employs a multi-layer machine learning model that learns the distribution patterns of the underlying data, effectively creating a mapping similar to the cumulative distribution function (CDF) of approximate keys. As illustrated in
Figure 1, for a given query key
, the RMI predicts the position of
by learning F(
) from the CDF. The exact location of the key is then determined within the interval [F(
) −
,F(
) +
], where
represents the permissible error bound.
A learned index is an innovative index structure that is constructed by leveraging patterns in the data distribution, thereby exhibiting high adaptability to varying data. Unlike traditional tree structures, which rely on traversal searches, a learned index performs queries through direct computations, significantly enhancing query efficiency. Additionally, since it stores only the parameters of its models—which are independent of the size of the underlying dataset—it also offers advantages in reducing memory overhead compared to traditional index structures. A series of one-dimensional learned indexes such as the RMI have demonstrated limitations when applied to high-dimensional data [
10]. In response, various high-dimensional learned indexes have been developed in the past three years, including LISA [
10], Flood [
11], the RSMI [
12], and the ZM Index [
13]. However, these studies predominantly focus on static data. Although there have been advancements in updating methods for high-dimensional learned indexes, their application scenarios remain confined to current or historical data queries [
14]. Notably, the existing spatial learning indexes are not equipped to support future-oriented queries for moving objects.
This paper proposes
FurMoLi, which employs a machine learning model to construct an index for supporting future queries of moving objects through a series of meticulously designed steps. Recognizing the dynamic nature of moving objects, FurMoLi adopts the clustering approach by Li et al. [
15], which accounts for both location and velocity attributes. This method clusters the dataset into
K regions, ensuring that each region maintains similar positional and motion characteristics to the extent possible. During the dimensionality reduction phase, we sort and number the cluster centers using the Lebesgue measure [
16] and create a partially monotonic dimensionality reduction function based on the partition boundaries. This function maps and sorts the two-dimensional data points of moving objects into a one-dimensional space, preserving the original order of dimensionality reduction values within each region and preventing cross-region value overlaps. In the model training phase, FurMoLi learns a series of piecewise linear functions, optimizing space efficiency, and employs the least squares method to fine-tune the parameters of each function. In the future query phase, FurMoLi draws on the mechanism of B
x-tree [
17] to expand the query windows, facilitating future range and KNN queries for moving objects.
The main contributions of this paper are as follows:
(1) A novel learned index structure and an effective query algorithm based on the learned index structure are designed to support future queries of moving objects, including future range queries and future k-nearest neighbor (KNN) queries. As far as we know, this is the first mature learned index for future queries of moving objects.
(2) A clustering method that considers both location and velocity attributes is utilized to segment the data region, ensuring uniform motion states within each region. This approach enhances the model’s capability to effectively learn the data distribution. Meanwhile, on this basis, a creative dimension reduction method is adopted to ensure the query recall rate and greatly reduce the calculation difficulty. Just add a simple filtering operation to ensure the accuracy of the query and improve the query efficiency.
(3) Extensive experiments are conducted on synthetic datasets. The results show that FurMoLi has better storage overhead and query efficiency than traditional moving object index structures, while maintaining good construction efficiency.
In
Section 2, we discuss technologies relevant to this paper.
Section 3 details the index construction process for moving objects and elaborates on future queries. The experimental results and analysis are presented in
Section 4, with conclusions and future works provided in
Section 5.
3. The Design of FurMoLi
This section will give an in-depth introduction to the design and training ideas of FurMoLi. Its overall architecture is shown in
Figure 2. The overall process includes partitioning data areas, constructing functions, building piecewise linear learned indexes, and implementing future queries. Firstly, the “position–velocity” clustering method is employed to segment the initial moving object dataset into
K regions based on the position and motion states of the data. These regions are then numbered, and a dimensionality reduction function is constructed to map two-dimensional moving object data into one-dimensional space and order them. To better understand the distribution of moving object data, a linear regression model is developed for each region, collectively forming a piecewise linear learned index. Finally, by expanding the query window, the dimensionality reduction values at the intersections between the expanded query window and the regions are calculated. This process determines the scope of the expanded query window on the one-dimensional index, enabling the retrieval of the required query points.
3.1. Data Partition
In the real world, the distribution of moving objects is often complicated. Without pre-processing and segmenting the data, directly learning from the dataset tends to result in low accuracy of the trained learned index and higher training costs. To more effectively learn the data distribution and facilitate subsequent operations, we fully utilized the location and velocity attributes of moving object data. We adopted the “location–velocity” clustering method, which is a variant of the K-Means clustering algorithm [
27]. This variant modifies the distance calculation formula to include the influence of the moving objects’ speed information. Consider two moving objects in space,
(
,
,
,
,
) and
(
,
,
,
,
), the clustering distance between
and
is defined as Equation (
1) to account for both their spatial coordinates and velocities.
where
is the weight assigned to the velocity information. Given that the velocity attribute significantly impacts clustering distance calculations for moving objects, typically set
.
The specific process of dividing the data space is detailed below and outlined in Algorithm 1. First,
K data points from the moving objects are randomly selected as the centroids. For each remaining data point
(
,
,
,
,
) and for each centroid
(
,
,
,
) (where
j = 1, 2, …,
K), the distance is calculated using Equation (
1). This calculation helps determine the region to which each data point belongs by minimizing the distance between the data point and the centroid of its region, as expressed in Equation (
2).
where
represents the region of the moving object
. The centroids’ positions and velocities are then updated in Equation (
3) to iterate the process until the model converges (when the change in centroid
exceeds the predefined threshold) or the maximum number of iterations is reached. The change in centroid
is defined by Equation (
4).
where
refers to region
j,
refers to the total number of moving objects in region j, and
(
,
,
,
) refers to the updated centroid of region
j. Additionally, since calculating the intersection of rectangles is simpler than that of rectangles and circles, it is practical for the subsequent operations of FurMoLi to construct a minimum covering circle for each region using the finally determined centroid coordinates as the center. Subsequently, the minimum circumscribed rectangle of the circle is constructed. This rectangle is then used as the final boundary for the data division of the moving objects, ensuring the ease of calculation and integration into the FurMoLi system. Equations (
5)–(
7) build the minimum covering circle and the minimum circumscribed rectangle for each region.
where
represents the radius of the minimum covering circle of region
j and [
,
]× [
,
] represents its minimum circumscribed rectangle. The construction result is shown in
Figure 2b.
Algorithm 1 Data partition. |
Input: Moving objects dataset X, number of regions K, maximum iterations M, convergence threshold E. |
Output: K region information [, ] × [, ], centroids’ information of K regions (, , , ). |
1: Randomly select K moving objects as initial clustering centroids , j = 1, 2, …, K. |
2: Initialize the number of iterations t = 0. |
3: Initialize . |
4: while and do |
5: |
6: |
7: Update , |
8: end while |
9: Build the minimum covering circle and the minimum circumscribed rectangle for each region. |
10: return [, ] × [, ], . |
3.2. Dimensionality Reduction
The dimensionality reduction function
D must satisfy the following conditions:
where
,
, and
. In the dimensionality-reduction process, regions must be initially sorted and numbered. This is achieved by calculating the Lebesgue measure [
16] of the rectangle formed by the center of each region and the coordinate axes. These measures are then compared, and the regions are sorted in ascending order. Subsequently, each region is assigned a unique identifier
. To ensure the effectiveness of this approach, we must guarantee that every point within a region has a dimension reduction value that falls within the interval
. Consequently, the dimensionality reduction function must possess three essential properties:
Continuity: The dimensionality reduction value should be close for moving objects that are proximate in space, ensuring a smooth transition in the reduced dimensions.
Boundedness: The dimension reduction value for any moving object within a region must lie within the interval .
Consistency: For any rectangle, the dimension reduction values at the lower left and upper right corners should accurately represent the range of dimension reduction values for the moving objects within that rectangle.
Property 3 is established to simplify the future query process and ensure high recall, which will be demonstrated in the forthcoming
Section 3.4.
It is logical to compare the Lebesgue measure of each point within the region to the Lebesgue measure of the rectangle defined by the left and bottom boundaries of the region. According to the dimensionality reduction approach described in Equation (
9), Equation (
8) and the three properties above can be satisfied.
where
is the Lebesgue measure on
,
,
. However, there is an issue with points on the region’s boundary: their Lebesgue measure is 0, rendering them unsupportive for future queries. Consequently, we introduce a new method for dimensionality reduction. This approach utilizes a straightforward linear dimensionality reduction, as detailed in Equation (
10):
where
. In this approach, the value of
determines the relative impact of the x and y directions on the dimensionality reduction value. Equation (
10) not only fulfills the previously mentioned conditions and properties, but also resolves the issue that Equation (
9) cannot compute the dimension reduction value for points on the boundary. Subsequently, the moving objects are sorted based on the dimensionality reduction values. With calculating in Equation (
10), the dimensionality reduction values for all moving objects in each region is ensured to be within a specific segment. Consequently, the dimension reduction values of moving objects in different regions will not overlap.
3.3. Learning Piecewise Function
This subsection will elaborate on the process by which FurMoLi constructs the learned index. After the partition of data regions and the reduction of data dimensions as discussed in the previous subsections, the initial data of moving objects are organized into K adjacent and disjoint regions within a one-dimensional array, based on their position distribution and motion state. For each region, the dimensionality reduction value of each moving object, termed the key value, serves as the input, while the corresponding position of this key value in the array, known as the index value, is used as the training label. A linear regression model is then developed as the learned index for each region. Consequently, a piecewise linear learned index is trained for the entire dataset of moving objects.
Figure 3 illustrates an example of the Key-Index CDF obtained using the methods described in the previous two subsections for a moving object dataset. The relationship between the key value and the index appears complicated, as depicted in the figure. Utilizing the approach from the literature [
28] would make it challenging to simulate this complexity with a neural network, particularly for large datasets. Instead, we employed a piecewise linear function to fit this relationship for several reasons:
The parameter size of the piecewise linear function is significantly smaller than that of a neural network, which reduces the space needed for learning the index structure;
Constraining the piecewise linear function to be monotone is simpler;
The training time for piecewise linear functions is much shorter than for neural networks;
During the future query phase, the piecewise linear function can expedite computations and enhance query efficiency.
For a region
, let
,
, and
be the corresponding index value of
, where
n is the number of moving objects in
,
,
. Let
and
. Train a linear regression function
for region
with
as the model input and
as the model training label:
where
and
are the parameters of the model,
,
. To ensure that Equation (
11) is monotonically increasing, it is essential to guarantee that
. We employed the least squares method to determine the parameters and constructed the loss function as Equation (
12):
To determine the corresponding parameters, it is essential to minimize the loss function. The gradient descent method is employed to calculate this minimization. By taking the partial derivative of Equation (
12) and setting it to zero, the sum of squared differences between the predicted and actual values is minimized. The values of the parameters
and
for the linear regression model, which correspond to region
, are shown in Equation (
13):
where
and
are the average values of
M and
I.
Ultimately, the multi-segment linear model, as depicted in
Figure 2c, is constructed. Since the prediction function invariably contains errors, similar to the RMI [
9], a maximum error threshold
must be established for each segment of the learned index, which is defined as the maximum difference between the predicted and actual index values.
Following the described construction process, a linear regression model is developed for the remaining regions, culminating in a global piecewise linear learned index. Finally, only the model parameters and error thresholds of the K-segment linear learned index need to be stored. In the next subsection, we will utilize and the corresponding error threshold for future range query and future KNN query on moving objects.
3.4. Future Range Query
Since the learned index is constructed based on the current time, we adopted
-tree method to facilitate future range queries. For a future query window
at time
, we implemented future queries by expanding
Q, as outlined in Algorithm 2. This approach ensures the recall rate of future queries and is more efficient than the MBR expansion method used by TPR-tree [
3]. Detailed proofs are provided in the literature [
17], and this paper offers only a brief explanation, as depicted in
Figure 4.
Q is a query window at time
in the future. The moving objects
,
at
move to
,
at
, which are in the query window at
. In order to achieve this result, the
-tree assigns Q the maximum rates
,
,
, and
of all moving objects in the four directions
,
,
, and
. Expand the query window to
by Equation (
15):
Because this query method is not constrained by the basic structure of the index, it is well suited to the learned index structure. Leveraging the consistency of the dimensionality reduction function introduced in
Section 3.2, the issue of future range query for moving objects based on the learned index can be efficiently addressed. By determining the coordinates of the lower left
L and upper right
R corners of the intersection between the expanded query window
and the regions, computing the dimensionality reduction values, the moving objects within the query window
Q at time
can be identified using the region’s learned index
. In the following, we will prove the recall of the preceding query process, which is also the consistency of the dimensionality reduction function:
Let the intersection of the expanded query window
and the region
be as rectangle
P, with the lower left corner coordinates
and the upper right corner coordinates
. For
:
Based on Equation (
16), for any point inside
P, its dimensionality reduction value must be between the dimensionality reduction values in the lower left corner and upper right corner of
P.
Since simple linear dimensionality reduction does not account for the dense distribution of data points of moving objects within intersecting rectangles, a small number of spatially non-adjacent points become adjacent in the one-dimensional array. Additionally, due to the error threshold
, a few moving objects that do not belong to the intersecting rectangle
P will be returned in the range
, as depicted in
Figure 5. To address this, a straightforward filtering step is added to remove moving objects not within
, as shown in
Figure 2d. Given that the number of objects requiring filtering is significantly smaller than the initial dataset, the query efficiency of the algorithm will not be substantially affected.
Algorithm 2 Future range query. |
Input: Query time , query window . |
Output: Moving objects . |
1: Get , , , |
2: Expand . |
3: . |
4: Get , of . |
5: Calculate , and obtain the moving objects. |
6: Filter moving objects |
7: return .
|
3.5. Future KNN Query
A future k-nearest neighbor (KNN) query involves, given a moving object
, querying the
k nearest moving objects to
q at a future time
. On the basis of
Section 3.4, this paper describes an iterative expansion of the future range query window until a sufficient number of k-nearest moving objects are returned. The specific process is outlined in Algorithm 3.
Initially, a positive query rectangle
is constructed with
q and
as the side length, where the calculation for
is provided in Equations (
17) and (
18) [
29].
where
is the estimated distance between q and its
nearest neighbor moving object and
N is the total number of moving objects. For the future time
,
is expanded to
according to Algorithm 2. If
contains at least k moving objects within the inscribed circle of
at
, the process stops. Otherwise,
is expanded to
by
, and
is further expanded to
following Algorithm 2. The search then proceeds in the area between
, iterating until the
k nearest moving objects to
q are identified.
Algorithm 3 Future KNN query. |
Input: Query time , moving object , number of nearest neighbors k. |
Output: k-nearest moving objects to q. |
1: Calculate , and obtain . |
2: Expand . |
3: Initialize . |
4: while 1 do |
5: if then |
6: Search moving objects in . |
7: else |
8: Search moving objects in . |
9: end if |
10: if k moving objects exist in inscribed circle of then |
11: Break. |
12: else |
13: . |
14: Expand . |
15: Expand |
16: end if |
17: end while |
18: return k-nearest moving objects.
|
5. Conclusions
In this paper, we propose FurMoLi—a novel future query technique for moving objects based on the learned index. To the best of our knowledge, FurMoLi is the first method that uses the learned index for the future query of moving objects. The experimental results demonstrated that FurMoLi outperforms the traditional moving object indexes, TPR-tree and -tree, particularly in terms of query time for the future range query and future KNN query. Notably, FurMoLi also offers significant advantages in storage overhead. Additionally, FurMoLi exhibits excellent scalability, maintaining consistent query and storage performance even as the data volume increases significantly. Finally, FurMoLi demonstrates strong adaptability, maintaining good query performance even when the number of destination (data distribution) changes.
In this work, we did not consider the update mechanism of FurMoLi, which provides a direction for subsequent research. When the data change significantly, a mature update mechanism can avoid the negative impact of index rebuilding. Meanwhile, FurMoLi utilizes a simple linear regression model. In future work, more advanced machine learning and deep learning models could be explored to build the learned index, thereby enhancing both query efficiency and index construction. At the same time, the dimensionality reduction method used in this paper ensures high recall, but achieving precision requires an additional filtering step, which reduces query efficiency. Future work will aim to explore algorithms that can guarantee both recall and precision. Ultimately, this paper only addresses two basic queries: future range query and future KNN query. Exploring the use of FurMoLi for the future continuous query and future closest pairs query is another important direction for future research.