Generating Pedestrian Trajectories Consistent with the Fundamental Diagram Based on Physiological and Psychological Factors

Pedestrian crowds often have been modeled as many-particle system including microscopic multi-agent simulators. One of the key challenges is to unearth governing principles that can model pedestrian movement, and use them to reproduce paths and behaviors that are frequently observed in human crowds. To that effect, we present a novel crowd simulation algorithm that generates pedestrian trajectories that exhibit the speed-density relationships expressed by the Fundamental Diagram. Our approach is based on biomechanical principles and psychological factors. The overall formulation results in better utilization of free space by the pedestrians and can be easily combined with well-known multi-agent simulation techniques with little computational overhead. We are able to generate human-like dense crowd behaviors in large indoor and outdoor environments and validate the results with captured real-world crowd trajectories.


Introduction
The problem of simulating the movement and behaviors of human-like crowds is important in many applications, including architecture and urban design, pedestrian dynamics, computer animation, games, virtual reality, etc. In the absence of governing mathematical models, intuition and observations have driven much of the research and development in this field. A key observation in understanding how individual trajectories are formulated arises from studies in pedestrian dynamics and traffic management that highlight the relationship between crowd density and pedestrian movement; as density increases, speed decreases [1][2][3][4][5][6][7]. This phenomenon is called the Fundamental Diagram [8].
Although real-world pedestrians tend to slow down in areas of high crowd densities, some of the well known crowd simulation models do not exhibit such behaviors. In this paper, we address the problem of modeling crowd behaviors governed by these densities: which we term as density-dependent behaviors. In particular, we present a novel approach that combines • The speed and density relationship in the crowd movements computed by our algorithm exhibits the Fundamental Diagram.
• Our approach uses physiological and psychological techniques to model the underlying factors that affect pedestrian movement.
• Our approach results in smoother trajectories and also reduces the number of collisions between the agents.
• Our approach is general and does not make any assumptions about the global planning algorithm or local navigation technique. We have combined our approach with local navigation algorithms based on reciprocal velocity obstacles and social forces.
• The computational overhead of our algorithm is low and we can simulate thousands of agents at interactive rates on a single core.
We validate our approach by comparing with captured crowd trajectories and also demonstrate its performance in indoor and outdoor environments.
A preliminary version of this paper appeared in [44]: this is the full version. The rest of the paper is organized as follows: We describe our approach to crowd simulation and density-dependent behaviors in Section 2. In Section 3, we compare simulation results with the empirical data. We highlight the performance of our algorithm in Section 4. Finally, in Section 5 we analyze the model's strengths and weaknesses.

Density-dependent Behaviors
In this section, we describe our approach to introducing density-dependent behaviours into well-known crowd simulation models. First, we introduce some of the notation and terminology used in the rest of the paper. In our crowd simulation algorithm, agents are modeled as twodimensional disks with the following common state: ½rpṽ cṽ 0 T 2 R 7 , where r is the radius of the disk,p,ṽ c , andṽ 0 are two-dimensional vectors representing the current position, current velocity and the input preferred velocity generated by the global planner, respectively. By convention, kṽ c k and kṽ 0 k are the current speed and the input preferred speed (i.e. the magnitudes of the corresponding vectors). We use subscripts to denote a particular agent i, such as r i andṽ 0 i .

Fundamental Diagram
The Fundamental Diagram is the observed relationship between pedestrian speed and density; as density increases, speed decreases (Fig 1). Many prior crowd simulation algorithms tend to reduce the speed of the agents through bottlenecks [19,20]. However, this is largely a function of performing collision avoidance in a congested environment i.e. agents slow down since they cannot move collision-free at a higher speed. It is not a manifestation of the Fundamental Diagram which does not depend on the capacity of a space; it corresponds to a relationship between the density and speed. To that effect, our algorithm aims to slow down agents in accordance with local density even if the agents could possibly move collision-free at a higher speed.
2.1.1 Physiological and Psychological Factors. Our model incorporates a physiological and a psychological factor. The physiological factor is based on the biomechanical principle that stride length and walking speed are inextricably linked; a change in one implies a change in the other [1]. The relationship, as defined by biomechanists [2], is defined by the "stride factor" parameter (α). It relates a person's stride length (L) and walking speed (v) as: where H = height/1.72 m is a height-normalizing constant. The psychological factor models the complex concept of personal space. Psychologists and biomechanists have shown that humans have a strong sense of personal space-a "buffer" that extends beyond mere physical requirements [3,5]. Our model includes a "stride buffer" parameter (β) that reflects this preference for personal space. As the stride buffer increases, an agent requires more space to walk comfortably at a given speed.
We use a linear combination of the physiological and psychological factors to yield a function that determines the natural walking speed (V) for the available space (S) in front of an agent: where α is the stride factor as defined by [2] and β is the stride buffer. Space-estimation: The relationship in Eq 2 is expressed in terms of the space on a line extending in a single direction. However, our agents move on a 2D plane, and we need to compute a similar mapping in a 2D region that comprises of other agents and obstacles. We base our method on some experimental observations performed by Seyfried et al. [4]. Seyfried et al. performed one dimensional experiments on the Fundamental Diagram by creating a narrow passage which constrained the subjects to walk in a line. The subjects' changes in speed are thus attributed to the available space in front and behind the agent, along the one-dimensional path. The density in this experiment was, likewise, a one-dimensional quantity (number of pedestrians/meter). The authors observed that the 1D density in the experiment was related to the 2D expectations defined by Weidmann [8] by a scale factor equal to the inverse of the individual's width. Given the average human width of 0.48 m, a measured 1D density value of 1 people/m translates to a 2D density value of 2.08 people/m 2 . We employ this observation in our model of space estimation by first computing the local 2D density and then using Seyfried et. al.'s method to map it to the scalar "space" value used in Eq (2).

Density Dependent Filters
We introduce density-dependent filters that can be used to generate human-like density responses. These filters can be integrated with any Global-Local Planner (GLP) based model. GLP based models use a global planner to plan a path through the static environment. The path is used to generate immediate goals which are communicated to the local planner as preferred velocities-velocities in the direction of an immediate goal, at a user-defined preferred speed. The local navigation scheme selects a viable velocity based on the preferred velocity and the local dynamic conditions (i.e. nearby obstacles and agents). In most crowd simulation algorithms based on the GLP paradigm, the preferred velocity serves as the interface between the global and local modules. Implicit to this model is the assumption that the agent's global plan is independent of the local conditions. This assumption places a particular burden on the local navigation module; it must be able to compute an appropriate response under an arbitrarily large range of local conditions. This burden can lead to problematic results: noisy trajectories, increased agent-agent collisions and undesirable agent behavior.
The density-dependent filters seek to reduce the mismatch between the two stages by seamlessly adapting the preferred velocities generated by the global planner to local dynamic conditions. Architecturally, they serve as the interface between the global planner and local navigation module, as shown in Fig 2. This results in smoother trajectories, reduced agentagent collisions and realistic agent behavior.
The agents seek to optimize their progress towards the goal by exploring the space around them, while their motion is governed by the physiological and psychological factors. At each step, our algorithm computes an arc centered at the input preferred velocity from the global planner. It chooses a new velocity, the corrected preferred velocity, from this arc such that it minimizes the cost function (Eq 9) while respecting the physiological and psychological factors that govern pedestrian movement. Finally, the density filter communicates the corrected preferred velocity for collision avoidance.
2.2.1 Agent Density Computation. Here, we describe our approach for computing the contribution of neighboring agents to the density perceived by an agent in the simulation. Given an agent i at positionp i and direction vectorv y i offset from the agent's input preferred velocityṽ 0 i by an angle θ, we define a point q y i that lies one meter ahead alongv y i . An agent j at positionp j is considered to a neighbor of agent i if the Euclidean betweenp i &p j is less than a predefined threshold. We use a Gaussian density function to determine the contribution of each neighboring agent to the density atq y i . It is well known that humans exhibit an elliptical personal space, with a preference for space in front [3]. To model the personal space of agent i, we transform the displacement towards a nearby agent j fromd ij ¼p i Àp j tod 0 ij y causing agents in front to have a greater contribution to density than those to the side (Eqs 5 and 6). Thus, the density of neighboring agents atq y i is: Effect of Obstacles on Density Computation. Here, we describe how obstacles affect the density perceived by an agent. We believe that there exists some discomfort perceived by humans when walking alongside obstacles. We use the inverse of contiguous free space (FS) available to an agent to reflect this discomfort. Essentially, the obstacles are forbidden spaces i.e. an agent may never intersect with an obstacle. At the same time, the obstacles also have a discomfort associated with them that inclines agents to keep a comfortable distance whenever possible.
Given a pointq, we represent this bias using a normalized 2D Gaussian kernel centered atq. The 2D kernel prioritizes space nearestq, increasing the agent's sensitivity to immediately proximate obstacles. The kernel is simply a weight function with compact support (w). Integrating it over the domain of the support (O) yields the contiguous free space (FS) available to an agent atq.
The effective density used in our algorithm for a pointq y i is the agent density r y Ai scaled by the inverse of the free space, FSðq y i Þ, available atq y i .
2.2.2 Agent's Response to Density. This section describes how an agent computes its optimal corrected preferred velocityṽ FD i . An agent i with width w i chooses θ, the directional offset from its input preferred velocity, such that it minimizes the distance to the goalg i from its current positionp i with respect to time period τ (Fig 3) arg min whereṽ FD y i represents the corrected preferred velocity in direction θ that accounts for physiological and psychological constraints. It can be computed as: The use of the corrected preferred velocityṽ FD y i in the cost function (Eq 9) implies that an agent implicitly minimizes the time to reach the goal which is consistent with earlier work in pedestrian dynamics [31,45]. This means that an agent may choose to traverse a longer but less congested path to the goal if it determines it can make more progress towards the goal along that path in the next time step.

Implementation
We represent the obstacles over a grid of cell size c b . The simulator identifies cells lying inside the obstacle and generates a level set. Next, it computes the free space available at each cell c p that is not contained within any obstacle. It does so by splatting a precomputed 2D Gaussian kernel at pointp, the center of cell c p and then systematically walking around the neighborhood of c p to determine contiguous free space (FS) with respect top (Fig 4). Hence, for a scene with n obstacles, we can find the obstacles that contribute to "density computation" at a pointp in O (n) time. This can all be done offline thereby saving runtime costs.
Algorithm 1 in S1 Table describes the simulation loop for each agent to determine its optimal corrected preferred velocityṽ FD i . The DensityAtPoint and CorrectedVelocity procedures referred in Algorithm 1 are described in S2 Table and S3 Table respectively. Finally, the optimal corrected preferred velocityṽ FD i is communicated to the local planner for collision avoidance.

Models Augmented with Density Dependent Filters
Our use of density-dependent filters is orthogonal to the choice of global and local planners.
To illustrate this generality, as well as our algorithm's efficacy, we have applied it to several local planners. The simulators all share the same global planner, which is a navigation mesh. The shared global planner means the differences between simulators will be dominated by the local planners. In particular, we demonstrate how our approach can be combined with two widely use local navigation algorithms: social forces [20] and optimal reciprocal collision avoidance [22]. It is important to note that the time period τ used in Eq 9 should be greater than the time step for either of the local planners. This implies that we optimize the preferred velocity for a larger time scale but account for collision avoidance on a smaller time scale. 2.4.1 Social Forces. The social force (SF) model treats the crowd as a collection of mass particles. Newtonian-like physics is applied to the system to compute the trajectories of the agents. At each time step, the superposition of various forces are computed for each agent, ultimately determining a feasible velocity by imparting acceleration on the agent. The preferred velocity is converted into a "driving force". The agent avoids collisions with other agents and obstacles through the application of repulsive forces. We have taken the exact formulation of these forces, including parameter values, from Helbing's work [20].
Social Forces with Density Dependent Filters (D-SF): An agent i under D-SF feels a driving forceF drive as:F where m i is the mass of the agent, τ H is the time step for the numerical solver andṽ new i is the new velocity for agent i.ṽ new i can be computed using the force equation: wheref ij represents the agent-agent repulsive force andf iW the agent-obstacle repulsive force.

Optimal Reciprocal Collision
Avoidance. Optimal Reciprocal Collision Avoidance (ORCA) [22] applies geometric optimization techniques in velocity space. It is based on the notion of velocity obstacles from robotics. Avoiding collision simply requires selecting a velocity which does not lie within the reciprocal velocity obstacle set for each agent. ORCA's unique formulation defines the velocity obstacles as half planes. The set of velocities that are permitted for agent i with respect to all other agents is the intersection of the half planes of permitted velocities induced by each other agent, and we denote this set ORCA t O i for the planning horizon τ O .
ORCA with Density Dependent Filters (D-ORCA): In the D-ORCA algorithm, an agent selects a new velocityṽ new i for itself that is closest to its optimal corrected preferred velocityṽ FD i amongst all velocities inside the region of permitted velocities: Comparison to Real-World Data We validate the performance of our model in three reproductions of live pedestrian experiments (Fig 5). These real world experiments examine the flow of pedestrians in various scenarios: a 2D uni-directional flow scenario, a bidirectional flow scenario, and a complex flow scenario of people exiting a stadium. For each experiment, we report adherence to the Fundamental Diagram.
We measure the simulator's ability to reproduce the Fundamental Diagram in the following manner. For each experiment, we define a region through which each agent must pass. We compute the time it takes for each agent to pass through the region and the average density of the agents in that region during that interval. This becomes a single density-speed data pair, which we present in a scatter plot (Fig 6). This analysis is consistent with earlier results reported in the pedestrian dynamics literature [4][5][6][7].
When the flow of agents is reduced because the capacity of the area is limited, congestion increases and the agents slow down. It is worth noting that both SF and ORCA agents exhibit such behavior. However, this is not a manifestation of the Fundamental Diagram. The Fundamental Diagram does not require changes in the capacity of a space. Simply increasing density should cause a reduction in speed.

Two Dimensional, Uni-Directional Flow
Zhang et al. [6] performed experiments of uni-directional flow in a corridor (Fig 5(a)). The authors performed multiple iterations of the experiment, varying the flow into the corridor and the flow out of the corridor to control the observed density in the measurement region inside  [6] (c) The bi-directional flow experiment in [7] and (c) The stadium experiment [46] with red arrowheads denoting the path to the exit tunnel. the corridor. Reproducing this experiment tests the suitability of the space-estimation formulation described earlier. Fig 6(a) shows the Fundamental Diagram results for ORCA, D-ORCA, SF and D-SF. Its easy to see that both ORCA and SF marginally reduce speeds at high densities. This is due to the constraints on the flow out of the corridor. The experiment created a bottleneck; the flow into the corridor was greater than the flow out of the corridor. However, D-ORCA and D-SF agents reduce speeds due to increase in density which is in accordance with the Fundamental Diagram and closely matches the captured human data.

Two-dimensional, Bi-directional Flow
Following the uni-directional flow experiment, Zhang et al. also examined bi-directional flow [7]. Using the same arrangement as in the previous uni-directional flow experiment, the authors placed subjects at both ends of the corridor. In our bi-directional experiment, we use an infinitely long corridor, of the same width in the pedestrian experiment. We vary the flow into the corridor by varying the initial agent density (ranging from 0.5-2.5 people/m 2 ). The Fundamental Diagram results can be seen in Fig 6(b). SF showed a consistent reduction in speed with respect to density. In contrast, ORCA exhibited relatively constant speeds irrespective of density. However, with the application of the density filters, agents were able to maintain a sparse distribution, which appears to be consistent with observed human-behaviors.  [7] and (c) The stadium experiment [46]. Agents in both D-ORCA and D-SF exhibit a human-like sensitivity to high densities and conform to the Fundamental Diagram. Crowd Simulation Using Density-Dependent Filters

Stadium
Burghardt et. al. [46] performed experiments on the complex flow of a crowd exiting a soccer stadium. They recorded the trajectories of 300 spectators as they made their way toward a predetermined exit tunnel. The stadium is difficult to simulate because of its non planar layout; furthermore, there are three dense flows that meet almost orthogonally at the entrance of the tunnel which leads to a bottleneck. Fig 6(c) depicts the Fundamental Diagram, computed at the entrance of the tunnel, for this dataset. It is easy to see the success of the density filters at effectively modeling the highly dense and convoluted flows that make up the stadium dataset. In contrast, both ORCA and SF agents achieve significantly high densities and exhibit little or no response to density. D-SF's response to density is further evident from the density field for captured pedestrian crowd (Fig 7(a)), D-SF (Fig 7(b)), and SF (Fig 7(c)) in the exit tunnel at the moment when 20% of the agents have entered the tunnel. SF agents achieve densities as high as 5.93 people/m 2 whereas D-SF agents achieve a maximum value of 3.96 people/m 2 , more in keeping with captured human data.

Results
In this section, we highlight the performance of our algorithm on different scenarios. In addition to generating density-dependent behaviors, our formulation also results in smoother trajectories and results in fewer agent-agent collisions as compared to prior methods.

Applications
We tested the capabilities of our model on a number of example scenarios, depicted in Fig 8. In one scenario, roughly depicting an hourglass, 200 agents stream in towards a narrow passage Crowd Simulation Using Density-Dependent Filters with concave windings (Fig 8(b)). Agents under D-SF and D-ORCA exhibit significantly fewer collisions than their SF and ORCA counterparts. In another scenario, agents move in concentric circles towards a ticket kiosk at the center (Fig 8(c)). They are programmed to wait for 10 seconds at the kiosk before heading outward again. This creates a high density situation since we have a large number of agents heading towards each other with opposing goals. Agents under D-SF and D-ORCA exhibit smoother trajectories and are able to reach their goals faster as compared to SF and ORCA respectively. Finally, we depict a dense crowd entering a shopping mall (Fig 8(d)). One thousand agents queue up outside the store waiting for the doors to open. Once opened, agents stream in and move towards the other end of the store. D-SF and D-ORCA agents exhibit a tendency to maintain personal space and to this end, utilize the free space around them. This translates to smoother trajectories and few collisions as compared to SF and ORCA respectively. It is worth noting that we used the same sampling parameters for all our experiments. Furthermore, with the obstacle grid computed offline, the run time overhead of our algorithm was minimal, as can be seen in Table 1. In most cases, the introduction of the density filters increased the average frame computation time by a few milliseconds. However, in case of the Kiosk, D-SF actually reduced the computation time. This is due to the significant decrease in collisions ( Table 2). The experiment created cross flows leading to regions of high density. SF agents attempted to achieve their preferred speed even in high densities, leading to collisions and thus increasing the time spent in collision detection. On the other hand, D-SF agents were able to maintain a sparse distribution and thus had fewer collisions.

Inter-agent Collisions
Finally, models augmented with density-dependent filters reduce the number and degree of collisions in the simulation. By a collision, we mean the overlap or penetration of one agent into the geometric shape corresponding to another agent. We use interval penetration depth as a metric for measuring the rate of collisions in a crowd. Penetration depth is the measure of how much two entities overlap; it is typically defined as the minimum displacement required to eliminate overlap. It allows us to quantify the severity of collision. For each pair of adjacent time steps, we compute the penetration depth between Crowd Simulation Using Density-Dependent Filters two agents, i and j, over the interval bound by those time steps t and t + 1. Finally, we produce a collision score for a full simulation by computing the average penetration depth across all frames and agents. Table 2 reports the collision scores for the scenarios, with and without the density filters. The order of magnitude difference in logarithmic scale with the application of the density filters is high as ten for both ORCA and SF. The "Bidirectional flow" in case of ORCA and "Hourglass" scenario in case of SF witnessed the most improvement which is understandable since these scenarios were designed to have the most cross flow. The fact that our density filter reduces collisions should not be surprising. Many of the collisions arise from the jostling due to non-smooth trajectories in dense scenarios. Smoother trajectories naturally lead to fewer collisions.

Trajectory Smoothness
Without the density filter, the trajectories exhibit a great deal of noise. The reason for this is that the unfiltered intention (preferred speed) might be inconsistent with the agents current condition; moving toward the goal at preferred speed may not be possible. But given that intention, the local navigation algorithm aggressively seeks to exploit every opportunity to increase the agent's speed to match its preferred speed. However, such rapid accelerations can often leave the agent in an untenable situation which needs to be reversed in the very next time step. The introduction of the density filter causes the intended speed to scale down according to the congestion. Because of this, the acceleration taken is more likely to be valid over a longer window and the motion of the agent becomes smoother. We illustrate our model's impact on trajectory smoothness by plotting trajectories of a small sample of agents (Fig 9). We performed a baseline simulation using SF with a time-step of 0.0625 s (middle). In addition, we simulated D-SF at the same time step (left) and SF at a 0.001 s time step (right). The baseline trajectories are chaotic. Reducing the time step by a factor of 62.5 improved smoothness, but introducing the density filter produced the smoothest trajectories, even at the larger time step.

Conclusion
We have introduced a novel crowd simulation algorithm based on density-dependent filters to generate human-like crowd flows. Our approach is applicable to a large number of GLP multiagent algorithms that use a combination of local and global planners, and can generate realistic density-dependent behaviors. We have highlighted the performance on many complex scenarios and also validated the performance with captured human trajectories. The computational overhead of our approach is relatively small, and it is shown to generate smoother trajectories with fewer collisions. Furthermore, the introduction of the density filters requires no significant changes to either the global or local navigation components.

Limitations and Future Work
The potential impact of the density filters depends on how sensitive the local planner is to the preferred velocity. In both SF and ORCA, the preferred velocity plays a significant role and this results in improved performance of D-SF and D-ORCA. Also, the benefit of the density filters may be relatively less in scenarios where global density-dependent navigation techniques are used. The fact that the adaptation is done at a local level implies that the density filters may prove ineffective in scenarios where global density-dependent navigation techniques are more appropriate.
In future work, we will investigate the application of the density filters at the meso-scale so as to allow agents to account for sudden changes in density. Furthermore, we plan to augment our density filters with other psychological factors which may play a vital role in modeling dense heterogeneous crowds.
Supporting Information S1