Skip to main content
added 119 characters in body
Source Link
RobPratt
  • 5.4k
  • 1
  • 15
  • 25

You can solve the problem via dynamic programming. For $n\in\{1,\dots,t\}$, let $V(n)$ be the minimum expected number of steps starting from $n$. Then $V(1)=0$ and otherwise $$V(n) = 1+\min\left(\frac{1}{n}\sum_{k=1}^n V(k), V(n-1)\right).$$$$V(n) = 1+\min\left(\frac{1}{t}\sum_{k=1}^t V(k), V(n-1)\right).$$

Because $V(n)$ appears on both sides, you cannot just iterate the recursion. Instead, you can use linear programming as follows. The problem is to maximize $\sum_{n=1}^t V(n)$ subject to linear constraints \begin{align} V(1) &= 0 \\ V(n) &\le 1 + \frac{1}{n}\sum_{k=1}^n V(k) \\ V(n) &\le 1 + V(n-1) \\ \end{align}\begin{align} V(1) &= 0 \\ V(n) &\le 1 + \frac{1}{t}\sum_{k=1}^t V(k) \\ V(n) &\le 1 + V(n-1) \\ \end{align} Here's a plot of $V(n)$ for $n\in\{1,\dots,1000\}$: enter image description hereenter image description here

In particular, $$V(n)= \begin{cases} n-1 &\text{for $n \le 45$}, \\ 44+2/9 &\text{otherwise}. \\ \end{cases}$$

You can solve the problem via dynamic programming. For $n\in\{1,\dots,t\}$, let $V(n)$ be the minimum expected number of steps starting from $n$. Then $V(1)=0$ and otherwise $$V(n) = 1+\min\left(\frac{1}{n}\sum_{k=1}^n V(k), V(n-1)\right).$$

Because $V(n)$ appears on both sides, you cannot just iterate the recursion. Instead, you can use linear programming as follows. The problem is to maximize $\sum_{n=1}^t V(n)$ subject to linear constraints \begin{align} V(1) &= 0 \\ V(n) &\le 1 + \frac{1}{n}\sum_{k=1}^n V(k) \\ V(n) &\le 1 + V(n-1) \\ \end{align} Here's a plot of $V(n)$ for $n\in\{1,\dots,1000\}$: enter image description here

You can solve the problem via dynamic programming. For $n\in\{1,\dots,t\}$, let $V(n)$ be the minimum expected number of steps starting from $n$. Then $V(1)=0$ and otherwise $$V(n) = 1+\min\left(\frac{1}{t}\sum_{k=1}^t V(k), V(n-1)\right).$$

Because $V(n)$ appears on both sides, you cannot just iterate the recursion. Instead, you can use linear programming as follows. The problem is to maximize $\sum_{n=1}^t V(n)$ subject to linear constraints \begin{align} V(1) &= 0 \\ V(n) &\le 1 + \frac{1}{t}\sum_{k=1}^t V(k) \\ V(n) &\le 1 + V(n-1) \\ \end{align} Here's a plot of $V(n)$ for $n\in\{1,\dots,1000\}$: enter image description here

In particular, $$V(n)= \begin{cases} n-1 &\text{for $n \le 45$}, \\ 44+2/9 &\text{otherwise}. \\ \end{cases}$$

Source Link
RobPratt
  • 5.4k
  • 1
  • 15
  • 25

You can solve the problem via dynamic programming. For $n\in\{1,\dots,t\}$, let $V(n)$ be the minimum expected number of steps starting from $n$. Then $V(1)=0$ and otherwise $$V(n) = 1+\min\left(\frac{1}{n}\sum_{k=1}^n V(k), V(n-1)\right).$$

Because $V(n)$ appears on both sides, you cannot just iterate the recursion. Instead, you can use linear programming as follows. The problem is to maximize $\sum_{n=1}^t V(n)$ subject to linear constraints \begin{align} V(1) &= 0 \\ V(n) &\le 1 + \frac{1}{n}\sum_{k=1}^n V(k) \\ V(n) &\le 1 + V(n-1) \\ \end{align} Here's a plot of $V(n)$ for $n\in\{1,\dots,1000\}$: enter image description here