8
$\begingroup$

Suppose you are driving on a road at speed $V$, and then at a distance $D$ you see a traffic lights showing "red". You are familiar with that road and know that the light will stay "red" for a time $T$, but as you just came around the corner you don't know how long it is already showing "red".

What is the best strategy to approach the traffic light, when you want your speed to be as high as possible$^1$ at the moment when the lights are switching to "green"? Constraints:

  1. You are not allowed to pass the lights as long as they show "red".

  2. As long as the lights are "red", you must not speed up, i.e. $|v(t_2)|\leqslant |v(t_1)|$ if $t_2 > t_1$.

  3. You are approaching the traffic lights, i.e. $V>0$, where positive speed is towards the lights (in the direction of the road).

  4. There is an upper limit for the deceleration of $g=9.8\mathrm{m}/\mathrm{s}^2$, and you are driving at a reasonable[tm] speed: It is possible that you can come to a halt before crossing the lights, even if the lights are "red" for the maximal time $T$.

The last point constrains the initial speed to $V\leqslant gT$, and thus the distance must satisfy $D\geqslant\frac12gT^2$ so that

$$D\geqslant\frac12V\cdot T$$

If the distance is big enough, i.e. $D\geqslant V\cdot T$ then the solution is simply to keep on driving with $V$ because at the moment you will reach the lights they will have changed to "green".

So let's also assume $D < V\cdot T$ in the remainder.

One strategy is to keep on driving with $V$ and if the lights don't switch doing a full brake and come to a halt.

But there might be better strategies like braking gradually, which gains you some extra time in which the lights might turn "green". The speed $v(T)$ is then not as high as $V$ but that's definitely better than coming to a halt.

I have no idea how to even formalize this...

Even if we knew the best strategies for all remaining times $T^{*}$, how would you average / combine these $v_{T^{*}}(t)$ to get the best solution w.r.t expected speed at the time the lights are switching "green"?

Presumably a calculus of variations problem?

In addition to the constraints from above, the following clarifications / simplifications shall apply:

  • The road is flat, i.e. no hills or (change in) potential energy.

  • You must stay on the road, i.e. the car moves on a prescribed trajectory. The road is just a 1-dimensional smooth line$^2$ with the lights at distance $D$ ahead.

  • The times when you come around the corner and see that the lights are "red" are evenly distributed during the "red"-phase, i.e. the average time until they switch "green" is $T/2$.

  • There is no friction or drag etc.: Change in speed is only due to using the brake.

  • There are no other cars etc. that would impede you.

  • Speed of light is infinitely high.


$^1$This is the most energy-efficient way of driving provided braking just dissipates kinetic energy.

$^2$Without loss of generality we can assume the road is straight, because change in direction won't dissipate energy as the component of such acceleration is perpendicular to the direction of motion.


Hint:

The best $v(t)$ is constrained by:

  • "Red" lights must not be crossed:

$$0 \leqslant \int_0^T v(t) dt \leqslant D $$

  • No speed-up while "red":

$$-g \leqslant v'(t) \leqslant 0 $$

  • Must not move backwards and no speed-up:

$$ 0 \leqslant v(t) \leqslant v(0) = V $$

If the switching time is known to be exactly $T^*$, then the optimal speed at time $T^*$ is given by

$$ v_{T^*} = V - gT^* + \sqrt{g(2D + g{T^*}^2 - 2VT^*)} $$

which follows from a simple geometric consideration. No Idea how to use that or if it's of any use at all...

$\endgroup$
11
  • 9
    $\begingroup$ Finally someone asking the right questions $\endgroup$
    – Azur
    Commented May 14, 2020 at 18:52
  • $\begingroup$ Are you interested in the maximum average speed or minimum expected energy loss? I assume these objectives have different solutions. $\endgroup$
    – Its_me
    Commented May 15, 2020 at 16:40
  • $\begingroup$ @Its_me Either case is interesting, in particularly which technology can be used to find solutions when there are nasty inequality / non-holonomic constraints. $\endgroup$ Commented May 18, 2020 at 11:45
  • $\begingroup$ Strangely, I have thought about an almost identical problem while driving on and off over the years, and I even wrote down a calculus of variations problem to try to solve it. My approach was to try to minimize the sum of (1) the time that I passed the light and (2) the energy dissipated by braking (i.e., how much gas/petrol is wasted) times a conversion constant that will make the units equal. This conversion constant was to be chosen on the basis of "How much of a hurry am I in?" and "How much do I care about the environment today?" $\endgroup$
    – sasquires
    Commented May 18, 2020 at 22:53
  • 1
    $\begingroup$ One other comment: I don't think that $ \int_0^T v(t) dt \le D $ is the right model for "Red lights must not be crossed." At the end of this interval, it is almost certain that the light has changed and it would therefore be okay to cross the light. I think that I had tried to model the problem as follows. At any given moment, $t$, there is some probability distribution that the light will change at time $\tau>t$, given that it has already not changed by time $t$. You want to maximize the expected value of some function over this probability distribution to determine the right speed at $t$. $\endgroup$
    – sasquires
    Commented May 18, 2020 at 22:59

1 Answer 1

6
+100
$\begingroup$

Since the time at which the light turns green is uniformly distributed over $[0,T]$, your expected velocity at the moment the light turns green is: $$\int_{0}^{T}\frac{v(t)}{T} dt = \frac{1}{T} \int_{0}^{T}v(t) dt$$ This is simply the distance that would be traveled by time $T$ divided by $T$. Any path $\hat{v}$ that traverses the whole distance D, i.e. $$\int_{0}^{T}\hat{v}(t) dt = D$$ will have an average velocity of $D/T$ and be optimal. It does not matter how you decelerate (or even accelerate, go backwards, etc.) so long as you would traverse the whole distance D by time $T$.


How to compute fuel efficiency requires we define what fuel efficiency is. Minimizing how much you brake and accelerate: $$\int_{0}^{T} |v'(t)|dt$$ is equivalent to what maximizing your expected velocity at the moment the light turns green, as was previously answered.

Alternatively, maybe fuel efficiency is equivalent to minimizing the dissipation of kinetic energy? (There is then no reason to ever accelerate as it only makes you go further without increasing the objective function.) If the car does not accelerate, then the problem is equivalent to maximizing the kinetic energy that remains: $$\int_{0}^{T}\frac{v(t)^{2}}{T} dt$$ Intuitively, because kinetic energy is convex in velocity, this expectation will be maximized by staying at the initial velocity of $V$ for as long as possible, denote this path by $\tilde{v}$. Further, let $F_{v}(\hat{V})$ denote the cumulative density function of velocity, i.e. the probability that velocity is less than $\hat{V}$ when the light turns green. Note that since $v$ and $\tilde{v}$ are non-increasing (supposing no acceleration), $$F_{v}(x) = \Pr[v(t_\textrm{green}) \leq x] = \int_{v^{-1}(x)}^{T} \frac{1}{T} dt = \frac{T-v^{-1}(x)}{T}$$

Claim 1: For any $v(t)$, there exists a $t^{*}$ (not necessarily unique) such that for all $t < t^{*}$ we have $\tilde{v}(t) \geq v(t)$, and for all $t > t^{*}$ we have $\tilde{v}(t) \leq v(t)$.

Proof: Let $\tilde{t}$ be the time at which $\tilde{v}$ starts decelerating, then: $$t^{*} = \inf \{t\geq\hat{t}| \tilde{v}(t^{*}) \leq v(t^{*}) \}$$ By construction, for all $t < t^{*}$ we have $\tilde{v}(t) \geq v(t)$. Further, since $\tilde{v}$ decelerates as quickly as possible to zero after $\hat{t}$, and at $t^{*} > \hat{t}$ we have $\tilde{v}(t^{*}) \leq v(t^{*})$, it must be that for all $t > t^{*}$ we have $\tilde{v}(t) \leq v(t)$.

Corollary 1: For any $v(t)$, take the $t^{*}$ satisfying the previous claim and let velocity $x^{*} = \tilde{v}(t^{*})$, then for all $x < x^{*}$ we have $F_{\tilde{v}}(x) \geq F_{v}(x)$, and for all $x > x^{*}$ we have $F_{\tilde{v}}(x) \leq F_{v}(x)$.

Claim 2: Any $v(t)$ which doesn't go distance $D$ by time $T$ is not optimal since $\hat{v}(t) = v(t-\epsilon)$ where $\epsilon>0$ is chosen so that $\hat{v}$ goes distance $D$ in time $T$ results in higher expected kinetic energy by delaying any deceleration.

Claim 3: Take any $v(t)$ which goes distance $D$ by time $T$, then $F_{\tilde{v}}$ is a mean preserving spread of $F_{v}$.

Proof: Since both $v(t)$ and $\tilde{v}(t)$ go distance $D$ by time $T$, they have the same mean velocity, which implies that: $$\mathbb{E}[\tilde{v}(t)] = \int_{0}^{V} 1 - F_{\tilde{v}}(x)dx = \int_{0}^{V} 1 - F_{v}(x)dx = \mathbb{E}[v(t)] = D/T$$ $$\Longrightarrow \int_{0}^{V} F_{\tilde{v}}(x) - F_{v}(x)dx = 0$$ Define: $$A(\hat{x}) = \int_{0}^{\hat{x}} F_{\tilde{v}}(x) - F_{v}(x)dx$$ Then $A(0) = 0$ and $A(V) = 0$. By Corollary 1, $A$ is increasing for $\hat{x}<x^{*}$ and decreasing from $\hat{x}>x^{*}$. Thus, $A(\hat{x})\geq 0$ for all $x$, and strictly for some $x$ if $F_{\tilde{v}}$ and $F_{v}$ are different.

By Claims 2 and 3, $\tilde{v}(t)$ (strictly) maximizes the expectation of any (strictly) convex function of velocity.


In addition to $\tilde{v}$ being a solution to either of the previous optimization problems, notice that it also minimizes the expected distance between the car and the light when it turns green.

I don't believe frictions would really affect the analysis as they are just mandatory braking? We would have to define friction and fuel efficiency to actually show that though.

Other considerations could be considered, e.g. comfort and not damaging the brakes. The point is you can decelerate/accelerate however you like without affecting your expected velocity for when the light turns green as long as you go distance $D$ by time $T$. Or, if you want to maximize kinetic energy, you should wait as long as possible to slow down.

$\endgroup$
41
  • 1
    $\begingroup$ That would be interesting, how do you think fuel should be modeled? Like, what would the objective function be mathematically? $\endgroup$ Commented May 19, 2020 at 16:49
  • 1
    $\begingroup$ I remember that one can model fuel consumption. An easy model is to simply incorporate it as a "friction": $$ C_{\text{fuel consumption}} = f V_{\text{speed}} $$ However, I do think there is a better way to do it. According to wikipedia: "Generally, fuel efficiency is maximized when acceleration and braking are minimized. So a fuel-efficient strategy is to anticipate what is happening ahead, and drive in such a way so as to minimize acceleration" So possibly, a simple way seems to be minimizing the acceleration: $$ \text{argmin}_V \int_0^T V^2(t) dt $$ what do you think? $\endgroup$ Commented May 19, 2020 at 17:04
  • 1
    $\begingroup$ Acceleration and braking (absolute changes to velocity) are minimized here by the original question of maximizing the expected velocity when the light turns green (while making sure to never accelerate). Since the amount of braking will be equal to the total reduction in velocity. $\endgroup$ Commented May 19, 2020 at 20:11
  • 1
    $\begingroup$ @Its_me: Instead of infinity, let's pick a large number, say $10^9$m/s. You get to the light nearly instantaneously: in $D/10^9$ seconds, and then stop instantaneously. The light turns green during that time period with probability $(D/10^9)/T$. Hence, the expected speed when the light turns green is 10^9 multiplied by the probability, which gives $D/T$! Hence, your example does not contradict my answer (so long as we don't have infinite speeds were we have to worry about multiplying infinity by zero). $\endgroup$ Commented May 20, 2020 at 0:24
  • 1
    $\begingroup$ ... Which one is the optimal? The expected velocity averaged over traffic light switches is $E[v(t)]=\int_0^T v(t) p(t) dt$. For uniform probability of light switches $p(t)$ the expectation value is proportional to the area under the curve $v(t)$. Thus, all those $v(t)$ with the largest area under $v(t)$, i.e. $D$, will be optimal. $\endgroup$
    – Its_me
    Commented May 20, 2020 at 18:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .