Traffic Simulator Description

Austin Parker

1  Program Description

This program is designed to simulate traffic patterns on the roadway. It was written in about a week, and so is probably not very good as far as these things go, but, I figured I'd put in on the web and see if anyone wanted to see it. Questions and comments can be sent to austinjp+traffic@lick.myleft.net. I've used the program to measure the difference between two styles of driving: move-right driving and random driving. Move right driving is the sort esspoused by the New Jersey turnpike (esspecially in that two-lane section near Delaware). The idea is that one is to be in the left lane only if one is passing another car. One is to move right whenever it is possible to move right, and is to move left only if it is impossible to continue going the same speed and the right lane is blocked. This can be compared to what I call random driving, which is a driving style that does not favor any particular lane. Random drivers are equally likely to move left or right when they change lanes. The model says that the move-right driving style is better because it allows for a higher average speed (5-10 mph faster) at most levels of conjestion. There are conjestion levels, however, where a random driving startegy leads to a faster average speed.
First I will describe the math behind the model, then I will give some data and some analysis leading to the above conclusions. Take all conclusions with a grain of salt, esspecailly if you don't read the math, as the model is still very primative.

2  Mathematical Basis

Here is the math behind the program. The math is meant to represent a sort of statistical account of how a roadway might work. It keeps track of the density of each lane on the road, as well as the percentage of people going each particular speed. In the program, we assume that there are only 5 speeds - this enables us to store the speed information in a variable (as opposed to haveing to keep track of the uncountable number of speeds that cars actually go). We keep track of the percentage of cars in each lane traveling each speed. For instance, if in lane one half of the cars are traveling speed 0, we would store a .5 for that lane and that speed. We also assume that there is a `desired' distribution of speeds. When there are no impediments to traveling the speed one desires to travel, the distribution of speeds will look like a given, natural distribution (in our case rhobase). So we will have to model conflicting forces on the system. The cars have a tendancy to either slow down or change lanes when faced with a slower driver ahead, and the cars have a tendancy to speed up when the current speed distribution does not look like the natural distirbution.
t
the time step (member of R)
l
the given lane
x
a speed
rho(l,x)
the percentage of cars in lane l gonig speed x
rhobase(x)
the percentage of cars which would ideally be going speed x, that is, the natural distribution.
density(l)
the number of cars in lane l divided by the numberof cars lane l can hold.
decision point
a situation where a car mustdo something otherthan continue at the same speed in the same lane.
D(l,x)
the probability that a car in lane l going speedx is at a decision point.
= sumi < x(rho(l,i)) * alpha(l)
alpha(l)
lanes appear more crowded than they actually are.This represents the percentage full lane l appears to be.(NOTE: in the implementation, getalpha(l) returnsa constant which one can multiply by density(l)to get alpha(l) as given here)
S(l,x)
the probability that a car in lane l going speedx will slow down. (we¢re assuming for now thatcars only slow down when they reach a decisionpoint and cannot change lanes).
= D(l,x) * alpha(l-1) * alpha(l+1)
pR(l), pL(l)
The probability that a car can more right (left)one lane - that there is enough room for thecar to get in.
= 1-alpha(l-1) (for pR)
= 1-alpha(l+1) (for pL)
R(l,x), L(l,x)
The probability that a car going speed x in lanel will move right (left) one lane.This is implemented as follows:The percentage that we¢ll move right (left) whenwe have to make a decision times the probabilitythat we¢ll make a decision plus the percentagethat we¢ll more right (left) when we don¢t haveto make a decision about it.
= D(l,x)*(pR(l)*pR(l)*frac_R + pR(l)*(1-pL(l))) + (1-D(l,x))*pR(l)*frac_nd_R
= D(l,x)*(pR(l)*pR(l)*(1-frac_R) + pL(l)*(1-pR(l))) + (1-D(l,x))*pL(l)*frac_nd_L
frac_nd_L,frac_nd_R,frac_R
all parameters of the system affecting how R(l,x) andL(l,x) work.
Rh(l), Lh(l)
The probability that any car going speed x in lanel will move right (left) one lane.Simply a sum of R(l,x)*rho(l,x) over x.
W(l,x)
The percentage of cars in lane l going speed x whichwant to be going faster (according to rhobase).Note that the percentage given is a percentages ofthe total number of cars in the given lane.
= min(rho(l,x)-rhobase(x),sumi > x(rhobase(i)-rho(l,i)))
(1)

Note that all of these functions which return percentages or probabilities will never return anything greater than 1 or less than 0 even if the equation says different.

We can now talk about getting rhot+1 from rhot and densityt+1 from densityt.

It happens in the following way: Starting at a given t:
speedup(l,x)
the percentage of cars going speed x in lane lwhich want to speed up = (1-D(l,x))*W(l,x)
slowdown(l,x)
the percentage of cars going speed x in lane lwhich will have to slow down = rho(l,x)*S(l,x)
rhot+1(l,x)
= rhot(l,x) - speedup(l,x) - slowdown(l,x)+ speedup(l,x-1) + slowdown(l,x+1)
chanceL(l)
the percentage chance a car will move left fromlane l
= density(l)*Lh(l)
chanceR(l)
...
= density(l)*Rh(l)
densityt+1(l)
= densityt(l) - chanceL(l) - chanceR(l)+ chanceL(l-1) + chanceR(l+1)
(2)

The parameters to the system are as follows: rhobase rho0 density0 frac_nd_R frac_nd_L frac_R

Basically, frac_nd_R, frac_nd_L, and frac_R define a driving style. given a particular rhobase, rho0, and density0, we can now work on finding a driving style which maximizes the average speed (or the mean speed or whatever parameter one would like to maximize).




File translated from TEX by TTH, version 2.92.
On 10 Jan 2004, 13:44.