Assume you have two coins $A,B$ with biases $P\_A,P\_B$ respectively.
We would like to make $N$ coin tosses and get the maximal number of heads possible.
Unfortunately, we know $P\_B$, but $P\_A$ is unknown at the beginning of the process.

**What is the best possible strategy for selecting which coin to toss at each step?**

Note: I'm looking for actual optimization of the selection, not heuristic methods. You may assume a reasonable prior distribution on $P\_A$ if needed.

---

EDIT: 

Here is a formal definition of the objective.
Let $P\_A,P\_B\in (0,1)$ and $P=max\{P\_A,P\_B\}$. The optimal strategy in hindsight will achieve on average $P\cdot N$ head tosses.
Let $a(P\_A,P\_B)$ be the expected number of times our strategy picked coin $A$ given that the probabilities were $P\_A,P\_B$.

**The Optimization Objective:** minimize the expected regret, i.e. $$Regret=P\cdot N - P\_A\cdot a(P\_A,P\_B) - P\_B\cdot (N-a(P\_A,P\_B))$$

**The Goal:** Devise a selection strategy that guarantees (expected) $Regret\leq r$ for any values of $P\_A,P\_B$ (for the smallest value of $r$ possible).

Note that if $P\_A\approx P\_B$ this is not a problem in this definition as it means our regret will be small regardless of which coin we flip. 

---

If $N$ is unknown (i.e. the process may end arbitrarily after an adversarialy chosen number of tosses), the best strategy would be to occasionally explore coin $A$ to get a better $\widehat {P\_A}$ estimation, and in the rest of the time toss coin $A$ iff $\widehat {P\_A} > P\_B$.

In the scenario $N$ is known, it's not hard to argue that the optimal strategy makes a series of tosses of coin $A$ and then either keeps on tossing $A$ for the remaining tosses or starts tossing only coin $B$, but how can we optimize the cutoff (i.e. the switch to tossing coin $B$) to maximize the expectancy of head results?