# Crowd Simulation with Arrival Time Constraints

^{1}

^{2}

^{*}

## Abstract

**:**

## 1. Introduction

## 2. Related Work

## 3. Proposed Algorithms

#### 3.1. Problem Statement

_{i}consists of a set of waypoints $\left\{{W}_{j}\in {\mathbf{R}}^{2}\right\}$ to get to the target G

_{i}, where $0\le j\le m$. The arrival-time constraints are represented as ${T}_{i}\in R$, and ∆T

_{i}is the difference of adjacent two T

_{i}and their average $\widehat{T}$. Given these configurations, collision-free paths must be found for all agents such that for each agent, the difference between the actual arrival time and the estimated average arrival time, $\u2206{A}_{j}=\widehat{A}-{A}_{i}$ matches $\u2206{T}_{i}$.

#### 3.2. Overview

#### 3.3. Pre-Processing Step

_{1}and P

_{2}as shown in Figure 3. In Figure 3a, it happens that both P

_{1}and P

_{2}have the same waypoint w

_{i}. In this case, if those two agents have a similar speed, then there is a high chance that the two agents would bump into each other at some point in time. To prevent this collision, the algorithm maintains an internal count variable for each waypoint. If a certain path uses a waypoint, then the count variable increases its value. If another path lies on the same waypoint, then instead of using the original waypoint, the algorithm finds a new position that is close to the original waypoint. The new position should not lie on any static obstacles and should be a within a threshold distance range from the original waypoint. Figure 3b explains the new position, perturbed from the original waypoint.

#### 3.4. ORCA with Modified Preferred Velocity

**a**, if the agent maintains its current velocity for a short period [1], given other dynamically moving agents playing the role of moving obstacles. In general, VO is defined in velocity space. Specifically, assume that $V{O}_{a}$ is a VO induced by agent

**a**. Then, VO is constructed by translating a collision cone, a set of velocities that lead to a collision eventually, given the velocity of agent

**a**, denoted by ${v}_{a}$. Figure 4 illustrates the VO for agent a given another agent

**b**. Although we discuss the method only for agent

**a**given another agent

**b**, the method can be applied to the agent

**b**given agent

**a**, because the method is reciprocal.

_{a}. The meaning of optimal in our approach requires the input of a preferred velocity. The preferred velocity is a vector obtained by multiplying a speed parameter with a direction vector. The direction vector is defined a unit vector from the agent’s position to the current waypoint. The optimal velocity must then be chosen to stay outside of $V{O}_{a}$ and to be as close to the preferred velocity as possible. In our approach, rather than using fixed maximum speed ${S}_{max}$, it is allowed change, depending on the visibility. This approach makes the agent arrive at the waypoint a little early, which gives some extra time to adjust the velocity to meet the time constraint.

**a**lies outside the VO when another agent chooses their velocity simultaneously. To fix this issue, the algorithm is upgraded so that each agent takes half of the responsibility of avoiding collision. It is called the RVO (reciprocal velocity obstacle). To implement the RVO efficiently while minimizing unnatural movement, the ORCA algorithm was proposed [3]. The ORCA argues that the velocity obstacles, along with the so-called half-plane that contains a set of collision-free velocities, generate smooth trajectories. Let ${v}_{a}$ represent the current velocity. In ORCA, a new parameter called the finite time horizon $\tau $ is introduced. The finite time horizon $\tau $ is the period that guarantees collision-free movement, which means that future collisions are ignored beyond $\tau $. With $\tau $, the $V{O}_{a}$ is often truncated into $V{O}_{a}^{\tau}$, which would reshape the collision cone (to be rounder). Let $q$ be the nearest point on the border of $V{O}_{a}^{\tau}$, $u$ be the vector connecting $q$ and ${v}_{a}$, and $n$ be the outward normal vector of $q$ and $V{O}_{a}^{\tau}$. Then, $q$ can be calculated as follows:

#### 3.5. Adjustment of Velocity for Time Constraints

**a**is $\left\{{w}_{i}\right\}$. Then the total length of the path, ${D}_{a}$, can be calculated as follows:

**a**maintains its current velocity, and that ${D}_{a}$ is the total length of the path it traverses, the estimated arrival time ${A}_{a}$ can be calculated as follows:

**a**, the velocity can be recalculated for given time constraints ${T}_{a}$. The time constraint ${T}_{a}\in R$, is a scalar value that indicates the arrival time of agent

**a**. The key point to note is that ${T}_{a}$ does not mean the absolute time at which the agent

**a**arrives at the target. In the proposed simulation, the difference of this value with time constraints of other agents is of more importance. Mathematically, assume that there is a set of constraints ${T}_{i}$ where $0\le i\le n$. For example, ${T}_{0}$ is the time constraint for agent 0, ${T}_{1}$ is the time constraint for agent 1, and so on. Succinctly, the value of ${T}_{i}$ is meaningful only when it is compared with some other ${T}_{j}$. That is, if ${T}_{i}$ is smaller than ${T}_{j},$ agent i arrives at its target position faster than agent j. The extent by which the agent

**i**arrives before agent

**j**depends on the difference between ${T}_{i}$ and ${T}_{j}$. For example, let three agents and their ${T}_{i}$ be 0.1, 0.5, and 0.3, respectively. Then, the order of arrival is the first, the third, and the second.

#### 3.6. User Interface for Setting Time Constraints

## 4. Experiments

_{i}was heuristically set to 0.5. For fast neighbor searching, a simple grid-bin method was used on a KD (K-dimension) tree structure. To increase the understandability of the figures in this section, a result video was created. Please refer to the accompanying video and Supplementary Materials at online https://youtu.be/qu_sxFoRhdg.

## 5. Discussions

## Supplementary Materials

## Author Contributions

## Funding

## Conflicts of Interest

## References

- Van den Berg, J.; Lin, M.; Manocha, D. Reciprocal Velocity Obstacles for Real-Time Multi-Agent Navigation. In Proceedings of the IEEE International Conference on Robotics and Automation (ICRA), Pasadena, CA, USA, 19–23 May 2008. [Google Scholar]
- Snape, J.; Berg, J.v.d.; Guy, S.; Manocha, D. The Hybrid Reciprocal Velocity Obstacle. IEEE Trans. Robot.
**2011**, 27, 696–706. [Google Scholar] - Van den Berg, J.; Guy, S.; Lin, M.; Manocha, D. Reciprocal n-body Collision Avoidance, Robotics research. In Proceedings of the 14th International Symposium ISRR, Lucerne, Switzerland, 31 August–3 September 2009; Selected papers based on the presentations at the symposium. Springer: Berlin, Germany, 2011. [Google Scholar]
- Van den Berg, J.; Snape, J.; Guy, S.; Manocha, D. Reciprocal Collision Avoidance with Acceleration-Velocity Obstacles. In Proceedings of the IEEE International Conference on Robotics and Automation (ICRA), Shangai, China, 9–13 May 2011. [Google Scholar]
- Jin, X.; Deng, Z. Crowd Simulation and its Applications: Recent Advance. J. Comput. Sci. Technol.
**2014**, 29, 799–811. [Google Scholar] - Curtis, S.; Best, A.; Manocha, D. Merge: A Modular Framework for Simulating Crowd Movement. Collectiv. Dyn.
**2016**, 1, 1–40. [Google Scholar] - Ijaz, K.; Sohail, S.; Hashish, S. A Survey of Latest Approaches for Crowd Simulation and Modeling using Hybrid Techniques. In Proceedings of the 17th UKSIM-AMSS International Conference on Modelling and Simulation, Cambridge, UK, 25–27 March 2015; pp. 25–27. [Google Scholar]
- Berg, J.; Patil, S.; Sewall, J.; Manocha, D.; Lin, M. Interactive Navigation of Individual Agents in Crowded Environments. In Proceedings of the Symposium on Interactive 3D Graphics and Games (I3D), Redwood City, CA, USA, 15–17 February 2008; pp. 15–17. [Google Scholar]
- Barnett, A.; Shum, H.; Komura, T. Coordinated Crowd Simulation with Topological Scene Analysis. Comput. Graph. Forum
**2016**, 35, 6. [Google Scholar] - Cooper, A.; Cooper, S.; Popovic, Z. Continuum Crowds. ACM Trans. Graph.
**2006**, 25, 3. [Google Scholar] - Karamouzas, I.; Skinner, B.; Guy, S. A universal power law governing pedestrian interaction. Phys. Rev. Lett.
**2014**, 113, 238701. [Google Scholar] - Karamouzas, I.; Sohre, N.; Narain, R.; Guy, S. Implicit Crowds: Optimization Integrator for Robust Crowd Simulation. ACM Trans. Graph.
**2017**, 36, 1–13. [Google Scholar] - Helbing, D. A fluid dynamic model for the movement of pedestrians. Complex. Syst.
**1992**, 6, 391–415. [Google Scholar] - Reynolds, C.W. Flocks, Herds, and Schools: A Distributed Behavioral Model. In Proceedings of the 14th Annual Conference on Computer Graphics and Interactive Techniques, ACM SIGGRAH, Anaheim, USA, 27–31 July 1987; Volume 1, pp. 25–34. [Google Scholar]
- Toll, W.; Cook IV, A.; Geraets, R. Real-time density-based crowd simulation. J. Comput. Anim. Virtual Worlds
**2012**, 23, 59–69. [Google Scholar] - Guy, S.; Chhugani, J.; Curtis, S.; Dubey, P.; Lin, M.; Manocha, D. PLEdestrians: A Least-Effort Approach to Crowd Simulation. In Proceedings of the ACM SIGGAPH/Eurographics Symposium on Computer Animation, Chapel Hill, NC, USA, 2 July 2010; pp. 119–128. [Google Scholar]
- RVO2 Library. Available online: http://gamma.cs.unc.edu/RVO2/ (accessed on 9 October 2020).
- Yang, L.; Qi, J.; Song, D.; Xiao, J.; Han, J.; Xia, Y. Survey of Robot 3D Path Planning Algorithms. J. Control. Sci. Eng.
**2016**, 2016. [Google Scholar] [CrossRef] [Green Version] - Sung, M.; Chenny, S.; Gleicher, M. Scalable Behavior for Crowd Simulation. Comput. Graph. Forum
**2014**, 23, 519–528. [Google Scholar] - Kurihaha, K.; Vronay, D.; Igagashi, T. Flexible Timeline User Interface using Constraints. In Proceedings of the CHI’05 Extended Abstracts on Human Factors in Computing Systems, Portland, OR, USA, 2 April 2005; pp. 1581–1584. [Google Scholar]
- Korkmaz, M.; Durdu, A. Comparing of optimal Path Planning Algorithms. In Proceedings of the International Conference on Advanced Trends in Radio-electronics, Telecommunications and Computer Engineering, Slavske, Ukraine, 20–24 February 2018. [Google Scholar]
- Guruji, A.; Agawal, H.; Parsediya, D.K. Time-efficient A* algorithm for Robot Path Planning. Proc. Technol.
**2016**, 23, 144–149. [Google Scholar]

**Figure 2.**Roadmap constructed by the PRM. The red rectangles represent the static obstacles. The red circles are the initial positions whereas the blue circles are target positions. The yellow lines represent the paths obtained from the PRM query. Note that given maximum number of connections, two nearly nodes are connected as an edge when they are visible each other, otherwise, the nodes are not connected. The nodes are sampled in the environment to avoid all static obstacles.

**Figure 3.**Left: The two paths (

**p**and

_{1}**p**) have a common waypoint ${w}_{i}$. Right: The waypoint ${w}_{i}$ is changed to ${w}_{i}^{\prime}$ for the second path for a given range parameter r, so that the two resulting paths have slightly different waypoints. Note that the waypoints represented as circles are the part of PRM road maps. Additionally, the ${w}_{i}^{\prime}$ is a random point inside the circle center at ${w}_{i}$ with radius r.

_{2}**Figure 4.**Left: Two agents ($\mathit{a}$ and $\mathit{b}$ ) are at ${\mathit{p}}_{\mathit{a}}$ and ${\mathit{p}}_{\mathit{b}}$, respectively. Their current velocities are ${\mathit{v}}_{\mathit{a}}$ and ${\mathit{v}}_{\mathit{b}}$, and their radii are ${\mathit{r}}_{\mathit{a}}$ and ${\mathit{r}}_{\mathit{b}}$. Middle: A velocity obstacle of agent

**a**($\mathit{V}{\mathit{O}}_{\mathit{a}}$) induced by agent

**b**, shown in velocity space. Right: A reciprocal velocity obstacle of agent

**a**($\mathit{R}\mathit{V}{\mathit{O}}_{\mathit{a}}$) induced by agent

**b**, shown in velocity space.

**Figure 5.**Given two agents

**a**and

**b**, the visibility checks whether the current waypoint ${\mathit{w}}_{\mathit{i}}$ is visible to the agent

**a**. This means that there should be no other agents (for example, agent

**b**) in sight, towards the waypoint.

**Figure 6.**Two agents

**a**and

**b**are at the positions ${\mathit{p}}_{\mathit{a}}$ and ${\mathit{p}}_{\mathit{a}}$, respectively. Their current velocities are ${\mathit{v}}_{\mathit{a}}$ and ${\mathit{v}}_{\mathit{b}}$, and their radii are ${\mathit{r}}_{\mathit{a}}$ and ${\mathit{r}}_{\mathit{b}}$. For time horizon $\mathit{\tau}$, the $\mathit{V}{\mathit{O}}_{\mathit{a}}^{\mathit{\tau}}$ of agent

**a**induced by agent

**b**is the truncated cone (gray cone), in the velocity space. Then, ORCA, which is built by augmenting $\mathit{V}{\mathit{O}}_{\mathit{a}}^{\mathit{\tau}}$ with an additional linear constraint, provides a half-plane of velocity of collisions, oscillations, and reciprocal dances [1].

**Figure 7.**Proposed user interface for time constraints: the user can control the time points (green circles) to change their time (y) coordinates.

**Figure 8.**Line formation scenario: (

**a**) Simulation without time constraints (

**b**) Simulation with time constraints (all agents arrive at their targets at the same time) (Refer to the video). Note that all sequences are from left to right in each row, and then from top to bottom to the next row.

**Figure 9.**Linear shape ordered scenario: Top: Blue points represent the time constraints set in the user interface. All other pictures show the simulation over time (refer to the video). Note that the sequences are from left to right in each row, and then from top to bottom to the next row.

**Figure 10.**Circle formation scenario: An example of circle formation-agents are in a circular formation in the beginning, and their target positions are set opposite to the circle (Refer to the video). Note that the sequences are from left to right in each row, and then from top to bottom to the next row.

**Figure 11.**Arch-shape ordered scenario: a complex environment example-red blocks represent fixed obstacles. Yellow lines indicate the connection of waypoints for each agent. The time constraints are set in a way that all agents can arrive at the target positions in a specific order (refer to the video).

**Figure 12.**Complex environment example where 30 agents are moving to arrive at their target positions (refer to the video).

**Figure 13.**Orange lines indicate the time constraints for 10 agents. Blue lines show the arrival time of the agents. Note that the two lines must have the same shape to meet the constraints.

**Table 1.**Comparison between the proposed modified PRM and the A* algorithm in terms of construction time.

Modified PRM | A* | |
---|---|---|

Time | 1.2 s | 3.2 s |

Age/Gender | Timeline Interface | Proposed Interface | |
---|---|---|---|

A | 24/F | 196 s | 152 s |

B | 28/M | 224 s | 175 s |

C | 27/M | 222 s | 165 s |

Average | 214 s | 164 s |

Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |

© 2020 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Sung, M.; Kim, S.
Crowd Simulation with Arrival Time Constraints. *Symmetry* **2020**, *12*, 1804.
https://doi.org/10.3390/sym12111804

**AMA Style**

Sung M, Kim S.
Crowd Simulation with Arrival Time Constraints. *Symmetry*. 2020; 12(11):1804.
https://doi.org/10.3390/sym12111804

**Chicago/Turabian Style**

Sung, Mankyu, and SeongKi Kim.
2020. "Crowd Simulation with Arrival Time Constraints" *Symmetry* 12, no. 11: 1804.
https://doi.org/10.3390/sym12111804