A technical guide
<protect>Anton</protect>
Cruising at speed $w$, distance $1$ from the light. With probability $p$, the light will turn in $1$, and with probability $1-p$, it'll turn in $2$.
If I initially slow down to $v\in [1/2,1]$, then if the light hasn't turned after $1$, I'm distance $1-v$ from the light and the light won't turn for another $1$, so I have to slow down to $(1-v)$. Thus, the expected cost is $$ p(w-v) + (1-p)(w+v-1) = -pv + w+v-1 -pv + p = w+v+p-1 - 2pv, $$ which has constant derivative $1-2p$. So if $p<1/2$, it's minimized at $v=1/2$, and for $p>1/2$, it's minimized at $v=1$.
How about if the distance with probability $1-p$, it'll turn at some time $t$. Then if I initially slow down to $v\in [1/t,1]$, if it hasn't turned after $1$, I'm at $1-v$ from the light and the light will turn after another $t-1$, so I have to slow down to $(1-v)/(t-1)$, so the expected cost is $$ p(w-v) + (1-p)(w - (1-v)/(t-1)) $$ whose derivative with respect to $v$ is $$ -p + (1-p)/(t-1) = \frac{-pt+1}{t-1} $$ So when $p<1/t$, it's minimized at $v=1/t$, and when $p>1/t$, it's minimized at $v=1$.
---
Suppose given a probability distribution of times $T$ on $(0,\infty)$ (with cumulative value $H(t)$ at $t$), the optimal expected cost is known to be $E(T)$. Then what is the optimal speed $v(T)$?
If instead of being at distance $1$ I was at distance $x$, then all my optimal speeds would be scaled by a factor of $x$, so the expected cost would be ...
If I'm instantaneously going $v\in (0,\infty)$, then a small amount of time $\Delta t$ I'm $1-v\Delta t$ away from the light, and the light has turned with probability $H(\Delta t)\approx T(0)\cdot \Delta t$ (if $T$ is continuous). If the light hasn't turned, then I should slow down to $v(t\mapsto T(t-\Delta t)/H(\Delta t))$. The expected cost is $$ H(\Delta t) (w-v) + (1-H(\Delta t)) E(t\mapsto T(t-\Delta t)/H(\Delta t)) $$