Similar to the linked variants on this problem, the optimal strategy takes the form of a function $v(t)$, which corresponds to the strategy in which you travel at velocity $v(t)$ until the light turns green, then you slam on the accelerator and accelerate at $a$ until you reach the speed limit $L$.

If $T$ is the time when the light turns green, we will be at $D=\int_0^Tdt\;v(t)$ traveling at $V=v(T)$, and the velocity function for $t\ge T$ is $v'(t)=\min(V+a(t-T),L)$. We want to maximize, for $t\gg T$:

$$K:=\int_0^tdt\; v'(t)=D-\frac{(L-V)^2}{2a}-LT+Lt$$

The leading term $Lt$ only depends on the chosen time $t$ to measure our distance, so we can ignore it, and similarly with $LT$ which depends only on $T$ which is not under our control. For the rest, we see a quadratic penalty to slowing below top speed.

The constraint of not running the red light is expressed as $P[\int_0^Tdt\;v(t)\le d]=1$, which amounts to just $\int_0^xdt\;v(t)\le d$ for all $x$ such that $\mu([x,\infty))>0$. In fact we can just go ahead and assume $\int_0^xdt\;v(t)\le d$ for all $x$ because the strategy is irrelevant once the light is green.

So we are looking at:

$$E[K]=E\left[\int_0^Tdt\;v(t)-\frac{(L-v(T))^2}{2a}\right]$$

where $T$ is drawn from the distribution $\mu$, and we wish to choose $v$ maximizing $E[K]$. I don't think much more can be done in this generality, so let me focus on the case $\mu$ uniform on $[0,\alpha]$.

In this case the expected value becomes (up to a factor $1/\alpha$ which doesn't affect the result)

$$\int_0^\alpha dT\left[\int_0^Tdt\;v(t)-\frac{(L-v(T))^2}{2a}\right]=$$
$$\int_0^\alpha dt\left[(\alpha-t)\;v(t)-\frac1{2a}(L-v(t))^2\right].$$

We can add in a Lagrange multiplier to account for the constraint (which will almost certainly turn out to be extremal) $\int_0^\alpha dt\; v(t)=d$, and solve this using calculus of variations:

$$\mathcal{L}(t,v,\lambda)=(\alpha-t)\;v-\frac1{2a}(L-v)^2+\lambda v$$

$$\frac{\partial\mathcal{L}}{\partial v}=0\implies v(t)=L+a(\alpha+\lambda)-at$$

Here $\lambda$ is a free constant which should be chosen to maintain the constraint $\int_0^\alpha dt\; v(t)\le d$, which I'll leave to you since the story is more interesting: This says you should *decelerate* at $a$ starting from an appropriate speed. (Here the appropriate speed is so that you come to a stop at the light, unless this puts the initial speed above $L$, in which case obviously you should drive at the speed limit until you get close enough.)

Let's try another simple and reasonable distribution: the exponential distribution with mean $\beta=\alpha^{-1}$. In this case the expectation works out to:

$$\int_0^\infty dT\;e^{-\alpha T}\left[\int_0^Tdt\;v(t)-\frac{(L-v(T))^2}{2a}\right]=$$
$$\int_0^\infty dt\;e^{-\alpha t}\left[\beta v(t)-\frac1{2a}(L-v(t))^2\right].$$

As with the uniform distribution case, we add a Lagrange multiplier and solve the Euler-Lagrange equation:

$$\mathcal{L}(t,v,\lambda)=e^{-\alpha t}\left[\beta v-\frac1{2a}(L-v)^2\right]+\lambda v$$

$$\frac{\partial\mathcal{L}}{\partial v}=0\implies v(t)=L+a(\beta+\lambda e^{\alpha t})$$

Unfortunately, this solution is formally problematic, since the integral of the velocity doesn't converge for large $t$. This solution is still correct before we hit the discontinuity, but we need to add the constraint in differently.

Let's explicitly consider a velocity curve that is zero after a certain fixed time, i.e. we approach the light and come to a stop. For a fixed chosen time $t^*$ to stop at, the functional is the same, and so the solution is the same: exponential deceleration away from the unreachable "steady state" velocity $L+a\beta$. But when we hit the light, we use our magic brakes to stop, and continue after the light from a full stop.

$$E[K]=\int_0^{t^*} dT\;e^{-\alpha T}\left[\int_0^Tdt\;v(t)-\frac{(L-v(T))^2}{2a}\right]+\underset{c(t^*)}{\underbrace{\int_{t^*}^\infty dT\;e^{-\alpha T}\left[d-\frac{L^2}{2a}\right]}}$$
$$=\int_0^{t^*} dt\left[\int_t^{t^*}dT\;e^{-\alpha T}\;v(t)-\frac{e^{-\alpha t}}{2a}(L-v(t))^2\right]+c(t^*).$$
$$=\int_0^{t^*} dt\left[\beta(e^{-\alpha t}-e^{-\alpha t^*})\;v(t)-\frac{e^{-\alpha t}}{2a}(L-v(t))^2\right]+c(t^*).$$

The parts that depend on $t^*$ don't affect the variational analysis:

$$\mathcal{L}(t,v,\lambda)=\beta(e^{-\alpha t}-e^{-\alpha t^*})\;v-\frac{e^{-\alpha t}}{2a}(L-v)^2+\lambda v$$

$$\frac{\partial\mathcal{L}}{\partial v}=0\implies v(t)=L+a(\beta(1-e^{\alpha(t-t^*)})+\lambda e^{\alpha t})$$

This time we should really solve for $\lambda$ since we need to ensure that $\int_0^{t^*}dt\;v(t)=d$. I'll spare the details as the algebra gets worse, but after putting $\lambda$ back in the equation, we have a one-dimensional optimization for $E[K]$ as a function of $t^*$, which can't be solved with elementary functions, but from numerical simulations it looks like the best option is still the extremal one: Wait until the last moment at the top speed, then execute the exponential deceleration maneuver $v(t)=L+a\beta(1-e^{\alpha t})$ and stop when $v(t)=0$, at $t=\beta\log(1+\frac L{a\beta})$.

PS: I don't recommend these maneuvers. They strike me as mildly suicidal.

notdo so is a severe constraint... $\endgroup$ – paul garrett Oct 22 '17 at 19:17