TITLE: Flipping coins on a budget
QUESTION [60 upvotes]: A coin is flipped $n$ times and you win if it comes up heads at least $k$ times.  The coin is unusual in that you're allowed to pick the probability $p_i$ that it comes up heads on the $i$th flip, subject only to the constraint that $\sum_i p_i \le b$, where $b$ is some predetermined "budget" that you have.  Moreover, you are allowed to wait until you've seen the results of the first $i-1$ flips before choosing the value of $p_i$.  Given $n$, $k$, and $b$, what is your optimal strategy, and what is your probability of winning?
One colorful way to state the problem is that if you're a sports team tasked with winning a best-of-$n$ series and you have limited resources (e.g., a limited bullpen for the World Series of major league baseball), how should you budget them?

Naturally, if $b\ge k$, you can simply pick $p_i=1$ for $k$ of the $n$ flips, and win with probability 1.  So the question is interesting only if $b\lt k$.
I've circulated this problem informally among colleagues, who have obtained miscellaneous partial results but not a full solution.  It would take too much space to summarize all the partial results, but let me mention some of the highlights.

Even the "non-adaptive case," where you're not allowed to see the results of your flips before choosing $p_i$, is not trivial.  The best strategy is to divide the budget evenly over $r$ flips for some $r$, but the exact value of $r$ is more complicated than you might think.  For a given $r$, the probability of $k$ successes is $$\sum_{m=k}^r {r \choose m} \left({b\over r}\right)^m\left(1-{b\over r}\right)^{r-m}.$$ From this it appears that if $b\lt k-1$ then we should choose $r=n$, and if $k-1 \le b \lt k$ then $r\approx (k-1)/3(b-k+1)$, but we have a proof only in special cases.
In the actual stated problem, let's let $d=k-b$, the deficit.  Then, at least in the small-deficit case, the best general strategy we have so far is to make an initial coin flip with probability $1-\lbrace d\rbrace$ (where $\lbrace d\rbrace$ denotes the fractional part of $d$), and then take $p_i=1/2$ until we find ourselves in a situation where we can "clinch" the win by taking the remaining $p_i=1$.  (It's possible to analyze this strategy quantitatively but I'll omit the details here.)  In particular, one can show that adaptive strategies significantly outperform non-adaptive strategies.
If $b$ is small then one can show that the best non-adaptive strategy is within a constant factor of optimum.  For example if $b\le 1$, then one can show that the overall winning probability $p$ satisfies
$${1\over 4}{n\choose k}\left({b\over n}\right)^k \le p \le {n\choose k}\left({b\over n}\right)^k.$$
The upper bound is actually true for all $b$ and the lower bound can be derived from the best non-adaptive strategy.

REPLY [2 votes]: I give here a solution at the limite $b$, $n$, $k$ very large: The optimal strategy is to alway play $\frac{b}{n}$ until you have more budget left than the number of head to get. It will give a probability of win equal to
$$2 \mathcal{N}([\frac{k-b}{\sqrt{b(1-\frac{b}{n})}},\infty])$$
With $\mathcal{N}$ the gaussian measure.
We note $S(i)$ the number of heads up to time $i$ and $b(i)=b-\sum_{j<i}p(j)$ the budget you still have after $i$ flip. We define $X$ as $$X(i)=k-S(i)-b(i) $$
The central observation is the following : whatever the strategy you chose $X$ is a Martingale. Therefore for  $n,b,k $ large and with a correct scaling it will converge to a continuous stochastic process.
We note $t=\frac{i}{n}$ and on $[0,1]$, and we change the notation such that $p(t)=p(i)$, $b(t)=\frac{b(i)}{n}$, $X(t)=\frac{1}{\sqrt{n}}X(i)$. At the limite the system evolves as follow:
$$\begin{cases}dX_t = \sigma(p(t))dB_t \\ db_t=-p(t)dt \end{cases}$$ where $\sigma(p(t))=\sqrt{p(t)(1-p(t))}$. The process $p(t)$ is our strategy and it should be think as $p(t,b_t,X_t)$ where  $0\leq p(t)\leq 1$. With initial condition $X_0 = \frac{1}{\sqrt{n}}(k-b)$ and final condition $b(t=1)=0$.
As soon as $X_t=0$, we are in the situation $b\geq k$ one can set $p(s)=1$ and then $p(s)=0$ to finish. Therefore one have to obtimize $$ \mathbb{P}(\exists t : X_t\leq 0)$$
We have an explicit solution for $X$: $$X_t=X_0+B_{\int_0^t \sigma(p(s))^2 ds} $$
And then $$ \mathbb{P}(\exists t \in [0,1]: X_t\leq 0)= \mathbb{P}(\exists u \in [0,\int_0^1 \sigma(p(s))^2 ds]: B_u\leq -X_0)$$ We recall that $\int_0^1 \sigma(p(s))^2 ds$ is not a constant but a random variable depending on the chosen strategy. However here we remark the probability is monotone in $\int_0^1 \sigma(p(s))^2 ds$ and we can conclude : we should always chose $p$ such that $$\int_0^1 \sigma(p(s))^2 ds = \max_{p'} \int_0^1 \sigma(p'(s))^2 ds=\int_0^1 \frac{b}{n}(1-\frac{b}{n})ds= \frac{b}{n}(1-\frac{b}{n})$$ The last equalities follow from the fact that $x\rightarrow \sigma(x)^2$ is concave. And we have 
$$\max_{p'} \mathbb{P}(\exists t : X_t\leq 0)= \mathbb{P}(\min_{u\in [0,\frac{b}{n}(1-\frac{b}{n})]} B_u\leq -X_0)=2 \mathcal{N}(y \leq \frac{k-b}{\sqrt{b(1-\frac{b}{n})}})$$
With $\mathcal{N}$ the gaussian measure. (the last equality is a well known property of the maximum of the Brownian motion)