FA-87656 / Collision detection broadphase / Open access
Axis variance uses the sample denominator · case 01
Reported spread disagrees with the population-variance contract.
ROOT CAUSE
Variance divides by n-1.
VERIFIED REPAIR
Divide by n.
Unsuccessful approach: Dividing by n squared shrinks the variance.
Case contract
solve(boxes): 3D sweep-and-prune axis selection. Boxes [id,minx,miny,minz,maxx,maxy,maxz]. Pick the axis with the largest population variance of box centres (first axis on ties), then order ids by (min on that axis, id). Return [axis, variance rounded to 6, ordered ids].
Why this case matters
Broadphase stages decide which object pairs ever reach narrowphase; a wrong boundary, ordering or bookkeeping rule silently drops real contacts or floods the solver with false candidates.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(boxes):
n = len(boxes)
best_axis, best_var = 0, -1.0
for ax in (0, 1, 2):
cs_ = [(b[1 + ax] + b[4 + ax]) / 2 for b in boxes]
mean = sum(cs_) / n
var = sum((c - mean) ** 2 for c in cs_) / (n - 1)
if var > best_var:
best_axis, best_var = ax, var
order = [b[0] for b in sorted(boxes, key=lambda b: (b[1 + best_axis], b[0]))]
return [best_axis, round(best_var, 6), order]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[[[7, 10, 7, 2, 10, 17, 9], [6, 3, 0, 1, 10, 4, 7]]], [1, 25.0, [6, 7]]], [[[[8, 2, 6, 0, 4, 13, 8], [1, 2, 3, 2, 8, 6, 9], [21, 2, 10, 0, 7, 14, 0], [12, 1, 5, 2, 3, 12, 7]]], [1, 7.296875, [1, 12, 8, 21]]], [[[[8, 0, 22, 17, 8, 31, 23], [14, 1, 2, 25, 1, 9, 25], [38, 0, 25, 6, 7, 35, 17], [36, 1, 11, 9, 11, 19, 12]]], [1, 93.8125, [14, 36, 8, 38]]], [[[[6, 4, 13, 9, 14, 22, 21], [7, 0, 28, 11, 5, 33, 18], [22, 7, 2, 27, 19, 9, 28], [12, 2, 9, 17, 13, 16, 25], [29, 3, 10, 19, 4, 19, 25]]], [1, 67.44, [22, 12, 29, 6, 7]]], [[[[17, 4, 16, 17, 8, 16, 20], [26, 1, 24, 26, 5, 25, 26]]], [1, 18.0625, [17, 26]]], [[[[29, 0, 28, 2, 10, 36, 4], [2, 8, 1, 1, 9, 5, 4]]], [1, 210.25, [2, 29]]], [[[[28, 23, 1, 1, 25, 7, 13], [30, 23, 2, 1, 30, 4, 1]]], [2, 9.0, [28, 30]]], [[[[28, 12, 13, 1, 14, 25, 5], [36, 10, 28, 0, 10, 32, 6], [17, 4, 16, 0, 7, 28, 9], [26, 2, 16, 0, 14, 27, 3], [20, 6, 12, 2, 14, 19, 13], [38, 17, 9, 0, 22, 18, 3]]], [1, 28.229167, [38, 20, 28, 17, 26, 36]]]], [[[[[39, 1, 1, 0, 5, 13, 6], [18, 7, 0, 0, 14, 8, 6], [17, 9, 0, 2, 15, 12, 13]]], [0, 15.5, [39, 18, 17]]], [[[[26, 6, 1, 2, 14, 9, 9], [3, 2, 1, 0, 5, 7, 1], [1, 0, 0, 2, 7, 9, 9], [28, 6, 1, 0, 9, 4, 6], [31, 10, 1, 2, 17, 13, 9], [24, 9, 0, 0, 15, 11, 9], [2, 3, 0, 2, 9, 4, 7]]], [0, 13.571429, [1, 3, 2, 26, 28, 24, 31]]], [[[[22, 2, 5, 2, 5, 17, 10], [8, 0, 7, 2, 5, 8, 7], [36, 2, 3, 2, 9, 14, 13], [15, 1, 10, 0, 9, 10, 2], [29, 0, 10, 2, 7, 10, 9], [26, 0, 4, 2, 12, 10, 4], [10, 0, 10, 0, 2, 19, 0]]], [2, 6.387755, [10, 15, 8, 22, 26, 29, 36]]], [[[[12, 1, 30, 8, 1, 34, 9], [30, 2, 5, 13, 5, 8, 24], [24, 0, 10, 8, 4, 11, 15], [36, 0, 24, 13, 3, 33, 17], [19, 0, 22, 22, 9, 29, 31], [29, 2, 20, 23, 6, 27, 31]]], [1, 87.368056, [30, 24, 29, 19, 36, 12]]], [[[[15, 1, 2, 1, 13, 9, 2], [20, 9, 0, 2, 19, 12, 7], [24, 5, 2, 0, 15, 8, 8], [9, 7, 2, 2, 9, 7, 8]]], [0, 7.1875, [15, 24, 9, 20]]], [[[[22, 2, 0, 1, 4, 7, 7], [23, 1, 15, 0, 11, 20, 9], [12, 1, 22, 2, 4, 29, 7], [15, 0, 3, 1, 7, 11, 10]]], [1, 75.546875, [22, 15, 23, 12]]], [[[[3, 27, 2, 2, 37, 6, 5], [35, 0, 10, 1, 10, 13, 13]]], [0, 182.25, [35, 3]]], [[[[10, 16, 11, 2, 26, 12, 10], [17, 16, 18, 0, 25, 27, 3], [1, 27, 13, 1, 32, 20, 1], [28, 23, 10, 2, 30, 21, 12], [16, 6, 2, 2, 17, 2, 8], [34, 14, 3, 1, 22, 4, 12], [23, 21, 10, 1, 32, 18, 11]]], [1, 45.561224, [16, 34, 23, 28, 10, 1, 17]]]], [[[[[1, 27, 25, 1, 39, 34, 10], [35, 21, 20, 2, 32, 29, 5], [22, 6, 14, 1, 10, 16, 12], [13, 3, 27, 2, 4, 34, 7], [8, 19, 15, 1, 26, 25, 12], [39, 0, 16, 0, 6, 22, 12]]], [0, 138.451389, [39, 13, 22, 8, 35, 1]]], [[[[26, 9, 1, 0, 13, 5, 12], [3, 20, 1, 0, 23, 12, 5], [21, 18, 1, 1, 24, 12, 3], [28, 11, 0, 1, 15, 12, 6], [38, 12, 0, 0, 23, 8, 6]]], [0, 17.66, [26, 28, 38, 21, 3]]], [[[[10, 0, 20, 25, 2, 29, 28], [24, 0, 3, 20, 11, 11, 24], [39, 0, 20, 8, 10, 32, 14], [33, 2, 17, 12, 9, 19, 22], [3, 2, 11, 27, 2, 21, 31], [7, 2, 25, 8, 14, 29, 16], [30, 2, 10, 27, 8, 10, 31], [38, 2, 14, 4, 11, 20, 11]]], [2, 64.25, [38, 7, 39, 33, 24, 10, 3, 30]]], [[[[37, 8, 1, 0, 14, 5, 1], [38, 0, 2, 22, 7, 5, 25], [10, 3, 5, 29, 7, 12, 38], [35, 6, 7, 7, 6, 19, 16]]], [2, 154.1875, [37, 35, 38, 10]]], [[[[11, 1, 10, 9, 4, 20, 10], [5, 5, 8, 7, 7, 13, 13], [19, 9, 7, 6, 14, 14, 13], [30, 8, 4, 3, 16, 9, 5], [6, 10, 4, 1, 13, 11, 12], [8, 6, 0, 2, 8, 2, 3], [13, 9, 3, 9, 12, 6, 10]]], [1, 17.887755, [8, 13, 6, 30, 19, 5, 11]]], [[[[6, 1, 2, 1, 11, 14, 4], [37, 2, 1, 1, 8, 10, 7]]], [1, 1.5625, [37, 6]]], [[[[22, 2, 1, 7, 8, 10, 10], [30, 0, 7, 6, 2, 7, 7], [29, 2, 8, 7, 12, 8, 14], [24, 1, 5, 10, 7, 9, 13], [4, 0, 4, 3, 1, 4, 12], [33, 2, 4, 10, 12, 5, 11], [20, 2, 9, 4, 5, 12, 11]]], [0, 5.785714, [4, 30, 24, 20, 22, 29, 33]]], [[[[15, 5, 0, 1, 7, 10, 3], [39, 7, 2, 0, 15, 11, 6], [35, 5, 1, 1, 9, 7, 1]]], [0, 4.666667, [15, 35, 39]]]], [[[[[18, 0, 4, 7, 11, 9, 12], [38, 2, 4, 3, 6, 10, 7], [3, 1, 6, 28, 4, 16, 28]]], [2, 99.055556, [38, 18, 3]]], [[[[22, 2, 2, 2, 7, 13, 8], [23, 0, 1, 0, 4, 8, 12], [1, 0, 1, 2, 3, 13, 4], [34, 2, 1, 2, 14, 6, 5]]], [0, 6.625, [1, 23, 22, 34]]], [[[[31, 25, 0, 0, 35, 10, 4], [12, 24, 1, 6, 35, 7, 13], [4, 18, 0, 5, 24, 2, 9]]], [0, 17.055556, [4, 12, 31]]], [[[[4, 6, 29, 13, 17, 29, 18], [19, 10, 18, 11, 11, 20, 14], [21, 1, 28, 8, 11, 30, 19], [16, 6, 17, 10, 8, 24, 11]]], [1, 21.671875, [16, 19, 21, 4]]], [[[[17, 1, 27, 2, 6, 38, 9], [15, 2, 20, 1, 4, 24, 1], [6, 0, 23, 0, 3, 28, 9], [10, 2, 13, 2, 6, 22, 10]]], [1, 30.046875, [10, 15, 6, 17]]], [[[[17, 6, 7, 0, 14, 15, 10], [23, 1, 8, 0, 2, 15, 0], [38, 4, 3, 1, 5, 12, 13]]], [0, 12.388889, [23, 38, 17]]], [[[[39, 9, 10, 0, 20, 17, 8], [9, 5, 9, 16, 10, 20, 24], [4, 3, 10, 6, 12, 18, 14]]], [2, 43.555556, [39, 4, 9]]], [[[[3, 4, 1, 1, 9, 9, 12], [13, 10, 1, 0, 22, 10, 1], [25, 2, 7, 1, 11, 17, 6], [23, 2, 8, 0, 10, 17, 5], [24, 2, 6, 2, 5, 10, 11]]], [0, 18.46, [23, 24, 25, 3, 13]]]], [[[[[5, 1, 5, 2, 11, 8, 6], [29, 2, 3, 6, 2, 13, 7]]], [0, 4.0, [5, 29]]], [[[[28, 1, 20, 1, 3, 26, 5], [7, 2, 12, 2, 8, 24, 5], [3, 0, 2, 1, 7, 9, 5]]], [1, 54.166667, [3, 7, 28]]], [[[[37, 0, 1, 0, 6, 8, 3], [32, 2, 2, 0, 10, 13, 4], [12, 0, 1, 0, 7, 7, 3], [2, 1, 0, 0, 3, 3, 12], [33, 2, 1, 0, 8, 11, 7], [16, 1, 2, 1, 4, 2, 9]]], [1, 4.395833, [2, 12, 33, 37, 16, 32]]], [[[[13, 5, 25, 23, 5, 26, 29], [19, 24, 6, 27, 32, 14, 33], [17, 1, 2, 17, 11, 9, 22], [4, 21, 25, 22, 27, 30, 24], [27, 29, 26, 1, 38, 30, 9], [30, 11, 22, 2, 13, 32, 7]]], [0, 120.868056, [17, 13, 30, 4, 19, 27]]], [[[[18, 10, 21, 1, 14, 27, 2], [16, 20, 5, 1, 26, 8, 11], [1, 6, 4, 2, 9, 7, 11]]], [1, 72.166667, [1, 16, 18]]], [[[[20, 6, 5, 14, 17, 10, 18], [9, 4, 6, 10, 16, 9, 19], [34, 2, 0, 14, 5, 7, 18], [1, 1, 1, 21, 4, 7, 26]]], [0, 15.421875, [1, 34, 9, 20]]], [[[[23, 23, 14, 0, 35, 18, 11], [31, 23, 5, 16, 26, 8, 19], [2, 0, 10, 28, 10, 21, 29], [18, 7, 19, 0, 17, 20, 5], [12, 7, 19, 14, 7, 25, 26], [36, 17, 1, 23, 18, 13, 29]]], [2, 94.055556, [18, 23, 12, 31, 36, 2]]], [[[[39, 2, 0, 8, 8, 1, 9], [2, 0, 7, 17, 6, 17, 19]]], [1, 33.0625, [39, 2]]]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
check("case %d" % i, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| case 0 | [1, 50.0, [6, 7]] | [1, 25.0, [6, 7]] | Failed |
| case 1 | [1, 9.729167, [1, 12, 8, 21]] | [1, 7.296875, [1, 12, 8, 21]] | Failed |
| case 2 | [1, 125.083333, [14, 36, 8, 38]] | [1, 93.8125, [14, 36, 8, 38]] | Failed |
| case 3 | [1, 84.3, [22, 12, 29, 6, 7]] | [1, 67.44, [22, 12, 29, 6, 7]] | Failed |
| case 4 | [1, 36.125, [17, 26]] | [1, 18.0625, [17, 26]] | Failed |
| case 5 | [1, 420.5, [2, 29]] | [1, 210.25, [2, 29]] | Failed |
| case 6 | [2, 18.0, [28, 30]] | [2, 9.0, [28, 30]] | Failed |
| case 7 | [1, 33.875, [38, 20, 28, 17, 26, 36]] | [1, 28.229167, [38, 20, 28, 17, 26, 36]] | Failed |
SHA-256 / 1b51032907ee1d959e5c3d529e4f8fa84d3f197e780bd2fd257409b6d4bfa399
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(boxes):
n = len(boxes)
best_axis, best_var = 0, -1.0
for ax in (0, 1, 2):
cs_ = [(b[1 + ax] + b[4 + ax]) / 2 for b in boxes]
mean = sum(cs_) / n
var = sum((c - mean) ** 2 for c in cs_) / n ** 2
if var > best_var:
best_axis, best_var = ax, var
order = [b[0] for b in sorted(boxes, key=lambda b: (b[1 + best_axis], b[0]))]
return [best_axis, round(best_var, 6), order]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[[[7, 10, 7, 2, 10, 17, 9], [6, 3, 0, 1, 10, 4, 7]]], [1, 25.0, [6, 7]]], [[[[8, 2, 6, 0, 4, 13, 8], [1, 2, 3, 2, 8, 6, 9], [21, 2, 10, 0, 7, 14, 0], [12, 1, 5, 2, 3, 12, 7]]], [1, 7.296875, [1, 12, 8, 21]]], [[[[8, 0, 22, 17, 8, 31, 23], [14, 1, 2, 25, 1, 9, 25], [38, 0, 25, 6, 7, 35, 17], [36, 1, 11, 9, 11, 19, 12]]], [1, 93.8125, [14, 36, 8, 38]]], [[[[6, 4, 13, 9, 14, 22, 21], [7, 0, 28, 11, 5, 33, 18], [22, 7, 2, 27, 19, 9, 28], [12, 2, 9, 17, 13, 16, 25], [29, 3, 10, 19, 4, 19, 25]]], [1, 67.44, [22, 12, 29, 6, 7]]], [[[[17, 4, 16, 17, 8, 16, 20], [26, 1, 24, 26, 5, 25, 26]]], [1, 18.0625, [17, 26]]], [[[[29, 0, 28, 2, 10, 36, 4], [2, 8, 1, 1, 9, 5, 4]]], [1, 210.25, [2, 29]]], [[[[28, 23, 1, 1, 25, 7, 13], [30, 23, 2, 1, 30, 4, 1]]], [2, 9.0, [28, 30]]], [[[[28, 12, 13, 1, 14, 25, 5], [36, 10, 28, 0, 10, 32, 6], [17, 4, 16, 0, 7, 28, 9], [26, 2, 16, 0, 14, 27, 3], [20, 6, 12, 2, 14, 19, 13], [38, 17, 9, 0, 22, 18, 3]]], [1, 28.229167, [38, 20, 28, 17, 26, 36]]]], [[[[[39, 1, 1, 0, 5, 13, 6], [18, 7, 0, 0, 14, 8, 6], [17, 9, 0, 2, 15, 12, 13]]], [0, 15.5, [39, 18, 17]]], [[[[26, 6, 1, 2, 14, 9, 9], [3, 2, 1, 0, 5, 7, 1], [1, 0, 0, 2, 7, 9, 9], [28, 6, 1, 0, 9, 4, 6], [31, 10, 1, 2, 17, 13, 9], [24, 9, 0, 0, 15, 11, 9], [2, 3, 0, 2, 9, 4, 7]]], [0, 13.571429, [1, 3, 2, 26, 28, 24, 31]]], [[[[22, 2, 5, 2, 5, 17, 10], [8, 0, 7, 2, 5, 8, 7], [36, 2, 3, 2, 9, 14, 13], [15, 1, 10, 0, 9, 10, 2], [29, 0, 10, 2, 7, 10, 9], [26, 0, 4, 2, 12, 10, 4], [10, 0, 10, 0, 2, 19, 0]]], [2, 6.387755, [10, 15, 8, 22, 26, 29, 36]]], [[[[12, 1, 30, 8, 1, 34, 9], [30, 2, 5, 13, 5, 8, 24], [24, 0, 10, 8, 4, 11, 15], [36, 0, 24, 13, 3, 33, 17], [19, 0, 22, 22, 9, 29, 31], [29, 2, 20, 23, 6, 27, 31]]], [1, 87.368056, [30, 24, 29, 19, 36, 12]]], [[[[15, 1, 2, 1, 13, 9, 2], [20, 9, 0, 2, 19, 12, 7], [24, 5, 2, 0, 15, 8, 8], [9, 7, 2, 2, 9, 7, 8]]], [0, 7.1875, [15, 24, 9, 20]]], [[[[22, 2, 0, 1, 4, 7, 7], [23, 1, 15, 0, 11, 20, 9], [12, 1, 22, 2, 4, 29, 7], [15, 0, 3, 1, 7, 11, 10]]], [1, 75.546875, [22, 15, 23, 12]]], [[[[3, 27, 2, 2, 37, 6, 5], [35, 0, 10, 1, 10, 13, 13]]], [0, 182.25, [35, 3]]], [[[[10, 16, 11, 2, 26, 12, 10], [17, 16, 18, 0, 25, 27, 3], [1, 27, 13, 1, 32, 20, 1], [28, 23, 10, 2, 30, 21, 12], [16, 6, 2, 2, 17, 2, 8], [34, 14, 3, 1, 22, 4, 12], [23, 21, 10, 1, 32, 18, 11]]], [1, 45.561224, [16, 34, 23, 28, 10, 1, 17]]]], [[[[[1, 27, 25, 1, 39, 34, 10], [35, 21, 20, 2, 32, 29, 5], [22, 6, 14, 1, 10, 16, 12], [13, 3, 27, 2, 4, 34, 7], [8, 19, 15, 1, 26, 25, 12], [39, 0, 16, 0, 6, 22, 12]]], [0, 138.451389, [39, 13, 22, 8, 35, 1]]], [[[[26, 9, 1, 0, 13, 5, 12], [3, 20, 1, 0, 23, 12, 5], [21, 18, 1, 1, 24, 12, 3], [28, 11, 0, 1, 15, 12, 6], [38, 12, 0, 0, 23, 8, 6]]], [0, 17.66, [26, 28, 38, 21, 3]]], [[[[10, 0, 20, 25, 2, 29, 28], [24, 0, 3, 20, 11, 11, 24], [39, 0, 20, 8, 10, 32, 14], [33, 2, 17, 12, 9, 19, 22], [3, 2, 11, 27, 2, 21, 31], [7, 2, 25, 8, 14, 29, 16], [30, 2, 10, 27, 8, 10, 31], [38, 2, 14, 4, 11, 20, 11]]], [2, 64.25, [38, 7, 39, 33, 24, 10, 3, 30]]], [[[[37, 8, 1, 0, 14, 5, 1], [38, 0, 2, 22, 7, 5, 25], [10, 3, 5, 29, 7, 12, 38], [35, 6, 7, 7, 6, 19, 16]]], [2, 154.1875, [37, 35, 38, 10]]], [[[[11, 1, 10, 9, 4, 20, 10], [5, 5, 8, 7, 7, 13, 13], [19, 9, 7, 6, 14, 14, 13], [30, 8, 4, 3, 16, 9, 5], [6, 10, 4, 1, 13, 11, 12], [8, 6, 0, 2, 8, 2, 3], [13, 9, 3, 9, 12, 6, 10]]], [1, 17.887755, [8, 13, 6, 30, 19, 5, 11]]], [[[[6, 1, 2, 1, 11, 14, 4], [37, 2, 1, 1, 8, 10, 7]]], [1, 1.5625, [37, 6]]], [[[[22, 2, 1, 7, 8, 10, 10], [30, 0, 7, 6, 2, 7, 7], [29, 2, 8, 7, 12, 8, 14], [24, 1, 5, 10, 7, 9, 13], [4, 0, 4, 3, 1, 4, 12], [33, 2, 4, 10, 12, 5, 11], [20, 2, 9, 4, 5, 12, 11]]], [0, 5.785714, [4, 30, 24, 20, 22, 29, 33]]], [[[[15, 5, 0, 1, 7, 10, 3], [39, 7, 2, 0, 15, 11, 6], [35, 5, 1, 1, 9, 7, 1]]], [0, 4.666667, [15, 35, 39]]]], [[[[[18, 0, 4, 7, 11, 9, 12], [38, 2, 4, 3, 6, 10, 7], [3, 1, 6, 28, 4, 16, 28]]], [2, 99.055556, [38, 18, 3]]], [[[[22, 2, 2, 2, 7, 13, 8], [23, 0, 1, 0, 4, 8, 12], [1, 0, 1, 2, 3, 13, 4], [34, 2, 1, 2, 14, 6, 5]]], [0, 6.625, [1, 23, 22, 34]]], [[[[31, 25, 0, 0, 35, 10, 4], [12, 24, 1, 6, 35, 7, 13], [4, 18, 0, 5, 24, 2, 9]]], [0, 17.055556, [4, 12, 31]]], [[[[4, 6, 29, 13, 17, 29, 18], [19, 10, 18, 11, 11, 20, 14], [21, 1, 28, 8, 11, 30, 19], [16, 6, 17, 10, 8, 24, 11]]], [1, 21.671875, [16, 19, 21, 4]]], [[[[17, 1, 27, 2, 6, 38, 9], [15, 2, 20, 1, 4, 24, 1], [6, 0, 23, 0, 3, 28, 9], [10, 2, 13, 2, 6, 22, 10]]], [1, 30.046875, [10, 15, 6, 17]]], [[[[17, 6, 7, 0, 14, 15, 10], [23, 1, 8, 0, 2, 15, 0], [38, 4, 3, 1, 5, 12, 13]]], [0, 12.388889, [23, 38, 17]]], [[[[39, 9, 10, 0, 20, 17, 8], [9, 5, 9, 16, 10, 20, 24], [4, 3, 10, 6, 12, 18, 14]]], [2, 43.555556, [39, 4, 9]]], [[[[3, 4, 1, 1, 9, 9, 12], [13, 10, 1, 0, 22, 10, 1], [25, 2, 7, 1, 11, 17, 6], [23, 2, 8, 0, 10, 17, 5], [24, 2, 6, 2, 5, 10, 11]]], [0, 18.46, [23, 24, 25, 3, 13]]]], [[[[[5, 1, 5, 2, 11, 8, 6], [29, 2, 3, 6, 2, 13, 7]]], [0, 4.0, [5, 29]]], [[[[28, 1, 20, 1, 3, 26, 5], [7, 2, 12, 2, 8, 24, 5], [3, 0, 2, 1, 7, 9, 5]]], [1, 54.166667, [3, 7, 28]]], [[[[37, 0, 1, 0, 6, 8, 3], [32, 2, 2, 0, 10, 13, 4], [12, 0, 1, 0, 7, 7, 3], [2, 1, 0, 0, 3, 3, 12], [33, 2, 1, 0, 8, 11, 7], [16, 1, 2, 1, 4, 2, 9]]], [1, 4.395833, [2, 12, 33, 37, 16, 32]]], [[[[13, 5, 25, 23, 5, 26, 29], [19, 24, 6, 27, 32, 14, 33], [17, 1, 2, 17, 11, 9, 22], [4, 21, 25, 22, 27, 30, 24], [27, 29, 26, 1, 38, 30, 9], [30, 11, 22, 2, 13, 32, 7]]], [0, 120.868056, [17, 13, 30, 4, 19, 27]]], [[[[18, 10, 21, 1, 14, 27, 2], [16, 20, 5, 1, 26, 8, 11], [1, 6, 4, 2, 9, 7, 11]]], [1, 72.166667, [1, 16, 18]]], [[[[20, 6, 5, 14, 17, 10, 18], [9, 4, 6, 10, 16, 9, 19], [34, 2, 0, 14, 5, 7, 18], [1, 1, 1, 21, 4, 7, 26]]], [0, 15.421875, [1, 34, 9, 20]]], [[[[23, 23, 14, 0, 35, 18, 11], [31, 23, 5, 16, 26, 8, 19], [2, 0, 10, 28, 10, 21, 29], [18, 7, 19, 0, 17, 20, 5], [12, 7, 19, 14, 7, 25, 26], [36, 17, 1, 23, 18, 13, 29]]], [2, 94.055556, [18, 23, 12, 31, 36, 2]]], [[[[39, 2, 0, 8, 8, 1, 9], [2, 0, 7, 17, 6, 17, 19]]], [1, 33.0625, [39, 2]]]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
check("case %d" % i, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| case 0 | [1, 12.5, [6, 7]] | [1, 25.0, [6, 7]] | Failed |
| case 1 | [1, 1.824219, [1, 12, 8, 21]] | [1, 7.296875, [1, 12, 8, 21]] | Failed |
| case 2 | [1, 23.453125, [14, 36, 8, 38]] | [1, 93.8125, [14, 36, 8, 38]] | Failed |
| case 3 | [1, 13.488, [22, 12, 29, 6, 7]] | [1, 67.44, [22, 12, 29, 6, 7]] | Failed |
| case 4 | [1, 9.03125, [17, 26]] | [1, 18.0625, [17, 26]] | Failed |
| case 5 | [1, 105.125, [2, 29]] | [1, 210.25, [2, 29]] | Failed |
| case 6 | [2, 4.5, [28, 30]] | [2, 9.0, [28, 30]] | Failed |
| case 7 | [1, 4.704861, [38, 20, 28, 17, 26, 36]] | [1, 28.229167, [38, 20, 28, 17, 26, 36]] | Failed |
SHA-256 / ac5d31b6eb10867a3cadb6265db17ab18d743886b244ebac88ed9c6a852bdf73
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(boxes):
n = len(boxes)
best_axis, best_var = 0, -1.0
for ax in (0, 1, 2):
cs_ = [(b[1 + ax] + b[4 + ax]) / 2 for b in boxes]
mean = sum(cs_) / n
var = sum((c - mean) ** 2 for c in cs_) / n
if var > best_var:
best_axis, best_var = ax, var
order = [b[0] for b in sorted(boxes, key=lambda b: (b[1 + best_axis], b[0]))]
return [best_axis, round(best_var, 6), order]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[[[7, 10, 7, 2, 10, 17, 9], [6, 3, 0, 1, 10, 4, 7]]], [1, 25.0, [6, 7]]], [[[[8, 2, 6, 0, 4, 13, 8], [1, 2, 3, 2, 8, 6, 9], [21, 2, 10, 0, 7, 14, 0], [12, 1, 5, 2, 3, 12, 7]]], [1, 7.296875, [1, 12, 8, 21]]], [[[[8, 0, 22, 17, 8, 31, 23], [14, 1, 2, 25, 1, 9, 25], [38, 0, 25, 6, 7, 35, 17], [36, 1, 11, 9, 11, 19, 12]]], [1, 93.8125, [14, 36, 8, 38]]], [[[[6, 4, 13, 9, 14, 22, 21], [7, 0, 28, 11, 5, 33, 18], [22, 7, 2, 27, 19, 9, 28], [12, 2, 9, 17, 13, 16, 25], [29, 3, 10, 19, 4, 19, 25]]], [1, 67.44, [22, 12, 29, 6, 7]]], [[[[17, 4, 16, 17, 8, 16, 20], [26, 1, 24, 26, 5, 25, 26]]], [1, 18.0625, [17, 26]]], [[[[29, 0, 28, 2, 10, 36, 4], [2, 8, 1, 1, 9, 5, 4]]], [1, 210.25, [2, 29]]], [[[[28, 23, 1, 1, 25, 7, 13], [30, 23, 2, 1, 30, 4, 1]]], [2, 9.0, [28, 30]]], [[[[28, 12, 13, 1, 14, 25, 5], [36, 10, 28, 0, 10, 32, 6], [17, 4, 16, 0, 7, 28, 9], [26, 2, 16, 0, 14, 27, 3], [20, 6, 12, 2, 14, 19, 13], [38, 17, 9, 0, 22, 18, 3]]], [1, 28.229167, [38, 20, 28, 17, 26, 36]]]], [[[[[39, 1, 1, 0, 5, 13, 6], [18, 7, 0, 0, 14, 8, 6], [17, 9, 0, 2, 15, 12, 13]]], [0, 15.5, [39, 18, 17]]], [[[[26, 6, 1, 2, 14, 9, 9], [3, 2, 1, 0, 5, 7, 1], [1, 0, 0, 2, 7, 9, 9], [28, 6, 1, 0, 9, 4, 6], [31, 10, 1, 2, 17, 13, 9], [24, 9, 0, 0, 15, 11, 9], [2, 3, 0, 2, 9, 4, 7]]], [0, 13.571429, [1, 3, 2, 26, 28, 24, 31]]], [[[[22, 2, 5, 2, 5, 17, 10], [8, 0, 7, 2, 5, 8, 7], [36, 2, 3, 2, 9, 14, 13], [15, 1, 10, 0, 9, 10, 2], [29, 0, 10, 2, 7, 10, 9], [26, 0, 4, 2, 12, 10, 4], [10, 0, 10, 0, 2, 19, 0]]], [2, 6.387755, [10, 15, 8, 22, 26, 29, 36]]], [[[[12, 1, 30, 8, 1, 34, 9], [30, 2, 5, 13, 5, 8, 24], [24, 0, 10, 8, 4, 11, 15], [36, 0, 24, 13, 3, 33, 17], [19, 0, 22, 22, 9, 29, 31], [29, 2, 20, 23, 6, 27, 31]]], [1, 87.368056, [30, 24, 29, 19, 36, 12]]], [[[[15, 1, 2, 1, 13, 9, 2], [20, 9, 0, 2, 19, 12, 7], [24, 5, 2, 0, 15, 8, 8], [9, 7, 2, 2, 9, 7, 8]]], [0, 7.1875, [15, 24, 9, 20]]], [[[[22, 2, 0, 1, 4, 7, 7], [23, 1, 15, 0, 11, 20, 9], [12, 1, 22, 2, 4, 29, 7], [15, 0, 3, 1, 7, 11, 10]]], [1, 75.546875, [22, 15, 23, 12]]], [[[[3, 27, 2, 2, 37, 6, 5], [35, 0, 10, 1, 10, 13, 13]]], [0, 182.25, [35, 3]]], [[[[10, 16, 11, 2, 26, 12, 10], [17, 16, 18, 0, 25, 27, 3], [1, 27, 13, 1, 32, 20, 1], [28, 23, 10, 2, 30, 21, 12], [16, 6, 2, 2, 17, 2, 8], [34, 14, 3, 1, 22, 4, 12], [23, 21, 10, 1, 32, 18, 11]]], [1, 45.561224, [16, 34, 23, 28, 10, 1, 17]]]], [[[[[1, 27, 25, 1, 39, 34, 10], [35, 21, 20, 2, 32, 29, 5], [22, 6, 14, 1, 10, 16, 12], [13, 3, 27, 2, 4, 34, 7], [8, 19, 15, 1, 26, 25, 12], [39, 0, 16, 0, 6, 22, 12]]], [0, 138.451389, [39, 13, 22, 8, 35, 1]]], [[[[26, 9, 1, 0, 13, 5, 12], [3, 20, 1, 0, 23, 12, 5], [21, 18, 1, 1, 24, 12, 3], [28, 11, 0, 1, 15, 12, 6], [38, 12, 0, 0, 23, 8, 6]]], [0, 17.66, [26, 28, 38, 21, 3]]], [[[[10, 0, 20, 25, 2, 29, 28], [24, 0, 3, 20, 11, 11, 24], [39, 0, 20, 8, 10, 32, 14], [33, 2, 17, 12, 9, 19, 22], [3, 2, 11, 27, 2, 21, 31], [7, 2, 25, 8, 14, 29, 16], [30, 2, 10, 27, 8, 10, 31], [38, 2, 14, 4, 11, 20, 11]]], [2, 64.25, [38, 7, 39, 33, 24, 10, 3, 30]]], [[[[37, 8, 1, 0, 14, 5, 1], [38, 0, 2, 22, 7, 5, 25], [10, 3, 5, 29, 7, 12, 38], [35, 6, 7, 7, 6, 19, 16]]], [2, 154.1875, [37, 35, 38, 10]]], [[[[11, 1, 10, 9, 4, 20, 10], [5, 5, 8, 7, 7, 13, 13], [19, 9, 7, 6, 14, 14, 13], [30, 8, 4, 3, 16, 9, 5], [6, 10, 4, 1, 13, 11, 12], [8, 6, 0, 2, 8, 2, 3], [13, 9, 3, 9, 12, 6, 10]]], [1, 17.887755, [8, 13, 6, 30, 19, 5, 11]]], [[[[6, 1, 2, 1, 11, 14, 4], [37, 2, 1, 1, 8, 10, 7]]], [1, 1.5625, [37, 6]]], [[[[22, 2, 1, 7, 8, 10, 10], [30, 0, 7, 6, 2, 7, 7], [29, 2, 8, 7, 12, 8, 14], [24, 1, 5, 10, 7, 9, 13], [4, 0, 4, 3, 1, 4, 12], [33, 2, 4, 10, 12, 5, 11], [20, 2, 9, 4, 5, 12, 11]]], [0, 5.785714, [4, 30, 24, 20, 22, 29, 33]]], [[[[15, 5, 0, 1, 7, 10, 3], [39, 7, 2, 0, 15, 11, 6], [35, 5, 1, 1, 9, 7, 1]]], [0, 4.666667, [15, 35, 39]]]], [[[[[18, 0, 4, 7, 11, 9, 12], [38, 2, 4, 3, 6, 10, 7], [3, 1, 6, 28, 4, 16, 28]]], [2, 99.055556, [38, 18, 3]]], [[[[22, 2, 2, 2, 7, 13, 8], [23, 0, 1, 0, 4, 8, 12], [1, 0, 1, 2, 3, 13, 4], [34, 2, 1, 2, 14, 6, 5]]], [0, 6.625, [1, 23, 22, 34]]], [[[[31, 25, 0, 0, 35, 10, 4], [12, 24, 1, 6, 35, 7, 13], [4, 18, 0, 5, 24, 2, 9]]], [0, 17.055556, [4, 12, 31]]], [[[[4, 6, 29, 13, 17, 29, 18], [19, 10, 18, 11, 11, 20, 14], [21, 1, 28, 8, 11, 30, 19], [16, 6, 17, 10, 8, 24, 11]]], [1, 21.671875, [16, 19, 21, 4]]], [[[[17, 1, 27, 2, 6, 38, 9], [15, 2, 20, 1, 4, 24, 1], [6, 0, 23, 0, 3, 28, 9], [10, 2, 13, 2, 6, 22, 10]]], [1, 30.046875, [10, 15, 6, 17]]], [[[[17, 6, 7, 0, 14, 15, 10], [23, 1, 8, 0, 2, 15, 0], [38, 4, 3, 1, 5, 12, 13]]], [0, 12.388889, [23, 38, 17]]], [[[[39, 9, 10, 0, 20, 17, 8], [9, 5, 9, 16, 10, 20, 24], [4, 3, 10, 6, 12, 18, 14]]], [2, 43.555556, [39, 4, 9]]], [[[[3, 4, 1, 1, 9, 9, 12], [13, 10, 1, 0, 22, 10, 1], [25, 2, 7, 1, 11, 17, 6], [23, 2, 8, 0, 10, 17, 5], [24, 2, 6, 2, 5, 10, 11]]], [0, 18.46, [23, 24, 25, 3, 13]]]], [[[[[5, 1, 5, 2, 11, 8, 6], [29, 2, 3, 6, 2, 13, 7]]], [0, 4.0, [5, 29]]], [[[[28, 1, 20, 1, 3, 26, 5], [7, 2, 12, 2, 8, 24, 5], [3, 0, 2, 1, 7, 9, 5]]], [1, 54.166667, [3, 7, 28]]], [[[[37, 0, 1, 0, 6, 8, 3], [32, 2, 2, 0, 10, 13, 4], [12, 0, 1, 0, 7, 7, 3], [2, 1, 0, 0, 3, 3, 12], [33, 2, 1, 0, 8, 11, 7], [16, 1, 2, 1, 4, 2, 9]]], [1, 4.395833, [2, 12, 33, 37, 16, 32]]], [[[[13, 5, 25, 23, 5, 26, 29], [19, 24, 6, 27, 32, 14, 33], [17, 1, 2, 17, 11, 9, 22], [4, 21, 25, 22, 27, 30, 24], [27, 29, 26, 1, 38, 30, 9], [30, 11, 22, 2, 13, 32, 7]]], [0, 120.868056, [17, 13, 30, 4, 19, 27]]], [[[[18, 10, 21, 1, 14, 27, 2], [16, 20, 5, 1, 26, 8, 11], [1, 6, 4, 2, 9, 7, 11]]], [1, 72.166667, [1, 16, 18]]], [[[[20, 6, 5, 14, 17, 10, 18], [9, 4, 6, 10, 16, 9, 19], [34, 2, 0, 14, 5, 7, 18], [1, 1, 1, 21, 4, 7, 26]]], [0, 15.421875, [1, 34, 9, 20]]], [[[[23, 23, 14, 0, 35, 18, 11], [31, 23, 5, 16, 26, 8, 19], [2, 0, 10, 28, 10, 21, 29], [18, 7, 19, 0, 17, 20, 5], [12, 7, 19, 14, 7, 25, 26], [36, 17, 1, 23, 18, 13, 29]]], [2, 94.055556, [18, 23, 12, 31, 36, 2]]], [[[[39, 2, 0, 8, 8, 1, 9], [2, 0, 7, 17, 6, 17, 19]]], [1, 33.0625, [39, 2]]]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
check("case %d" % i, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| case 0 | [1, 25.0, [6, 7]] | [1, 25.0, [6, 7]] | Passed |
| case 1 | [1, 7.296875, [1, 12, 8, 21]] | [1, 7.296875, [1, 12, 8, 21]] | Passed |
| case 2 | [1, 93.8125, [14, 36, 8, 38]] | [1, 93.8125, [14, 36, 8, 38]] | Passed |
| case 3 | [1, 67.44, [22, 12, 29, 6, 7]] | [1, 67.44, [22, 12, 29, 6, 7]] | Passed |
| case 4 | [1, 18.0625, [17, 26]] | [1, 18.0625, [17, 26]] | Passed |
| case 5 | [1, 210.25, [2, 29]] | [1, 210.25, [2, 29]] | Passed |
| case 6 | [2, 9.0, [28, 30]] | [2, 9.0, [28, 30]] | Passed |
| case 7 | [1, 28.229167, [38, 20, 28, 17, 26, 36]] | [1, 28.229167, [38, 20, 28, 17, 26, 36]] | Passed |
SHA-256 / 912e020256914068b17a20f911e51361f9ee1bc7a9d2c78166580643bf93ff32
Verification & scope
A deterministic bounded teaching model with stipulated toy conventions; not a production physics engine or spatial index. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:51:00.962600+00:00.
Case digest / 621f33d211c8f7b4310a71027ad2768cd6e32ecbe75c0b4b7fb457ab8f61a90f