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:
You are not allowed to pass the lights as long as they show "red".
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$.
You are approaching the traffic lights, i.e. $V>0$, where positive speed is towards the lights (in the direction of the road).
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...