{"abstract":"An order is accepted against stock that is too close to expiry and then comes up short.","category":"Inventory cost layering","checks":7,"contract":"Input {lots:[[lot,qty,expiry_day,unit_cost]], today, order_qty, min_shelf}. A lot is eligible when expiry_day - today >= min_shelf. Eligible lots are picked by earliest expiry, ties by lot id ascending. If eligible stock < order_qty return {\"error\":\"insufficient\",\"available\":eligible qty}. Return {picks:[[lot,qty]], cost}.","evaluation_group":"w2-inventory-cost-layering-fefo-lot-picking","failed_approach":"Summing lots that have not yet expired still includes lots below minimum shelf life.","family":"w2-inventory-cost-layering-fefo-lot-picking-availability-pool","id":"FA-60081","implementations":{"attempt":{"sha256":"3cc199cf9059ea564f748cad4482033d4bc6930a26c13dcfdae2adef25d1df49","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    today = x['today']\n    elig = [l for l in x['lots'] if l[2] - today >= x['min_shelf']]\n    avail = sum(l[1] for l in x['lots'] if l[2] >= today)\n    if avail < x['order_qty']:\n        return {'error': 'insufficient', 'available': avail}\n    elig.sort(key=lambda l: (l[2], l[0]))\n    need = x['order_qty']\n    picks = []\n    cost = 0\n    for lot, qty, exp, unit in elig:\n        if need == 0:\n            break\n        take = min(need, qty)\n        picks.append([lot, take])\n        cost += take * unit\n        need -= take\n    return {'picks': picks, 'cost': cost}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['earliest expiry', {'lots': [['L3', 5, 120, 10], ['L1', 5, 110, 12], ['L2', 5, 130, 9]], 'today': 100, 'order_qty': 7, 'min_shelf': 5}, {'picks': [['L1', 5], ['L3', 2]], 'cost': 80}], ['shelf boundary', {'lots': [['A', 4, 106, 10], ['B', 4, 200, 11]], 'today': 101, 'order_qty': 3, 'min_shelf': 5}, {'picks': [['A', 3]], 'cost': 30}], ['insufficient', {'lots': [['A', 4, 150, 10], ['B', 9, 101, 11]], 'today': 100, 'order_qty': 6, 'min_shelf': 10}, {'error': 'insufficient', 'available': 4}], ['tie by lot', {'lots': [['Z9', 2, 140, 8], ['A1', 2, 140, 7], ['M5', 9, 150, 6]], 'today': 100, 'order_qty': 3, 'min_shelf': 1}, {'picks': [['A1', 2], ['Z9', 1]], 'cost': 22}], ['expired skipped', {'lots': [['OLD', 50, 90, 1], ['NEW', 6, 300, 2]], 'today': 100, 'order_qty': 4, 'min_shelf': 0}, {'picks': [['NEW', 4]], 'cost': 8}], ['zero order', {'lots': [['A', 3, 150, 10]], 'today': 100, 'order_qty': 0, 'min_shelf': 0}, {'picks': [], 'cost': 0}], ['big lots small order', {'lots': [['B7', 100, 400, 3], ['C2', 1, 381, 5], ['A4', 2, 390, 4]], 'today': 100, 'order_qty': 2, 'min_shelf': 30}, {'picks': [['C2', 1], ['A4', 1]], 'cost': 9}]], [['earliest expiry', {'lots': [['L3', 5, 120, 10], ['L1', 5, 110, 12], ['L2', 5, 130, 9]], 'today': 100, 'order_qty': 8, 'min_shelf': 5}, {'picks': [['L1', 5], ['L3', 3]], 'cost': 90}], ['shelf boundary', {'lots': [['A', 4, 107, 10], ['B', 4, 200, 11]], 'today': 102, 'order_qty': 3, 'min_shelf': 5}, {'picks': [['A', 3]], 'cost': 30}], ['insufficient', {'lots': [['A', 4, 150, 10], ['B', 9, 101, 11]], 'today': 100, 'order_qty': 7, 'min_shelf': 10}, {'error': 'insufficient', 'available': 4}], ['tie by lot', {'lots': [['Z9', 2, 140, 8], ['A1', 2, 140, 7], ['M5', 9, 150, 6]], 'today': 100, 'order_qty': 3, 'min_shelf': 1}, {'picks': [['A1', 2], ['Z9', 1]], 'cost': 22}], ['expired skipped', {'lots': [['OLD', 50, 90, 1], ['NEW', 7, 300, 2]], 'today': 100, 'order_qty': 4, 'min_shelf': 0}, {'picks': [['NEW', 4]], 'cost': 8}], ['zero order', {'lots': [['A', 3, 150, 10]], 'today': 100, 'order_qty': 0, 'min_shelf': 0}, {'picks': [], 'cost': 0}], ['big lots small order', {'lots': [['B7', 100, 400, 3], ['C2', 1, 382, 5], ['A4', 2, 390, 4]], 'today': 100, 'order_qty': 2, 'min_shelf': 30}, {'picks': [['C2', 1], ['A4', 1]], 'cost': 9}]], [['earliest expiry', {'lots': [['L3', 5, 120, 10], ['L1', 5, 110, 12], ['L2', 5, 130, 9]], 'today': 100, 'order_qty': 6, 'min_shelf': 5}, {'picks': [['L1', 5], ['L3', 1]], 'cost': 70}], ['shelf boundary', {'lots': [['A', 4, 108, 10], ['B', 4, 200, 11]], 'today': 103, 'order_qty': 3, 'min_shelf': 5}, {'picks': [['A', 3]], 'cost': 30}], ['insufficient', {'lots': [['A', 4, 150, 10], ['B', 9, 101, 11]], 'today': 100, 'order_qty': 8, 'min_shelf': 10}, {'error': 'insufficient', 'available': 4}], ['tie by lot', {'lots': [['Z9', 2, 140, 8], ['A1', 2, 140, 7], ['M5', 9, 150, 6]], 'today': 100, 'order_qty': 3, 'min_shelf': 1}, {'picks': [['A1', 2], ['Z9', 1]], 'cost': 22}], ['expired skipped', {'lots': [['OLD', 50, 90, 1], ['NEW', 8, 300, 2]], 'today': 100, 'order_qty': 4, 'min_shelf': 0}, {'picks': [['NEW', 4]], 'cost': 8}], ['zero order', {'lots': [['A', 3, 150, 10]], 'today': 100, 'order_qty': 0, 'min_shelf': 0}, {'picks': [], 'cost': 0}], ['big lots small order', {'lots': [['B7', 100, 400, 3], ['C2', 1, 383, 5], ['A4', 2, 390, 4]], 'today': 100, 'order_qty': 2, 'min_shelf': 30}, {'picks': [['C2', 1], ['A4', 1]], 'cost': 9}]], [['earliest expiry', {'lots': [['L3', 5, 120, 10], ['L1', 5, 110, 12], ['L2', 5, 130, 9]], 'today': 100, 'order_qty': 7, 'min_shelf': 5}, {'picks': [['L1', 5], ['L3', 2]], 'cost': 80}], ['shelf boundary', {'lots': [['A', 4, 109, 10], ['B', 4, 200, 11]], 'today': 104, 'order_qty': 3, 'min_shelf': 5}, {'picks': [['A', 3]], 'cost': 30}], ['insufficient', {'lots': [['A', 4, 150, 10], ['B', 9, 101, 11]], 'today': 100, 'order_qty': 9, 'min_shelf': 10}, {'error': 'insufficient', 'available': 4}], ['tie by lot', {'lots': [['Z9', 2, 140, 8], ['A1', 2, 140, 7], ['M5', 9, 150, 6]], 'today': 100, 'order_qty': 3, 'min_shelf': 1}, {'picks': [['A1', 2], ['Z9', 1]], 'cost': 22}], ['expired skipped', {'lots': [['OLD', 50, 90, 1], ['NEW', 9, 300, 2]], 'today': 100, 'order_qty': 4, 'min_shelf': 0}, {'picks': [['NEW', 4]], 'cost': 8}], ['zero order', {'lots': [['A', 3, 150, 10]], 'today': 100, 'order_qty': 0, 'min_shelf': 0}, {'picks': [], 'cost': 0}], ['big lots small order', {'lots': [['B7', 100, 400, 3], ['C2', 1, 384, 5], ['A4', 2, 390, 4]], 'today': 100, 'order_qty': 2, 'min_shelf': 30}, {'picks': [['C2', 1], ['A4', 1]], 'cost': 9}]], [['earliest expiry', {'lots': [['L3', 5, 120, 10], ['L1', 5, 110, 12], ['L2', 5, 130, 9]], 'today': 100, 'order_qty': 8, 'min_shelf': 5}, {'picks': [['L1', 5], ['L3', 3]], 'cost': 90}], ['shelf boundary', {'lots': [['A', 4, 110, 10], ['B', 4, 200, 11]], 'today': 105, 'order_qty': 3, 'min_shelf': 5}, {'picks': [['A', 3]], 'cost': 30}], ['insufficient', {'lots': [['A', 4, 150, 10], ['B', 9, 101, 11]], 'today': 100, 'order_qty': 10, 'min_shelf': 10}, {'error': 'insufficient', 'available': 4}], ['tie by lot', {'lots': [['Z9', 2, 140, 8], ['A1', 2, 140, 7], ['M5', 9, 150, 6]], 'today': 100, 'order_qty': 3, 'min_shelf': 1}, {'picks': [['A1', 2], ['Z9', 1]], 'cost': 22}], ['expired skipped', {'lots': [['OLD', 50, 90, 1], ['NEW', 10, 300, 2]], 'today': 100, 'order_qty': 4, 'min_shelf': 0}, {'picks': [['NEW', 4]], 'cost': 8}], ['zero order', {'lots': [['A', 3, 150, 10]], 'today': 100, 'order_qty': 0, 'min_shelf': 0}, {'picks': [], 'cost': 0}], ['big lots small order', {'lots': [['B7', 100, 400, 3], ['C2', 1, 385, 5], ['A4', 2, 390, 4]], 'today': 100, 'order_qty': 2, 'min_shelf': 30}, {'picks': [['C2', 1], ['A4', 1]], 'cost': 9}]]]\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":"5b456742487df99523eacef628e3b7dd0c3fc78041177b0b5560faf7005aeff9","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    today = x['today']\n    elig = [l for l in x['lots'] if l[2] - today >= x['min_shelf']]\n    avail = sum(l[1] for l in x['lots'])\n    if avail < x['order_qty']:\n        return {'error': 'insufficient', 'available': avail}\n    elig.sort(key=lambda l: (l[2], l[0]))\n    need = x['order_qty']\n    picks = []\n    cost = 0\n    for lot, qty, exp, unit in elig:\n        if need == 0:\n            break\n        take = min(need, qty)\n        picks.append([lot, take])\n        cost += take * unit\n        need -= take\n    return {'picks': picks, 'cost': cost}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['earliest expiry', {'lots': [['L3', 5, 120, 10], ['L1', 5, 110, 12], ['L2', 5, 130, 9]], 'today': 100, 'order_qty': 7, 'min_shelf': 5}, {'picks': [['L1', 5], ['L3', 2]], 'cost': 80}], ['shelf boundary', {'lots': [['A', 4, 106, 10], ['B', 4, 200, 11]], 'today': 101, 'order_qty': 3, 'min_shelf': 5}, {'picks': [['A', 3]], 'cost': 30}], ['insufficient', {'lots': [['A', 4, 150, 10], ['B', 9, 101, 11]], 'today': 100, 'order_qty': 6, 'min_shelf': 10}, {'error': 'insufficient', 'available': 4}], ['tie by lot', {'lots': [['Z9', 2, 140, 8], ['A1', 2, 140, 7], ['M5', 9, 150, 6]], 'today': 100, 'order_qty': 3, 'min_shelf': 1}, {'picks': [['A1', 2], ['Z9', 1]], 'cost': 22}], ['expired skipped', {'lots': [['OLD', 50, 90, 1], ['NEW', 6, 300, 2]], 'today': 100, 'order_qty': 4, 'min_shelf': 0}, {'picks': [['NEW', 4]], 'cost': 8}], ['zero order', {'lots': [['A', 3, 150, 10]], 'today': 100, 'order_qty': 0, 'min_shelf': 0}, {'picks': [], 'cost': 0}], ['big lots small order', {'lots': [['B7', 100, 400, 3], ['C2', 1, 381, 5], ['A4', 2, 390, 4]], 'today': 100, 'order_qty': 2, 'min_shelf': 30}, {'picks': [['C2', 1], ['A4', 1]], 'cost': 9}]], [['earliest expiry', {'lots': [['L3', 5, 120, 10], ['L1', 5, 110, 12], ['L2', 5, 130, 9]], 'today': 100, 'order_qty': 8, 'min_shelf': 5}, {'picks': [['L1', 5], ['L3', 3]], 'cost': 90}], ['shelf boundary', {'lots': [['A', 4, 107, 10], ['B', 4, 200, 11]], 'today': 102, 'order_qty': 3, 'min_shelf': 5}, {'picks': [['A', 3]], 'cost': 30}], ['insufficient', {'lots': [['A', 4, 150, 10], ['B', 9, 101, 11]], 'today': 100, 'order_qty': 7, 'min_shelf': 10}, {'error': 'insufficient', 'available': 4}], ['tie by lot', {'lots': [['Z9', 2, 140, 8], ['A1', 2, 140, 7], ['M5', 9, 150, 6]], 'today': 100, 'order_qty': 3, 'min_shelf': 1}, {'picks': [['A1', 2], ['Z9', 1]], 'cost': 22}], ['expired skipped', {'lots': [['OLD', 50, 90, 1], ['NEW', 7, 300, 2]], 'today': 100, 'order_qty': 4, 'min_shelf': 0}, {'picks': [['NEW', 4]], 'cost': 8}], ['zero order', {'lots': [['A', 3, 150, 10]], 'today': 100, 'order_qty': 0, 'min_shelf': 0}, {'picks': [], 'cost': 0}], ['big lots small order', {'lots': [['B7', 100, 400, 3], ['C2', 1, 382, 5], ['A4', 2, 390, 4]], 'today': 100, 'order_qty': 2, 'min_shelf': 30}, {'picks': [['C2', 1], ['A4', 1]], 'cost': 9}]], [['earliest expiry', {'lots': [['L3', 5, 120, 10], ['L1', 5, 110, 12], ['L2', 5, 130, 9]], 'today': 100, 'order_qty': 6, 'min_shelf': 5}, {'picks': [['L1', 5], ['L3', 1]], 'cost': 70}], ['shelf boundary', {'lots': [['A', 4, 108, 10], ['B', 4, 200, 11]], 'today': 103, 'order_qty': 3, 'min_shelf': 5}, {'picks': [['A', 3]], 'cost': 30}], ['insufficient', {'lots': [['A', 4, 150, 10], ['B', 9, 101, 11]], 'today': 100, 'order_qty': 8, 'min_shelf': 10}, {'error': 'insufficient', 'available': 4}], ['tie by lot', {'lots': [['Z9', 2, 140, 8], ['A1', 2, 140, 7], ['M5', 9, 150, 6]], 'today': 100, 'order_qty': 3, 'min_shelf': 1}, {'picks': [['A1', 2], ['Z9', 1]], 'cost': 22}], ['expired skipped', {'lots': [['OLD', 50, 90, 1], ['NEW', 8, 300, 2]], 'today': 100, 'order_qty': 4, 'min_shelf': 0}, {'picks': [['NEW', 4]], 'cost': 8}], ['zero order', {'lots': [['A', 3, 150, 10]], 'today': 100, 'order_qty': 0, 'min_shelf': 0}, {'picks': [], 'cost': 0}], ['big lots small order', {'lots': [['B7', 100, 400, 3], ['C2', 1, 383, 5], ['A4', 2, 390, 4]], 'today': 100, 'order_qty': 2, 'min_shelf': 30}, {'picks': [['C2', 1], ['A4', 1]], 'cost': 9}]], [['earliest expiry', {'lots': [['L3', 5, 120, 10], ['L1', 5, 110, 12], ['L2', 5, 130, 9]], 'today': 100, 'order_qty': 7, 'min_shelf': 5}, {'picks': [['L1', 5], ['L3', 2]], 'cost': 80}], ['shelf boundary', {'lots': [['A', 4, 109, 10], ['B', 4, 200, 11]], 'today': 104, 'order_qty': 3, 'min_shelf': 5}, {'picks': [['A', 3]], 'cost': 30}], ['insufficient', {'lots': [['A', 4, 150, 10], ['B', 9, 101, 11]], 'today': 100, 'order_qty': 9, 'min_shelf': 10}, {'error': 'insufficient', 'available': 4}], ['tie by lot', {'lots': [['Z9', 2, 140, 8], ['A1', 2, 140, 7], ['M5', 9, 150, 6]], 'today': 100, 'order_qty': 3, 'min_shelf': 1}, {'picks': [['A1', 2], ['Z9', 1]], 'cost': 22}], ['expired skipped', {'lots': [['OLD', 50, 90, 1], ['NEW', 9, 300, 2]], 'today': 100, 'order_qty': 4, 'min_shelf': 0}, {'picks': [['NEW', 4]], 'cost': 8}], ['zero order', {'lots': [['A', 3, 150, 10]], 'today': 100, 'order_qty': 0, 'min_shelf': 0}, {'picks': [], 'cost': 0}], ['big lots small order', {'lots': [['B7', 100, 400, 3], ['C2', 1, 384, 5], ['A4', 2, 390, 4]], 'today': 100, 'order_qty': 2, 'min_shelf': 30}, {'picks': [['C2', 1], ['A4', 1]], 'cost': 9}]], [['earliest expiry', {'lots': [['L3', 5, 120, 10], ['L1', 5, 110, 12], ['L2', 5, 130, 9]], 'today': 100, 'order_qty': 8, 'min_shelf': 5}, {'picks': [['L1', 5], ['L3', 3]], 'cost': 90}], ['shelf boundary', {'lots': [['A', 4, 110, 10], ['B', 4, 200, 11]], 'today': 105, 'order_qty': 3, 'min_shelf': 5}, {'picks': [['A', 3]], 'cost': 30}], ['insufficient', {'lots': [['A', 4, 150, 10], ['B', 9, 101, 11]], 'today': 100, 'order_qty': 10, 'min_shelf': 10}, {'error': 'insufficient', 'available': 4}], ['tie by lot', {'lots': [['Z9', 2, 140, 8], ['A1', 2, 140, 7], ['M5', 9, 150, 6]], 'today': 100, 'order_qty': 3, 'min_shelf': 1}, {'picks': [['A1', 2], ['Z9', 1]], 'cost': 22}], ['expired skipped', {'lots': [['OLD', 50, 90, 1], ['NEW', 10, 300, 2]], 'today': 100, 'order_qty': 4, 'min_shelf': 0}, {'picks': [['NEW', 4]], 'cost': 8}], ['zero order', {'lots': [['A', 3, 150, 10]], 'today': 100, 'order_qty': 0, 'min_shelf': 0}, {'picks': [], 'cost': 0}], ['big lots small order', {'lots': [['B7', 100, 400, 3], ['C2', 1, 385, 5], ['A4', 2, 390, 4]], 'today': 100, 'order_qty': 2, 'min_shelf': 30}, {'picks': [['C2', 1], ['A4', 1]], 'cost': 9}]]]\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"},"fixed":{"sha256":"d7112bdf7e7b95f8f1df07c32f6cb00cff5fcbfbb22ef62e301033369e533971","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    today = x['today']\n    elig = [l for l in x['lots'] if l[2] - today >= x['min_shelf']]\n    avail = sum(l[1] for l in elig)\n    if avail < x['order_qty']:\n        return {'error': 'insufficient', 'available': avail}\n    elig.sort(key=lambda l: (l[2], l[0]))\n    need = x['order_qty']\n    picks = []\n    cost = 0\n    for lot, qty, exp, unit in elig:\n        if need == 0:\n            break\n        take = min(need, qty)\n        picks.append([lot, take])\n        cost += take * unit\n        need -= take\n    return {'picks': picks, 'cost': cost}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['earliest expiry', {'lots': [['L3', 5, 120, 10], ['L1', 5, 110, 12], ['L2', 5, 130, 9]], 'today': 100, 'order_qty': 7, 'min_shelf': 5}, {'picks': [['L1', 5], ['L3', 2]], 'cost': 80}], ['shelf boundary', {'lots': [['A', 4, 106, 10], ['B', 4, 200, 11]], 'today': 101, 'order_qty': 3, 'min_shelf': 5}, {'picks': [['A', 3]], 'cost': 30}], ['insufficient', {'lots': [['A', 4, 150, 10], ['B', 9, 101, 11]], 'today': 100, 'order_qty': 6, 'min_shelf': 10}, {'error': 'insufficient', 'available': 4}], ['tie by lot', {'lots': [['Z9', 2, 140, 8], ['A1', 2, 140, 7], ['M5', 9, 150, 6]], 'today': 100, 'order_qty': 3, 'min_shelf': 1}, {'picks': [['A1', 2], ['Z9', 1]], 'cost': 22}], ['expired skipped', {'lots': [['OLD', 50, 90, 1], ['NEW', 6, 300, 2]], 'today': 100, 'order_qty': 4, 'min_shelf': 0}, {'picks': [['NEW', 4]], 'cost': 8}], ['zero order', {'lots': [['A', 3, 150, 10]], 'today': 100, 'order_qty': 0, 'min_shelf': 0}, {'picks': [], 'cost': 0}], ['big lots small order', {'lots': [['B7', 100, 400, 3], ['C2', 1, 381, 5], ['A4', 2, 390, 4]], 'today': 100, 'order_qty': 2, 'min_shelf': 30}, {'picks': [['C2', 1], ['A4', 1]], 'cost': 9}]], [['earliest expiry', {'lots': [['L3', 5, 120, 10], ['L1', 5, 110, 12], ['L2', 5, 130, 9]], 'today': 100, 'order_qty': 8, 'min_shelf': 5}, {'picks': [['L1', 5], ['L3', 3]], 'cost': 90}], ['shelf boundary', {'lots': [['A', 4, 107, 10], ['B', 4, 200, 11]], 'today': 102, 'order_qty': 3, 'min_shelf': 5}, {'picks': [['A', 3]], 'cost': 30}], ['insufficient', {'lots': [['A', 4, 150, 10], ['B', 9, 101, 11]], 'today': 100, 'order_qty': 7, 'min_shelf': 10}, {'error': 'insufficient', 'available': 4}], ['tie by lot', {'lots': [['Z9', 2, 140, 8], ['A1', 2, 140, 7], ['M5', 9, 150, 6]], 'today': 100, 'order_qty': 3, 'min_shelf': 1}, {'picks': [['A1', 2], ['Z9', 1]], 'cost': 22}], ['expired skipped', {'lots': [['OLD', 50, 90, 1], ['NEW', 7, 300, 2]], 'today': 100, 'order_qty': 4, 'min_shelf': 0}, {'picks': [['NEW', 4]], 'cost': 8}], ['zero order', {'lots': [['A', 3, 150, 10]], 'today': 100, 'order_qty': 0, 'min_shelf': 0}, {'picks': [], 'cost': 0}], ['big lots small order', {'lots': [['B7', 100, 400, 3], ['C2', 1, 382, 5], ['A4', 2, 390, 4]], 'today': 100, 'order_qty': 2, 'min_shelf': 30}, {'picks': [['C2', 1], ['A4', 1]], 'cost': 9}]], [['earliest expiry', {'lots': [['L3', 5, 120, 10], ['L1', 5, 110, 12], ['L2', 5, 130, 9]], 'today': 100, 'order_qty': 6, 'min_shelf': 5}, {'picks': [['L1', 5], ['L3', 1]], 'cost': 70}], ['shelf boundary', {'lots': [['A', 4, 108, 10], ['B', 4, 200, 11]], 'today': 103, 'order_qty': 3, 'min_shelf': 5}, {'picks': [['A', 3]], 'cost': 30}], ['insufficient', {'lots': [['A', 4, 150, 10], ['B', 9, 101, 11]], 'today': 100, 'order_qty': 8, 'min_shelf': 10}, {'error': 'insufficient', 'available': 4}], ['tie by lot', {'lots': [['Z9', 2, 140, 8], ['A1', 2, 140, 7], ['M5', 9, 150, 6]], 'today': 100, 'order_qty': 3, 'min_shelf': 1}, {'picks': [['A1', 2], ['Z9', 1]], 'cost': 22}], ['expired skipped', {'lots': [['OLD', 50, 90, 1], ['NEW', 8, 300, 2]], 'today': 100, 'order_qty': 4, 'min_shelf': 0}, {'picks': [['NEW', 4]], 'cost': 8}], ['zero order', {'lots': [['A', 3, 150, 10]], 'today': 100, 'order_qty': 0, 'min_shelf': 0}, {'picks': [], 'cost': 0}], ['big lots small order', {'lots': [['B7', 100, 400, 3], ['C2', 1, 383, 5], ['A4', 2, 390, 4]], 'today': 100, 'order_qty': 2, 'min_shelf': 30}, {'picks': [['C2', 1], ['A4', 1]], 'cost': 9}]], [['earliest expiry', {'lots': [['L3', 5, 120, 10], ['L1', 5, 110, 12], ['L2', 5, 130, 9]], 'today': 100, 'order_qty': 7, 'min_shelf': 5}, {'picks': [['L1', 5], ['L3', 2]], 'cost': 80}], ['shelf boundary', {'lots': [['A', 4, 109, 10], ['B', 4, 200, 11]], 'today': 104, 'order_qty': 3, 'min_shelf': 5}, {'picks': [['A', 3]], 'cost': 30}], ['insufficient', {'lots': [['A', 4, 150, 10], ['B', 9, 101, 11]], 'today': 100, 'order_qty': 9, 'min_shelf': 10}, {'error': 'insufficient', 'available': 4}], ['tie by lot', {'lots': [['Z9', 2, 140, 8], ['A1', 2, 140, 7], ['M5', 9, 150, 6]], 'today': 100, 'order_qty': 3, 'min_shelf': 1}, {'picks': [['A1', 2], ['Z9', 1]], 'cost': 22}], ['expired skipped', {'lots': [['OLD', 50, 90, 1], ['NEW', 9, 300, 2]], 'today': 100, 'order_qty': 4, 'min_shelf': 0}, {'picks': [['NEW', 4]], 'cost': 8}], ['zero order', {'lots': [['A', 3, 150, 10]], 'today': 100, 'order_qty': 0, 'min_shelf': 0}, {'picks': [], 'cost': 0}], ['big lots small order', {'lots': [['B7', 100, 400, 3], ['C2', 1, 384, 5], ['A4', 2, 390, 4]], 'today': 100, 'order_qty': 2, 'min_shelf': 30}, {'picks': [['C2', 1], ['A4', 1]], 'cost': 9}]], [['earliest expiry', {'lots': [['L3', 5, 120, 10], ['L1', 5, 110, 12], ['L2', 5, 130, 9]], 'today': 100, 'order_qty': 8, 'min_shelf': 5}, {'picks': [['L1', 5], ['L3', 3]], 'cost': 90}], ['shelf boundary', {'lots': [['A', 4, 110, 10], ['B', 4, 200, 11]], 'today': 105, 'order_qty': 3, 'min_shelf': 5}, {'picks': [['A', 3]], 'cost': 30}], ['insufficient', {'lots': [['A', 4, 150, 10], ['B', 9, 101, 11]], 'today': 100, 'order_qty': 10, 'min_shelf': 10}, {'error': 'insufficient', 'available': 4}], ['tie by lot', {'lots': [['Z9', 2, 140, 8], ['A1', 2, 140, 7], ['M5', 9, 150, 6]], 'today': 100, 'order_qty': 3, 'min_shelf': 1}, {'picks': [['A1', 2], ['Z9', 1]], 'cost': 22}], ['expired skipped', {'lots': [['OLD', 50, 90, 1], ['NEW', 10, 300, 2]], 'today': 100, 'order_qty': 4, 'min_shelf': 0}, {'picks': [['NEW', 4]], 'cost': 8}], ['zero order', {'lots': [['A', 3, 150, 10]], 'today': 100, 'order_qty': 0, 'min_shelf': 0}, {'picks': [], 'cost': 0}], ['big lots small order', {'lots': [['B7', 100, 400, 3], ['C2', 1, 385, 5], ['A4', 2, 390, 4]], 'today': 100, 'order_qty': 2, 'min_shelf': 30}, {'picks': [['C2', 1], ['A4', 1]], 'cost': 9}]]]\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":"Stipulated bounded teaching model with explicit toy rules; not an accounting-standard implementation. 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-inventory-cost-layering-fefo-lot-picking-availability-pool","generated_at":"2026-09-29T14:46:42.288431+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Inventory valuation and cost-of-goods decisions depend on this rule.","repair":"Sum only eligible lots when checking availability.","root_cause":"Available quantity sums all lots instead of eligible lots.","sha256":"a7ee84555a4dedebba3dea2360615a9685ae93d8e7bb5aed82fb79340d46fad7","title":"First-expired-first-out lot picking: availability pool · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":40.498,"exit_code":1,"observations":[{"actual":{"cost":80,"picks":[["L1",5],["L3",2]]},"check":"earliest expiry","expected":{"cost":80,"picks":[["L1",5],["L3",2]]},"passed":true},{"actual":{"cost":30,"picks":[["A",3]]},"check":"shelf boundary","expected":{"cost":30,"picks":[["A",3]]},"passed":true},{"actual":{"cost":40,"picks":[["A",4]]},"check":"insufficient","expected":{"available":4,"error":"insufficient"},"passed":false},{"actual":{"cost":22,"picks":[["A1",2],["Z9",1]]},"check":"tie by lot","expected":{"cost":22,"picks":[["A1",2],["Z9",1]]},"passed":true},{"actual":{"cost":8,"picks":[["NEW",4]]},"check":"expired skipped","expected":{"cost":8,"picks":[["NEW",4]]},"passed":true},{"actual":{"cost":0,"picks":[]},"check":"zero order","expected":{"cost":0,"picks":[]},"passed":true},{"actual":{"cost":9,"picks":[["C2",1],["A4",1]]},"check":"big lots small order","expected":{"cost":9,"picks":[["C2",1],["A4",1]]},"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"earliest expiry\", \"actual\": {\"picks\": [[\"L1\", 5], [\"L3\", 2]], \"cost\": 80}, \"expected\": {\"picks\": [[\"L1\", 5], [\"L3\", 2]], \"cost\": 80}, \"passed\": true}, {\"check\": \"shelf boundary\", \"actual\": {\"picks\": [[\"A\", 3]], \"cost\": 30}, \"expected\": {\"picks\": [[\"A\", 3]], \"cost\": 30}, \"passed\": true}, {\"check\": \"insufficient\", \"actual\": {\"picks\": [[\"A\", 4]], \"cost\": 40}, \"expected\": {\"error\": \"insufficient\", \"available\": 4}, \"passed\": false}, {\"check\": \"tie by lot\", \"actual\": {\"picks\": [[\"A1\", 2], [\"Z9\", 1]], \"cost\": 22}, \"expected\": {\"picks\": [[\"A1\", 2], [\"Z9\", 1]], \"cost\": 22}, \"passed\": true}, {\"check\": \"expired skipped\", \"actual\": {\"picks\": [[\"NEW\", 4]], \"cost\": 8}, \"expected\": {\"picks\": [[\"NEW\", 4]], \"cost\": 8}, \"passed\": true}, {\"check\": \"zero order\", \"actual\": {\"picks\": [], \"cost\": 0}, \"expected\": {\"picks\": [], \"cost\": 0}, \"passed\": true}, {\"check\": \"big lots small order\", \"actual\": {\"picks\": [[\"C2\", 1], [\"A4\", 1]], \"cost\": 9}, \"expected\": {\"picks\": [[\"C2\", 1], [\"A4\", 1]], \"cost\": 9}, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":40.39,"exit_code":1,"observations":[{"actual":{"cost":80,"picks":[["L1",5],["L3",2]]},"check":"earliest expiry","expected":{"cost":80,"picks":[["L1",5],["L3",2]]},"passed":true},{"actual":{"cost":30,"picks":[["A",3]]},"check":"shelf boundary","expected":{"cost":30,"picks":[["A",3]]},"passed":true},{"actual":{"cost":40,"picks":[["A",4]]},"check":"insufficient","expected":{"available":4,"error":"insufficient"},"passed":false},{"actual":{"cost":22,"picks":[["A1",2],["Z9",1]]},"check":"tie by lot","expected":{"cost":22,"picks":[["A1",2],["Z9",1]]},"passed":true},{"actual":{"cost":8,"picks":[["NEW",4]]},"check":"expired skipped","expected":{"cost":8,"picks":[["NEW",4]]},"passed":true},{"actual":{"cost":0,"picks":[]},"check":"zero order","expected":{"cost":0,"picks":[]},"passed":true},{"actual":{"cost":9,"picks":[["C2",1],["A4",1]]},"check":"big lots small order","expected":{"cost":9,"picks":[["C2",1],["A4",1]]},"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"earliest expiry\", \"actual\": {\"picks\": [[\"L1\", 5], [\"L3\", 2]], \"cost\": 80}, \"expected\": {\"picks\": [[\"L1\", 5], [\"L3\", 2]], \"cost\": 80}, \"passed\": true}, {\"check\": \"shelf boundary\", \"actual\": {\"picks\": [[\"A\", 3]], \"cost\": 30}, \"expected\": {\"picks\": [[\"A\", 3]], \"cost\": 30}, \"passed\": true}, {\"check\": \"insufficient\", \"actual\": {\"picks\": [[\"A\", 4]], \"cost\": 40}, \"expected\": {\"error\": \"insufficient\", \"available\": 4}, \"passed\": false}, {\"check\": \"tie by lot\", \"actual\": {\"picks\": [[\"A1\", 2], [\"Z9\", 1]], \"cost\": 22}, \"expected\": {\"picks\": [[\"A1\", 2], [\"Z9\", 1]], \"cost\": 22}, \"passed\": true}, {\"check\": \"expired skipped\", \"actual\": {\"picks\": [[\"NEW\", 4]], \"cost\": 8}, \"expected\": {\"picks\": [[\"NEW\", 4]], \"cost\": 8}, \"passed\": true}, {\"check\": \"zero order\", \"actual\": {\"picks\": [], \"cost\": 0}, \"expected\": {\"picks\": [], \"cost\": 0}, \"passed\": true}, {\"check\": \"big lots small order\", \"actual\": {\"picks\": [[\"C2\", 1], [\"A4\", 1]], \"cost\": 9}, \"expected\": {\"picks\": [[\"C2\", 1], [\"A4\", 1]], \"cost\": 9}, \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":38.757,"exit_code":0,"observations":[{"actual":{"cost":80,"picks":[["L1",5],["L3",2]]},"check":"earliest expiry","expected":{"cost":80,"picks":[["L1",5],["L3",2]]},"passed":true},{"actual":{"cost":30,"picks":[["A",3]]},"check":"shelf boundary","expected":{"cost":30,"picks":[["A",3]]},"passed":true},{"actual":{"available":4,"error":"insufficient"},"check":"insufficient","expected":{"available":4,"error":"insufficient"},"passed":true},{"actual":{"cost":22,"picks":[["A1",2],["Z9",1]]},"check":"tie by lot","expected":{"cost":22,"picks":[["A1",2],["Z9",1]]},"passed":true},{"actual":{"cost":8,"picks":[["NEW",4]]},"check":"expired skipped","expected":{"cost":8,"picks":[["NEW",4]]},"passed":true},{"actual":{"cost":0,"picks":[]},"check":"zero order","expected":{"cost":0,"picks":[]},"passed":true},{"actual":{"cost":9,"picks":[["C2",1],["A4",1]]},"check":"big lots small order","expected":{"cost":9,"picks":[["C2",1],["A4",1]]},"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"earliest expiry\", \"actual\": {\"picks\": [[\"L1\", 5], [\"L3\", 2]], \"cost\": 80}, \"expected\": {\"picks\": [[\"L1\", 5], [\"L3\", 2]], \"cost\": 80}, \"passed\": true}, {\"check\": \"shelf boundary\", \"actual\": {\"picks\": [[\"A\", 3]], \"cost\": 30}, \"expected\": {\"picks\": [[\"A\", 3]], \"cost\": 30}, \"passed\": true}, {\"check\": \"insufficient\", \"actual\": {\"error\": \"insufficient\", \"available\": 4}, \"expected\": {\"error\": \"insufficient\", \"available\": 4}, \"passed\": true}, {\"check\": \"tie by lot\", \"actual\": {\"picks\": [[\"A1\", 2], [\"Z9\", 1]], \"cost\": 22}, \"expected\": {\"picks\": [[\"A1\", 2], [\"Z9\", 1]], \"cost\": 22}, \"passed\": true}, {\"check\": \"expired skipped\", \"actual\": {\"picks\": [[\"NEW\", 4]], \"cost\": 8}, \"expected\": {\"picks\": [[\"NEW\", 4]], \"cost\": 8}, \"passed\": true}, {\"check\": \"zero order\", \"actual\": {\"picks\": [], \"cost\": 0}, \"expected\": {\"picks\": [], \"cost\": 0}, \"passed\": true}, {\"check\": \"big lots small order\", \"actual\": {\"picks\": [[\"C2\", 1], [\"A4\", 1]], \"cost\": 9}, \"expected\": {\"picks\": [[\"C2\", 1], [\"A4\", 1]], \"cost\": 9}, \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}