Driver Behaviour Algorithms for the Cellular Automata-Based Mathematical Model of Traffic Flows

. The work is devoted to the development of new algorithms describing the complex interaction of drivers for the parallel numerical implementation of the traffic flow model developed by the authors based on the cellular automata theory. As is known from observations, the behaviour of drivers largely determines how difficult it will be to pass a section with a bottleneck (a narrowing, a motionless obstacle, etc.) or even without it at the same flow values. In such conditions, cars can move in a synchronized flow at a more or less constant speed or go into “stop-and-go” mode. The authors have developed a set of algorithms for a large number of different road situations, which is featured in this article.


Introduction
Traffic flow modelling is an essential field of research nowadays, as traffic management problems require solving on everyday basis. Now, having highperformance supercomputers at hand, one can use developed traffic models and algorithms to create software for real time routing and infrastructural tasks that require immediate attention, as well as for long term road and city development tasks.
The model considered in this article was developed by the authors a few years ago and since then is being constantly modified and refined, mainly by building realistic algorithms of driver interactions in various situations and on different road elements (see, for example, [1]).
The main focus of this work are new algorithms for the model. The algorithm of driving around a wide obstacle (i.e., road maintenance works on a multilane highway) has been developed. The algorithm for boundary conditions exchange for the correct representation of a traffic jam spread across the network in case of parallel computations has been developed.

Cellular automata (CA) model for traffic flows
Traffic flow modelling allows for various approaches, though all models can be divided into two big groups: macroscopic models and microscopic models. As a rule, macro models are based on the similarity between a vehicle flow and a compressible fluid flow, so traffic is described by hydrodynamic equations and only average characteristics (flow density and velocity) are considered. Micro models on the other hand consider each vehicle separately. Usually the motion equations are written out, but it's not the only way of constructing a microscopic mathematical model of traffic flows. The approach based on cellular automata (CA) realizes this possibility in order to avoid dealing with differential equations and to ensure more flexibility in depicting drivers' interactions.
The cellular automata (CA) approach has a long and successful history of usage in various fields of research, including medical, biological and social sciences. It was introduced into the traffic field by K. Nagel and M. Schreckenberg in 1992 [2] and, since then, is widely used for modelling vehicular traffic all over the world [3][4][5][6][7][8][9].
The basics of the CA traffic flow model are as follows: the computational domain (the road, see Fig. 1) is divided into equal cells, each cell is 7.5 m long and one lane wide (the amount of space a single car takes up in the maximum density case -i.e., when being in a traffic jam). The distance in the model is measured in cells, a vehicle speed -in the number of cells per time step, time is measured in steps, time step is equal to 1 second.  Here V is the speed of a vehicle, V max is maximal speed of a vehicle, d is the distance to the next car in the lane, and p is the probability of additional speed decrease by a driver.
Basically, most complicated algorithms in the model are connected to driver behaviour. The decision making regarding a lane change depends on various factors. For each of the following situations the sequence of operations before reaching the decision will be different: • closer/farther the car is from the intersection; • narrowing/widening of a road; • driver's goal (a turn, a certain exit, etc); • presence of obstacles in a given and/or an adjacent lane; • presence of a congestion in a given/adjacent lane; • presence/absence of road markings prohibiting lane change; • on-ramp or an entrance from a secondary road to a main road; • crossing a non-signalized/signalized intersection; • U-turn; etc.
The authors have developed a set of algorithms for a large number of different road situations (see [10]).

Numerical realization
The model is realized as a program package written using C/C++, Glut library for visualizing the computation along with it and MPI library for boundary data exchange during parallel calculations on highperformance supercomputer systems. The program has a module structure, each module answers for modeling traffic on a certain road element (an intersection, a strait road fragment, a U-turn, etc.). From these elements a road network is constructed. Each element is computed on a separate CPU.

The algorithm for changing lanes for driving around a wide obstacle
One of the new algorithms developed for the CA model is the algorithm of drivers' decision making regarding changing lanes in presence of a wide obstacle that blocks several lanes on a multilane highway. This situation occurs fairly often when part of the road is closed for repairs. Lanes can also be blocked by slow-moving heavy duty vehicles that clean the road. The main difference between this case and the one where drivers need to move around small obstacles (car/cars that stopped due to an accident or breakage) is that the width and the position of the obstacle should be taken into consideration while choosing from which side to by-pass an obstacle to -the left one or the right one.
The algorithm of this decision making is shown in Fig. 3.
The Boolean type variable that determines if the lane change happens for the certain car at the current time step is at first set to true value if the step number is even (for moving to the right) or odd (for moving to the left).  The algorithm is realized as a module for the program package developed by the authors. The output is shown in Fig. 4.   Fig. 4. Modelling driving around a wide obstacle. Figure 4 represents the 9-lane highway road. The movement direction is shown with the arrow (right to left). The traffic here is right-hand side. A cluster of 4x4 black squares represents a wide obstacle. The cars are depicted by squares of different shades of gray. Darker cars enter this road fragment by first 5 lanes (slower ones), lighter cars use faster lanes -from 6 to 9.
Here we can see that darker cars choose to move to the right while lighter ones change lanes to the left, this way ensuring that obstacle by-passing takes less steps, which is the goal of the algorithm and reproduces real life driver behaviour.

The boundary conditions exchange algorithm for parallel computations
As computations for each road element are carried out on different processors and drivers don't "know" anything about traffic conditions on the next element, some probing needs to take place before a car might exit the current road element in order to see if there's the possibility to enter the next one. For that, flag variables are set to indicate the situation, and they are exchanged before actual boundary condition exchange takes place.
Block-scheme for the algorithm of car exiting a road element is shown in Fig. 5.  When a vehicle is reaching the end of the road on an element, we check if it's going to leave it at the current time step. If the number of cell i exceeds the size of the road after adding the current speed value, the car is about to exit. If it's a free exit with an open boundary, the vehicle just leaves the computational domain. If the road element has a neighbouring one, the data about the exiting car (its current speed, ID number, desired destination, maximal speed, the ability of the driver to become cooperative) is packed for sending and the flag variable that indicates that the there's data for receiving is set to 1 (flag=1).
When cars are added to the system, it happens differently whether it is a free boundary entrance or not (see Fig. 6). If it is free, we check if the first cell is empty. If it is, a car can be added, if not -it is added to the queue to be put on the road as soon as the first cell is empty. If a road element is connected to its neighbour, we check if there's data packed for transmission on the processor that is accountable for modelling a neighbouring road fragment. If said data exists, we check if there is a possibility of adding a car according to the position of its target cell. If adding is possible, we do so, setting the return flag variable to 0 (rflag=0) indicating that the car was added and thus can be removed from the previous element. If adding a car was not successful, the return flag is set to 1 and the car stays on the previous road element with its speed set to zero. In order to avoid high deceleration values, the situation is constantly checked for congestions at boundaries to slow down cars that approach the entrances to congested road elements.
To test the algorithm, the computations on different road networks were carried out. The results show it works correctly.

Conclusions
New algorithms for the CA model developed by authors earlier were presented in the article. The algorithms were realized as a part of the program package developed by authors and test problems were solved to confirm their adequate representation of real life traffic.
The developed program package for high performance computing systems can be used for traffic modelling on city road networks, taking into consideration different driving strategies and evaluating the efficiency of measures taken in order to decrease traffic jams. It can be used as a basis for Intelligent Transport System of a metropolis.