Heilbronn's triangle problem
Better configurations for Heilbronn’s triangle problem in the unit square, n = 11–14

n = 11: 0.0322216088 from a restarted hill climb (seed 2026)
Browse files+22 −2 routes/wutao-cc-t2/README.md View file
| @@ -4,8 +4,28 @@ status: working | ||
| 4 | 4 | --- |
| 5 | 5 | # Route: wutao-cc-t2, a better n = 11 configuration |
| 6 | 6 | |
| 7 | -Goal: beat the n = 11 value held here (0.01399, `routes/annealing/n11.txt`). | |
| 7 | +Goal: beat the n = 11 value held here, 0.01399 (`routes/annealing/n11.txt`, also the only n = 11 file on `symmetric` and `adaptive`). | |
| 8 | + | |
| 9 | +## What I tried | |
| 10 | + | |
| 11 | +`search.py`: random restarts, each a hill climb that moves one point by a Gaussian step and keeps the move when the | |
| 12 | +smallest area (ties: the second smallest) does not drop; the step shrinks by 0.7 after 60 rejected moves in a row. | |
| 13 | +Pure Python, no dependencies. | |
| 14 | + | |
| 15 | +## What happened | |
| 16 | + | |
| 17 | +- Test run (seed 1, 4 restarts x 3000 iterations): 0.0196403546. | |
| 18 | +- Seed 2026, 200 restarts x 20000 iterations (98 s on one core): **0.0322216088**, in `n11.txt`. | |
| 19 | + `python3 verify.py routes/wutao-cc-t2` locally: `n = 11: 0.03222`. | |
| 20 | +- Still below the literature value 1/27 = 0.0370 (Goldberg 1972), so this is not a record. | |
| 21 | + | |
| 22 | +## Reproduce | |
| 23 | + | |
| 24 | +``` | |
| 25 | +python3 routes/wutao-cc-t2/search.py 11 2026 200 20000 routes/wutao-cc-t2/n11.txt | |
| 26 | +python3 verify.py routes/wutao-cc-t2 | |
| 27 | +``` | |
| 8 | 28 | |
| 9 | 29 | ## Next |
| 10 | 30 | |
| 11 | -Run a search of my own for n = 11 and push `n11.txt`. | |
| 31 | +Wait for the `verify` check on this push to name n = 11: 0.03222, then open a pull request into main. | |
+12 −0 routes/wutao-cc-t2/n11.txt added View file
| @@ -0,0 +1,12 @@ | ||
| 1 | +# n = 11, search.py seed 2026, 200 restarts x 20000 iterations | |
| 2 | +0.5551687689315955 0.7407564163443823 | |
| 3 | +0.8903650289968402 0.0 | |
| 4 | +0.2404023076938314 0.363893832540658 | |
| 5 | +0.41470454211477753 0.11041388927356695 | |
| 6 | +1.0 0.715197916839965 | |
| 7 | +0.2699777437588696 1.0 | |
| 8 | +0.11556475372075081 0.0 | |
| 9 | +1.0 0.11022168774509751 | |
| 10 | +0.8934087121624331 0.8668659099413367 | |
| 11 | +0.1191750386775862 0.911117175502115 | |
| 12 | +0.00011317121509647971 0.3426156232529306 | |
+54 −0 routes/wutao-cc-t2/search.py added View file
| @@ -0,0 +1,54 @@ | ||
| 1 | +#!/usr/bin/env python3 | |
| 2 | +"""Search for n points in the unit square with a large smallest triangle. | |
| 3 | + | |
| 4 | +Random restarts; each runs a hill climb that moves one point at a time and | |
| 5 | +keeps a move when the smallest area does not drop (ties broken by the second | |
| 6 | +smallest), with a step that shrinks when moves stop being accepted. | |
| 7 | +Usage: search.py N SEED RESTARTS ITERS OUT""" | |
| 8 | +import itertools | |
| 9 | +import random | |
| 10 | +import sys | |
| 11 | + | |
| 12 | + | |
| 13 | +def areas(p, tri): | |
| 14 | + return sorted(abs((p[b][0] - p[a][0]) * (p[c][1] - p[a][1]) - (p[c][0] - p[a][0]) * (p[b][1] - p[a][1])) / 2 | |
| 15 | + for a, b, c in tri) | |
| 16 | + | |
| 17 | + | |
| 18 | +def climb(p, tri, rng, iters): | |
| 19 | + s = areas(p, tri)[:2] | |
| 20 | + step = 0.1 | |
| 21 | + fails = 0 | |
| 22 | + for _ in range(iters): | |
| 23 | + i = rng.randrange(len(p)) | |
| 24 | + old = p[i] | |
| 25 | + p[i] = (min(1.0, max(0.0, old[0] + rng.gauss(0, step))), min(1.0, max(0.0, old[1] + rng.gauss(0, step)))) | |
| 26 | + t = areas(p, tri)[:2] | |
| 27 | + if t >= s: | |
| 28 | + s, fails = t, 0 | |
| 29 | + else: | |
| 30 | + p[i] = old | |
| 31 | + fails += 1 | |
| 32 | + if fails > 60: | |
| 33 | + step, fails = max(step * 0.7, 1e-7), 0 | |
| 34 | + return s[0] | |
| 35 | + | |
| 36 | + | |
| 37 | +def main(): | |
| 38 | + n, seed, restarts, iters, out = int(sys.argv[1]), int(sys.argv[2]), int(sys.argv[3]), int(sys.argv[4]), sys.argv[5] | |
| 39 | + rng = random.Random(seed) | |
| 40 | + tri = list(itertools.combinations(range(n), 3)) | |
| 41 | + best, best_p = -1, None | |
| 42 | + for r in range(restarts): | |
| 43 | + p = [(rng.random(), rng.random()) for _ in range(n)] | |
| 44 | + v = climb(p, tri, rng, iters) | |
| 45 | + if v > best: | |
| 46 | + best, best_p = v, list(p) | |
| 47 | + print(f"restart {r}: {v:.10f}", flush=True) | |
| 48 | + with open(out, "w") as f: | |
| 49 | + f.write(f"# n = {n}, search.py seed {seed}, {restarts} restarts x {iters} iterations\n") | |
| 50 | + f.writelines(f"{x!r} {y!r}\n" for x, y in best_p) | |
| 51 | + print(f"best {best:.10f}") | |
| 52 | + | |
| 53 | + | |
| 54 | +main() | |