{"abstract":"Moving a heavy base joint is charged the same as moving a light wrist joint.","category":"Inverse kinematics solvers","checks":7,"contract":"Input [candidates, current, limits, weights] with joint angles in degrees. A limits entry is null for a continuous joint (distance is the shortest wrap-around difference) or [lo,hi] for a limited joint (inclusive bounds, distance is the plain difference because motion cannot pass the stop). Cost is sum w*d^2. Return [index into candidates, cost rounded 4] for the cheapest feasible candidate, earliest wins ties within 1e-9, or \"none\".","contract_signature":"x","evaluation_group":"w2-inverse_kinematics_solvers-ik-branch-selection","failed_approach":"Using w_i * d_i makes the metric linear and changes which branch wins.","family":"w2-inverse_kinematics_solvers-ik-branch-selection-joint-weighting","id":"FA-88011","implementations":{"attempt":{"sha256":"da935c705437f16c8c0b89229c9c30430e8677fca92192723b176ba203f80e2e","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nN = 1\nobservations = []\ndef solve(x):\n    cands,cur,lims,w=x\n    best=None\n    bi=None\n    for k,c in enumerate(cands):\n        ok=all(l is None or l[0]<=q<=l[1] for q,l in zip(c,lims))\n        if not ok: continue\n        cost=0.0\n        for q,p,wi,l in zip(c,cur,w,lims):\n            if l is None:\n                d=abs(q-p)%360.0\n                d=min(d,360.0-d)\n            else:\n                d=abs(q-p)\n            cost+=wi*d\n        if best is None or cost<best-1e-9:\n            best=cost\n            bi=k\n    if bi is None: return 'none'\n    return [bi,round(best,4)]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['limit boundary candidate', [[[[170, 10], [0, 10]], [160, 10], [[-170, 170], None], [1, 1]]], [0, 100.0]], ['all infeasible', [[[[200, 0], [-200, 0]], [0, 0], [[-170, 170], None], [1, 1]]], 'none'], ['continuous wrap shorter', [[[[0, 170], [0, -170]], [0, 175], [[-90, 90], None], [1, 1]]], [0, 25.0]], ['multi-turn limited joint', [[[[-200, 0], [150, 0]], [170, 0], [[-270, 270], None], [1, 1]]], [1, 400.0]], ['wide limited joint far', [[[[250, 0], [-100, 0]], [-120, 0], [[-270, 270], None], [1, 1]]], [1, 400.0]], ['weighted wrist', [[[[10, 50], [40, 0]], [0, 0], [[-90, 90], [-90, 90]], [1, 0.1]]], [0, 350.0]], ['exact tie keeps first', [[[[10, 0], [-10, 0]], [0, 0], [[-90, 90], None], [1, 1]]], [0, 100.0]]], [['continuous wrap shorter', [[[[0, 170], [0, -170]], [0, 175], [[-90, 90], None], [1, 1]]], [0, 25.0]], ['wide limited joint far', [[[[250, 0], [-100, 0]], [-120, 0], [[-270, 270], None], [1, 1]]], [1, 400.0]], ['weighted wrist', [[[[10, 50], [40, 0]], [0, 0], [[-90, 90], [-90, 90]], [1, 0.1]]], [0, 350.0]], ['exact tie keeps first', [[[[10, 0], [-10, 0]], [0, 0], [[-90, 90], None], [1, 1]]], [0, 100.0]], ['near tie within tolerance', [[[[10, 0], [0, 10.0000000001]], [0, 0], [None, None], [1, 1]]], [0, 100.0]], ['slightly better later', [[[[10, 0], [9.999, 0]], [0, 0], [[-90, 90], [-90, 90]], [1, 1]]], [1, 99.98]], ['three joints mixed', [[[[10, 350, -20], [15, -5, -25], [100, 0, 0]], [12, 0, -22], [[-120, 120], None, [-45, 45]], [2, 1, 1]]], [1, 52.0]]], [['multi-turn limited joint', [[[[-200, 0], [150, 0]], [170, 0], [[-270, 270], None], [1, 1]]], [1, 400.0]], ['near tie within tolerance', [[[[10, 0], [0, 10.0000000001]], [0, 0], [None, None], [1, 1]]], [0, 100.0]], ['slightly better later', [[[[10, 0], [9.999, 0]], [0, 0], [[-90, 90], [-90, 90]], [1, 1]]], [1, 99.98]], ['infeasible first candidate', [[[[95, 0], [30, 0], [20, 5]], [0, 0], [[-90, 90], None], [1, 1]]], [2, 425.0]], ['lower bound inclusive', [[[[-90, 0], [60, 60]], [-80, 0], [[-90, 90], [-90, 90]], [1, 1]]], [0, 100.0]], ['continuous across 180', [[[[0, -179], [0, 100]], [0, 179], [None, None], [1, 1]]], [0, 4.0]], ['heavy weight flips choice', [[[[5, 40], [30, 0]], [0, 0], [None, None], [10, 1]]], [0, 1850.0]]], [['limit boundary candidate', [[[[170, 10], [0, 10]], [160, 10], [[-170, 170], None], [1, 1]]], [0, 100.0]], ['wide limited joint far', [[[[250, 0], [-100, 0]], [-120, 0], [[-270, 270], None], [1, 1]]], [1, 400.0]], ['weighted wrist', [[[[10, 50], [40, 0]], [0, 0], [[-90, 90], [-90, 90]], [1, 0.1]]], [0, 350.0]], ['continuous across 180', [[[[0, -179], [0, 100]], [0, 179], [None, None], [1, 1]]], [0, 4.0]], ['three joints mixed', [[[[10, 350, -20], [15, -5, -25], [100, 0, 0]], [12, 0, -22], [[-120, 120], None, [-45, 45]], [2, 1, 1]]], [1, 52.0]], ['heavy weight flips choice', [[[[5, 40], [30, 0]], [0, 0], [None, None], [10, 1]]], [0, 1850.0]], ['continuous large difference', [[[[0, 300], [0, 200]], [0, 0], [[-10, 10], None], [1, 1]]], [0, 3600.0]]], [['limit boundary candidate', [[[[170, 10], [0, 10]], [160, 10], [[-170, 170], None], [1, 1]]], [0, 100.0]], ['all infeasible', [[[[200, 0], [-200, 0]], [0, 0], [[-170, 170], None], [1, 1]]], 'none'], ['continuous wrap shorter', [[[[0, 170], [0, -170]], [0, 175], [[-90, 90], None], [1, 1]]], [0, 25.0]], ['multi-turn limited joint', [[[[-200, 0], [150, 0]], [170, 0], [[-270, 270], None], [1, 1]]], [1, 400.0]], ['weighted wrist', [[[[10, 50], [40, 0]], [0, 0], [[-90, 90], [-90, 90]], [1, 0.1]]], [0, 350.0]], ['three joints mixed', [[[[10, 350, -20], [15, -5, -25], [100, 0, 0]], [12, 0, -22], [[-120, 120], None, [-45, 45]], [2, 1, 1]]], [1, 52.0]], ['continuous large difference', [[[[0, 300], [0, 200]], [0, 0], [[-10, 10], None], [1, 1]]], [0, 3600.0]]]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, 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":"74e98efadbe836752b88b114b94dcc7cadc68adaf67a0bb35221fa0d8f7cb88a","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nN = 1\nobservations = []\ndef solve(x):\n    cands,cur,lims,w=x\n    best=None\n    bi=None\n    for k,c in enumerate(cands):\n        ok=all(l is None or l[0]<=q<=l[1] for q,l in zip(c,lims))\n        if not ok: continue\n        cost=0.0\n        for q,p,wi,l in zip(c,cur,w,lims):\n            if l is None:\n                d=abs(q-p)%360.0\n                d=min(d,360.0-d)\n            else:\n                d=abs(q-p)\n            cost+=d*d\n        if best is None or cost<best-1e-9:\n            best=cost\n            bi=k\n    if bi is None: return 'none'\n    return [bi,round(best,4)]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['limit boundary candidate', [[[[170, 10], [0, 10]], [160, 10], [[-170, 170], None], [1, 1]]], [0, 100.0]], ['all infeasible', [[[[200, 0], [-200, 0]], [0, 0], [[-170, 170], None], [1, 1]]], 'none'], ['continuous wrap shorter', [[[[0, 170], [0, -170]], [0, 175], [[-90, 90], None], [1, 1]]], [0, 25.0]], ['multi-turn limited joint', [[[[-200, 0], [150, 0]], [170, 0], [[-270, 270], None], [1, 1]]], [1, 400.0]], ['wide limited joint far', [[[[250, 0], [-100, 0]], [-120, 0], [[-270, 270], None], [1, 1]]], [1, 400.0]], ['weighted wrist', [[[[10, 50], [40, 0]], [0, 0], [[-90, 90], [-90, 90]], [1, 0.1]]], [0, 350.0]], ['exact tie keeps first', [[[[10, 0], [-10, 0]], [0, 0], [[-90, 90], None], [1, 1]]], [0, 100.0]]], [['continuous wrap shorter', [[[[0, 170], [0, -170]], [0, 175], [[-90, 90], None], [1, 1]]], [0, 25.0]], ['wide limited joint far', [[[[250, 0], [-100, 0]], [-120, 0], [[-270, 270], None], [1, 1]]], [1, 400.0]], ['weighted wrist', [[[[10, 50], [40, 0]], [0, 0], [[-90, 90], [-90, 90]], [1, 0.1]]], [0, 350.0]], ['exact tie keeps first', [[[[10, 0], [-10, 0]], [0, 0], [[-90, 90], None], [1, 1]]], [0, 100.0]], ['near tie within tolerance', [[[[10, 0], [0, 10.0000000001]], [0, 0], [None, None], [1, 1]]], [0, 100.0]], ['slightly better later', [[[[10, 0], [9.999, 0]], [0, 0], [[-90, 90], [-90, 90]], [1, 1]]], [1, 99.98]], ['three joints mixed', [[[[10, 350, -20], [15, -5, -25], [100, 0, 0]], [12, 0, -22], [[-120, 120], None, [-45, 45]], [2, 1, 1]]], [1, 52.0]]], [['multi-turn limited joint', [[[[-200, 0], [150, 0]], [170, 0], [[-270, 270], None], [1, 1]]], [1, 400.0]], ['near tie within tolerance', [[[[10, 0], [0, 10.0000000001]], [0, 0], [None, None], [1, 1]]], [0, 100.0]], ['slightly better later', [[[[10, 0], [9.999, 0]], [0, 0], [[-90, 90], [-90, 90]], [1, 1]]], [1, 99.98]], ['infeasible first candidate', [[[[95, 0], [30, 0], [20, 5]], [0, 0], [[-90, 90], None], [1, 1]]], [2, 425.0]], ['lower bound inclusive', [[[[-90, 0], [60, 60]], [-80, 0], [[-90, 90], [-90, 90]], [1, 1]]], [0, 100.0]], ['continuous across 180', [[[[0, -179], [0, 100]], [0, 179], [None, None], [1, 1]]], [0, 4.0]], ['heavy weight flips choice', [[[[5, 40], [30, 0]], [0, 0], [None, None], [10, 1]]], [0, 1850.0]]], [['limit boundary candidate', [[[[170, 10], [0, 10]], [160, 10], [[-170, 170], None], [1, 1]]], [0, 100.0]], ['wide limited joint far', [[[[250, 0], [-100, 0]], [-120, 0], [[-270, 270], None], [1, 1]]], [1, 400.0]], ['weighted wrist', [[[[10, 50], [40, 0]], [0, 0], [[-90, 90], [-90, 90]], [1, 0.1]]], [0, 350.0]], ['continuous across 180', [[[[0, -179], [0, 100]], [0, 179], [None, None], [1, 1]]], [0, 4.0]], ['three joints mixed', [[[[10, 350, -20], [15, -5, -25], [100, 0, 0]], [12, 0, -22], [[-120, 120], None, [-45, 45]], [2, 1, 1]]], [1, 52.0]], ['heavy weight flips choice', [[[[5, 40], [30, 0]], [0, 0], [None, None], [10, 1]]], [0, 1850.0]], ['continuous large difference', [[[[0, 300], [0, 200]], [0, 0], [[-10, 10], None], [1, 1]]], [0, 3600.0]]], [['limit boundary candidate', [[[[170, 10], [0, 10]], [160, 10], [[-170, 170], None], [1, 1]]], [0, 100.0]], ['all infeasible', [[[[200, 0], [-200, 0]], [0, 0], [[-170, 170], None], [1, 1]]], 'none'], ['continuous wrap shorter', [[[[0, 170], [0, -170]], [0, 175], [[-90, 90], None], [1, 1]]], [0, 25.0]], ['multi-turn limited joint', [[[[-200, 0], [150, 0]], [170, 0], [[-270, 270], None], [1, 1]]], [1, 400.0]], ['weighted wrist', [[[[10, 50], [40, 0]], [0, 0], [[-90, 90], [-90, 90]], [1, 0.1]]], [0, 350.0]], ['three joints mixed', [[[[10, 350, -20], [15, -5, -25], [100, 0, 0]], [12, 0, -22], [[-120, 120], None, [-45, 45]], [2, 1, 1]]], [1, 52.0]], ['continuous large difference', [[[[0, 300], [0, 200]], [0, 0], [[-10, 10], None], [1, 1]]], [0, 3600.0]]]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, 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":"Deterministic planar or low-dimensional teaching model with a stipulated convention; not a general robotics library. 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-inverse_kinematics_solvers-ik-branch-selection-joint-weighting","generated_at":"2026-09-29T14:51:04.265289+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Inverse kinematics code turns task-space goals into joint commands; a wrong branch, sign, limit or update order sends a real arm to the wrong pose.","root_cause":"The weight vector is unpacked but never multiplied into the cost.","sha256":"b3591000b53d58a3f112775e74fdb06116781d8c6088854dbe14f5ce7b85b8b3","title":"Branch cost ignores per-joint weights · 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.103,"exit_code":1,"observations":[{"actual":[0,10.0],"check":"limit boundary candidate","expected":[0,100.0],"passed":false},{"actual":"none","check":"all infeasible","expected":"none","passed":true},{"actual":[0,5.0],"check":"continuous wrap shorter","expected":[0,25.0],"passed":false},{"actual":[1,20.0],"check":"multi-turn limited joint","expected":[1,400.0],"passed":false},{"actual":[1,20.0],"check":"wide limited joint far","expected":[1,400.0],"passed":false},{"actual":[0,15.0],"check":"weighted wrist","expected":[0,350.0],"passed":false},{"actual":[0,10.0],"check":"exact tie keeps first","expected":[0,100.0],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"limit boundary candidate\", \"actual\": [0, 10.0], \"expected\": [0, 100.0], \"passed\": false}, {\"check\": \"all infeasible\", \"actual\": \"none\", \"expected\": \"none\", \"passed\": true}, {\"check\": \"continuous wrap shorter\", \"actual\": [0, 5.0], \"expected\": [0, 25.0], \"passed\": false}, {\"check\": \"multi-turn limited joint\", \"actual\": [1, 20.0], \"expected\": [1, 400.0], \"passed\": false}, {\"check\": \"wide limited joint far\", \"actual\": [1, 20.0], \"expected\": [1, 400.0], \"passed\": false}, {\"check\": \"weighted wrist\", \"actual\": [0, 15.0], \"expected\": [0, 350.0], \"passed\": false}, {\"check\": \"exact tie keeps first\", \"actual\": [0, 10.0], \"expected\": [0, 100.0], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":40.207,"exit_code":1,"observations":[{"actual":[0,100.0],"check":"limit boundary candidate","expected":[0,100.0],"passed":true},{"actual":"none","check":"all infeasible","expected":"none","passed":true},{"actual":[0,25.0],"check":"continuous wrap shorter","expected":[0,25.0],"passed":true},{"actual":[1,400.0],"check":"multi-turn limited joint","expected":[1,400.0],"passed":true},{"actual":[1,400.0],"check":"wide limited joint far","expected":[1,400.0],"passed":true},{"actual":[1,1600.0],"check":"weighted wrist","expected":[0,350.0],"passed":false},{"actual":[0,100.0],"check":"exact tie keeps first","expected":[0,100.0],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"limit boundary candidate\", \"actual\": [0, 100.0], \"expected\": [0, 100.0], \"passed\": true}, {\"check\": \"all infeasible\", \"actual\": \"none\", \"expected\": \"none\", \"passed\": true}, {\"check\": \"continuous wrap shorter\", \"actual\": [0, 25.0], \"expected\": [0, 25.0], \"passed\": true}, {\"check\": \"multi-turn limited joint\", \"actual\": [1, 400.0], \"expected\": [1, 400.0], \"passed\": true}, {\"check\": \"wide limited joint far\", \"actual\": [1, 400.0], \"expected\": [1, 400.0], \"passed\": true}, {\"check\": \"weighted wrist\", \"actual\": [1, 1600.0], \"expected\": [0, 350.0], \"passed\": false}, {\"check\": \"exact tie keeps first\", \"actual\": [0, 100.0], \"expected\": [0, 100.0], \"passed\": true}], \"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."}}