Purpose: Solve a linear program with constraints in fixed dimension in expected — linear in , which is exactly what low-dimensional geometry problems need.
The Idea: randomized incremental with backwards analysis
- Shuffle the constraints randomly.
- Add them one at a time, maintaining the current optimum .
- When constraint is added:
- if already satisfies it, nothing changes — this is the common case;
- otherwise the new optimum must lie on the boundary hyperplane of constraint . Project the previous constraints onto that hyperplane and solve a -dimensional LP recursively.
The analysis (backwards analysis)
After constraints have been added, the optimum is determined by exactly of them. Since the order was random, the probability that the -th constraint added is one of those is . So the expected cost is
The is harmless for or — which covers essentially every geometric LP that appears in practice.
Complexity
- Time: expected
- Space:
- Deterministic alternative: Megiddo’s algorithm, — linear in but with a far worse constant
Backwards analysis is the real lesson
“What is the probability that the last element added was important?” is a remarkably powerful proof technique. It gives clean expected bounds for:
| Algorithm | Backwards analysis says |
|---|---|
| Seidel’s LP | \Pr[\text{i-th constraint is binding}] = d/i |
| Welzl’s minimum enclosing circle | \Pr[\text{i-th point is on the circle}] = 3/i |
| Randomized incremental Delaunay | expected structural change per insertion |
| Randomized quicksort | expected |
| Treap depth | expected |
Learning to run this argument is worth more than memorising any single algorithm on the list.
Contest applications of 2D/3D LP
- Half-plane intersection feasibility — is the intersection of half-planes non-empty? That is a 2D LP.
- Chebyshev centre — the largest inscribed circle in a convex polygon
- Smallest enclosing circle — an LP-type problem; Welzl is the specialised version
- Line fitting under — minimise the maximum vertical error, a 2D LP
- Feasibility of difference constraints — although those are better solved by Bellman-Ford
LP-type problems
Seidel’s algorithm generalises to any LP-type problem: an optimisation over a set system with a well-defined “combinatorial dimension” , satisfying monotonicity and locality axioms. Minimum enclosing ball, minimum enclosing ellipsoid, smallest enclosing annulus, and distance between polytopes are all LP-type, and all solvable in expected for fixed dimension by the same framework (Sharir-Welzl, Matoušek-Sharir-Welzl).
Variants / Use Cases
- Welzl’s algorithm — the minimum enclosing circle special case
- Half-Plane Intersection — the construction when you need the whole region, not just a point
- Simplex method — the general-purpose LP algorithm for large ; exponential worst case, excellent in practice
- Geometry — the branch overview