Article

# HyPedSim: A Multi-Level Crowd-Simulation Framework—Methodology, Calibration, and Validation

Huu-Tu Dang* and Benoit Gaudou and Nicolas Verstaevel

UMR 5505 IRIT, Université Toulouse Capitole, 31000 Toulouse, France; benoit.gaudou@ut-capitole.fr (B.G.); nicolas.verstaevel@ut-capitole.fr (N.V.)

* Correspondence: huu-tu.dang@ut-capitole.fr

**Abstract:** Large-scale crowd phenomena are complex to model because the behaviour of pedestrians needs to be described at both strategic, tactical, and operational levels and is impacted by the density of the crowd. Microscopic models manage to mimic the dynamics at low densities, whereas mesoscopic models achieve better performances in dense situations. This paper proposes and evaluates a novel agent-based model to enable agents to dynamically change their operational model based on local density. The ability to combine microscopic and mesoscopic models for multi-scale simulation is studied through a use case of pedestrians at the Festival of Lights, Lyon, France. Pedestrian outflow data are extracted from video recordings of exiting crowds at the festival. The hybrid model is calibrated and validated using a genetic algorithm that optimises the match between simulated and observed outflow data. Additionally, a local sensitivity analysis is then conducted to identify the most sensitive parameters in the model. Finally, the performance of the hybrid model is compared to different models in terms of density map and computation time. The results demonstrate that the hybrid model has the capacity to effectively simulate pedestrians across varied density scenarios while optimising computational performance compared to other models.

**Keywords:** agent-based model; multi-level behaviour; pedestrian modelling; multi-scale simulation

<figure><img src="image_1.png" /></figure>

check for
updates

**Citation:** Dang, H.-T.; Gaudou, B.; Verstaevel, N. HyPedSim: A Multi-Level Crowd-Simulation Framework—Methodology, Calibration, and Validation. *Sensors* **2024**, *24*, 1639. https://doi.org/ 10.3390/s24051639

Academic Editor: Raffaele Gravina

Received: 31 January 2024

Revised: 28 February 2024

Accepted: 29 February 2024

Published: 2 March 2024

<figure><img src="image_2.png" /></figure>

**Copyright:** © 2024 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 (https://
creativecommons.org/licenses/by/
4.0/).

# 1. Introduction

Pedestrian simulation is an effective tool to model and study the behaviour of pedestrians in various contexts, from optimisation of pedestrian flows to safety issues [1]. Pedestrian behaviour can commonly be modelled into a three-layer level architecture [2]:

* Strategic level: pedestrians determine a list of activities (or targets) and when they want to perform these activities.

* Tactical level: pedestrians choose a path to the predefined destinations based on information about the environment.

* Operational level: pedestrians adjust their local movements such as collision avoidance to adapt to the surrounding area.

In order to build a pedestrian simulation, modellers have to effectively instantiate their model for at least one of the three layers, that is to say at least one strategic model (also referred to as goal selection model) [3,4], or one tactical level model (also known as path planning model) [5,6], or one operational level model [7,8]. The majority of research contributes to the operational level because this level addresses the immediate, physical behavior of pedestrians such as collision avoidance or local movements. This paper focuses on selecting the proper algorithm for the operational level which computes the velocities and speed of each pedestrian based on local information.

Many types of operational models exist in the literature, each model being built to capture and mimic a specific phenomenon [9]. Therefore, their performance differs if they are put into contexts for which they have not been designed. Microscopic models are usually used to simulate pedestrians in low- and medium-density situations, where
the density level is less than 2 ped/m² [1]. These models encounter specific problems when applied to high-density situations, such as abnormal vibrations with the Social Force Model [10], congestion in dense bidirectional flow with the Velocity Obstacle Model [11], and unrealistic results in terms of collision metrics with the data-driven models [12,13]. On the other hand, pedestrian dynamics in high-density situations are similar to fluid flow [14], and fluid-like equation models [14,15] are particularly appropriate for these scenarios due to their assumption of the continuousness of pedestrian flow. Given the observed variability in the performance of pedestrian-simulation models across different crowd densities, the integration of multiple models is required to accommodate the full spectrum of potential scenarios.

This contribution proposes and evaluates an agent-based model to enable agents to dynamically change their operational model based on local density to adapt to their dynamic environments. An agent-based approach is selected as it is a common method to model pedestrians in which agents represent pedestrians with decision-making capabilities, personal characteristics, and varied levels of operations and interactions [16]. Local density estimation is achieved through predefined regions in the environment, which enables contextual and structured adaptation to various environments. Additionally, the use of pre-defined areas can facilitate the implementation of the model by providing a more intuitive and manageable approach to estimating density. The ability to combine microscopic and mesoscopic models for multi-scale simulation is studied through a use case of pedestrian crowds at the Festival of Lights, Lyon, France—the so-called HyPedSim framework. This case study demonstrates the utility of the framework with respect to integrating different models in order to enable festival organisers to test various experiments of large-scale crowd simulation for safety planning and control.

The paper is organised as follows. Related works are summarised in Section 2. Section 3 describes our proposed agent-based model for the multi-level behaviour of pedestrians. Next, Section 4 illustrates the ability to couple models through the applications of simulating pedestrian crowds at the Festival of Lights. The performance of the hybrid model in comparison to other models is then demonstrated in Section 5. Finally, the paper ends with a conclusion and discussion in Section 6.

## 2. Related Work

Hybrid modelling is a methodology that incorporates different modelling techniques into a single framework. In pedestrian modelling, a hybrid model usually integrates macroscopic or mesoscopic models with microscopic models [17]. This combination enables the hybrid model to exploit the strengths of both approaches, thereby achieving a balance between simulating global crowd dynamics with reasonable computational cost while preserving the detailed representation of individual behaviour.

The classification of hybrid models relies on the communication mechanism between different simulation models, which can be categorised into two main types: auto-switch models and region-based models. Auto-switch models [18–20] allow only one model to run at a time but can switch from a macroscopic model to a microscopic model and vice versa based on a trigger condition. In contrast, the region-based model [21,22] assigns certain areas in the environment for each model and runs these models concurrently. A mechanism for the aggregation and disaggregation of crowds is required for hybrid models to have a consistent transition between the macroscopic and microscopic levels.

On the other hand, the calibration of pedestrian-simulation models is an essential step to improve the realism of simulation results. This step involves fine-tuning the parameters of a pedestrian-simulation model to ensure that simulation outputs match observed data [23]. Various techniques have been used to calibrate simulation models such as genetic algorithm [24], Bayesian inference [25], and maximum likelihood estimation [26]. However, calibrating hybrid models requires greater complexity, as there are more parameters across multiple constituent models. Another difficulty specific to crowd models is the lack of em-
pirical pedestrian data in high-density situations due to challenges in accurately extracting
pedestrian features from video recordings of crowds [27].

Currently, there is a lack of a general framework for modelling multi-level pedestrian behaviour that allows agents to dynamically change their operational models. Although Curtis et al. [28] proposed the Menge framework, a crowd simulator that aggregates different modelling algorithms for each level of pedestrian behaviour, this framework only allows one modelling technique to be implemented at the operational level in the simulation. To tackle this challenge, our work focuses on developing an agent-based model that simulates multi-level pedestrian behaviour and is compatible with various modelling algorithms at each level. Furthermore, this model enables pedestrian agents to switch their operational models in response to changes in local density. A detailed description is provided in the following section.

3. HyPedSim Framework

This section presents HyPedSim, a framework that allows agents to dynamically
change their operational models. Note that while our primary focus is at the operational
level, the tactical level component is also described to demonstrate that this approach is
extensible to model the higher levels of pedestrian behavior.

3.1. *General Overview*

The environment is divided into different zones, with each zone comprising walkable space and potential obstacles. This division of the environment can be based on expert knowledge or particular crowd characteristics and environmental criteria. Figure 1 illustrates an example of the environment separated into four distinct zones while a concrete example of zones is displayed in Section 4. An appropriate pedestrian-simulation model, such as the Social Force Model [7] or Continuum Crowds Model [15], is selected to simulate pedestrians in each zone depending on crowd density. Each zone is associated with specific triggering rules and transition functions.

The triggering rules evaluate pedestrian and environmental characteristics within the respective zone to select suitable models for pedestrian simulation. Due to the varying performance of pedestrian models across different crowd densities, these rules identify appropriate models to accurately capture the dynamics within each area. When new individuals enter a zone, the transition functions are activated to adapt their information, facilitating a smooth transition from their previous zone to the current one.

When entering a new zone, pedestrians adjust their tactical and operational models to align with the requirements of the corresponding zone. To ensure a generic and extensible approach for various pedestrian-simulation models, an agent-based model is proposed in Section 3.2 to model the multi-level behaviour of pedestrians. This agent-based model enables pedestrians to dynamically select the appropriate modelling algorithm at each level of behaviour.

<figure><img src="image_3.png" /><figcaption>**Figure 1.** General overview.</figcaption></figure>

3.2. Agent-Based Model for Multi-Level Behaviour

To develop an agent-based model for multi-level pedestrian behaviour, an abstraction
is first introduced to describe the problem of pedestrian modelling. The problem is divided
into two subproblems: *tactical* and *operational subproblem* (the integration of a *strategic subproblem* is not in the scope of this paper). Suppose that $S = \{E, A\}$, where E and A are the environment and the set of agents in simulation, respectively. The *tactical subproblem* can be formalised by the function $T, T: S \times t \times \mathbb{R}^2 \rightarrow \mathbb{R}^2$, which maps the simulation state, time, and the agents' destination to the local target which is in $\mathbb{R}^2$. The *operational subproblem* can be formalised as follows: $O: S \times t \times \mathbb{R}^2 \times \{0, 1\} \rightarrow \mathbb{R}^2$. The function O maps the local simulation state S, time, and local target, and a binary value (1 if agents are in high-density zones or 0 otherwise) to a feasible velocity in $\mathbb{R}^2$, which is then used to update agents' locations in the next simulation step. In general, the problem of pedestrian modelling can be stated via the following mathematical formulation:

$$v_i(t) = O_i(T_i(t)) \qquad (1)$$

$$p_i(t+1) = p_i(t) + v_i(t)\Delta t \qquad (2)$$

where $v_i(t)$ and $p_i(t)$ are the velocity and the location of agent i in the xy-coordinate system at time t, respectively, and $\Delta t$ is the duration of a simulation step.

Given the description above, an agent-based model is designed as shown in Figure 2. To include different modelling algorithms, each subproblem is represented by an abstract class ("class" refers to the classical definition in the Object Oriented Programming paradigm). The *tactical subproblem* is presented via the *Tactical level* while the *Operational level* class presents the *operational subproblem*. Each abstract class can contain different inheritance subclasses, where each subclass represents a specific model to simulate various behaviours depending on the situation (strategy pattern). The *Pedestrian* class has two attributes, which are *tactical_level* and *operational_level*, that are responsible for communicating with the *Tactical level* and *Operational level*. The pedestrian agents are only allowed to present one model for each level of behaviour at a time, but that model may be changed based on the state of the environment in which the pedestrian agents are operating.

<figure><img src="image_4.png" /><figcaption>Figure 2. Agent-based model for multi-level pedestrian behaviour.</figcaption></figure>

Each modelling algorithm for each level needs to inherit the corresponding abstract class. The *Tactical level* and *Operational level* classes return the local target and feasible velocity for pedestrians, respectively. What should be noted here is that in the simulation environment, excluding the *Pedestrian* class, only one single instance of each class is created (singleton pattern). Therefore, our model does not increase complexity but
improves the flexibility of simulation. Furthermore, it is possible to change the modelling algorithm at each level of behaviour by simply updating the variables *tactical_level* and *operational_level* in the *Pedestrian* class.

### 3.3. *Pedestrian Activity Diagram*

Figure 3 illustrates the activity diagram of pedestrian agents at each simulation step. Initially, the agents perceive their surrounding environment to identify neighbouring agents. Subsequently, if the agents have either reached their current local target or do not have a local target, they execute *define local target* behaviour which invokes their corresponding inheritance model from the *Tactical level* class to assign a new local target. Afterward, pedestrian agents perform the *move* behaviour using the returned velocity from their respective inheritance model in the *Operational level* class.

After moving to new locations, pedestrians check whether they have arrived at their destination. If yes, their movement is completed. Otherwise, they determine if they have transitioned into a new zone. In such cases, pedestrian agents need to update their states by sending a request to the zone entity to obtain information about the tactical and operational models employed in this new zone. This query returns the results *tactical_level*<sub>new</sub> and *operational_level*<sub>new</sub>, which represent the operational and tactical in use within the zone, respectively. Pedestrians then update their attributes by setting their operational variable *operational_level* to *operational_level*<sub>new</sub> and their tactical variable *tactical_level* to *tactical_level*<sub>new</sub>.

This continuous process of perceiving the environment, defining local targets, moving, and updating states based on zone transitions enables pedestrian agents to navigate through the simulation space effectively. This dynamic approach allows for the modelling of complex scenarios and interactions between agents, accounting for varying tactical and operational models across different zones.

<figure><img src="image_5.png" /><figcaption>Figure 3. Pedestrian activity diagram at each simulation step.</figcaption></figure>
## 4. Application to the Festival of Lights

This section demonstrates the capacity of the HyPedSim framework to model large, dense crowds in mass-gathering events such as the Festival of Lights. The festival is first introduced, followed by a discussion of empirical data collection. The pedestrian-simulation models and their coupling used in the HyPedSim framework are then described in detail. Finally, the calibration of the framework using a genetic algorithm along with the validation and sensitivity analysis of the calibration results are presented.

### 4.1. Festival of Lights

The Festival of Lights [29] is an annual art festival in Lyon, France. During the Festival of Lights, visitors gather to watch light shows projected onto the walls of the city's most beautiful monuments. Figure 4 shows pedestrians watching a light show in Place des Terreaux (as highlighted by the red rectangle), the festival's central plaza and most crowded area. After the show ends, pedestrians head towards the two pre-configured exit roads (Constantine Road and Chenavard Road) designed for safety management, as illustrated via the bottom-left blue arrows.

<figure><img src="image_6.png" /><figcaption>**Figure 4.** A screenshot of pedestrians watching the show at the Place des Terreaux in 2022 (https://www.fetedeslumieres.lyon.fr/fr/oeuvre/grand-mix-au-musee-des-beaux-arts-de-lyon (accessed on 30 January 2024)) and main circulation of the exiting crowd.</figcaption></figure>

### 4.2. Data Collection

Two cameras are used to record the crowd exiting, with each camera corresponding to one exit road. Subsequently, the pedestrian outflow on each road is manually calculated. Figure 5 shows the instant outflow of pedestrians over time on Constantine and Chenavard Roads. A total of 3833 pedestrians are counted, with 1803 pedestrians on Constantine Road and 2030 pedestrians on Chenavard Road. The exit time of the crowd is almost 400 s. The Gaussian filter method with a standard deviation of 2.0 for the Gaussian kernel is applied to reduce fluctuation error and improve the consistency of the outflow.
<figure><img src="image_7.png" /><figcaption>Figure 5. Empirical outflow of pedestrians. (a) The outflow of Constantine Road. (b) The outflow of Chenavard Road.</figcaption></figure>

## 4.3. Pedestrian-Simulation Models

During the pedestrian exit process, the plaza experiences high density, while the two exit roads exhibit lower density. Our proposed agent-based model can effectively simulate these situations where density varies spatially and temporally. To achieve this, two pedestrian-simulation models—the Social Force Model [7] and the Continuum Crowds Model [15], as well as their hybridisation in HyPedSim—are incorporated at the operational level of the framework to simulate dense crowd exit scenarios at the Festival of Lights.

### 4.3.1. Social Force Model

This section presents the simplified Social Force Model (SFM) [7] used in the framework, which describes pedestrian motion as driven by social forces. These forces result from both internal factors, such as an individual's attraction towards a personal goal, and external factors, like repulsion from neighbouring pedestrians. The SFM is formulated based on Newton's second law:

$$ \mathbf{a}_i(t) = \frac{\mathbf{v}_i^{\text{pref}} - \mathbf{v}_i(t)}{\tau} + \sum_{j \in N(i)} \mathbf{n}_{ij}(t) A \exp^{-\frac{d_{ij}(t)}{B}} \quad (3) $$

where $\mathbf{a}_i(t)$, $\mathbf{v}_i(t)$ are the acceleration vector and velocity vector of pedestrian $i$ at time $t$, respectively. Let $\mathbf{v}_i^{\text{pref}}$ denote preferred velocity of pedestrian $i$, and $V^{\text{pref}} = \|\mathbf{v}_i^{\text{pref}}\|$ represent the preferred speed of pedestrians. The first term of Equation (3) accounts for the acceleration from the current velocity to the preferred velocity within the reaction time $\tau$. The second term in Equation (3) describes distance-based repulsion forces with other pedestrians in the neighbour set $N(i)$, where $A, B$ are the parameters controlling the strength and range of the repulsion forces and:

$$ d_{ij}(t) = \|\mathbf{x}_i(t) - \mathbf{x}_j(t)\| - (r_i + r_j) \quad \text{and} \quad \mathbf{n}_{ij}(t) = \frac{\mathbf{x}_j(t) - \mathbf{x}_i(t)}{\|\mathbf{x}_i(t) - \mathbf{x}_j(t)\|} \quad (4) $$

where $\mathbf{x}_i(t)$ and $r_i$ are the position at time $t$ and radius of pedestrian $i$, respectively. $d_{ij}(t)$ is the separation distance between pedestrian $i$ and $j$, and $\mathbf{n}_{ij}(t)$ is the unit vector pointing from $\mathbf{x}_j(t)$ to $\mathbf{x}_i(t)$. Figure 6 illustrates intuitively the repulsion force $\mathbf{f}_{ij}$ between pedestrian $i$ and $j$.
<figure><img src="image_8.png" /><figcaption>Figure 6. Description of repulsion force $f_{ij}$ between pedestrian i and j.</figcaption></figure>

The SFM has been demonstrated to realistically reproduce self-organisation phenomena in low-density situations such as lane formation and arc-shaped clogging at bottlenecks [7]. There are four parameters of the SFM for calibration including: A, B, $V^{pref}$, $\tau$.

### 4.3.2. Continuum Crowds Model

On the other hand, Treuille et al. [15] proposed the Continuum Crowds (CC) Model, which treats pedestrian flow similarly as a continuum without taking into account individual differences. Global navigation is managed via dynamic potential field using the eikonal equation (Equation (5)):

$$ \|\nabla\phi(\mathbf{x})\| = C \qquad (5) $$

$$ \mathbf{v} = -f(\mathbf{x}, \theta) \frac{\nabla\phi(\mathbf{x})}{\|\nabla\phi(\mathbf{x})\|} \qquad (6) $$

where $\phi$ represents the potential function and C denotes the estimated unit cost in the direction of the gradient $\nabla\phi$. The cost value to the goals is evaluated based on distance, time, and discomfort factors. Pedestrian velocity is determined by the direction opposite the gradient, with the magnitude depending on the speed field $f(\mathbf{x}, \theta)$ evaluated at position $\mathbf{x}$ with moving direction $\theta$.

The CC model is suitable for simulating large crowds in extreme-density situations with computational efficiency. To apply the CC model, the environment is discretised into cells. Pedestrians in the same cells, with the same target, have the same velocity. The magnitude of velocity in each cell, assuming that the environmental topography is characterised with no effect of slope, is defined based on local density:

$$ f(\mathbf{x}, \theta) = f_{\max} - \frac{\rho(\mathbf{x} + r\mathbf{n}_{\theta}) - \rho_{\min}}{\rho_{\max} - \rho_{\min}} (f_{\max} - f_{\text{flow}}(\mathbf{x}, \theta)) \qquad (7) $$

where $\rho_{\max}$, $\rho_{\min}$ are the maximum and minimum density thresholds affecting the speed value, respectively. $f_{\text{flow}}(\mathbf{x}, \theta)$ represents the average flow speed in the direction $\theta$ at the position $\mathbf{x}$. Likewise, $\rho(\mathbf{x} + r\mathbf{n}_{\theta})$ denotes the local density evaluated at the point $\mathbf{x} + r\mathbf{n}_{\theta}$ which is at distance $r$ from $\mathbf{x}$ in the direction $\theta$.

Figure 7 describes the relationship between density and pedestrian speed. Pedestrian speed reaches its maximum value when the density is below $\rho_{\min}$. In contrast, if the density exceeds $\rho_{\max}$, pedestrian speed is limited to the average flow speed of crowds. The minimum value of average flow speed is set at $f_{\min}$. Between these density thresholds, pedestrian speed linearly decreases from its maximum value to its minimum value. Therefore, the parameters that need to be calibrated are: $f_{\min}$, $f_{\max}$, $\rho_{\min}$, $\rho_{\max}$.
<figure><img src="image_9.png" /><figcaption>**Figure 7.** Parameters of CC model.</figcaption></figure>

### 4.3.3. Hybrid Model

Pedestrian agents follow the activity diagram depicted in Figure 3 in general, with additional details when specifically applied to simulating crowds at the Festival of Lights.

**Specification of operational level models:** During the pedestrian exit process at the Place des Terreaux, the plaza experiences high density, while the two exit roads exhibit lower density. To handle these multi-density dynamics, the environment is divided into three distinct zones (as illustrated via the three rectangles in Figure 4). The plaza is specified as a high-density zone (red rectangle) and two exit roads are specified as low-density zones (blue rectangles). Each zone is characterised by one specific operational level model for pedestrian simulation. The specifications of the operational level models for these zones are as follows:

* The CC model [15] for a single target cell is used to simulate pedestrians in the high-density zone due to its effectiveness in dense scenarios. This approach leads to further discretisation into cells, each storing information about the environment and the pedestrians, such as average velocity and local density.

* The SFM [7] is applied to the two low-density zones to simulate pedestrians who have exited the plaza to one of the two exit roads, as it can realistically simulate pedestrians in low-density situations.

**Criteria to transition operational level models:** The transition criteria are activated as soon as pedestrian agents move out of the high-density zone into a new, low-density zone. When this occurs, the transition rule is applied, which sets the variable *operational_level* = SFM. Additionally, the parameter *t_delay* is introduced to provide better control over the transition by causing pedestrians to stand still for a short period after exiting the high-density zone.

**Exit choice behaviour:** Once pedestrians meet the transition criteria, they probabilistically select one of the two available exit roads. The probability of choosing an exit road depends on the distance to each of the exit roads at that time:

* If pedestrians are closer to Constantine Road, they choose Constantine Road as the exit road with the probability of $\alpha$ and Chenavard Road with the probability of $1 - \alpha$.

* Conversely, if pedestrians are closer to Chenavard Road, they choose Chenavard Road as the exit road with the probability of $\beta$ and Constantine Road with the probability of $1 - \beta$.

It is important to acknowledge that combining microscopic models and macroscopic models often requires further aggregation or disaggregation of individuals to convert and transform individual information between these models. However, our hybrid model uses a mesoscopic model and a microscopic model, both of which retain representation at the individual level. Therefore, our model sidesteps this additional step as individual information such as position and velocity are preserved when they transition to a new zone.
### 4.4. Model Calibration

Calibration of the framework is needed to realistically reproduce the pedestrian outflow of the crowd exiting during the Festival of Lights. Three types of parameters in the framework are specified for calibration:

* Hybridisation: $t_{delay}, \alpha, \beta$.

* Parameters of SFM: $A, B, V^{pref}, \tau$.

* Parameters of CC: $f_{min}, f_{max}, \rho_{min}, \rho_{max}$.

The Genetic Algorithm (GA) is used to calibrate the framework due to the large and non-linear search space. The objective fitness function is calculated as mean normalised absolute error:

$$ fitness = \frac{1}{N} \sum_{i=1}^{N} \left( \frac{|f_{i}^{obs} - f_{i}^{sim}|}{f_{i}^{obs}} \right)_{\text{Constantine}} + \left( \frac{|f_{i}^{obs} - f_{i}^{sim}|}{f_{i}^{obs}} \right)_{\text{Chenavard}} \quad (8) $$

where $f^{obs}, f^{sim}$ are the observed and simulated pedestrian outflow, respectively. The objective fitness function measures the similarity between the simulated and observed outflow across N observations, with lower fitness values indicating better agreement. The GA is operated through the following steps:

* **Initialisation:** A population of 128 individuals is initialised, with each individual representing a chromosome consisting of 11 genes corresponding to 11 parameters for calibration. Each parameter gene was initialised via random sampling from a defined range of minimum to maximum values specific to that parameter. The value interval of the parameters for each pedestrian-simulation model is chosen based on settings commonly used in the literature [7,15]. Let $\phi_i$ denote the ith parameter gene in each chromosome, where $\phi_i^{min}$ and $\phi_i^{max}$ are the minimum and maximum allowable values of the parameter $\phi_i$, respectively. Table 1 depicts the range of values for the parameters.

<table><caption>Table 1. List of parameters and their ranges.</caption><thead><tr><th>Type</th><th>Parameter $\phi_i$</th><th>$\phi_i^{min}$</th><th>$\phi_i^{max}$</th></tr></thead><tbody><tr><td rowspan="3">Hybrid</td><td>$t_{delay}$</td><td>0.0</td><td>1.0</td></tr><tr><td>$\alpha$</td><td>0.0</td><td>1.0</td></tr><tr><td>$\beta$</td><td>0.0</td><td>1.0</td></tr><tr><td rowspan="4">SFM</td><td>A</td><td>0.5</td><td>5.0</td></tr><tr><td>B</td><td>0.1</td><td>0.5</td></tr><tr><td>$V^{pref}$</td><td>0.8</td><td>1.5</td></tr><tr><td>$\tau$</td><td>0.4</td><td>0.6</td></tr><tr><td rowspan="4">CC</td><td>$f_{min}$</td><td>0.05</td><td>0.25</td></tr><tr><td>$f_{max}$</td><td>0.8</td><td>1.6</td></tr><tr><td>$\rho_{min}$</td><td>0.05</td><td>0.5</td></tr><tr><td>$\rho_{max}$</td><td>6.0</td><td>8.0</td></tr></tbody></table>

* **Fitness evaluation:** The fitness of individuals in the population is evaluated by comparing the simulated outflow data, extracted from simulations of a crowd exiting at the Festival of Lights, with observed outflow using the fitness function in Equation (8). A total of N = 20 observations are selected via systematic sampling. Implementation details of the simulations are described in the next section.

* **Selection:** This process refers to choosing individuals with the best fitness values from the population to serve as parents for generating offspring for the next generation. In this work, 50% of individuals with the lowest fitness values in each generation are selected as parents for crossover and retained for the next generation.

* **Crossover:** Pairs of parent individuals in the best-selected set are combined to reproduce offspring. Uniform crossover is used with each gene of an offspring's chromo-
some having a 0.5 probability of originating from the corresponding gene of either parent, as shown in Figure 8.

<figure><img src="image_10.png" /><figcaption>Figure 8. Crossover.</figcaption></figure>

* **Mutation**: The mutation operator randomly alters chromosomes to prevent converging to a locally optimal solution. A mutation rate of 0.01 is applied to each gene in a chromosome. If a mutation occurs for the parameter gene $\phi_i$:

$$ \phi_i = \phi_i^{min} + \gamma(\phi_i^{max} - \phi_i^{min}), \quad 0 \le \gamma \le 1. \qquad (9) $$

where $\gamma$ is a random value between 0 and 1.

Figure 9 presents the flow of the calibration process executed using the GA. An individual, which represents a set of parameters, is input into the crowd exiting simulation on the GAMA platform [30] to evaluate fitness. The GA stops when the number of generations exceeds 150.

<figure><img src="image_11.png" /><figcaption>Figure 9. Flow of the calibration process.</figcaption></figure>
## 4.5. Simulation Details

The experiment configuration for simulating the crowd exit scenario is as follows:

* The simulation is conducted with a time step $\Delta t = 0.1$ s, with 3883 agents.

* Pedestrians are initialised with a uniform distribution across the high-density zone.

* All simulations are conducted using the GAMA platform [30] on a M1 MacBook Pro with 32 GB of memory.

## 4.6. Calibration Results

Figure 10 shows the average fitness value and best fitness value of the population over 150 generations. It can clearly be seen that the average fitness exhibits an exponential decrease in the first 10 generations. Then, it declines gradually until generation 35, where it stabilises for the remaining duration. Similarly, the best fitness value of the population drops rapidly until generation 30 before reaching a stable state.

<figure><img src="image_12.png" /><figcaption>Figure 10. Average and best fitness values over the generations.</figcaption></figure>

Table 2 presents the optimal parameter values obtained through the calibration process. The calibrated $\alpha$ and $\beta$ values indicate that pedestrians are more likely to choose the closest road to exit. However, $\beta$ is lower than $\alpha$. This can be explained by the fact that there are more pedestrians near Chenavard Road than Constantine Road at the time when the exit choice behaviour is performed.

<table><caption>Table 2. Optimal parameter values obtained via the calibration process.</caption><thead><tr><th>Parameter $\phi_i$</th><th>$t_{delay}$</th><th>$\alpha$</th><th>$\beta$</th><th>$A$</th><th>$B$</th><th>$V^{pref}$</th><th>$\tau$</th><th>$f_{min}$</th><th>$f_{max}$</th><th>$\rho_{min}$</th><th>$\rho_{max}$</th></tr></thead><tbody><tr><td>Best value</td><td>0.9</td><td>0.91</td><td>0.76</td><td>1.83</td><td>0.45</td><td>1.25</td><td>0.57</td><td>0.15</td><td>1.35</td><td>0.11</td><td>6.36</td></tr></tbody></table>

## 4.7. Model Validation

The calibrated parameters are used to reproduce the pedestrian outflow of the crowd exiting at the Festival of Lights. A total of 90 simulations are conducted with the calibrated parameters. The simulated outflow is extracted and the average is computed with a 95% confidence interval. Figure 11 presents a comparison of simulated outflow and observed outflow for the two exit roads. As illustrated, the simulated outflow exhibits close alignment with the observed outflow data.
<figure><img src="image_13.png" /><figcaption>Figure 11. Comparison of observed and simulated outflow for the two exit roads. (a) Constantine Road. (b) Chenavard Road.</figcaption></figure>

4.8. Sensitivity Analysis

It is important to understand how different parameters in the calibrated model can influence the simulation results. A local sensitivity analysis is therefore conducted by individually varying the value of one parameter at a time around its calibrated value while holding all other parameters constant. The values vary from –25% to 25% in increments of 5% as long as they fall within their corresponding permissible ranges, except for *t*<sub>delay</sub> because of its dependence on discrete time step value. For each combination of parameter values, 40 simulations are run to compute the average pedestrian outflow and its 95% confidence interval.

Figure 12 presents the local sensitivity analysis results for each parameter. For all hybridisation parameters, the fitness function generally reaches the optimal value at the calibrated value of each parameter. The parameter $\beta$ demonstrates the strongest sensitivity to the simulation results, with the fitness value increasing sharply as $\beta$ moves away from 0.75. In contrast, although $t_{delay}$ and $\alpha$ display similar trends, their effects on fitness values are less pronounced than those of $\beta$.

On the other hand, for the parameters of the pedestrian-simulation models, the sensitivity results differ between the SFM and CC models. For the parameters of the SFM, the fitness values remain largely unchanged, indicating that the SFM parameter variations do not substantially affect the fitness value and the outflow results. For the parameters of the CC model, only those parameters specifying pedestrian speed, including $f_{min}$ and $f_{max}$, exhibit strong sensitivity to the fitness values, with a rapid increase when these parameters deviate from their calibrated values. In contrast, the parameters $\rho_{min}$ and $\rho_{max}$ have almost no impact on the fitness value.

<figure><img src="image_14.png" /><figcaption>Figure 12. *Cont.*</figcaption></figure>
<figure><img src="image_15.png" /><figcaption>**Figure 12.** Local sensitivity analysis for different parameters. (a) $t_{delay}$, (b) $\alpha$, (c) $\beta$, (d) $A$, (e) $B$, (f) $V^{pref}$, (g) $\tau$, (h) $f_{min}$, (i) $f_{max}$, (j) $\rho_{min}$, (k) $\rho_{max}$.</figcaption></figure>

**5. Performance Analysis**

This section demonstrates the performance of the hybrid model in simulating a large number of pedestrian agents. As such, the hybrid model is compared to three others:

* SFM-only model: the SFM is applied in all three zones.

* 3-CC-1 model: consists of three separate CC models, each with one target cell for simulating one single zone.

* 1-CC-2 model: one CC model for simulating the entire environment, with two designated target cells representing two exit roads. This configuration increases computational complexity compared to using only one target cell.

For each simulation, two indicators are computed, and an average is determined from a total of 15 simulations for each model:

* Density map (in ped/m²) of pedestrian density distribution across the simulation area.

* Computation time (in s) required to calculate one simulation step.

Figure 13 presents the density maps of various models over different time steps ($t = 60$ s, $150$ s, $240$ s). In the SFM-only model, the highest density area, with a maximum density of 3.5 ped/m², is observed in both the plaza and the two exits. Similarly, the 3-CC-1 model and 1-CC-2 model can simulate extremely high densities of 6–8 ped/m², but these extremely high-density areas also appear in both the plaza and the two exits. In contrast, the hybrid model exhibits a clear difference in density levels between the plaza and the two exits. These results indicate that the hybrid model can effectively simulate pedestrians in environments with a mix of low- and high-density situations. Furthermore, a key advantage of this model is its generic nature and flexibility, as it can accommodate
any combination of zones and models, enabling the modelling of various scenarios and crowd dynamics.

<figure><img src="image_16.png" /><figcaption>**Figure 13.** Density maps among different models with 6000 simulated agents.</figcaption></figure>

Next, various numbers of pedestrian agents (3 K to 15 K) are used to evaluate the simulation time of different models. Figure 14a displays the simulation of 6000 agents at Place des Terreaux using the hybrid model, with pedestrians in the high-density zone represented in red and pedestrians in the low-density zones shown in blue. The results, shown in Figure 14b, indicate that the SFM-only and 3-CC-1 models have the longest simulation times, which increase significantly as the number of pedestrians grows, while the 1-CC-2 model has a similar simulation time to them at first but drops as the number of agents increases. In contrast, our model demonstrates superior performance in terms of simulation time, with a large difference from the other models observed as the number of pedestrians grows. This finding indicates that using mesoscopic models for low-density regions is unnecessary, and they can be replaced with microscopic models. These results suggest that having different modelling algorithms at each level not only improves the variety of behaviour observed in various scenarios but also enhances overall performance compared to using only microscopic models or multiple mesoscopic models.

<figure><img src="image_17.png" /><figcaption>**Figure 14.** Simulation results. (a) Simulation of 6000 agents at the Place des Terreaux using the hybrid model with pedestrians in the high-density zone in red and those in the low-density zones in blue. (b) Comparison of performance for different models.</figcaption></figure>
**6. Conclusions and Discussion**

Large-scale crowd phenomena are complex to model as the behaviour of pedestrians needs to be described at strategic, tactical, and operational levels and it is impacted by the density of the crowd. Particularly in the operational level modelling, each model can only simulate a single type of pedestrian dynamic, while pedestrian dynamics vary significantly depending on the density of the environment. This paper proposes an agent-based model for simulating the multi-level behaviour of pedestrians, where agents are able to dynamically change their operational model based on local density. The ability to combine different models of the proposed agent-based model for multi-scale simulation is evaluated through a use case of pedestrians at the Festival of Lights, Lyon, France.

The hybrid model is calibrated using a genetic algorithm that utilises pedestrian outflow data extracted from video recordings of exiting crowds at the festival. Simulation results of the calibrated model show a match between simulated and observed pedestrian outflow over time. Furthermore, a local sensitivity analysis is then conducted to identify the most sensitive parameters in the model. Finally, the performance of the hybrid model is compared to different models in terms of density map and computation time. The comparison results demonstrate that the hybrid model has the capacity to effectively simulate pedestrians across varied density scenarios while optimising computational performance compared to other models.

The proposed framework is useful for simulating a broad range of pedestrian dynamics through its capacity to integrate various pedestrian-simulation models and their coupling. The combination of these models can be used for large-scale and multilayered simulations of crowds across numerous scenarios. Additionally, the framework facilitates comparative analysis of the performance of different pedestrian-simulation models. Moreover, the proposed framework is not only generic in the domain of pedestrian modelling but also extensible to other related domains such as traffic simulation and social simulation.

Our future work aims to incorporate a greater variety of modelling algorithms for each level of behaviour, particularly at the operational level. Then, the selection of an optimal algorithm at each level of behaviour and the criteria for switching these algorithms must be defined based on the density of each region. Another promising direction involves applying density-based clustering algorithms to pedestrian coordinates in order to dynamically estimate the local density of environments.

**Author Contributions:** H.-T.D.: Conceptualisation, Methodology, Software, Formal analysis, Data curation, Visualisation, Writing—Original draft, Writing—Review and editing; B.G.: Conceptualisation, Methodology, Writing—Review and editing, Funding acquisition, Supervision; N.V.: Conceptualisation, Methodology, Writing—Review and editing, Funding acquisition, Supervision. All authors have read and agreed to the published version of the manuscript.

**Funding:** The authors acknowledge the Franco-German research project MADRAS funded in France by the Agence Nationale de la Recherche (ANR, French National Research Agency), grant number ANR-20-CE92-0033, and in Germany by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation), grant number 446168800.

**Institutional Review Board Statement:** Not applicable.

**Informed Consent Statement:** Not applicable.

**Data Availability Statement:** The data that support the findings of this study are available from the corresponding author, Huu-Tu Dang, upon reasonable request.

**Conflicts of Interest:** The authors declare no conflicts of interest.
## Abbreviations

The following abbreviations are used in this manuscript:

SFM Social Force Model

CC Continuum Crowds

GA Genetic Algorithm

## References

1. Duives, D.C.; Daamen, W.; Hoogendoorn, S.P. State-of-the-art crowd motion simulation models. *Transp. Res. Part C Emerg. Technol.* **2013**, *37*, 193–209.

2. Hoogendoorn, S.P.; Bovy, P.H.L. Pedestrian Route-choice and activity scheduling theory and Models. *Transp. Res. Part B Methodol.* **2004**, *38*, 169–190.

3. Haghani, M.; Sarvi, M. Human exit choice in crowded built environments: Investigating underlying behavioural differences between normal egress and emergency evacuations. *Fire Saf. J.* **2016**, *85*, 1–9.

4. Kielar, P.M.; Borrmann, A. Modeling pedestrians’ interest in locations: A concept to improve simulations of pedestrian destination choice. *Simul. Model. Pract. Theory* **2016**, *61*, 47–62.

5. van Toll, W.G.; Cook, A.F.; Geraerts, R. Real-time density-based crowd simulation. *Comput. Animat. Virtual Worlds* **2012**, *23*, 59–69.

6. Jiang, Y.; Chen, B.; Li, X.; Ding, Z. Dynamic navigation field in the Social Force Model for pedestrian evacuation. *Appl. Math. Model.* **2020**, *80*, 815–826.

7. Helbing, D.; Farkas, I.; Vicsek, T. Simulating dynamical features of Escape panic. *Nature* **2000**, *407*, 487490.

8. van den Berg, J.; Guy, S.J.; Lin, M.; Manocha, D. Reciprocal N-body collision avoidance. In *Robotics Research: The 14th International Symposium ISRR*; Springer: Berlin/Heidelberg, Germany, 2011; pp. 3–19.

9. Papadimitriou, E.; Yannis, G.; Golias, J. A critical assessment of pedestrian behaviour models. *Transp. Res. Part F Traffic Psychol. Behav.* **2009**, *12*, 242–255.

10. Pelechano, N.; Allbeck, J.; Badler, N. Controlling Individual Agents in High-Density Crowd Simulation. In *Proceedings of the Eurographics/SIGGRAPH Symposium on Computer Animation, San Diego, CA, USA*, 2–4 August 2007; pp. 99–108.

11. Zhao, M.; Zhong, J.; Cai, W. A role-dependent data-driven approach for high-density crowd behavior modeling. *ACM Trans. Model. Comput. Simul.* **2018**, *28*, 1–25.

12. Korbmacher, R.; Dang, H.-T.; Tordeux, A. Predicting pedestrian trajectories at different densities: A multi-criteria empirical analysis. *Phys. A Stat. Mech. Its Appl.* **2024**, *634*, 129440.

13. Dang, H.-T.; Korbmacher, R.; Tordeux, A.; Gaudou, B.; Verstaevel, N. TTC-SLSTM: Human trajectory prediction using time-to-collision interaction energy. In *Proceedings of the 2023 15th International Conference on Knowledge and Systems Engineering (KSE), Hanoi, Vietnam*, 18–20 October 2023; pp. 1–6.

14. Helbing, D. A Fluid Dynamic Model for the Movement of Pedestrians. *Complex Syst.* **1992**, *6*, 391–415.

15. Treuille, A.; Cooper, S.; Popović, Z. Continuum crowds. *ACM Trans. Graph.* **2006**, *25*, 1160–1168.

16. Martinez-Gil, F.; Lozano, M.; García-Fernández, I.; Fernández, F. Modeling, evaluation, and scale on artificial pedestrians: A literature review. *ACM Comput. Surv.* **2017**, *50*, 1–35.

17. Siyam, N.; Alqaryouti, O.; Abdallah, S. Research issues in agent-based simulation for pedestrians evacuation. *IEEE Access* **2020**, *8*, 134435–134455.

18. Göttlich, S.; Pfirsching, M. A micro-macro hybrid model with application for material and pedestrian flow. *Cogent Math. Stat.* **2018**, *5*, 1476049.

19. Xiong, M.; Cai, W.; Zhou, S.; Low, M.; Tian, F.; Chen, D.; Ong, D.; Hamilton, B. A case study of multi-resolution modeling for crowd simulation. In *Proceedings of the 2009 Spring Simulation Multiconference, San Diego, CA, USA*, 22–27 March 2009; pp. 1–8.

20. Xiong, M.; Tang, S.; Zhao, D. A hybrid model for simulating crowd evacuation. *New Gener. Comput.* **2013**, *31*, 211–235.

21. Xiong, M.; Lees, M.; Cai, W.; Zhou, S.; Low, M.Y. Hybrid modelling of crowd simulation. *Procedia Comput. Sci.* **2010**, *1*, 57–65.

22. Biedermann, D.H.; Clever, J.; Borrmann, A. A generic and density-sensitive method for multi-scale pedestrian dynamics. *Autom. Constr.* **2021**, *122*, 103489.

23. Sparnaaij, M.; Duives, D.C.; Knoop, V.L.; Hoogendoorn, S.P. Multiobjective calibration framework for pedestrian-simulation models: A study on the effect of movement base cases, metrics, and density levels. *J. Adv. Transp.* **2019**, *2019*, 1–18.

24. Zeng, W.; Chen, P.; Yu, G.; Wang, Y. Specification and calibration of a microscopic model for pedestrian dynamic simulation at signalized intersections: A hybrid approach. *Transp. Res. Part C Emerg. Technol.* **2017**, *80*, 37–70.

25. Gödel, M.; Bode, N.; Köster, G.; Bungartz, H.-J. Bayesian inference methods to calibrate crowd dynamics models for safety applications. *Saf. Sci.* **2022**, *147*, 105586.

26. Hoogendoorn, S.P.; Daamen, W.; Landman, R. Microscopic calibration and validation of pedestrian models—Cross-comparison of models using experimental data. In *Pedestrian and Evacuation Dynamics 2005*; Springer: Vienna, Austria, 2005; pp. 253–265.

27. Feng, Y.; Duives, D.; Daamen, W.; Hoogendoorn, S. Data collection methods for studying pedestrian behaviour: A systematic review. *Build. Environ.* **2021**, *187*, 107329.

28. Curtis, S.; Best, A.; Manocha, D. Menge: A modular framework for simulating crowd movement. *Collect. Dyn.* **2016**, *1*, 1–40.
29. Festival of Lights. Available online: https://www.fetedslumieres.lyon.fr (accessed on 30 January 2024).

30. Taillandier, P.; Gaudou, B.; Grignard, A.; Huynh, Q.-N.; Marilleau, N.; Caillou, P.; Philippon, D.; Drogoul, A. Building, composing and experimenting complex spatial models with the Gama Platform. *GeoInformatica 2018*, *23*, 299–322.

**Disclaimer/Publisher's Note:** The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.