A technical guide: Difference between revisions

From stacky wiki
(Created page with "<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...")
 
No edit summary
 
Line 29: Line 29:
H(\Delta t) (w-v) + (1-H(\Delta t)) E(t\mapsto T(t-\Delta t)/H(\Delta t))
H(\Delta t) (w-v) + (1-H(\Delta t)) E(t\mapsto T(t-\Delta t)/H(\Delta t))
$$
$$
---
Say I'm distance $d$ off and certain (have confidence $p_0=1$) of change in $t_0$ time, then optimum speed is $v_0 = d/t_0$ and expected cost is $w-d/t_0$.
If I'm distance $d$ off, and have confidence $p_1$ of change in $t_1$ time, and $1-p_1$ in change after $t_1+t_0$ time, then optimum speed is in $[d/(t_0+t_1),d/t_1]$
$$
v_1 = \begin{cases}
\frac{d}{t_0+t_1} & p_1 < \frac{t_1}{t_0+t_1}\\
\frac{d}{t_1} & p_1 > \frac{t_1}{t_0+t_1}
\end{cases}
$$
and expected cost is
$$
E = \begin{cases}
w-\frac{d}{t_1+t_0} & p_1 < \frac{t_1}{t_0+t_1}\\
w-\frac{d}{t_1} & p_1 > \frac{t_1}{t_0+t_1}
\end{cases}
$$
if distance $d$ off, and have confidences $p_2$, $(1-p_2)p_1$, $(1-p_2)(1-p_1)$ in turning after $t_2$, $t_2+t_1$, and $t_2+t_1+t_0$, respectively, then optimum speed is in $[d/(t_2+t_1+t_0),d/t_2]$
$$
v_2 = \begin{cases}
\end{cases}
$$
and expected cost is
$$
E = \begin{cases}
\end{cases}
$$
d-vt_2 is the new d.
p_2(w-v) + (1-p_2)(w-(d-vt_2)/(X)) is new E, where X=t_1 or t_1+t_0
-p_2 + (1-p_2)(t_2/X) proportional to
X - p_2(X+t_2)
p_2 X/(X+t_2)

Latest revision as of 23:29, 7 August 2013

<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)) $$

---

Say I'm distance $d$ off and certain (have confidence $p_0=1$) of change in $t_0$ time, then optimum speed is $v_0 = d/t_0$ and expected cost is $w-d/t_0$.

If I'm distance $d$ off, and have confidence $p_1$ of change in $t_1$ time, and $1-p_1$ in change after $t_1+t_0$ time, then optimum speed is in $[d/(t_0+t_1),d/t_1]$ $$ v_1 = \begin{cases} \frac{d}{t_0+t_1} & p_1 < \frac{t_1}{t_0+t_1}\\ \frac{d}{t_1} & p_1 > \frac{t_1}{t_0+t_1} \end{cases} $$ and expected cost is $$ E = \begin{cases} w-\frac{d}{t_1+t_0} & p_1 < \frac{t_1}{t_0+t_1}\\ w-\frac{d}{t_1} & p_1 > \frac{t_1}{t_0+t_1} \end{cases} $$

if distance $d$ off, and have confidences $p_2$, $(1-p_2)p_1$, $(1-p_2)(1-p_1)$ in turning after $t_2$, $t_2+t_1$, and $t_2+t_1+t_0$, respectively, then optimum speed is in $[d/(t_2+t_1+t_0),d/t_2]$ $$ v_2 = \begin{cases} \end{cases} $$ and expected cost is $$ E = \begin{cases} \end{cases} $$

d-vt_2 is the new d. p_2(w-v) + (1-p_2)(w-(d-vt_2)/(X)) is new E, where X=t_1 or t_1+t_0 -p_2 + (1-p_2)(t_2/X) proportional to X - p_2(X+t_2)

p_2 X/(X+t_2)