Simplified Algorithm of Moving Object Trajectory Based on Interval Floating

. Tis paper proposes an online trajectory simplifcation algorithm based on interval foating. Te accumulated angle deviation is used in the algorithm, and the bounded error theorem of interval foating is presented. First, the accumulated angle deviation starts from the nearest reserved point. Next, the sum of the angle deviations generated by the subsequent trajectory points is continuously calculated. When the simplifed threshold is reached for the frst time, it is will be judged whether the simplifed threshold interval needs to be foated as well as the next reservation in the foating error interval. It is worth noting that the interval between two adjacent reserved points foats only once. Te algorithm is tested on real trajectory data, and the experimental results show that the algorithm has an improved simplifcation rate with a certain simplifcation error.


Introduction
In the 21st century, with the advent of 4G and 5G mobile communication technologies, the higher popularity of the Internet has considerably promoted social progress. Besides, big data-related research becomes the hot spot globally. Also, mobile computing has been constantly evolving along with technologies such as mobile object databases and mobile communication network coverage. Te location information of mobile terminal equipment keeps changing with time, and GPS and RFID are currently used as the main data collection equipment. Researchers employ the collected trajectory data to study the characteristics of moving objects and apply them in areas such as smart transportation and location-based services (LBS) [1,2]. Location-based personalized service technology is a feld that has been thriving in recent years. In terms of personalized recommendation, there are location recommendation [3], travel prediction [4], and user behavior analysis [5]. Te basis of all LBS research is positioning, and a large amount of user location data needs to be obtained. However, many data in the stored massive trajectory data are of little research signifcance, which increases the difculty of the subsequent scientifc research analysis, causing huge capital and workload wasted in existing storage technology. In order to reduce the storage cost, more attention has been drawn to the research topic of trajectory simplifcation of moving objects. Many excellent trajectory simplifcation algorithms have been reported, but the development of trajectory simplifcation algorithms is still relatively slow, and each simplifcation algorithm has its own limitations. Many algorithms have their own specifc application scenarios, and it is necessary to develop new simplifcation algorithms to broaden the spectrum of trajectory simplifcation so as to cope with various types of trajectory data sets in the future; in addition, most online algorithms use bufers since interval algorithms often have high time complexity. Terefore, it is necessary to explore new low-cost trajectory simplifcation algorithms.
So far, some related research has focused on the simplifcation algorithm of moving object trajectory. When the trajectory data simplifcation algorithm was frst applied to computer graphics, the initially processed data only contained spatial information. Terefore, Euclidean distance (PED) was widely used. However, the data collected by the GPS system records time information in addition to space information. If we continue to use PED to study the simplifed algorithm of moving object trajectories, we will inevitably lose time information. Terefore, the synchronized Euclidean distance (SED) is gradually applied to the trajectory simplifcation algorithm. Many studies on trajectory simplifcation algorithms show that researchers mainly delve into two dimensions: ofine simplifcation and online simplifcation.
Te advantage of online trajectory simplifcation is that it supports real-time applications and can compress trajectory data while picking up new trajectory points as they are acquired. Ofine trajectory simplifcation starts compressing only after all points are acquired from the input trajectory and is suitable for analysing historical trajectory data. Ofine trajectory simplifcation usually has fewer errors compared to online trajectory simplifcation. However, in many applications, the trajectory data of the moving objects arrive in a stream, such as real-time AIS information received by shore-based systems. Tese applications include real-time trajectory tracking and position monitoring. Terefore, some online trajectory simplifcation methods have been proposed to handle this situation.
Te earliest ofine trajectory simplifcation algorithm based online segments is the Douglas-Peucker algorithm (DP algorithm) proposed in 1973 [6]. Te DP algorithm needs to give the threshold of the simplifed algorithm in advance. Te threshold uses PED, and the algorithm is simplifed according to the setting. Te threshold recursively selects points greater than the simplifed threshold and keeps the algorithm running until all points are less than the threshold set by the simplifed algorithm. Te TD-TR algorithm (also known as the top-down time ratio algorithm) was proposed by Meratnia and De [7]. Compared with the traditional DP algorithm, the TD-TR algorithm overcomes the shortcomings of the DP algorithm, for example, losing time information. TD-TR uses SED instead in the distance function of the DP algorithm because SED not only retains position but also time information compared with PED distance. Lin et al. [8] proposed the ATS algorithm. Te ATS algorithm segments the original trajectory according to the important feature of the trajectory speed, calculates the SED threshold of the small trajectory, and fnally uses the DP algorithm to simplify the fnal trajectory. Ke et al. [9] proposed the Angular algorithm, which uses the accumulated angle deviation to select or reject the trajectory point. By setting the accumulated angle threshold, the angle error before and after the trajectory simplifcation can be controlled. Te time complexity is O (n). Opening Window (OW) is a traditional online trajectory simplifcation algorithm. Te core idea of OW is to initialize a window with a fxed size from the starting point of the trajectory and slide the window over the points on the original trajectory. Tis process is repeated until the last point of the original trajectory is processed [10]. Opening Window Time Ratio (OW-TR) [7] extended OPW using a synchronized Euclidean distance (SED) error instead of the spatial error. A number of successful online trajectory simplifcation algorithms have been proposed to simplify the road vehicle trajectories, terrain boundary line, trajectory data mining, and graphics display [11,12]. Trajcevski et al. [13] proposed an online algorithm called Dead Reckoning, which uses the idea of estimation to estimate subsequent trajectory points.
Muckell et al. [14] proposed the SQUISH algorithm, which will add new points directly to the bufer when there is still space in it. When the bufer is full, the algorithm deletes the point with the smallest error. Te removal of small information points increases the importance of the left and right points of the discarded points in the area. Te trajectory simplifed by the algorithm has a reliable error guarantee, and the algorithm can be fexibly adjusted through the simplifcation rate and error. SQUISH-E [14] can achieve the smallest error under the condition of an artifcially given simplifcation rate. Te worst-case time complexity of the algorithm is O (nlogn/β), β represents the artifcially set simplifcation rate. Although it is an online trajectory simplifcation algorithm, in fact, under the condition of an artifcially given simplifcation rate, the SQUISH algorithm can only perform ofine trajectory simplifcation, and the algorithm needs to repeatedly traverse all points in the original trajectory, which is time-complex. In the most extreme case, the error between the original trajectory and the simplifed trajectory will be very considerable.
Te main innovations and contributions of this paper include as follows: (1) Te bounded error theorem of interval foating is proposed, which can fully simplify the trajectory with a certain simplifcation error. (2) An online trajectory simplifcation algorithm is presented and implemented, which can simplify trajectory data online. (3) Various experiments were conducted from diferent data set sizes and diferent angle thresholds to evaluate the time performance and simplifcation rate performance of the algorithm. Trough experimental comparison, in the face of large-scale trajectory data, the proposed algorithm has better time complexity and simplifcation rate.

Related Definitions and
Lemmas of Algorithms 2.1. Defnition 1: Angle Diference of Trajectory Segment [9]. Defne the direction angle θ of the trajectory segment as follows: the directions of the trajectory segment p i p j and p m p k are denoted by θ(p i p j ) and θ(p m p k ), respectively, and the constraints are Te angle diference formula is For two given angles θ 1 and θ 2 , the magnitude of their angle diference is Te angle diference ∆(θ 1 , θ 2 ) is divided into two cases, |θ 1 − θ 2 | and 2π − |θ 1 − θ 2 | (see Figure 1). Easy to get by defnition, the range of angle diference is [0, π]. [9]. Te angle of the moving object at point p i and the angle change between the points before and after it is the angle deviation of the point, which is represented by the symbol p i.ϵ d , and the details are as follows:  [9]. Te meaning of the cumulative angle deviation is the cumulative sum of the angle defection of all points from the count point to the current point, which is defned as follows:

Defnition 3: Cumulative Angular Deviation
It should be noted that p s k represents the starting point of the simplifed trajectory segment p s k p s k+1 , p s k+1 is the end point of the trajectory segment, and the subscript of the trajectory segment needs to satisfy the constraint: s k < i < s k+1 . [15]. Te trajectory simplifcation algorithm that retains the direction information generally achieves the purpose of simplifcation by constraining the direction of the trajectory, which can ensure a certain direction error. In fact, the algorithm also retains the position information while retaining the direction information. Long et al. [15] proved that the direction-preserving algorithm can maintain the position characteristics. Te following introduces the bounded error lemma of position information:

Lemma 1: Bounded Error of Position Information
In the simplifed algorithm that preserves direction information, if the simplifed error is within ε, then the shortest vertical Euclidean distance d minped and ε of the original trajectory and the simplifed trajectory must satisfy the following relationship: Among them, l max represents the maximum length of the original trajectory segment corresponding to the simplifed trajectory segment in the simplifed trajectory.
Proof. Let p s k p s k+1 be a simplifed trajectory segment selected arbitrarily. Among them, we stipulate that p s k is the starting point of the simplifed trajectory section, and p s k+1 is the end point of the simplifed trajectory section. Ten, the simplifcation of the current trajectory section must satisfy the directional error within ε. For a simplifed trajectory segment p s k p s k+1 selected at random, we can construct a Figure 1: (a), (b), and (c), respectively, show how the angle diference of the trajectory segment is calculated in diferent situations. rhombus according to p s k p s k+1 (see Figure 3), and prove the theorem in the rhombus. In the rhombus in the fgure above, there is a relationship: ∆(p s k a, p s k p s k+1 ) � ε. Assuming that the position of p i is outside the rhombus, then there must be a situation where p i is below p s k a. Terefore, there is a diference between the unsimplifed trajectory segment p j− 1 p j and the simplifed trajectory segment p s k a. Tere must be an intersection point between them. If the position of p i is outside the rhombus, the direction error between the original trajectory segment p j− 1 p j and the simplifed trajectory segment p s k p s k+1 must be greater than ε. So far, the conclusion drawn is in contradiction with our original defnition of the direction angle error. So it is deduced that p i must exist within the rhombus constructed by the simplifed trajectory segment p s k p s k+1 . So, it is concluded that even the point p i farthest from the simplifed trajectory segment p s k p s k+1 must satisfy the following constraints: Among them, distance represents the vertical Euclidean distance between two elements in the calculation plane, which can be the distance from point to point or point to straight line. □ 2.5. Lemma 2: Bounded Error of Direction [9]. Te results and discussion may be presented separately, or in one combined section and may optionally be divided into headed subsections. Ke et al. [9] proposed the bounded error theorem of direction in the A algorithm and proved the theorem. Te accumulated angle deviation used by the A algorithm is based on the bounded error theorem of direction. Te following will prove that the accumulated angular deviation is a bounded error in direction.
Assuming that the artifcially prescribed direction threshold p i.ε d is ε t , for each original trajectory point p i , if the cumulative angle deviation p i.ε d of point p i is greater than the given ε t , then p i will be retained. Te direction error between the fnal simplifed trajectory and the original trajectory must obey the following constraints: Proof. According to the relevant defnition introduced above, for a random segment of trajectory segment p s k p s k+1 , the direction of the trajectory segment p i p i+1 composed of connected trajectory points between p s k and p s k+1 can be derived. Te specifc expression is as follows: Among them, the p s k is the starting point, p s k+1 is the end point, and p s k +1 , p s k +2 , p s k +3 ... etc. represent the trajectory points between p s k and p s k+1 .
For the random trajectory segment p s k p s k+1 , the trajectory segment p i p i+1 composed of all the adjacent trajectory points in p s k p s k+1 satisfes the angle constraint [θ(p s k p s k+1 ) − ε t , θ(p s k p s k+1 ) + ε t ] (see Figure 4). In other words, for all the trajectory segments p i p i+1 , the direction of p i p i+1 must be within the ε t error in the direction of the frst small trajectory segment p s k p s k +1 .
Te vector p s k p s k+1 �������→ in the rhombus (see Figure 3) can be expressed as follows: According to (11), it can be seen that the vector sum of the geometric vectors formed by all two adjacent trajectory points in p s k p s k+1 �������→ can be fnally expressed as p s k p s k+1 �������→ , then the following constraints must be derived: According to the above proofs, the direction angle error of any deleted track segment in the original trajectory is controlled within the range of ε from the original trajectory.
Terefore, when running the trajectory simplifcation algorithm, setting the algorithm's ε t to half of ε can realize that the error between the simplifed trajectory and the original trajectory is within ε.

Teorem: Bounded Error of Interval Float. Tis paper proposes the theorem: Bounded Error of Interval Float.
If the current trajectory point p i.ε a is in the interval ε t < p i.ε a < 2ε t , the algorithm performs a foating operation, that is, the accumulated angle deviation interval that needs to be discarded to simplify the trajectory foats from [− ε t , ε t ] to [min ε a , 2ε t + min ε a ]; if the current trajectory point satisfes the accumulated angle deviation is within the interval − ε t > p i.ε a > − 2ε t , the accumulated angle deviation If the interval foats from [− ε t , ε t ] to [− 2ε t +max ε a , max ε a ], the simplifed error ε(T ′ ) must satisfy the constraints: Among them, min ε a and max ε a respectively represent the minimum and maximum accumulated angle deviation values from the last retained point to the current trajectory point. Proof. For the simplifed trajectory segment p s k p s k+1 in Lemma 2, if the cumulative angle deviation of the end point p s k+1 is in the interval ε t < p s k+1 .ε a < 2ε t , there must be a small value Ω (see Figure 5), so that the current point p s k+1 .ε a satisfes the following formula: and the minimum accumulated angle deviation min ε a in the trajectory section p s k p s k+1 must satisfy the following formula: Terefore, point p s k+1 is not necessarily the frst reserved point encountered from point p s k , and the interval of the error threshold needs to be foated up: from [− ε t , ε t ] to [min ε a , 2ε t + min ε a ]. After that, continue to search for the frst reserved point encountered from point p s k , and the point p ss k+1 whose cumulative angle deviation is greater than 2ε t + min ε t for the frst time is reserved; in the same way, when − ε t > p s k+1 .ε a > − 2ε t , the interval needs to be foated down to [− 2ε t +max ε a , max ε a ].
Te direction of the trajectory segment p i p i+1 existing between the frst and last points of the simplifed trajectory p s k p ss k+1 that foats through the interval satisfes the formula: For the foating interval, the random trajectory segment p i p i+1 satisfes the angle constraint in its trajectory segment p s k p s k+1 : θ p s k p ss k+1 − min ε a , θ p s k p ss k+1 + 2ε t + min ε a . (16) Tat is, the directions of the small trajectory sections p i p i+1 between the simplifed trajectory sections p s k p s k+1 are all within the direction error interval of the foating interval [min ε a , 2ε t + min ε a ] of the frst small trajectory section p s k p s k+1 of the simplifed trajectory section p s k p s k+1 .
After foating, the simplifed trajectory segment p s k p ss k+1 of the new end point will be obtained, and the rhombus is reconstructed according to p s k p ss k+1 ������� �→ (see Figure 6). Te vector B in the rhombus can be expressed as follows: According to the abovementioned formula, the vector sum of the geometric vectors composed of all the two adjacent trajectory points between p s k p ss k+1 can be fnally expressed as p s k p ss k+1 ������� �→ , and the satisfed constraints must be derived: θ p s k p ss k+1 − min ε a < θ p s k p ss k+1 < θ p s k p ss k+1 + 2ε t + min ε a . (18) In the same way, the descending provable interval must satisfy the constraint: θ p s k p ss k+1 + max ε a > θ p s k p ss k+1 > θ p s k p ss k+1 − 2ε t + max ε a .

(19)
According to the above proofs, the error between a random small track segment deleted in the middle of the simplifed track segment and the original track can be guaranteed to be Terefore, when running the trajectory simplifcation algorithm, when the cumulative angle deviation of the current point is greater than the given threshold ε, refnding the frst reserved point after an interval foat must ensure the directional error between the simplifed trajectory and the original trajectory in 2ε t .

Description of Interval Floating
Algorithm. According to related lemmas and theorems, this paper proposes an interval foating-based trajectory simplifcation algorithm for moving objects. As long as the simplifed threshold is set, for each trajectory point collected, the search started from the most recently retained point each time, if there is a trajectory. If the point satisfes p i.ε a > 2ε t , the point will be reserved, which can avoid the situation that the angle deviation of the reserved point is extremely small when its accumulated angle deviation reaches the threshold. For example, we set the direction error to 0.6, and the simplifed threshold value when the algorithm is running 0.3, point p 3 Mobile Information Systems will be retained instead of point p 2 , but the contribution of point p 2 is much greater than that of p 3 , so we cannot use p i.ε a > ε t as the judgment condition (see Figure 7). However, algorithm Angular uses p i.ε a > ε t as the judgment condition; if it does not exist, it will continue to fnd the point where the accumulated angle deviation is greater than the simplifed threshold from the current point, perform an interval foat from the current point, and continue to fnd the frst point after the foating operation. If the point p ss k+1 accumulated angle deviation exceeds the foating interval, this point p ss k+1 must be retained. At this time, the direction interval is updated to the initial threshold interval again, that is, for each simplifed trajectory, they pass the foating interval no more than once. If more than once, the bounded error between the simplifed trajectory and the original trajectory cannot be guaranteed (see Algorithm 1).

Experiment and Discussion
In order to verify the trajectory simplifcation algorithm STIF based on interval foats, this paper uses the Geolife dataset in [16][17][18]. Te GPS trajectory dataset was collected in (Microsoft Research Asia) Geolife project by 182 users in a period of over fve years (from April 2007 to August 2012). A GPS trajectory of this dataset is represented by a sequence of time-stamped points, each of which contains the information of latitude, longitude, and altitude. Each fle in the data selected for this experiment is larger than 30 KB. Te experiment in this paper uses data sets of diferent sizes and diferent angle thresholds for experiments and analyzes the time performance and simplifcation rate performance of the algorithm through the experimental results. Te simplifcation rate of the algorithm is defned as follows: Among them, T ′ represents the simplifed trajectory, and T represents the original trajectory. What we hope is that the algorithm can guarantee a low simplifcation rate within a certain error.

Performance Evaluation Based on Simplifed Time.
According to the experimental results (see Figure 8), when the data size is constant and the threshold is set very small, the simplifcation time of STIF algorithm is slightly larger than that of Angular. As the threshold increases, the simplifcation time of STIF algorithm tends to decrease and gradually approach Angular. From the perspective of the two algorithms, whether it is STIF or Angular, as the simplifcation threshold increases, the simplifcation time of the algorithm tends to decrease.
Te size of the data set ranges from 1000 to 5000. According to the experimental results, for the two algorithms, the average simplifcation time (see Figures 9 and 10) of the simplifcation thresholds of diferent sizes decreases with the increase of the data set.

Performance Evaluation Based on Simplifcation Rate.
According to the experimental results (see Figure 11), it can be concluded that under 5000 trajectories, the average (P 1 P 2 ) (P 2 P 3 ) simplifcation rate of the two algorithms tends to decrease with the increase of the simplifcation threshold, and the simplifcation rate of STIF algorithm is lower than Angular.
By observing the experimental results (see Figures 12 and  13), we can conclude that no matter what the simplifcation threshold is, the relationship between the simplifcation rate of the two algorithms and the data scale is that the larger the data scale is, the lower is the simplifcation rate.
It can be concluded from the experimental results (see Figures 14 and 15) that for the two algorithms, the simplifcation rate decreases with the increase of the simplifcation threshold among the fve data sets of diferent sizes. Also, compared to algorithm Angular, the highest simplifcation rate of algorithm STIF is only a data size of 1000. When the simplifcation threshold is set to 1/12π, it is  Input: Te starting point P s , ε, ε t � ε/2, Angle deviation of current point p i.ε d , Cumulative angular deviation of current point p i.ε a , Upper interval positive ε t � ε t , Lower interval negative ε t � − ε t , Current maximum and minimum angle deviation max ε a � 0, min ε a � 0, Float limit flag Output: Simplifed trajectory T′ min ε a � p i.ε d //If the angle deviation of the current point is greater than 2 * ε t if (Math.abs(p i.ε d ) > 2 * ε t ){ add (P.get(ii)); p i.ε a � 0; fag � 0; positive ε t � ε t ;//"Zero adjustment" in the upper section" negative ε t � − ε t ; //"Zero adjustment" in the lower interval max ε a � 0; min ε a � 0; } if (Math.abs(p i.ε a )> ε t ){ //Te upper interval meets the foating condition if (p i.ε a > positive ε t && p i.ε a < 2 * positive ε t && fag �� 0){ //Float in the lower interval negative ε t � min ε a ; //Float up the upper interval positive ε t � 2 * ε t + min ε a ; //Calculate the subsequent points after the interval has foated once. When //the simplifed condition is reached again, "zero" fag � 1; } else if(p i.ε a < negative ε t && p i.ε a > 2 * negative ε t && fag � � 0){ //Te lower interval meets the foating condition //Float in the upper interval positive ε t � max ε a ; //Float down in the lower interval negative ε t � − 2 * ε t + max ε a ; fag � 1; }else if(fag � � 1){ ALGORITHM 1: Continued. slightly higher than 0.35, but for algorithm Angular, when the simplifcation threshold is 1/12π, the highest simplifcation rate is greater than 0.45, and the lowest simplifcation rate is also greater than 0.35. Speaking of massive trajectory data, the number of acquisition points for each trajectory is more than tens of thousands of points. In this case, the Angular algorithm retains too many trajectories data are not conducive to efcient data storage. On the contrary, the STIF algorithm can ensure the accurate retention of points while reducing the simplifcation rate.

. Conclusions
Tis article mainly introduces a new trajectory simplifcation algorithm based on interval foating. Various experiments were conducted from diferent data set sizes and diferent angle thresholds to evaluate the time performance and simplifcation rate performance of the algorithm. Trough experimental comparison, algorithm STIF has outperformed algorithm Angular in simplifcation rate; in addition, as the data set increases, the average simplifcation time of algorithm STIF is slightly longer than that of algorithm Angular when the simplifcation threshold is smaller. With the increase of the threshold, the simplifcation time of the STIF algorithm is signifcantly reduced. Terefore, in the face of large-scale trajectory data, the STIF algorithm can show a better simplifcation rate and simplifcation time. For future works, it is planned to assess the algorithms with other datasets, considering other transportation modes and trajectories' characteristics as well as diferent application scenarios.

Data Availability
Te dataset used to support the results of this experiment is the GPS trajectory dataset, which is collected by Microsoft Research Asia. In more than three years (from April 2007 to August 2012), 182 users participated in the Geolife project. Te data used in the algorithm experiment can be obtained through the following website: https://research.microsoft. com/en-us/projects/geolife/.