exupero's blog
RSSApps

Choosing a speed to minimize passing

In the previous post I showed how drivers who may be less patient with traffic end up encountering more traffic by speeding, while a slower driver can go relatively further without having to slow down behind another car. If you wanted to minimize how often you got stuck behind a slower car, simply drive slower than everyone else. But such a "rolling roadblock" car can be just as much of a hazard as a speeding car, which is why highways have minimum speed limits and unusually slow vehicles use four-way flashers to alert other drivers. The safest speed to drive seems to be the one that minimizes not only how often you pass another car but how often another car has to pass you.

Here's a bunch of traffic with random speeds and starting points:

distancedistancetimetime

I'd guess that a driver minimizes passing by driving the average speed of the traffic around them. Checking that guess with the traffic above, the average speed is shown as a dashed line, while the whole-numbered speeds that produce the fewest intersections are solid:

distancedistancetimetime

Driving the average speed looks like a pretty good way to minimize passing.

In practice, however, it's tough to know the average speed of all the traffic you'll encounter, and while you could approximate the overall average by averaging the speeds of cars around you, it's also difficult to know the speeds of other cars with much precision.

Thus, let's see how close we can get to the average just by speeding up whenever we're passed and slowing down whenever we pass someone:

distancedistancetimetime

Starting out faster or slower than the average and adjusting speed with each car passed or that passes you does eventually get you pretty close to the global average. In this model, both initial speeds end up about three miles per hour from the average.

While the algorithm might work out in simulation, adjusting speed with every vehicle encountered seems like tedious way to drive. Safer than constantly trying to optimize speed is probably just picking a predictable speed and sticking to it.