Timing a stoplight just right

This Riddler is about how to perfectly time a stoplight, something we’ve all had to deal with!

You are driving your car on a perfectly flat, straight road. You are the only one on the road and you can see anything ahead of you perfectly. At time t=0, you are at Point A, cruising along at a speed of 100 kilometers per hour, which is the speed limit for the whole road. You want to reach Point C, exactly 4 kilometers ahead, in the shortest time possible. But, at Point B, 2 kilometers ahead of you, there is a traffic light.

At time t=0, the light is green, but you don’t know how long it has been green. You do know that at the beginning of each second, there is a 1 percent chance that the light will turn yellow. Once it turns yellow, it remains yellow for 5 seconds and then turns red for 20 seconds. Your car can accelerate or decelerate at a maximum rate of 2 meters per second-squared. You must always drive at or below the speed limit. You can pass through the intersection when the traffic light is yellow, but not when it is red.

What is the best strategy to reach your destination as soon as possible?

Here is my solution:
[Show Solution]

2 thoughts on “Timing a stoplight just right”

  1. I wish I could take your class!

    I too just intuited that the probability is too small for any other strategy to be advisable, and I just directly calculated what you can do to get through the light going as fast as possible if it does turn yellow at various points. (https://www.sharelatex.com/project/588bc1336e5de4073270ebed) I’m curious about at what probability-per-second it starts to be preferable to ensure that you can hit the light at top speed as the red ends, but not curious enough to go through the drudgery of calculating the expectations.

    I think backing up does make sense (if legal) where otherwise, with full deceleration to zero starting when you see the yellow and full acceleration to the hit the light as it turns green, you’d be sitting at rest for some period of time–you can use that time to back up and hit the light going faster than you would have.

    1. Yes, backing up makes sense. All I did in my solution was compute the optimal trajectory assuming the light never turns yellow. Depending on when it does turn yellow, that affects how you should act.

      I think the real way to solve this problem would be to solve a separate optimization for each possible instant where the light could turn yellow. This gets messy pretty quickly using my approach, so I abandoned the idea. I wish the posted solution on fivethirtyeight gave more insight rather than just stating the solution. i.e. I’m not convinced it’s even correct.

Leave a Reply

Your email address will not be published.