# Optimization of Cellular Automata Model for Moving Bottlenecks in Urban Roads
## 2 A Cellular Automaton Model for Urban Roads Considering Vehicle Heterogeneity
### Vehicle Update Rules for Road Segments
#### 2.2.2 Car-Following Rule  
Based on the previously mentioned safe distance model, during the transition from time \(t\) to \(t+1\), an improved car-following rule is established by evaluating the relationship between the vehicle spacing \(L_{n}(t)\) and the three types of safe distances. The cellular automaton model based on safe distances evolves according to the following rules.  
Acceleration:  
At time t, if the distance between a vehicle and the preceding vehicle is not less than the critical safe distance for acceleration and the vehicle's speed is less than the maximum speed, the vehicle accelerates; if the distance is less than the critical safe distance for acceleration but not less than the critical safe distance for maintaining speed, the vehicle maintains its current speed.  
\[v_{n}(t+1)=\left\{\begin{array}{l}min(v_{n}(t)+a_{n},vmax),L_{n}(t)\geq L_{sa} (t)\\ v_{n}(t),L_{sk}(t)\leq L_{n}(t)<L_{sa}(t)\end{array}\right. \tag{13}\]  
2. Deceleration:  
(1) At time \(t\), when a vehicle is relatively far away from the intersection (with \(S_{n}\) not less than 5 cells) and the distance to the preceding vehicle is less than the critical safe distance for decelerating, the vehicle decelerates; when the distance is less than the critical safe distance for decelerating, the vehicle applies emergency braking.  
\[v_{n}(t+1)=\left\{\begin{array}{l}max(v_{n}(t)-a_{n},0),L_{sd}(t)\leq L_{n} (t)<L_{sk}(t)\\ max(v_{n}(t)-a_{nm},0),L_{n}(t)<L_{sd}(t)\end{array}\right. \tag{14}\]  
(2) At time \(t\), when a vehicle is relatively close to the intersection (with \(S_{n}\) less than 5 cells) and the distance to the preceding vehicle is not less than the critical safe distance for decelerating, the vehicle decelerates; when the distance is less than the critical safe distance for decelerating, the vehicle applies emergency braking.  
Scenario I: When the intersection traffic light is green.  
In Scenario I, \(v_{n}\to min(v_{n},L_{n},S_{n}+1)\) indicates that the vehicle needs to decelerate as it passes through the intersection. The maximum speed within the intersection is 1 cell/s, meaning that when the vehicle enters the intersection from the roadway, it can only advance to the first cell within the intersection in its first step.  
Scenario II: When the intersection traffic light is red.  
1. Straight-moving and left-turning vehicles: \(v_{n}\to min(v_{n},L_{n},S_{n})\), indicating that straight-moving and left-turning vehicles are stopped due to the red light.  
2. Right-turning vehicles: \(v_{n}\to min(v_{n},L_{n},S_{n})\) when they are controlled by signals; \(v_{n}\to min(v_{n},L_{n},S_{n}+1)\) when they are not controlled by signals.  
3. Random Slowdown:  
If a vehicle that decelerated in the previous step undergoes random slowdown in this step, its speed will decrease by \(2a_{n}\) within one time step, which exceeds the vehicle's deceleration capability. Therefore, random slowdown is only applied to vehicles that did not experience deceleration in the previous step.  
\[v_{n}(t+1)=max(v_{n}(t)-a_{n},0)\left\{\begin{array}{l}rand<R\\ L_{n}(t)\geq L_{sa}(t)\end{array}\right. \tag{15}\]  
where \(rand\) is the randomization number for slowdown, and \(R\) is the probability of a random slowdown.  
4. Location Update.  
\[x_{n}(t+1)=x_{n}(t)+v_{n}(t+1) \tag{16}\]