AI Glossary / Mathematics and optimization / Intermediate
Odds algorithm
Definition
The odds algorithm is an optimal stopping rule for selecting the last success in a finite sequence of independent yes-or-no trials with known success probabilities. It adds success odds backward from the final trial until their sum reaches or exceeds one. That calculation determines when to begin accepting the first success encountered during forward observation.
What it means
The task has a specific objective: maximize the probability that the single success you choose is the sequence's last success. You observe outcomes one at a time, cannot return to an earlier opportunity, and do not know future outcomes. This differs from maximizing total reward, choosing the largest numerical value or predicting that a particular event is certain. F. Thomas Bruss's odds theorem supplies the rule under stated assumptions. Its elegance does not make it a general-purpose recommendation for real decisions with dependent events, uncertain probabilities or multiple objectives.
How it works
For trial i, let its success probability be p_i and failure probability be q_i = 1 − p_i. When q_i is positive, the success odds are r_i = p_i/q_i. Starting from the final trial, add these odds backward. Stop the backward calculation at the first index where the sum reaches or exceeds 1; if it never does, use the first index. During actual forward observation, ignore successes before that threshold and stop at the first success at or after it. If none occurs there, the rule cannot win. Probabilities equal to one require the theorem's special handling rather than ordinary finite division. Backward planning uses known probabilities, not advance access to realized outcomes.
Three practical examples
- A classroom simulation asks a participant to identify the last successful trial in a fixed sequence of independent random tests, making the rule directly applicable.
- An algorithm researcher uses the rule as a benchmark when evaluating learned stopping policies in an environment with known independent event probabilities.
- A carefully specified selection model can map record events to independent indicators, connecting the theorem with some best-choice problems. That mapping must be established; the ordinary sequence of business opportunities is not automatically independent.
Think of it this way
Think of watching a scheduled sequence of signal lights and being allowed to press a button once, hoping to catch the final green light. The algorithm identifies a waiting period followed by accepting the next green. The analogy captures irreversible timing, but it only inherits the theorem when the number of signals and their independent green probabilities meet the model assumptions.
Worked example
Consider five independent trials with success probabilities 0.1, 0.2, 0.3, 0.4 and 0.2. Starting at trial 5, the odds are 0.2/0.8 = 0.25. Adding trial 4 gives 0.25 + 0.4/0.6, approximately 0.9167. Adding trial 3 gives approximately 1.3452, so the threshold is trial 3. Ignore successes in trials 1 and 2, then take the first success among trials 3-5. The rule wins exactly when that tail contains one success. Its probability is 0.3 × 0.6 × 0.8 + 0.7 × 0.4 × 0.8 + 0.7 × 0.6 × 0.2 = 0.144 + 0.224 + 0.084 = 0.452. Beginning only at trial 4 would give 0.4 × 0.8 + 0.6 × 0.2 = 0.44. The optimal 0.452 probability still leaves substantial chance of losing; optimal does not mean certain.
Illustrative case study
In a fictional research exercise, Orchard Lab trains an agent to stop on the last successful event in a finite simulated sequence. The designers supply independent event probabilities and compare the agent with the odds algorithm. When they later introduce correlated events, they retain the old rule only as a baseline and derive or test a method suited to the changed environment. They do not describe the original theorem as a guarantee for the dependent setting. The illustration reports no measured research result.
Common misconceptions and mistakes
Add odds, not probabilities: p/(1 − p) is different from p. The threshold concerns where acceptance begins, not where a success is guaranteed. The objective is the last success, not the greatest payoff, longest wait or highest event probability. Unknown probabilities introduce estimation uncertainty, and dependent outcomes can invalidate the simple rule. The familiar value 1/e occurs in related settings and limiting results, but it is not the exact win probability for every odds-algorithm problem. Certain-success trials also need careful treatment to avoid undefined arithmetic.
Business use
The method is most useful as a precise decision-theory example or benchmark for a genuinely matching stopping problem. Before applying it, write down the objective, horizon, observation order, recall restrictions and probability assumptions. Test whether a success indicator represents the event that actually matters. In operational decisions, costs, multiple selections, variable rewards or changing information can require a different formulation. When probabilities are estimated from data, evaluate sensitivity to those estimates rather than presenting the theorem's known-probability optimum as an empirically guaranteed outcome.
People also ask
Does the algorithm predict the final success in advance?
No. It chooses an optimal stopping policy without observing future outcomes.
What if the total odds never reach one?
The basic rule begins accepting from the first trial.
Can it be used when events depend on one another?
Extensions exist, but the simple independent-trial theorem does not automatically apply. The dependence must be modeled and the relevant result checked.
Check your understanding
In the worked example, a success occurs at trial 2 and another at trial 4. What does the rule do?
Answer: It ignores trial 2 because the threshold is trial 3. If trial 3 fails, it stops at trial 4; it wins only if trial 5 then fails. A later success would make that otherwise valid choice lose.
Related terms
- Bernoulli trial
- Odds
- Stopping time
- Dynamic programming
- optimal stopping
- secretary problem
Learn next
enumerate all outcomes of a three-trial example and compare the win probabilities of different thresholds. Then replace independence with a shared hidden condition and examine why the original probability calculation no longer applies unchanged.
More in Mathematics and optimization
- Absolute error loss - Absolute error loss measures a numerical prediction's error as the absolute difference between its predicted and reference values: L(y,y-hat)=|y-y-hat|.
- Active-set method - An active-set method is an optimization approach that works with a changing subset of constraints believed to be tight at the solution.
- Adjoint state method - The adjoint state method computes how a chosen objective changes when the parameters of a mathematical model change.
- Σ-algebra
- Algebraic connectivity - Algebraic connectivity is the second-smallest eigenvalue of a graph's Laplacian matrix.
- Algorithm IMED - Algorithm IMED, short for Indexed Minimum Empirical Divergence, is a method for choosing actions in a stochastic multi-armed bandit problem.
Sources
Sources: F. Thomas Bruss, Sum the Odds to One and Stop, Theorem 1 and section 2.1, author-uploaded primary text, https://www.researchgate.net/publication/38351353_Sum_the_odds_to_one_and_stop ; original publication DOI, https://doi.org/10.1214/aop/1019160340 . The five-trial probabilities and arithmetic above are original illustrations of the stated theorem.
Previous: Odds Next: Odds ratio