Adaptive pedestrian dynamics based on geodesics

Here, we report on a new approach for adaptive path finding in microscopic simulations of pedestrian dynamics. The approach extends a widely used concept based on scalar navigation fields—the so-called floor field method. Adopting a continuum perspective, navigation fields used in our approach correspond to the shortest distances to the pedestrian's targets with respect to arbitrary metrics, e.g. metrics depending on the local terrain. If the metric correlates inversely with the expected speed, these distances could be interpreted as expected travel times. Following this approach, it is guaranteed that virtual pedestrians navigate along the steepest descent of the navigation field and thus follow geodesics. Using the Eikonal equation, i.e. a continuum model, navigation fields can be determined with respect to arbitrary metrics in an efficient manner. The fast marching method used in this work offers a fast method to solve the Eikonal equation (complexity N log N, where N is degree of freedom). Increasing computational efforts with respect to classical approaches only mildly, the consideration of locally varying metrics allows a realistic adaptive movement behavior like the avoidance of certain terrains. The method is outlined using a simple cellular automaton approach. Extensions to other microscopic models, e.g. cellular automata approaches or social force models, are possible.

3 navigation field is typically determined using the underlying lattice [5][6][7][8][9][10]. Starting from the target, the number of minimal moves along the main axes of the lattice is assigned to each cell (Dijkstra's algorithm, [14]), i.e. the distance measured in the 1-metric or Manhattan metric (Manhattan navigation field). Due to the analogy to a propagating flood, the method is often referred to as the flood-filling method.
Although several variants of Dijkstra's algorithm exist, e.g. allowing also diagonal propagation weighted with a factor √ 2 [9], the discreteness and symmetry of the underlying models are always reflected in the navigation field. The movement pattern is not isotropic. Motion in arbitrary directions can only be approximated by a sequence of motions parallel to the main axes of the lattice [1].
The problem of unnatural movement due to navigation fields based on Dijkstra's algorithm has been addressed in several works: Huang and Guo [10] propose to calculate the navigation field on a rectangular lattice by the weighted sum of two distances both based on Dijkstra's algorithm. One comes from the case of permitting only vertical and horizontal movements and the other from permitting movements in all eight directions. If the weighting is chosen appropriately, realistic movement patterns are found. An approach not depending on the choice of specific weighting parameters but relying directly on Euclidean distances has been proposed in [7]. The authors construct a navigation field in terms of the minimum Euclidean distance to the exit via a combination of visibility graphs and Dijkstra's algorithm. The approach resolves any symmetry reflections in the navigation field due to the underlying lattice [15]. However, in complex geometries the procedure could be rather slow.
Recently, a different perspective on the navigation field has been proposed [8,15]: the navigation field is considered as a measure for the expected travel time rather than a measure for distances. The authors suggest to compose the navigation field of a field reflecting exact Euclidean distances (taking a considerable amount of computation time) plus a perturbation dynamically generated using standard flood-fill methods [7] (being relatively fast-they are of order N , where N is the number of cells in the scenario). During the filling process, the value of the field cell is increased by a larger value if the cell is occupied by a pedestrian reflecting an increased travel time. Pursuing this concept of minimizing travel times, certain unrealistic artifacts are avoided in comparison to standard methods considering large crowds.
In this work, we present a new dynamic field-based navigation algorithm for microscopic simulation approaches to pedestrian dynamics which introduces nearly no artifacts due to the underlying discrete structures. The approach is based on the construction of navigation fields reflecting distances to the target measured in arbitrary metrics, including the real Euclidean metric. Generation of navigation fields is related to the Eikonal equation, i.e. a continuum model, which can be solved efficiently using the fast marching method (FMM) [16]. Realistic navigation fields can be computed extremely fast even in complex domains (order N log N , where N is the number of cells in the scenario). Furthermore, we introduce new movement rules ensuring that virtual pedestrians follow the steepest descent of the navigation field. In comparison to other approaches, full benefit of the available information is taken, leading to more realistic movement patterns of single pedestrians as well as pedestrian crowds. If the underlying metric correlates inversely with the expected speed, the navigation field can be interpreted as expected travel times and the movement strategy of single pedestrians reduces to minimizing travel times (as suggested in [8]). Via a dynamic regeneration of the navigation field, a dynamic adaptation of navigation strategies is possible. 4 Similar ideas to the microscopic approach outlined in [8] as well as the ideas outlined in our approach have been proposed by Hughes [17] for macroscopic approaches to pedestrian dynamics. In a series of papers, different aspects of this approach have been investigated [18][19][20]. Pedestrian flows, modeled by a density field rather than resolving single pedestrians, are driven by a potential similar to the navigation field presented here. That is, pedestrian densities are transported with a speed proportional to the gradient of the potential. Such a macroscopic perspective is, however, only valid in certain regimes, a microscopic perspective is more suited to many real world applications.
The paper is structured as follows: firstly, we outline the cellular automaton model, followed by the general concept of the proposed method including the initialization of the navigation field and the choice of the movement direction for single virtual pedestrians (movement algorithm). Then we present several examples emphasizing that the outlined approach yields reliable movement patterns not reflecting any artifacts of the underlying discretizations.

A cellular automaton model
For clarity, we present the proposed approach for a specific cellular automaton model. We choose the cellular automaton model proposed in [21][22][23][24] similar to many classical approaches (see e.g. [1,6]).
The simulation area is covered by a hexagonal lattice of cells with lattice spacing , chosen to fit the spatial requirement of an average European male [25]. At each time step each cell has a certain state; it is either empty or occupied by a pedestrian or a fixed obstacle. Pedestrians move on this lattice by a fixed set of rules from sources, where they are generated, to targets, where they leave the scenario. The rules are chosen in the style of electrodynamics: pedestrians are attracted by their targets modeled as long-range potentials, the navigation field, and are repelled from other pedestrians and obstacles modeled as short-range potentials. In the simplest case, the movement rule for single pedestrians is purely deterministic and reduces to finding the neighboring unoccupied cell with the minimal summed potential value, which we refer to in the following as the zeroth-order algorithm.
When generated, a certain free flow velocity is assigned to each pedestrian. Depending on the local density of pedestrians, pedestrians are forced to slow down during the movement in certain regions. Choosing an appropriate calibration, Weidman's fundamental diagram [25] is ensured [24]. The movement sequence of single pedestrians follows a sequential update scheme where pedestrians with a higher speed are allowed to move more often than pedestrians with a lower speed.
The model is quite similar to the so-called static floor field cellular automaton (cf [5] and further references in [1]). The main difference is that here we rely on a purely deterministic scheme, whereas in typical approaches based on the floor field method pedestrians choose their move according to probabilities depending on potential fields.

Initialization of the navigation field
The central idea of the proposed approach is to determine the expansion of a wavefront in a 2D domain , the domain of interest, rather than the direct calculation of distances (see figure 1), i.e. navigation is based on travel times of a wave rather than on distances. To do so, we consider a wavefront that initially (i.e. at T = 0) is given by the outline of the target, the curve g. The wavefront propagates with a normal velocity F(x) 0 (evolution of wavefronts is solely determined by their normal velocities, [16]). Inside obstacles F(x) = 0 holds, since they cannot be penetrated by the wave. Arrival times T (x) of the wavefront at a point x are determined by the Eikonal equation [16]: If F(x) ≡ 1 outside obstacles, arrival times T (x) coincide with exact Euclidean distances to the target, i.e. the lengths of the shortest paths (Euclidean navigation field). Choosing different F(x) outside obstacles, arrival times can still be interpreted as distances, but with respect to different spatial measures.
Introducing the Eikonal equations (1) and (2), we have reformulated the problem as a partial differential equation, i.e. a continuum model. The FMM [16] offers an efficient method to solve the Eikonal equation on a wide range of discretizations grids (complexity N log N , where N is the degree of freedom/number of vertexes). Here, we use the regular triangular grid with fixed grid size spanned by the vertexes given by the cell centers of the cellular automaton's hexagonal lattice (complexity N log N , where N is the number of cells).
Although the considered microscopic model for pedestrian movement (cf section 2) is based on a discrete hexagonal lattice, we have formulated the initialization of a navigation field from a continuum perspective. Considering the discretizations of the FMM algorithm directly, a purely discrete point of view is obtained. The main idea of the algorithm is to update the navigation field value in each cell not only taking into account a single neighbor with the smallest field value (Dijkstra's algorithm) but rather taking into account two neighbors with the smallest field values. A significantly better approximation of the Euclidean metric is obtained. However, following a continuum perspective has several advantages: on the one hand, the discretizations do not necessarily have to be bound to the underlying lattice of the cellular automaton. By choosing a coarser discretization, a significant speedup of the algorithm can be gained. On the other hand, the continuum formulation allows an evident interpretation of the directions of the shortest paths. This information can be used for a correction of standard movement rules with the goal of more realistic movement patterns. Furthermore, a possible extension to social force models [2] becomes evident. Introducing a force proportional to ∇T (x)/|∇T (x)|, similar navigation strategies could also be introduced in social force models.

Direction of the shortest paths
As outlined above, arrival times T (x) of the navigation field correspond to the shortest distances to the target (eventually measured with different metrics). Thus, following the continuum interpretation, the direction of the shortest paths, the geodesics, is given by ∇T (x). Using the FMM to solve (1) and (2), T (x) is only approximated in the centers of the cellular automaton cells. Via interpolation, e.g. piecewise linear interpolation (cf figure 2), the gradient can be approximated everywhere in . Hence, even if the target is not directly visible, i.e. the direct line between a pedestrian and the target cuts obstacles, the directions of the shortest paths can be determined.

Non-constant metrics
Choosing F(x) = 1 with F(x) > 0 (outside obstacles), spatially varying metrics can be realized (e.g. distances on greens are generally weighted differently than distances on streets). Smaller F(x) correspond to a slower propagation of the wavefront and hence to steeper gradients of T (x). Since we interpret T (x) as distances, a slower propagation corresponds to a stronger weighting of distances, i.e. a different metric (cf figure 1). Hence, distances in different regions can be measured in different metrics, leading to avoidance of certain grounds (pedestrians move along geodesics).
We would like to stress that the normal wave speed F(x) is only related to the favoring of pedestrians for different grounds, e.g. streets are avoided. F(x) has not to be related to the free flow velocity of pedestrians. However, if we choose the metric proportional to the expected travel speed, T (x) corresponds to the expected travel times and the navigation strategies reduce to minimizing travel times rather than minimizing distances. 7

First-order movement algorithm
Using a Euclidean navigation field with the zeroth-order movement algorithm, the shortest path is followed only roughly (cf orange path in figure 2). Thus, even if realistic distances are considered, paths of single pedestrians deviate from expected paths. Taking advantage of the knowledge of the direction of the shortest path in the continuum setting, the deterministic movement strategy can be adapted (cf figure 2).
Let us consider the ith step of length of a person p resting in P 0 . Without restriction of movement to the main axes of the lattice, the pedestrian would move to P * along the direction to the target. Moving e.g. to P 1 , a deviation n p,i normal to the shortest path is made, i.e. n p,i is the normal distance to the line locally given by the direction to the target and P 0 . Furthermore, a tangential deviation t p,i is obtained, i.e. in P 1 the pedestrian is approximately t p,i further away from the target than in P * .
Following the continuum perspective, for all x ∈ , we can determine the directions of the shortest paths (given by ∇T (x)). This first-order information can be used for spatial and temporal corrections of the zeroth-order algorithm yielding a first-order algorithm (for simplicity, let us restrict in the following to F(x) ≡ 1; cf figure 2). First, we determine for the current cell P 0 the direction (vector η p,i = ∇T ( P 0 )/|∇T ( P 0 )|) of the shortest path to the target. Then we identify the two neighboring cells (of P 0 ) directly located to the left and right sides of the shortest path ( P 1 and P 2 ). For both cells the normal deviation n p,i is determined. Deviations to the left and right are assigned different signs. The movement algorithm chooses the current step i such that | j=1...i n p, j | is minimal. The chosen cell (out of P 1 and P 2 ) is not necessarily the neighboring cell with the minimal T (x). In this case, the navigation field value of the chosen cell is corrected (only for this step), i.e. it is reduced slightly under the minimal neighboring value. Afterwards, the zeroth-order algorithm is used including other interactions added to the navigation field (e.g. interactions with the environment). Adopting this first order approach, shortest paths to the target are directly followed by virtual pedestrians as expected for most pedestrians in reality.
Analogous to normal deviations, tangential deviations t p,i are determined. These can be used to adapt the speed of pedestrians: if in step i the sum of all tangential deviations j=1...i t p, j of person p exceeds a multiple of the cell distance , an extra step is granted. Thus tangential deviations are always bounded by and travel times of virtual pedestrians match with expected travel times in reality. Without any corrections, virtual travel times might be significantly longer than expected, since motion is only possible along the main axes of the lattice (see figure 3). Alternative speed corrections have been suggested e.g. in [6,26,27].

Applications
As a first example, we have compared different approaches using a single scenario: the zerothorder algorithm using a Manhattan navigation field ( figure 4(a)), the zeroth-order algorithm using an Euclidean navigation field ( figure 4(b)), and the first-order algorithm based on a Euclidean navigation field ( figure 4(c)). In figures 4(a) and (b), pedestrians show preferences for certain directions due to the non-isotropic nature of the underlying lattice. This is an artifact inherent to all zeroth-order algorithms, even in the case of a true Euclidean metric. In reality, one would expect pedestrians to follow the shortest paths directly, i.e. one would expect only two bends in pedestrian paths at the corners of the obstacle. These paths are recovered by virtual pedestrians following the new first-order algorithm based on an approximation of Euclidean distances ( figure 4(c)). The more realistic spatial and temporal movement leads to more reliable travel times, an important aspect for virtual egress studies. Another example (in the spirit of [10]) comparing the proposed movement algorithm with the zeroth-order algorithm based on Dijkstra's algorithm is shown in figure 5. Around a circular target in the middle, several sources are located at a fixed distance. The target is blocked, i.e. no pedestrians can leave the scenario through the target. Thus a congestion is found around the target. In the case of a metric based on Dijkstra's algorithm, the hexagonal symmetry is manifested in the congestion ( figure 5(a)). Considering a metric based on the FMM algorithm, the congestion does not reflect any symmetries ( figure 5(b)) and thus could be (a) (b) Figure 6. Simulation using a first-order algorithm with an adaptive navigation field. Distances on different grounds are weighted differently, leading to a tactical behavior of pedestrians: certain grounds are avoided by following geodesics.
behavior according to the condition of the grounds which have to be passed. They try to avoid unpreferred regions (shaded in gray) by following geodesics of the underlying metric. Adapting the metric appropriately allows the realization of partial artificial intelligence. Similar patterns are found in everyday situations, e.g. pedestrians crossing a street.
Through an appropriate choice of non-constant metrics in the vicinity of obstacles, it is also possible to realize the avoidance of obstacles in an elegant way. Existing approaches typically consider an additive repulsive obstacle potential. Following this concept, local minima in the summed potential could emerge and pedestrians could get stuck in these local minima. Realizing the avoidance of certain terrains, e.g. close to obstacles, via non-constant metrics, navigation fields are always guaranteed by construction to have local minima only in the targets themselves, i.e. pedestrians could never get stuck.
Furthermore, the concept of non-constant metrics allows an elegant and user-friendly realization of complex geometries. Instead of specifying all obstacles, one could simply adopt the metric within these obstacles appropriately, i.e. choosing extremely slow front speeds F(x). An example where the metric is obtained from a standard grayscale image is shown in figure 7, where white fields correspond to fast F(x): during a regional virtual evacuation, pedestrians leave a soccer stadium and move towards the train station as well as several parking lots and park-and-ride stops located around the stadium, the corresponding targets. As expected, pedestrians choose their routes along the streets specified by the metric.
Further tactical behavior of virtual pedestrians can be realized via multiple dynamic navigation field initialization similar to the ideas outlined in [8]: weighting distances in regions Simulation using a first-order algorithm with a dynamic adaptive navigation field reinitialized every ten steps. Distances underlying the navigation field are weighted relative to the local pedestrian density, thus that virtual pedestrians tactically avoid congestions.
with a high pedestrian density are stronger and by reinitializing the navigation field every ten steps pedestrians adapt their navigation dynamically to the current situation. They avoid congestion by dynamically choosing detours, which they expect to be faster than waiting in congestions. An example is shown in figure 8, with two alternative routes to the target. If the congestion in front of the narrow passage exceeds a certain threshold, the initialization wave of the navigation field propagates faster around the obstacle such that corresponding geodesics are passing above the obstacle. Virtual pedestrians move towards the target choosing the upper route. Similar tactical behavior can be observed in many everyday situations.

Discussion
The considered examples (section 7) underline that the new navigation algorithm for pedestrian crowd simulations yields realistic spatial and temporal movement patterns of single pedestrians as well as large crowds: choosing a navigation field approximating true Euclidean distances plus a first-order movement algorithm based on the directions of the shortest paths, virtual pedestrians closely follow the shortest paths (geodesics). Also, in reality, most pedestrians follow the shortest paths. Thus, traveled distances and travel times of virtual pedestrians are more accurate, an important aspect for egress studies.
Choosing the underlying metrics appropriately, the realization of adaptive tactical behavior of virtual pedestrians is possible: unpreferable regions are avoided, e.g. streets are crossed in a nearly perpendicular fashion. Choosing a dynamic update in the spirit of [8], also the avoidance of pedestrian congestions can be realized. As regularly observed in real life, detours are taken if they are expected to be less blocked and thus faster. Furthermore, complex topographies can be represented via the choice of varying metrics in an elegant and user-friendly way as outlined by the example considered in this paper.
In comparison to existing navigation algorithms based on fields (e.g. [5,6,9,10]), only slightly more computational effort is required to determine the navigation field (order N log N instead of order N , where N is the degree of freedom/number of cells). The navigation field considered here, is however, able to approximate the shortest Euclidean distances, e.g. as calculated exactly in [7], leading to significantly more realistic results [15]. Although the presented algorithm can be formulated in a purely discrete way, we have relied here on a continuum perspective. Thus, the choice of an appropriate discretization is relatively arbitrary, allowing further reductions in computational speed. It is possible to choose navigation field discretizations independent of the cellular automaton lattice, e.g. with size 2 , reducing the number of unknowns N . No modifications of the movement algorithm are necessary.
Similar ideas to the approach presented here have been suggested for macroscopic continuum approaches considering pedestrian densities in a purely analytical fashion [17,18]. Recently, these ideas have been also realized in macroscopic computational approaches [19,20]. Like most macroscopic approaches, these approaches share the drawback that they are not valid for low pedestrian densities. Furthermore, it is an unresolved problem how reliable the predicted dynamics are since all pedestrians are assumed to move with the same speed.
Here, we have outlined a new navigation algorithm for a specific deterministic cellular automaton simulator. The presented algorithm offers an easily adaptable framework for realistic navigation of single pedestrians as well as crowds in microscopic approaches to pedestrian dynamics. Variants for other discrete microscopic approaches, many of them very similar to the considered cellular automaton-the so-called floor field methods [5,6,9,10], can be easily derived. Since a continuum perspective has been adopted, the same strategies could also be implemented in social force models [2].