A Dynamic Time Warping Algorithm Based Analysis of Pedestrian Shockwaves at Bottleneck

Since the quantitative methodology analysis of the high-density pedestrian shockwaves at a bottleneck is limited, this paper proposes a dynamic time warping (DTW) algorithm for identifying, analyzing, and verifying the shockwaves. A set of real-world trajectory data is used to illustrate the proposed algorithm. Results show that the DTW algorithm is capable of depicting the pedestrian shockwaves elaborately and accurately. Results also show that the shockwave velocity is unsteady, as throughout time the gathering wave velocity and the evanescent wave velocity are decreasing and increasing, respectively.Themutual influence between followers and leaders is decreased when the shockwave spreads. There is a linear relationship between the shockwave velocity and density. Furthermore, singularities present a potential match solution to help identify the changing of pedestrian behaviors. The DTW algorithm for evaluating the pedestrian system stability has significant intrinsic features in the pedestrian traffic control and management.


Introduction
The rail transit, which has the advantages of high velocity, punctuality rate, and capacity, is the leading approach to solving traffic problems in cities with a large population; however, it has been getting overcrowded and uncomfortable for passengers inside the subway station.The design of pedestrian facilities for the rail transit needs to consider the complex behaviors of the pedestrian flows [1,2].In general, the design follows the rule of thumb (i.e., the designing rule with the assumption of ideal pedestrian behaviors), while it fails to reflect the actual pedestrian behaviors, causing potential security issues.Thus, the pedestrian behaviors in the pedestrian facilities with limited space capacity are worth studying.
The following is one of the most essential pedestrian behaviors.It may cause a pedestrian stampede, which occurs when large groups of people try to escape from confined spaces where escape path directions abruptly change.In the field of transportation, the following behavior of vehicles was first studied.Pipes [3] introduced the follow-the-leader concept based on the traffic flow theory.The optimal velocity model was then proposed to model the following behavior [4,5].Then Newell's car-following model was carried out to investigate the driving behavior with the trajectory data [6].Based on Newell's car-following model, Taylor et al. [7] proposed Dynamic Time Warping (DTW) algorithm to examine driver heterogeneity in car-following behavior.
Since the pedestrian movements and vehicle movements are similar [6], the one-dimensional fluid dynamics model developed for the vehicle movements has been applied to the studies on pedestrian movements.For statistically investigating pedestrian flow, Lv et al. [8] analyzed the similarity between the vehicle following and the pedestrian following at the single lane and developed the optimal velocity model to study the pedestrian following behavior.Then, the social force model was calibrated and developed to simulate real-world scenarios in the pedestrian movement for evacuation scenarios, pilgrimage, and urban environments [9][10][11].Support Vector Machine (SVM) algorithm, cellular automata model, and normal cloud model have been created to reveal the pedestrian density-flow relationship and evaluate pedestrian dynamics following behavior in a subway station [12][13][14][15][16][17].
Being related to a pedestrian following behavior, the shockwave is a boundary in a pedestrian stream that represents a discontinuity in the flow-density domain [18].Izadpanah et al. [19] proposed a new methodology to detect and analyze shockwaves based on traffic trajectory data.Li et al. [20] described the use of cloud-based crowdsourced probe data to simplify the problem of detecting the boundary of shockwaves between uncongested and congested conditions.Stanitsas and Hourdos [21] used shockwave activity as a surrogate of safety (shockwave length) and mobility (shockwave frequency) to evaluate shared hot lane facilities.Sundara et al. [22] analyzed the traffic shockwave propagation associated with darkness on highways and determined the value of darkness shockwave velocity propagation.Zhang et al. [23] proposed and verified the application and efficiency of a traffic shockwave model.Cho et al. [24] evaluate the shockwave effectiveness including theoretical verification based on traffic flow model and shockwave theory.However, the shockwaves, which often occur at the bottleneck, can quickly lead to congestion accidents.Since the quantitative methodology analysis of the high-density pedestrian shockwaves at bottleneck is limited, the accuracy and complexity of the velocity calculation of shockwave have not been studied.Hence, analysis of the pedestrian shockwave in detail at the bottleneck is needed.
This paper investigates the pedestrian movement at a bottleneck and presents a basic theory to evaluate the stability of the pedestrian system and have a great significance for the pedestrian traffic control and management.The main contribution of this paper is to propose a new approach, named DTW algorithm, for identifying, analyzing, and verifying the shockwaves.Compared with the fluid dynamic theory, the superiority of the DTW algorithm is that it provides a new method for calculating wave velocity using fewer parameters and simplified formula.This paper also contributes to using a set of real-world trajectory data to illustrate the proposed algorithm and validate the computational efficiency of the estimated results algorithm.The parameters, such as gathering wave velocity, the evanescent wave velocity, and the relationship between the shockwave velocity and the density, are analyzed.

Pedestrians following Characteristics
When pedestrians are compared with vehicles, pedestrians have more free and flexible behaviors and are more valuable to the influence of environment or other pedestrians.But behaviors of vehicles and pedestrians can still be considered to be similar.The pedestrian following movements in the single-file passageway is analogous to the vehicle following movements in the single lane.The leader is the person who influences a group of people into walking in a single-file passageway; the follower is the person who follows the leader walking in the single-file passageway.The movements of followers are all restricted by the leader and adjusted according to the positions and velocities of the leaders.The average velocity of the followers is less than or equal to the average velocity of the leaders so that collision is avoided.Vehicles or pedestrians are controlled by the conditions of space and velocity.The follower velocity is restricted by the space distance of the whole group.When the distance is decreased to a certain extent, vehicles or pedestrians must stop due to the congestion.Due to the existence of the reaction time, the change of motion of followers is always delayed after the change of motion of leaders.Due to the delay, the change of motion of the whole group at the bottleneck has a complex transfer phenomenon.We apply a follow model that has been developed for vehicle movement to the investigation of onedimensional pedestrian movement.

DTW Algorithm
For the analysis of the pedestrian shockwave, the DTW algorithm is proposed that serves to extract the optimal match points and analyze pedestrian microscopic following behavior.Because of the advantage of matching precision, the DTW algorithm has been widely applied to the field of speech recognition, pattern recognition, and failure diagnosis [25][26][27] and the field of sensor technology for tracking pedestrian trajectories [28,29].The specific aim of this paper is to use the DTW algorithm to find the similarity or distance between pedestrian data sets.
The DTW algorithm is explained with an example of twopeople trajectory data.The time-series data of position and velocity for the leaders and the followers are inputted and calibrated using SIMI Motion.Table 1

lists an example of the time input data.
A velocity difference matrix C is established to assess the cost of aligning each velocity data point in one-time series to all other points of the second time series, using the equation where   is the velocity of the leader at time point  and   is the velocity of the follower at time point .An example of the velocity difference matrix is shown as follows: The velocity difference matrix C is used to calculate the cumulative velocity difference matrix L that denotes the cumulative least cost for continuously moving from the first pair to the last pair.The algorithm of the cumulative least cost evaluates the costs in the next cell vertically, horizontally, or diagonally away from the current cell in the matrix, using the equation An example of the cumulative velocity difference matrix is shown as follows: The optimal alignment with the least cumulative velocity difference matrix, which starts at the last pair in the cumulative velocity difference matrix and works back to the first pair, is found.The warp path search pattern is used to search the next cell vertically, horizontally, and diagonally away from the current cell in the warp path.An example of the warp path is shown as follows (formatted in italics):  When establishing the warp path, one potential problem arises when the values of the cumulative velocity differences in the adjacent cells are equal.Thus, a prespecified warp path step direction (diagonal step is preferred) is specified to help guide the algorithm through the cumulative velocity difference matrix.
The DTW algorithm (programmed using MATLAB) is applied to intuitively and precisely find the optimal corresponding between two timestamps.Note that the algorithm allows one-to-many matching in time series.An example of the matching result is shown in Figure 1 (the position data is shown in Notations and Input Parameters).

Analysis of the Shockwaves with Practical
Pedestrian Behavior Data

The Identification of Shockwaves.
One typical bottleneck is selected as an example to illustrate the identifying process of shockwave using DTW algorithm, as shown in Figure 2(a) (the scene before the bottleneck is selected).Figure 2(b) shows the optimal matching results through the DTW algorithm.For evaluating the shockwave transmitting, the data for the blank group is collected from subway channel.identified by comparing with the blank group (which present a parallel matching line).The shockwave velocity is defined as the slope of the optimal matching line between two points and is a primary parameter of depicting the characteristics of shockwaves.Figure 4 visualizes the key points highlight in matching results, and Table 2 lists the values of the key parameters.The optimal match point coordinate obtained through the DTW algorithm is extracted to analyze pedestrian following parameters.There is a phenomenon of shockwave transmission when pedestrians walk through the bottleneck.Lines AB, CD, and EF are the boundaries between low-density state and high-density state, indicating the tendency of gathering.On the contrary, lines GB, HD, and IF are the boundaries from high-density state to low-density state, indicating the tendency of dissipating.
In Table 2, since  AB >  CD >  EF , the shockwave velocity appears to change in the entrance and departure regions, a slight trend toward decreasing before congestion and

The Verification of Shockwaves.
The fluid dynamic theory is introduced to verify the shockwaves identification results of DTW algorithm.The velocity of shockwave is calculated using  where the parameter  is the velocity of shockwave,  1 ,  2 are the pedestrian flow in a different state,  1 ,  2 are the pedestrian density in different state, V 1 , V 2 are the pedestrian velocity in different state, and  1 ,  2 are the pedestrian distance in a different state.
Table 3 lists the change of the shockwaves velocity.Figure 5 presents the comparison of the two algorithms for gathering and evanescent wave.The tendency of the shockwave velocity changing between the two algorithms is consistent, which verifies the analysis of the phenomenon of shockwaves by using the DTW algorithm.Compared with the fluid dynamic theory, the superiority of the DTW algorithm is more intuitively and precisely finding the changing point of wave velocity; on the other hand, it provides a new method of calculating wave velocity.Fewer parameters and more straightforward formula are beneficial to reduce the complexity of calculation.

The Shockwaves Characteristics of Pedestrian Flow
The typical shockwaves parameters of pedestrian flows, such as singularities, shockwave velocity, and density, are further analyzed using the 25 groups of pedestrian trajectory data.

Singularity Analysis.
Relevant to the shockwave characteristics of the pedestrian flow, the singularity occurs where a large section of time series is matched with a single point in the other time series.
The physics of the singularity in the pedestrian crowd is the pedestrian's speed variation, which affects the stability of the pedestrian system.Singularities are divided into two types: the follower's reaction is mapped to multiple actions by the leader (which present equilateral triangle); the multiple actions by the follower are mapped to a single action by the leader (which present inverted triangle), as shown in Figure 6.
The singularities offer a matching solution which is presenting a new perspective identifying pedestrian following behavior.The size of the angle  at the singularity has an important implication for the individual pedestrian following behavior of shockwaves.Different angles indicate that the individual reaction time for state changes diverges.At bottleneck, especially in a high density of pedestrian, as the angle increases, the follower reaction time increases, and the pedestrian flow state is increasingly unstable.

Evaluation of the Parameters of Density and Shockwave
Velocity in Pedestrian Flow.The relationship between the density and shockwave velocity of pedestrian flow is analyzed.The changing shockwaves velocity is obtained, as shown in Figure 7.The gathering wave velocity decreased due to the limited capacity and disappeared at the end, while the evanescent wave velocity increased reversely.Both the gathering wave velocity and the evanescent wave velocity have a close linear relationship, as shown in Table 3.  Figure 8 shows the changing density of the pedestrian flow.The density of the pedestrian flow increases before the bottleneck happens and decreases after that, which presents a phenomenon of "low density-high density-low density."For the pedestrian psychology of escaping from the crowd, the acceleration of pedestrian after bottleneck is larger than the one before the bottleneck happens.Also, the density of the pedestrian flow has a quadratic correlation, as shown in Table 4.
Results show an intimate relationship between the shockwave velocity and the density (Figure 9).The shockwave velocities, including both gathering wave velocity evanescent wave velocity, decrease with the density increase.The evanescent wave velocity has a larger acceleration than gathering wave velocity, which results from the psychology of pedestrian escaping from the crowd.Moreover, there is a linear relationship between the density and either the gathering wave velocity or the evanescent wave velocity.

Conclusion
The DTW algorithm is capable of identifying, analyzing, and verifying the shockwaves of pedestrians using the crowd trajectory data in traffic bottleneck.Compared with the fluid dynamic theory, the superiority of the DTW algorithm is that it provides a new method of calculating wave velocity.Fewer parameters and more simple formula are beneficial to reduce the complexity of calculation.The parameters, such as gathering wave velocity, the evanescent wave velocity,   and the relationship between the shockwave velocity and the density, are also analyzed.Results show that there is a linear relationship between the shockwave velocity and the density.Also, a set of real-world trajectory data is used to illustrate the proposed algorithm and validate the computational efficiency of the estimated results algorithm.The DTW algorithm for evaluating the pedestrian system stability has significant intrinsic features in the pedestrian traffic control and management.

Figure 4 :
Figure 4: Key points highlight in matching results.

Figure 5 :Figure 6 :
Figure 5: Comparison of the two algorithms for gathering and evanescent wave.

Figure 7 :
Figure 7: Shockwave velocity for 25 times of pedestrian flow.
: The slope of the line   Δ : The area of triangle : The response sensitivity of pedestrian state changes C: The velocity difference matrix   : The velocity of the leader at different time points    : The velocity of the follower at different time points  L: The cumulative velocity difference matrix : The velocity of shockwave   : The pedestrian flow in state    : The pedestrian density in state  V  : The pedestrian velocity in state    : The pedestrian distance in state .

Table 1 :
Position and velocity time-series data.

Table 2 :
Value of the key parameter.

Table 3 :
Values of pedestrian shockwaves.

Table 4 :
Values of density and shockwaves velocity of pedestrian Flow.