## 2 Modeling and Methods
### Pedestrians' Motion Rules  
The pedestrian crossing event is governed by the pedestrian's prudence and speed as well as the available space in the crosswalk. Once a pedestrian enters the waiting zone, she/he decides to remain at such a site or to start crossing by considering a critical gap \(g_{c}\) between the crosswalk and the nearest vehicle. Based on Reference [29], the critical gap for a pedestrian \(i\) is computed in terms of the lane width \(W_{l}\), the desired pedestrian speed \(v_{i}^{p}\), and a safety factor \(\gamma\) that reflects the pedestrians' prudence, as follows:  
\[g_{c}=\frac{W_{l}}{v_{i}^{p}}+\gamma. \tag{1}\]  
By considering the HCM and Reference [8; 29], \(\gamma\) is randomly selected between 0 and 2.5 with probability \(P_{\gamma}=\frac{1}{m^{\prime}}\), for some \(m^{\prime}>0\). If \(g_{c}\) is satisfied, the pedestrians proceed to cross the lane having the priority over vehicles, which means the nearest vehicle must stop until the pedestrians finish the maneuver.  
A pedestrian's motion throughout the crosswalk is conducted according to \(v_{i}^{p}\) and the availability of space within the neighborhood, prioritizing the forward movement. A pedestrian's neighborhood \(N\) is a matrix with up to three columns and \(v_{max}^{p}\) rows, located in front of the current cell. However, since there may be other pedestrians within the neighborhood, each column \(j\) is trimmed according to the position of the nearest neighbor, which determines the available space gap \(g_{j}\) in such a column (see Figure 2).  
Figure 1: Scheme of the lane and the crosswalk; (**a**) crosswalk within the lane, (**b**) crosswalk deployment.  
Each of the remaining cells have an associated probability \(P_{j,k}\in[0,1]\), where \(j\) is the row index. As the first option, the pedestrian selects to remain on the same column (forward movement) as long as \(g_{k}\
eq 0\). Otherwise, if \(g_{k}=0\), the pedestrian must select as the next location, the column containing the cell with the highest probability. In the case that there are no empty cells within the neighborhood, the pedestrian remains at the same location until a space becomes available.  
Once a pedestrian \(i\) has selected her/his next location, her/his movement is described through a cellular automata model defined by three rules:  
1. Acceleration: \[v_{i}^{p}=\begin{cases}\min(v_{rand}^{p},g_{k})&\text{if the pedestrian is in the waiting zone,}\\ g_{k}&\text{otherwise,}\end{cases}\] (2)
2. Deceleration: \[v_{i}^{p}=\min(v_{i}^{p},g_{k}),\] (3)
3. Movement: \[N_{j,k},\text{ such that }j=j+v_{i}^{p},\] (4)  
where \(v_{i}^{p}\) is the current speed of the pedestrian \(i\) at location \(N_{j,k}\). The maximum speed for a pedestrian is denoted as \(v_{max}^{p}\); therefore, \(v_{rand}^{p}\) is a random integer between 0 and \(v_{max}^{p}\). According to References [28; 29; 30], the average speed for a pedestrian is 1.4 m/s, hence \(v_{max}^{p}=\left\lceil\frac{14}{0.6}\right\rceil=3\), denoting with \(\left\lceil\ \right\rceil\) the ceiling function. Varying the pedestrians' speed among 1 and \(v_{max}^{p}\) allows the recreation of different pedestrian capacities, which in the real world are influenced by age group or people's physical conditions.