# Odds algorithm

The odds-algorithm is a mathematical method for computing optimal strategies for a class of problems that belong to the domain of optimal stopping problems. Their solution follows from the odds-strategy, and the importance of the odds-strategy lies in its optimality, as explained below.

The odds-algorithm applies to a class of problems called last-success-problems. Formally, the objective in these problems is to maximize the probability of identifying in a sequence of sequentially observed independent events the last event satisfying a specific criterion (a "specific event"). This identification must be done at the time of observation. No revisiting of preceding observations is permitted. Usually, a specific event is defined by the decision maker as an event that is of true interest in the view of "stopping" to take a well-defined action. Such problems are encountered in several situations.

## Examples

Two different situations exemplify the interest in maximizing the probability to stop on a last specific event.

1. Suppose a car is advertised for sale to the highest bidder (best "offer"). Let n potential buyers respond and ask to see the car. Each insists upon an immediate decision from the seller to accept the bid, or not. Define a bid as interesting, and coded 1 if it is better than all preceding bids, and coded 0 otherwise. The bids will form a random sequence of 0s and 1s. Only 1s interest the seller, who may fear that each successive 1 might be the last. It follows from the definition that the very last 1 is the highest bid. Maximizing the probability of selling on the last 1 therefore means maximizing the probability of selling best.
2. A physician, using a special treatment, may use the code 1 for a successful treatment, 0 otherwise. The physician treats a sequence of n patients the same way, and wants to minimize any suffering, and to treat every responsive patient in the sequence. Stopping on the last 1 in such a random sequence of 0s and 1s would achieve this objective. Since the physician is no prophet, the objective is to maximize the probability of stopping on the last 1. (See Compassionate use.)

## Definitions

Consider a sequence of ${\displaystyle n}$ independent events. Associate with this sequence another sequence ${\displaystyle I_{1},\,I_{2},\,\dots ,\,I_{n}}$ with values 1 or 0. Here ${\displaystyle \,I_{k}=1}$, called a success, stands for the event that the kth observation is interesting (as defined by the decision maker), and ${\displaystyle \,I_{k}=0}$ for non-interesting. We observe independent random variables ${\displaystyle I_{1},\,I_{2},\,\dots ,\,I_{n}}$ sequentially and want to select the last success.

Let ${\displaystyle \,p_{k}=P(\,I_{k}\,=1)}$ be the probability that the kth event is interesting. Further let ${\displaystyle \,q_{k}=\,1-p_{k}}$ and ${\displaystyle \,r_{k}=p_{k}/q_{k}}$.Note that ${\displaystyle \,r_{k}}$ represents the odds of the kth event turning out to be interesting, explaining the name of the odds-algorithm.

## Algorithmic procedure

The odds-algorithm sums up the odds in reverse order

${\displaystyle r_{n}+r_{n-1}+r_{n-2}\,+\cdots ,\,}$

until this sum reaches or exceeds the value 1 for the first time. If this happens at index s, it saves s and the corresponding sum

${\displaystyle R_{s}=\,r_{n}+r_{n-1}+r_{n-2}+\cdots +r_{s}.\,}$

If the sum of the odds does not reach 1, it sets s = 1. At the same time it computes

${\displaystyle Q_{s}=q_{n}q_{n-1}\cdots q_{s}.\,}$

The output is

1. ${\displaystyle \,s}$, the stopping threshold
2. ${\displaystyle \,w=Q_{s}R_{s}}$, the win probability.

## Odds-strategy

The odds-strategy is the rule to observe the events one after the other and to stop on the first interesting event from index s onwards (if any), where s is the stopping threshold of output a.

The importance of the odds-strategy, and hence of the odds-algorithm, lies in the following odds-theorem.

## Odds-theorem

The odds-theorem states that

1. The odds-strategy is optimal, that is, it maximizes the probability of stopping on the last 1.
2. The win probability of the odds-strategy equals ${\displaystyle \,w=Q_{s}R_{s}}$
3. If ${\displaystyle \,R_{s}\geq \,1}$, the win probability ${\displaystyle \,w}$ is always at least ${\displaystyle \,1/e=0.368\dots }$, and this lower bound is best possible.

## Features

The odds-algorithm computes the optimal strategy and the optimal win probability at the same time. Also, the number of operations of the odds-algorithm is (sub)linear in n. Hence no quicker algorithm can possibly exist for all sequences, so that the odds-algorithm is, at the same time, optimal as an algorithm.

## Sources

Bruss 2000 devised the odd-algorithm, and coined its name. It is also known as Bruss-algorithm (strategy). Free implementations can be found on the web.

## Applications

Applications reach from medical questions in clinical trials over sales problems, secretary problems, portfolio selection, (one-way) search strategies, trajectory problems and the parking problem to problems in on-line maintenance and others.

There exists, in the same spirit, an Odds-Theorem for continuous-time arrival processes with independent increments such as the Poisson processBruss. In some cases, the odds are not necessarily known in advance (as in Example 2 above) so that the application of the odds-algorithm is not directly possible. In this case each step can use sequential estimates of the odds. This is meaningful, if the number of unknown parameters is not large compared with the number n of observations. The question of optimality is then more complicated, however, and requires additional studies. Generalizations of the odds-algorithm allow for different rewards for failing to stop and wrong stops as well as replacing independence assumptions by weaker ones (Ferguson (2008)).

## Variations

Bruss & Paindaveine 2000 discussed a problem of selecting the last ${\displaystyle k}$ successes.

Tamaki 2010 proved a multiplicative odds theorem which deals with a problem of stopping at any of the last ${\displaystyle \ell }$ successes. A tight lower bound of win probability is obtained by Matsui & Ano 2014.

Matsui & Ano 2017 discussed a problem of selecting ${\displaystyle k}$ out of the last ${\displaystyle \ell }$ successes and obtained a tight lower bound of win probability. When ${\displaystyle \ell =k=1,}$ the problem is equivalent to Bruss' odds problem. If ${\displaystyle \ell =k\geq 1,}$ the problem is equivalent to that in Bruss & Paindaveine 2000. A problem discussed by Tamaki 2010 is obtained by setting ${\displaystyle \ell \geq k=1.}$

multiple choice problem: A player is allowed ${\displaystyle r}$ choices, and he wins if any choice is the last success. For classical secretary problem, Gilbert & Mosteller 1966 discussed the cases ${\displaystyle r=2,3,4}$. The odds problem with ${\displaystyle r=2,3}$ is discussed by Ano, Kakinuma & Miyoshi 2010. For further cases of odds problem, see Matsui & Ano 2016.

An optimal strategy belongs to the class of strategies defined by a set of threshold numbers ${\displaystyle (a_{1},a_{2},...,a_{r})}$, where ${\displaystyle a_{1}. The first choice is to be used on the first candidates starting with ${\displaystyle a_{1}}$th applicant, and once the first choice is used, second choice is to be used on the first candidate starting with ${\displaystyle a_{2}}$th applicant, and so on.

When ${\displaystyle r=2}$, Ano, Kakinuma & Miyoshi 2010 showed that the tight lower bound of win probability is equal to ${\displaystyle e^{-1}+e^{-{\frac {3}{2}}}.}$ For general positive integer ${\displaystyle r}$, Matsui & Ano 2016 discussed the tight lower bound of win probability. When ${\displaystyle r=3,4,5}$, tight lower bounds of win probabilities are equal to ${\displaystyle e^{-1}+e^{-{\frac {3}{2}}}+e^{-{\frac {47}{24}}}}$, ${\displaystyle e^{-1}+e^{-{\frac {3}{2}}}+e^{-{\frac {47}{24}}}+e^{-{\frac {2761}{1152}}}}$ and ${\displaystyle e^{-1}+e^{-{\frac {3}{2}}}+e^{-{\frac {47}{24}}}+e^{-{\frac {2761}{1152}}}+e^{-{\frac {4162637}{1474560}}},}$ respectively. For further cases that ${\displaystyle r=6,...,10}$, see Matsui & Ano 2016.

## References

• Ano, K.; Kakinuma, H.; Miyoshi, N. (2010). "Odds theorem with multiple selection chances" (PDF). Journal of Applied Probability. 47 (4): 1093–1104. doi:10.1239/jap/1294170522.CS1 maint: ref=harv (link)
• Bruss, F. Thomas (2000). "Sum the odds to one and stop". The Annals of Probability. Institute of Mathematical Statistics. 28 (3): 1384–1391. doi:10.1214/aop/1019160340. ISSN 0091-1798.CS1 maint: ref=harv (link)
• —: "A note on Bounds for the Odds-Theorem of Optimal Stopping", Annals of Probability Vol. 31, 1859–1862, (2003).
• —: "The art of a right decision", Newsletter of the European Mathematical Society, Issue 62, 14–20, (2005).
• T. S. Ferguson: (2008, unpublished)
• Bruss, F. T.; Paindaveine, D. (2000). "Selecting a sequence of last successes in independent trials" (PDF). Journal of Applied Probability. 37 (2): 389–399. doi:10.1239/jap/1014842544.CS1 maint: ref=harv (link)
• Gilbert, J; Mosteller, F (1966). "Recognizing the Maximum of a Sequence". Journal of the American Statistical Association. 61 (313): 35–73. doi:10.2307/2283044. JSTOR 2283044.CS1 maint: ref=harv (link)
• Matsui, T; Ano, K (2014). "A note on a lower bound for the multiplicative odds theorem of optimal stopping". Journal of Applied Probability. 51 (3): 885–889. doi:10.1239/jap/1409932681.CS1 maint: ref=harv (link)
• Matsui, T; Ano, K (2016). "Lower bounds for Bruss' odds problem with multiple stoppings". Mathematics of Operations Research. 41 (2): 700–714. arXiv:1204.5537. doi:10.1287/moor.2015.0748.CS1 maint: ref=harv (link)
• Matsui, T; Ano, K (2017). "Compare the ratio of symmetric polynomials of odds to one and stop". Journal of Applied Probability. 54: 12–22. doi:10.1017/jpr.2016.83.CS1 maint: ref=harv (link)
• Shoo-Ren Hsiao and Jiing-Ru. Yang: "Selecting the Last Success in Markov-Dependent Trials", Journal of Applied Probability, Vol. 93, 271–281, (2002).
• Tamaki, M (2010). "Sum the multiplicative odds to one and stop" (PDF). Journal of Applied Probability. 47 (3): 761–777. doi:10.1239/jap/1285335408.CS1 maint: ref=harv (link)
• Mitsushi Tamaki: "Optimal Stopping on Trajectories and the Ballot Problem", Journal of Applied Probability Vol. 38, 946–959 (2001).
• E. Thomas, E. Levrat, B. Iung: "L'algorithme de Bruss comme contribution à une maintenance préventive", Sciences et Technologies de l'automation, Vol. 4, 13-18 (2007).