{'fraction_non_alphanumeric': 0.025358678615922517, 'fraction_numerical': 0.006992725957481011, 'mean_word_length': 4.356005165733965, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 2, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Influence of driver behavior in the emergence of traffic gridlocks

We present a microscopic driving algorithm that prescribes the acceleration using three parameters: the distance to the leading vehicle, to the next traffic light and to the nearest stopping point when the next traffic light is in the red phase. We apply this algorithm to construct decision trees that enable two driving behaviors: aggressive and careful. The focus of this study is to analyze the amount of aggressive drivers that are needed in order to generate a traffic gridlock in a portion of a city with signalized intersections. At rush hour, aggressive drivers will enter the intersection regardless if they have enough time or space to clear it. When their traffic light changes they block other drivers, thus providing the conditions for a gridlock to develop. We find that gridlocks emerge even with very few aggressive drivers present. These results support the idea of promoting good driving behavior to avoid heavy congestion during rush hours.


Introduction
Traffic congestion is a problem in all mayor cities of the world. It has been studied using theoretical and empirical approaches with a variety of methods that include statistical physics, numerical analysis, fluid dynamics and cellular automata, to mention a few. A comprehensive review has been done in Refs. 1, 2.
One of the most widely used methods to study traffic dynamics is cellular automata, from the pioneering work of Nagel and Schreckenberg 3 to many subsequent improvements and extensions, see Refs. 4, 5, 6, 7 and references therein. Cellular automata have the advantage that traffic rules are stated in fairly simple formulae whose computer implementation can run very fast. Other approach to traffic simulations are microscopic models, where the acceleration is given at a particular time as a function of parameters such as distances and velocities of the neighboring vehicles. Some examples are the follow-the-leader models, 8 the Newell model 9 and the intelligent driver model. 10 Microscopic formulations have the advantage of giving a fine-grained time evolution which is a more realistic description of the motion. 11 In this study we will use a microscopic model to analyze the dynamics of an urban traffic scenario with signalized intersections, in which streets follow a Cartesian lay out and are single lanes with alternating senses of motion. The focus of our analysis is the influence of driver behavior in the emergence of gridlocks. To this end we devised a driving algorithm that specifies the acceleration based on three parameters which are the following distances: to the leading vehicle, to the next traffic light and to the nearest stopping point when the next traffic light is in the red phase. The advantage and motivation of this approach is that it enables the formulation of two driving behaviors which we call 11 aggressive and careful . The aggressive driver follows the leading vehicle at a safe distance but will never care about blocking the intersection. This is a problem at rush hour congestion, specially when his traffic light turns red and he has not cleared the intersection. When this happens the aggressive driver not only is standing still but also does not allow cars in the perpendicular lane to advance, hence providing the conditions for a gridlock to develop. On the other hand, the careful driver will never block the intersection, she will wait until having enough distance headway so that she can effectively clear the intersection without ever blocking it.
We set up runs with different amounts of aggressive and careful drivers and check whether a gridlock develops. Since traffic is the result of many factors and interactions, we also take into account the effects of taking a turn and the traffic light scheme. Our main conclusion is that gridlocks emerge even when very few aggressive drivers are present, while there is none when all drivers are careful.
This papers is organized as follows: section 2 describes our proposed driving scheme, the integration of the equations of motion, the computation of the acceleration and the decision trees that enable the aggressive and careful behaviors. Section 3 presents the results for a freeway test case and the conditions that give rise to gridlocks in city traffic. We conclude in section 4.

Driving algorithm
In order to account for the two different driving behaviors that we want to study, we devised a scheme to prescribe the acceleration of every vehicle based upon the three distances depicted in Fig. 1. In freeway traffic the main parameter that determines the acceleration is the distance d(t i ) to the leading vehicle. 2 In the model we propose here we add two more parameters, one is the distance d TL (t i ) to the next traffic light and the other is the distance d STP (t i ) to the stopping point when the traffic light is in the red phase.
Once the acceleration is known, the position and velocity of every vehicle is integrated using the Euler method, such that traffic Influence of driver behavior in the emergence of traffic gridlocks 3 where x(t i ), v(t i ) and a(t i ) are the position, velocity and acceleration for a given vehicle at the i-th iteration. Similarly, the elapsed time is t i and δt is the time step.
Since the acceleration values do not vary largely during the simulation, this method is good enough to integrate the equations of motion.

Acceleration modes
For each vehicle, the acceleration a(t i ) is set by one of three acceleration modes, which we call GO, CAR IN FRONT and STOP. These modes are a way to mimic how the driver controls the vehicle in an urban traffic scenario. The motivation behind the acceleration modes is the flexibility they provide in order to construct a modular decision tree that implements the driving behaviors we are interested in, namely the careful and the aggressive. The acceleration in each mode is set as follows: • GO: The vehicle moves with constant acceleration a go until it reaches a maximum speed v max . It is given as • CAR IN FRONT: The vehicle moves at a speed such that it keeps a safe distance to the leading vehicle. 8 The safe distance is the necessary space such that the time elapsed from bumper to bumper as measured at a fixed location is δt s . The acceleration is where d(t i ) is the distance to the leading vehicle (bumper to bumper) at a time t i (see Fig. 1) and d s (t i ) = v(t i ) δt s is the safe separation between the cars such that at the current speed v(t i ) the vehicle would take a time δt s to traverse. In this mode, the cars keep the same time separation, which will be a larger (shorter) length when going at a faster (slower) speed. In practice, when taking one iteration step for the velocity, Eq. (2) reduces to v(t i+1 ) = d(t i )/δt s . In other words, the speed is set to the value that is needed to keep a time δt s to the leading vehicle. • STOP: A car will stop when the traffic light is red. The acceleration in this case will be where d STP (t i ) is the distance to the point where the car has to be at rest (see Fig. 1). By taking this approach, the car breaks smoothly, reaching zero speed as d STP (t i ) approaches zero. In this mode we set v(t i ) = 0 whenever d STP (t i ) < d min or d(t i ) < d min . The first condition ensures that a car stops before entering an intersection and the second one avoids collisions. The fixed quantity d min is the minimum separation distance between cars.
We will show in Sec. 3 that the acceleration modes reproduce the fundamental diagram for freeway traffic shown in Refs. 2, 12, 13.

Guided by car or traffic light
The decision as to which acceleration mode is used at a given time is determined by the values of the distances mentioned above, i.e. d(t i ), d TL (t i ) and d STP (t i ). We assume that the process of deciding which acceleration mode will be used starts by determining what is closer: either the leading vehicle or the traffic light at the nearest intersection. If the leading vehicle is closer, the driver will just follow it at a safe distance, regardless of the traffic light. On the contrary, if the traffic light is closer, then the driver will disregard the leading vehicle and will maneuver according to the color of the signal. In the first case we say that the driver is car-guided, and in the second case he is TL-guided (Traffic Light). This decision is made at the beginning of each iteration by comparing the distances d(t i ) and d TL (t i ) (see Fig. 1 Once this step is done the next ones will depend on the color of the traffic light. We consider red, yellow and green phases with duration T r , T y and T g , respectively.
We use the traffic light color as the starting point of the decision trees that will implement the two types of driving behavior, i.e. careful and aggressive.
traffic Influence of driver behavior in the emergence of traffic gridlocks 5

Two types of driving behavior
We focus our attention on the traffic flux and speed attained when individual drivers behave in one of two ways, which we call the aggressive and the careful types, following Ref. 11. The distinction between them occurs when the driver has to make a decision at the same time that he is approaching the intersection of two perpendicular streets. We assume that the traffic flow at the intersection is controlled by a traffic light and that all streets have a single lane with a fixed sense of motion. When the vehicle density is high, there is a chance that some drivers will block the intersection, either moving slowly or standing still completely. If the potentially blocking driver, has enough green light time to clear the intersection, then he just goes through it at a low speed. The problem arises when the traffic light changes from green to yellow and red while the car is still traversing the intersection. At this point the vehicles waiting on the perpendicular lane have now the green light, but they will not be able to move because the intersection is blocked, thus increasing congestion.
We define the careful driving behavior or careful type as that in which the driver will never block the intersection. The careful driver achieves this by waiting to have enough distance headway to the leading vehicle so that she can effectively clear the intersection. The aggressive type is the opposite. This driver will follow the leading vehicle at a safe distance but he will not have any consideration about obstructing an intersection whatsoever.
From now on, for clarity, we will drop the time dependence from the distances considered.

The aggressive type
The decision trees for this driving conduct are shown in Fig. 2. In the car-guided tree the acceleration mode is basically CAR IN FRONT. The STOP mode is reached when three conditions are met: the light is red, the leading vehicle has entered the intersection (d > d STP ) and the driver has not entered it yet (d STP ≤ B w ). Here, the aggressive conduct is manifest when the condition d STP ≤ B w is false, which means that the driver is already going through the intersection and he will continue to move. The TL-guided tree is straightforward. The aggressive behavior is expressed when the light changes to red while the driver is already on the intersection (d STP ≤ B w ). The yellow light plays a role in this tree through the variable Y count , which is the remaining time before the signal turns to red. The condition d TL /v < Y count tries to mimic the judging criterion that the driver uses to evaluate whether he has time to clear the intersection in the time that remains of yellow light.

The careful type
The decision trees for this behavior are illustrated in Fig. 3  the traffic light phase. The carefulness shows here in the fact that there is a single condition to go into STOP mode, which is that the driver has not entered the intersection. This ensures that in the careful behavior the driver will always stop before going through the intersection. In the TL-guided panel, the driver executes more evaluations before crossing an intersection. If the signal is green she goes to GO mode only if she has enough space to accommodate herself after clearing the intersection completely (d > d TL + ℓ + d min ), where ℓ is the length of the car. We consider that a car blocks the intersection if any fraction of its length is over it. Red light means unconditional stop. In yellow phase the driver still evaluates whether she has enough time and space to safely clear the intersection altogether.

Results and discussion
We implemented the above schemes using the C++ programming language. The setup consists of a grid-like city where all streets meet at perpendicular intersections in a Cartesian fashion. The extent of the city is 10 blocks in both x and y directions. Each street contains only a single lane, the sense of which alternates according to (−1) ix and (−1) jŷ for the x and y directions, respectively. The variables i and j are numbering integers in the interval [0,9]. All streets have periodic boundaries, which gives the city a 2-torus topology.

Single lane with green lights
In order to test our driving algorithm, we present first some results for a simplified setting. Using the city layout, let's consider the situation in which cars travel along a unique street only, and all traffic lights are set to green during the whole simulation. This setting mimics the conditions of a continuous road of length L with periodic boundary conditions. We set L = 20(B w + S w ) (see Fig. 1), corresponding to a total length L = 2 km, according to the values listed in Table 1.
We randomly distribute a number of vehicles N with zero initial velocity along the street. This defines the density ρ = N/L. The cars start moving according to the rules outlined in Sec. 2. We follow their motion for a three-hour simulated period, during which we compute the instantaneous average speedv(t k ) over all vehicles at intervals of 1 s according tov where v j (t k ) is the speed of the j-th vehicle at a time t k . Now we take the last 300 s of the simulation and compute the time averaged speed V = kv (t k )/300. These time averages have a standard deviation that is less than 4% the value of V . Knowing ρ and V the traffic flow is given as Q = ρV . By taking the last 300 s of a three-hour simulation we make sure that the transient part of the dynamics is over and we are left with the steady state. The results are shown in Fig. 4. We plot the traffic flow Q (panel A) and the average velocity V (panel B) versus the vehicle density ρ. We consider the two extreme cases: one where all drivers are aggressive and the other where all drivers are careful. Our results for the aggressive type are in agreement with the fundamental diagrams in Refs. 6, 1, 10, 2, 14, 15. The traffic flow Q exhibits a linear growth at low densities, reaching a maximum when the safe separation is d s = v max δt s . This corresponds to a critical density ρ cr = 1/(ℓ + d s ) ≈ 11 vehicles/km. From this point the flow decreases linearly until the density is ρ max = 1/(ℓ + d min ) ≈  143 vehicles/km. When density reaches ρ max all vehicles are at their minimum separation d min , thus they cannot be any closer and Q goes to zero.
In the case where all drivers are careful (0% aggressive), the traffic flow exhibits a different behavior. It starts increasing linearly at low densities, as in the previous case, but it drops to a constant value over a wide range of densities. This is due to the fact that careful drivers try to stop at every intersection if they don't have enough space to position themselves without blocking the intersection after crossing it. This behavior is desired at higher densities, thus it is not optimal for lower ones. Since we are interested in urban traffic and congestion at high densities we do not perform further optimization for the careful type at lower densities.
The fact that the aggressive type behavior reproduces the fundamental diagram for freeway traffic validates our ad-hoc driving algorithm formulation, which is qualitatively similar to those presented in Refs. 16,10. Other feature we found in our simulations is the existence of stop-and-go waves, which are a well-known property of freeway traffic. 17

City with turning vehicles and traffic lights
We consider a square city of size 10 × 10 blocks, each block being a B w + S w square per side. The total road length is L = 200(B w + S w ), which amounts to 20 km. The density ρ and average velocity V are defined in the same way as in section 3.1.
Initially a number of vehicles N are randomly distributed on all streets. All initial velocities are zero. We consider three driving behavior configurations for the N drivers: all aggressive, half aggressive-half careful and all careful. We will name these configurations by the percentage of aggressive drivers they have, i.e. 100-, 50and 0%-aggressive, respectively. For each configuration we consider that there is a probability that a driver will take a turn at the next intersection. Ideally, the amount of turns a driver will take depends solely on the departure and destination points within the city. In reality it is influenced by other factors such as traffic incidents along the way, a preferred route or the driver's empirical knowledge of the state of the city traffic. To cover a wide range of turning probabilities we set up a series of runs, each with a fixed probability to take a turn. For instance, a run with 0% turning probability means that all drivers will just go straight ahead, the amount of cars in each lane will remain constant throughout the simulated time.
The probabilities considered here are 0, 10, 25, 50 and 75%. For the type of city we are analyzing, i.e. streets consisting of a single lane with alternating and unique senses, a trip from one location to another can be accomplished by taking turns in 10 to 25% of the traversed intersections. Traffic lights are set up in two different ways: synchronized (sync-) and random (rand-) modes. In sync-mode all traffic lights change at the same time. Initially, the lights are in green phase for both senses along the x-direction, consequently they are in red phase for both senses along the y-direction. The duration of the three phases is the same for all traffic lights (see Table 1). In rand-mode each traffic light is out of phase by a random fraction of the cycle. The extent of the cycle is still the same for all traffic lights but now the shifting sequence has been randomly ordered. Figure 5 shows traffic flow and average velocity for urban traffic using the three driving behavior configurations, the five turning probabilities and traffic lights in sync-mode. Figure 6 shows similar results but setting traffic lights to rand-mode. The effect of turning is evident for sync-mode traffic lights. In rand-mode, turning probabilities make no significant differences for both the flow and the average velocity. Our results are similar to those reported in Ref. 14 for urban traffic with signalized intersections. The cases with 100% aggressive drivers give higher fluxes at lower densities and traffic lights in sync-mode. This is no surprise, since sync-mode enables half of the city grid to momentarily behave as free roads during the green phase. However, the high flux is cut down abruptly to zero when a critical density is reached. This sharp change from a finite value to zero flow signals a total gridlock, meaning that all vehicles are standing still without moving. This constitutes a first order phase transition. 1,6,18 The cause of this lies in the distinctive feature of the aggressive type: the driver can block the intersection box. At low densities such behavior is of little or no consequence. But as soon as the streets become crowded and the drivers that are waiting to clear the intersection are actually blocking the street perpendicular to their motion, the traffic collapses and nobody can move.

Gridlock
Gridlocks emerge in sync-and rand-modes and for all turning probabilities whenever we have 100% and 50% aggressive drivers, as can be seen in panels A, B, D and E in Figs. 5 and 6. The only cases in which gridlock is avoided is with 0% aggressive drivers. The main feature of the careful driver is that she will never block the intersection. She will wait until there is enough space ahead to actually traverse and clear the intersection. In cases of high vehicle densities, this behavior keeps the traffic flowing, as can be seen in panels C and F in Figs. 5 and 6.
There is always traffic flow in the 0% aggressive configuration. It goes to zero  only at high densities, when vehicles approach their allowed minimum separation. We do not find any traffic jam when all drivers are careful. This poses the question: how many aggressive drivers are needed in order to produce a gridlock? We explored this situation performing runs with 1, 3, 6, 12 and 25% aggressive drivers, the traffic flow for these cases (25% not shown) are presented in Fig. 7. We can see that traffic jams arise with as little as 1-3% aggressive drivers. In the 1% case, gridlocks are more frequent with increasing turning probability. In the 3% case, only the 10% probability turning curve is free from gridlocks until ρ ≈ 60 vehicles/km, for higher turning probabilities gridlocks are present. The effect of a higher turning probability is translated into a decrease in flow for the sync-mode traffic lights setting (Fig. 5). In rand-mode it has no noticeable effect on the flow (panels A and D in Fig. 6). It makes the gridlock onset appear at lower densities 1 (panels B and E) and correlates with a smaller flow for 0% aggressive drivers (panels C and F). This can be understood noticing that an aggressive driver that takes a turn into a congested lane, can end up blocking the intersection, instead of just going ahead had it not turned.
We chose to simulate a three-hour period of congested traffic, which is enough to collapse the flow even with a small number of aggressive drivers. The time it takes for a gridlock to appear depends on the vehicle density. The higher the density the sooner it emerges. We can say that a traffic jam could be avoided if higher densities dissolve quickly, instead of lasting for as long as three hours. Consequently, the system would have a higher tolerance to aggressive drivers, requiring larger amounts of them for a gridlock to happen. We therefore take the three-hour period as a worst case scenario.

Conclusion
We have formulated a microscopic traffic model that simulates the decision making process for two kinds of driving behaviors. The formulation is based on the values of three parameters at a given instant of time. These parameters are the following distances: to the leading vehicle, to the next traffic light and to the nearest stopping point when the next traffic light is in the red phase. More complex decision trees can be formulated making use of additional parameters. This would account for a more realistic driving behavior. For instance, the driver could base her decision of going through the intersection not only on the location of her leading vehicle but also on the location of the next one ahead.
We have shown the importance of individual driving behavior in the collective properties of traffic flow, specifically in the phase transition from congested flow to a traffic jam or gridlock. In practice it is impossible to have the ideal situation of attaining zero aggressive drivers; however, the less they are, the better the chances to keep traffic flowing at rush hours.
Gridlocks arise even when very few aggressive drivers are present. Around 3% is enough to collapse the traffic flow. This is a very important lesson in promoting good driving behavior, since very few aggressive drivers can create chaos, it is even more important that everybody do their best not to be one of them.
Rand-mode traffic lights give more similar fluxes and speeds regardless of turning frequency. This is because rand-mode does not enable a preferred direction of motion as sync-mode does by shifting all traffic lights at the same time. Randomization makes the flow insensitive to turning frequency, making gridlocks appear at a more defined value of density. We consider that rand-mode is the scheme that best represents the traffic light conditions in the portion of Guatemala City called Centro Histórico.
Several aspects of city traffic have been studied with cellular automata. 15,[19][20][21][22] Our results support their findings in the sense that drivers who do not follow good conduct rules tend to worsen the traffic. Here we offer a different approach to account for driver behavior.
Future work includes the effects of the extent of the traffic light cycle and the use of different cycle lengths for different intersections.