{"abstract":"Unbalanced splits are costed backwards.","category":"Collision detection broadphase","checks":8,"contract":"solve(prims): top-down BVH build step. Split axis = larger centroid extent (x on ties). Primitives sorted by centroid on that axis (index tiebreak). Cost of split k = 1 + (P(L)*k + P(R)*(n-k))/P(parent) with P the box perimeter of the primitives' bounds; leaf cost n. Return [best k or 0 for leaf, axis, cost rounded to 6, sorted left indices].","contract_signature":"prims","evaluation_group":"w2-collision_detection_broadphase-sah-split-selection","failed_approach":"Using n/2 for both children ignores imbalance entirely.","family":"w2-collision_detection_broadphase-sah-split-selection-child-primitive-counts","id":"FA-87436","implementations":{"attempt":{"sha256":"2710ff323c3740a7606c690d6b4d32d6c765f2da89a9d27c83e9922703d83c8a","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nN = 1\nobservations = []\ndef solve(prims):\n    n = len(prims)\n    cent = [((p[0] + p[2]) / 2, (p[1] + p[3]) / 2) for p in prims]\n    ex = max(c[0] for c in cent) - min(c[0] for c in cent)\n    ey = max(c[1] for c in cent) - min(c[1] for c in cent)\n    axis = 0 if ex >= ey else 1\n    order = sorted(range(n), key=lambda i: (cent[i][axis], i))\n    def box(ids):\n        return [min(prims[i][0] for i in ids), min(prims[i][1] for i in ids), max(prims[i][2] for i in ids), max(prims[i][3] for i in ids)]\n    def perim(b):\n        return 2 * ((b[2] - b[0]) + (b[3] - b[1]))\n    pa = perim(box(order))\n    best_k, best = 0, float(n)\n    for k in range(1, n):\n        cost = 1 + ((perim(box(order[:k])) + perim(box(order[k:]))) * n / 2) / pa\n        if cost < best:\n            best_k, best = k, cost\n    return [best_k, axis, round(best, 6), sorted(order[:best_k])]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[[[[[5, 0, 7, 5], [3, 9, 6, 12]]], [1, 1, 1.8125, [0]]], [[[[0, 5, 6, 9], [5, 8, 7, 14], [6, 3, 8, 4], [6, 2, 11, 5], [8, 0, 14, 1], [7, 8, 11, 9]]], [3, 1, 4.535714, [2, 3, 4]]], [[[[7, 6, 12, 8], [6, 7, 13, 10], [3, 6, 8, 10], [1, 2, 2, 4]]], [1, 0, 3.25, [3]]], [[[[5, 0, 10, 4], [0, 1, 5, 7]]], [0, 0, 2.0, []]], [[[[7, 4, 12, 10], [9, 4, 12, 9]]], [0, 0, 2.0, []]], [[[[6, 4, 9, 9], [1, 3, 5, 10], [3, 6, 5, 12], [4, 2, 9, 6]]], [2, 1, 3.777778, [0, 3]]], [[[[8, 5, 12, 12], [6, 5, 11, 12], [2, 7, 9, 8], [4, 6, 11, 13], [5, 0, 11, 2], [4, 8, 5, 14]]], [2, 1, 5.25, [2, 4]]], [[[[4, 4, 11, 5], [6, 0, 10, 5], [10, 6, 16, 11], [2, 2, 4, 9], [7, 8, 11, 15], [6, 10, 13, 11], [7, 7, 8, 12]]], [4, 0, 5.862069, [0, 1, 3, 6]]]], [[[[[8, 7, 10, 13], [3, 3, 8, 6], [2, 2, 7, 4], [9, 10, 12, 14]]], [2, 1, 2.909091, [1, 2]]], [[[[2, 5, 9, 9], [9, 2, 10, 7], [2, 0, 7, 7], [4, 5, 6, 12]]], [0, 0, 4.0, []]], [[[[2, 3, 8, 7], [9, 4, 13, 5]]], [0, 0, 2.0, []]], [[[[6, 3, 10, 8], [10, 9, 12, 15], [7, 7, 13, 14], [2, 3, 8, 4], [7, 7, 8, 12], [2, 2, 8, 8], [5, 6, 6, 9]]], [4, 1, 5.25, [0, 3, 5, 6]]], [[[[3, 10, 10, 11], [8, 0, 11, 5], [0, 9, 1, 11], [6, 9, 7, 12], [9, 1, 11, 4], [0, 8, 6, 15], [7, 4, 12, 10]]], [4, 0, 5.185185, [0, 2, 3, 5]]], [[[[1, 2, 7, 5], [9, 5, 11, 6]]], [1, 0, 1.857143, [0]]], [[[[9, 3, 16, 10], [5, 8, 11, 13]]], [0, 0, 2.0, []]], [[[[5, 6, 6, 11], [5, 5, 10, 8]]], [0, 0, 2.0, []]]], [[[[[4, 1, 5, 3], [1, 6, 4, 11]]], [1, 1, 1.785714, [0]]], [[[[10, 3, 14, 10], [0, 1, 3, 3]]], [1, 0, 1.695652, [1]]], [[[[9, 7, 13, 11], [6, 3, 8, 5]]], [1, 1, 1.8, [1]]], [[[[8, 10, 9, 15], [7, 1, 11, 7]]], [1, 1, 1.888889, [1]]], [[[[7, 6, 8, 8], [5, 0, 10, 7], [7, 8, 12, 14], [1, 6, 8, 8], [3, 0, 7, 3]]], [4, 1, 4.16, [0, 1, 3, 4]]], [[[[5, 4, 9, 11], [2, 3, 6, 8], [1, 0, 5, 5], [5, 10, 11, 14], [5, 8, 7, 13], [7, 9, 10, 11], [2, 2, 7, 9]]], [3, 1, 5.541667, [1, 2, 6]]], [[[[10, 1, 12, 4], [7, 0, 8, 1], [2, 1, 7, 8], [6, 3, 13, 5], [8, 9, 9, 11], [4, 10, 9, 17], [9, 8, 12, 15]]], [4, 1, 5.535714, [0, 1, 2, 3]]], [[[[1, 3, 5, 10], [3, 0, 7, 7], [10, 4, 17, 6], [2, 2, 6, 9]]], [3, 0, 3.192308, [0, 1, 3]]]], [[[[[3, 3, 9, 10], [3, 4, 6, 9], [8, 3, 12, 4], [4, 1, 6, 2], [9, 2, 12, 8], [3, 9, 6, 10], [5, 9, 12, 14]]], [5, 1, 6.363636, [0, 1, 2, 3, 4]]], [[[[6, 2, 10, 6], [2, 4, 8, 9], [8, 3, 13, 6]]], [1, 0, 2.833333, [1]]], [[[[10, 0, 16, 1], [1, 7, 8, 10], [3, 5, 5, 10], [6, 8, 13, 9], [5, 9, 10, 10]]], [4, 0, 4.0, [1, 2, 3, 4]]], [[[[4, 10, 8, 13], [0, 9, 1, 14]]], [0, 0, 2.0, []]], [[[[3, 6, 5, 8], [10, 0, 11, 1], [5, 1, 11, 8]]], [0, 0, 3.0, []]], [[[[8, 5, 13, 7], [10, 10, 17, 14], [8, 3, 15, 4]]], [2, 1, 2.65, [0, 2]]], [[[[8, 10, 15, 15], [4, 2, 8, 7]]], [1, 1, 1.875, [1]]], [[[[4, 0, 7, 3], [5, 8, 12, 12], [2, 1, 5, 4], [8, 0, 14, 7], [2, 10, 9, 11]]], [3, 1, 4.541667, [0, 2, 3]]]], [[[[[3, 9, 8, 12], [5, 8, 6, 13]]], [0, 0, 2.0, []]], [[[[2, 0, 8, 4], [10, 6, 14, 8], [9, 6, 15, 8], [7, 7, 10, 12], [9, 6, 15, 8], [8, 6, 9, 13]]], [1, 1, 4.269231, [0]]], [[[[0, 9, 1, 12], [0, 9, 2, 15]]], [0, 1, 2.0, []]], [[[[5, 7, 10, 10], [9, 0, 13, 4], [9, 4, 16, 11], [7, 6, 8, 13]]], [2, 1, 3.5, [1, 2]]], [[[[5, 1, 8, 5], [8, 9, 15, 12]]], [1, 1, 1.809524, [0]]], [[[[1, 8, 4, 13], [1, 7, 4, 14], [0, 0, 1, 5], [1, 7, 5, 8], [8, 0, 10, 7], [1, 8, 6, 14], [6, 8, 13, 11]]], [5, 0, 6.037037, [0, 1, 2, 3, 5]]], [[[[10, 2, 16, 7], [4, 2, 5, 5], [9, 8, 10, 9], [7, 4, 11, 9], [8, 9, 12, 10], [0, 3, 2, 9], [0, 7, 7, 8]]], [3, 0, 5.583333, [1, 5, 6]]], [[[[10, 1, 16, 6], [2, 10, 4, 14], [7, 3, 14, 9], [6, 7, 11, 13], [0, 7, 2, 12]]], [2, 0, 4.034483, [1, 4]]]]]\nfor i, (args, expected) in enumerate(fixtures[N-1]):\n    check(\"case %d\" % i, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"6fb31d5c672b90504738b1cb71a20ed6bba7f7092719dec131aee0e5bbb58950","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nN = 1\nobservations = []\ndef solve(prims):\n    n = len(prims)\n    cent = [((p[0] + p[2]) / 2, (p[1] + p[3]) / 2) for p in prims]\n    ex = max(c[0] for c in cent) - min(c[0] for c in cent)\n    ey = max(c[1] for c in cent) - min(c[1] for c in cent)\n    axis = 0 if ex >= ey else 1\n    order = sorted(range(n), key=lambda i: (cent[i][axis], i))\n    def box(ids):\n        return [min(prims[i][0] for i in ids), min(prims[i][1] for i in ids), max(prims[i][2] for i in ids), max(prims[i][3] for i in ids)]\n    def perim(b):\n        return 2 * ((b[2] - b[0]) + (b[3] - b[1]))\n    pa = perim(box(order))\n    best_k, best = 0, float(n)\n    for k in range(1, n):\n        cost = 1 + (perim(box(order[:k])) * (n - k) + perim(box(order[k:])) * k) / pa\n        if cost < best:\n            best_k, best = k, cost\n    return [best_k, axis, round(best, 6), sorted(order[:best_k])]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[[[[[5, 0, 7, 5], [3, 9, 6, 12]]], [1, 1, 1.8125, [0]]], [[[[0, 5, 6, 9], [5, 8, 7, 14], [6, 3, 8, 4], [6, 2, 11, 5], [8, 0, 14, 1], [7, 8, 11, 9]]], [3, 1, 4.535714, [2, 3, 4]]], [[[[7, 6, 12, 8], [6, 7, 13, 10], [3, 6, 8, 10], [1, 2, 2, 4]]], [1, 0, 3.25, [3]]], [[[[5, 0, 10, 4], [0, 1, 5, 7]]], [0, 0, 2.0, []]], [[[[7, 4, 12, 10], [9, 4, 12, 9]]], [0, 0, 2.0, []]], [[[[6, 4, 9, 9], [1, 3, 5, 10], [3, 6, 5, 12], [4, 2, 9, 6]]], [2, 1, 3.777778, [0, 3]]], [[[[8, 5, 12, 12], [6, 5, 11, 12], [2, 7, 9, 8], [4, 6, 11, 13], [5, 0, 11, 2], [4, 8, 5, 14]]], [2, 1, 5.25, [2, 4]]], [[[[4, 4, 11, 5], [6, 0, 10, 5], [10, 6, 16, 11], [2, 2, 4, 9], [7, 8, 11, 15], [6, 10, 13, 11], [7, 7, 8, 12]]], [4, 0, 5.862069, [0, 1, 3, 6]]]], [[[[[8, 7, 10, 13], [3, 3, 8, 6], [2, 2, 7, 4], [9, 10, 12, 14]]], [2, 1, 2.909091, [1, 2]]], [[[[2, 5, 9, 9], [9, 2, 10, 7], [2, 0, 7, 7], [4, 5, 6, 12]]], [0, 0, 4.0, []]], [[[[2, 3, 8, 7], [9, 4, 13, 5]]], [0, 0, 2.0, []]], [[[[6, 3, 10, 8], [10, 9, 12, 15], [7, 7, 13, 14], [2, 3, 8, 4], [7, 7, 8, 12], [2, 2, 8, 8], [5, 6, 6, 9]]], [4, 1, 5.25, [0, 3, 5, 6]]], [[[[3, 10, 10, 11], [8, 0, 11, 5], [0, 9, 1, 11], [6, 9, 7, 12], [9, 1, 11, 4], [0, 8, 6, 15], [7, 4, 12, 10]]], [4, 0, 5.185185, [0, 2, 3, 5]]], [[[[1, 2, 7, 5], [9, 5, 11, 6]]], [1, 0, 1.857143, [0]]], [[[[9, 3, 16, 10], [5, 8, 11, 13]]], [0, 0, 2.0, []]], [[[[5, 6, 6, 11], [5, 5, 10, 8]]], [0, 0, 2.0, []]]], [[[[[4, 1, 5, 3], [1, 6, 4, 11]]], [1, 1, 1.785714, [0]]], [[[[10, 3, 14, 10], [0, 1, 3, 3]]], [1, 0, 1.695652, [1]]], [[[[9, 7, 13, 11], [6, 3, 8, 5]]], [1, 1, 1.8, [1]]], [[[[8, 10, 9, 15], [7, 1, 11, 7]]], [1, 1, 1.888889, [1]]], [[[[7, 6, 8, 8], [5, 0, 10, 7], [7, 8, 12, 14], [1, 6, 8, 8], [3, 0, 7, 3]]], [4, 1, 4.16, [0, 1, 3, 4]]], [[[[5, 4, 9, 11], [2, 3, 6, 8], [1, 0, 5, 5], [5, 10, 11, 14], [5, 8, 7, 13], [7, 9, 10, 11], [2, 2, 7, 9]]], [3, 1, 5.541667, [1, 2, 6]]], [[[[10, 1, 12, 4], [7, 0, 8, 1], [2, 1, 7, 8], [6, 3, 13, 5], [8, 9, 9, 11], [4, 10, 9, 17], [9, 8, 12, 15]]], [4, 1, 5.535714, [0, 1, 2, 3]]], [[[[1, 3, 5, 10], [3, 0, 7, 7], [10, 4, 17, 6], [2, 2, 6, 9]]], [3, 0, 3.192308, [0, 1, 3]]]], [[[[[3, 3, 9, 10], [3, 4, 6, 9], [8, 3, 12, 4], [4, 1, 6, 2], [9, 2, 12, 8], [3, 9, 6, 10], [5, 9, 12, 14]]], [5, 1, 6.363636, [0, 1, 2, 3, 4]]], [[[[6, 2, 10, 6], [2, 4, 8, 9], [8, 3, 13, 6]]], [1, 0, 2.833333, [1]]], [[[[10, 0, 16, 1], [1, 7, 8, 10], [3, 5, 5, 10], [6, 8, 13, 9], [5, 9, 10, 10]]], [4, 0, 4.0, [1, 2, 3, 4]]], [[[[4, 10, 8, 13], [0, 9, 1, 14]]], [0, 0, 2.0, []]], [[[[3, 6, 5, 8], [10, 0, 11, 1], [5, 1, 11, 8]]], [0, 0, 3.0, []]], [[[[8, 5, 13, 7], [10, 10, 17, 14], [8, 3, 15, 4]]], [2, 1, 2.65, [0, 2]]], [[[[8, 10, 15, 15], [4, 2, 8, 7]]], [1, 1, 1.875, [1]]], [[[[4, 0, 7, 3], [5, 8, 12, 12], [2, 1, 5, 4], [8, 0, 14, 7], [2, 10, 9, 11]]], [3, 1, 4.541667, [0, 2, 3]]]], [[[[[3, 9, 8, 12], [5, 8, 6, 13]]], [0, 0, 2.0, []]], [[[[2, 0, 8, 4], [10, 6, 14, 8], [9, 6, 15, 8], [7, 7, 10, 12], [9, 6, 15, 8], [8, 6, 9, 13]]], [1, 1, 4.269231, [0]]], [[[[0, 9, 1, 12], [0, 9, 2, 15]]], [0, 1, 2.0, []]], [[[[5, 7, 10, 10], [9, 0, 13, 4], [9, 4, 16, 11], [7, 6, 8, 13]]], [2, 1, 3.5, [1, 2]]], [[[[5, 1, 8, 5], [8, 9, 15, 12]]], [1, 1, 1.809524, [0]]], [[[[1, 8, 4, 13], [1, 7, 4, 14], [0, 0, 1, 5], [1, 7, 5, 8], [8, 0, 10, 7], [1, 8, 6, 14], [6, 8, 13, 11]]], [5, 0, 6.037037, [0, 1, 2, 3, 5]]], [[[[10, 2, 16, 7], [4, 2, 5, 5], [9, 8, 10, 9], [7, 4, 11, 9], [8, 9, 12, 10], [0, 3, 2, 9], [0, 7, 7, 8]]], [3, 0, 5.583333, [1, 5, 6]]], [[[[10, 1, 16, 6], [2, 10, 4, 14], [7, 3, 14, 9], [6, 7, 11, 13], [0, 7, 2, 12]]], [2, 0, 4.034483, [1, 4]]]]]\nfor i, (args, expected) in enumerate(fixtures[N-1]):\n    check(\"case %d\" % i, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w2-collision_detection_broadphase-sah-split-selection-child-primitive-counts","generated_at":"2026-09-29T14:50:58.659143+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"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.","root_cause":"Left perimeter is multiplied by n-k and right by k.","sha256":"993752443ec097e47c877c1b863ff77bec48fcaaceb45ccfdd4ace72146ea4dc","title":"SAH weights each child area by the other child count · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":40.808,"exit_code":1,"observations":[{"actual":[1,1,1.8125,[0]],"check":"case 0","expected":[1,1,1.8125,[0]],"passed":true},{"actual":[1,1,4.214286,[4]],"check":"case 1","expected":[3,1,4.535714,[2,3,4]],"passed":false},{"actual":[1,0,2.7,[3]],"check":"case 2","expected":[1,0,3.25,[3]],"passed":false},{"actual":[0,0,2.0,[]],"check":"case 3","expected":[0,0,2.0,[]],"passed":true},{"actual":[0,0,2.0,[]],"check":"case 4","expected":[0,0,2.0,[]],"passed":true},{"actual":[3,1,3.666667,[0,1,3]],"check":"case 5","expected":[2,1,3.777778,[0,3]],"passed":false},{"actual":[1,1,4.375,[4]],"check":"case 6","expected":[2,1,5.25,[2,4]],"passed":false},{"actual":[1,0,5.344828,[3]],"check":"case 7","expected":[4,0,5.862069,[0,1,3,6]],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"case 0\", \"actual\": [1, 1, 1.8125, [0]], \"expected\": [1, 1, 1.8125, [0]], \"passed\": true}, {\"check\": \"case 1\", \"actual\": [1, 1, 4.214286, [4]], \"expected\": [3, 1, 4.535714, [2, 3, 4]], \"passed\": false}, {\"check\": \"case 2\", \"actual\": [1, 0, 2.7, [3]], \"expected\": [1, 0, 3.25, [3]], \"passed\": false}, {\"check\": \"case 3\", \"actual\": [0, 0, 2.0, []], \"expected\": [0, 0, 2.0, []], \"passed\": true}, {\"check\": \"case 4\", \"actual\": [0, 0, 2.0, []], \"expected\": [0, 0, 2.0, []], \"passed\": true}, {\"check\": \"case 5\", \"actual\": [3, 1, 3.666667, [0, 1, 3]], \"expected\": [2, 1, 3.777778, [0, 3]], \"passed\": false}, {\"check\": \"case 6\", \"actual\": [1, 1, 4.375, [4]], \"expected\": [2, 1, 5.25, [2, 4]], \"passed\": false}, {\"check\": \"case 7\", \"actual\": [1, 0, 5.344828, [3]], \"expected\": [4, 0, 5.862069, [0, 1, 3, 6]], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":38.484,"exit_code":1,"observations":[{"actual":[1,1,1.8125,[0]],"check":"case 0","expected":[1,1,1.8125,[0]],"passed":true},{"actual":[1,1,3.071429,[4]],"check":"case 1","expected":[3,1,4.535714,[2,3,4]],"passed":false},{"actual":[1,0,2.15,[3]],"check":"case 2","expected":[1,0,3.25,[3]],"passed":false},{"actual":[0,0,2.0,[]],"check":"case 3","expected":[0,0,2.0,[]],"passed":true},{"actual":[0,0,2.0,[]],"check":"case 4","expected":[0,0,2.0,[]],"passed":true},{"actual":[3,1,3.222222,[0,1,3]],"check":"case 5","expected":[2,1,3.777778,[0,3]],"passed":false},{"actual":[5,1,3.416667,[0,1,2,3,4]],"check":"case 6","expected":[2,1,5.25,[2,4]],"passed":false},{"actual":[1,0,3.793103,[3]],"check":"case 7","expected":[4,0,5.862069,[0,1,3,6]],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"case 0\", \"actual\": [1, 1, 1.8125, [0]], \"expected\": [1, 1, 1.8125, [0]], \"passed\": true}, {\"check\": \"case 1\", \"actual\": [1, 1, 3.071429, [4]], \"expected\": [3, 1, 4.535714, [2, 3, 4]], \"passed\": false}, {\"check\": \"case 2\", \"actual\": [1, 0, 2.15, [3]], \"expected\": [1, 0, 3.25, [3]], \"passed\": false}, {\"check\": \"case 3\", \"actual\": [0, 0, 2.0, []], \"expected\": [0, 0, 2.0, []], \"passed\": true}, {\"check\": \"case 4\", \"actual\": [0, 0, 2.0, []], \"expected\": [0, 0, 2.0, []], \"passed\": true}, {\"check\": \"case 5\", \"actual\": [3, 1, 3.222222, [0, 1, 3]], \"expected\": [2, 1, 3.777778, [0, 3]], \"passed\": false}, {\"check\": \"case 6\", \"actual\": [5, 1, 3.416667, [0, 1, 2, 3, 4]], \"expected\": [2, 1, 5.25, [2, 4]], \"passed\": false}, {\"check\": \"case 7\", \"actual\": [1, 0, 3.793103, [3]], \"expected\": [4, 0, 5.862069, [0, 1, 3, 6]], \"passed\": false}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}