What does Bayesian Search and Optimal Stopping conclude, in numbers, about “Bayesian Search: Where to Look, and What Not Finding Means”?
Answer: Search theory writes "where to look" in terms of three ingredients: the prior, the detection function and Bayesian updating; the greedy rule for the next search picks the place with the largest product of posterior probability and detection probability. Not finding is information, pushing probability from easy places towards hard ones. On the illustrative grid, searching by the product is faster than looking only at probability or sweeping outwards. The *Scorpion* and AF 447 cases show that a good prior and honest detection probabilities are crucial; AF 447 in particular shows that assumptions about the effectiveness of past searches must themselves be put into the model and updated. In foraging ecology the marginal value theorem writes "when to leave a patch" as stopping when the marginal rate of gain falls to the average rate; "Lévy flights are optimal" holds only under conditions such as sparse, revisitable targets, and whether animals really search this way is still disputed. The next chapter turns to another kind of search: allocating a limited number of tries among several options with uncertain payoffs.
Scope of the numbers: Marked boxes separate published evidence, runnable Python calculations (17 programs, all checked), classical sources and the author's hypotheses.
Data table
The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it. standard-library Python only
| prior: 197 cells possible; top 10 hold 0.119, top 50 hold 0.473 | ||||||
| P(found by day t) | t=1 | t=5 | t=10 | t=20 | t=40 | mean days |
| A largest p x d | 0.088 | 0.311 | 0.484 | 0.694 | 0.892 | 17.5 |
| B largest p | 0.067 | 0.287 | 0.459 | 0.672 | 0.888 | 18.3 |
| C sweep | 0.071 | 0.262 | 0.451 | 0.665 | 0.850 | 21.3 |
| plan A, no success: rough-cell mass after 0/1/5/20 days: 0.349 0.382 0.465 0.559 | ||||||
| top cell after 1/5/20 days: (11, 8) 0.0139, (12, 9) 0.0158, (10, 7) 0.0136 |
Key formula
Show the full program
# Bayesian search, invented 20 x 20 sea area, 10 looks a day; prior and detection
# probabilities as in the text. Plans: (A) largest p_c d_c; (B) largest p_c; (C) sweep.
import math
N, LKP, DRIFT, LOOKS = 20, (8, 10), (12, 7), 10
CELLS = [(x, y) for x in range(N) for y in range(N)]
def prior():
inside = [c for c in CELLS if math.dist(c, LKP) <= 8]
p = {c: 0.0 for c in CELLS}
for w, m, s in ((0.35, LKP, None), (0.35, LKP, 3.0), (0.30, DRIFT, 2.5)):
part = {c: 1.0 if s is None else math.exp(-math.dist(c, m) ** 2 / (2 * s * s))
for c in inside}
tot = sum(part.values())
for c, v in part.items():
p[c] += w * v / tot
return p
def detect(c):
return 0.4 if c[0] >= 13 or abs(c[0] - c[1] - 2) <= 1 else 0.8
def update(p, c): # unsuccessful look at c (Bayes's rule)
miss = 1 - p[c] * detect(c)
for k in p:
p[k] /= miss
p[c] *= 1 - detect(c)
return miss
def run(plan, days):
p, found, curve, snaps, k = prior(), 0.0, [], {}, 0
sweep = sorted((c for c in CELLS if math.dist(c, LKP) <= 8),
key=lambda c: (math.dist(c, LKP), c))
for day in range(1, days + 1):
for _ in range(LOOKS):
if plan == "A":
c = max(CELLS, key=lambda c: p[c] * detect(c))
elif plan == "B":
c = max(CELLS, key=lambda c: p[c])
else:
c = sweep[k % len(sweep)]; k += 1
found += (1 - found) * (1 - update(p, c))
curve.append(found)
if day in (1, 5, 20):
snaps[day] = dict(p)
return curve, snaps
if __name__ == "__main__":
p0 = prior(); top = sorted(p0.values(), reverse=True)
print(f"prior: {sum(v > 0 for v in p0.values())} cells possible;"
f" top 10 hold {sum(top[:10]):.3f}, top 50 hold {sum(top[:50]):.3f}")
print("P(found by day t) t=1 t=5 t=10 t=20 t=40 mean days")
for plan, name in (("A", "A largest p x d"), ("B", "B largest p"), ("C", "C sweep")):
curve, _ = run(plan, 120)
cols = "".join(f" {curve[t - 1]:.3f}" for t in (1, 5, 10, 20, 40))
print(f" {name:25s}{cols} {sum(1 - f for f in curve) + 1:6.1f}")
snaps = run("A", 20)[1]
rough = lambda p: sum(v for k, v in p.items() if detect(k) < 0.5)
print("plan A, no success: rough-cell mass after 0/1/5/20 days: " + " ".join(
f"{rough(p):.3f}" for p in (p0, *snaps.values())))
tops = [(max(CELLS, key=lambda c: p[c]), max(p.values())) for p in snaps.values()]
print(" top cell after 1/5/20 days: " + ", ".join(f"{c} {v:.4f}" for c, v in tops))Single source and citation
Fan, Y. (2026). Bayesian Search in Unknown Landscapes, Optimal Stopping and Gittins Indices (Version 1.0.0), Chapter 3: Bayesian Search: Where to Look, and What Not Finding Means. 5D Library. https://doi.org/10.5281/zenodo.23810102
DOI: 10.5281/zenodo.23810102 · Read the monograph · 5DL-B-042 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026042,
author = {Fan, Yafu},
title = {Bayesian Search in Unknown Landscapes, Optimal Stopping and Gittins Indices},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
doi = {10.5281/zenodo.23810102},
url = {https://doi.org/10.5281/zenodo.23810102}
}Other chapter answers in this book
- Chapter 1 · The Secretary Problem and 1/e: When to Stop If You See Only Ranks and Cannot Go Back
- Chapter 2 · Variants of the Secretary Problem and How People Stop
- Chapter 4 · Multi-Armed Bandits: Gittins Indices, Thompson Sampling and the Regret Lower Bound
- Chapter 5 · Sunk Costs: Rational Persistence, Fallacious Persistence and Stop-Loss Boundaries Set in Advance
- Chapter 6 · Applications: Testing Lanes and Selecting People
- Chapter 8 · Practice and a Pre-Registered Trial