FA-95816 / Shipping rate zone lookup / Open access
LTL breaks: deficit weight never considered · case 01
Shipments just under a break pay more than rating at the break minimum would cost.
ROOT CAUSE
The deficit-weight comparison with heavier breaks is missing.
VERIFIED REPAIR
Compare the actual charge with every heavier break minimum at its rate.
Unsuccessful approach: Checking only the next break misses cheaper breaks further up.
Case contract
Weight breaks 0, 500, 1000, 2000, 5000, 10000 lb with cents-per-cwt rates for the lane. Weight rounds up to a whole lb (min 1) and is rated at its break: ceil(w * rate / 100). Deficit rating: if billing any heavier break minimum at that break rate is strictly cheaper, use the cheapest such. Charge is at least min_charge. Return [charge, break index, rated weight].
Why this case matters
LTL lane rates use weight breaks with deficit weight rating.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(weight, rates, min_charge):
BREAKS = [0, 500, 1000, 2000, 5000, 10000]
w = max(1, math.ceil(weight))
idx = max(i for i, b in enumerate(BREAKS) if w >= b)
cost = -(-w * rates[idx] // 100)
best = [cost, idx, w]
return [max(best[0], min_charge), best[1], best[2]]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['deficit to 500', [450, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [18000, 1, 500]], ['generated mix 5', [480, [5000, 4900, 1000, 900, 800, 700], 9000], [10000, 2, 1000]], ['on break', [500, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [18000, 1, 500]], ['fraction', [800.5, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [28836, 1, 801]], ['tie keeps actual', [450, [4000, 3600, 3000, 2500, 2100, 1800], 9000], [18000, 0, 450]], ['minimum', [100, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [9000, 0, 100]], ['generated mix 7', [480, [4200, 3600, 3000, 2500, 2100, 1800], 0], [18000, 1, 500]], ['generated mix 15', [1700, [5000, 4900, 1000, 900, 800, 700], 20000], [20000, 2, 1700]]], [['generated mix 8', [450, [5000, 4900, 1000, 900, 800, 700], 9000], [10000, 2, 1000]], ['generated mix 5', [480, [5000, 4900, 1000, 900, 800, 700], 9000], [10000, 2, 1000]], ['fraction', [800.5, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [28836, 1, 801]], ['tie keeps actual', [450, [4000, 3600, 3000, 2500, 2100, 1800], 9000], [18000, 0, 450]], ['deficit to 500', [450, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [18000, 1, 500]], ['minimum', [100, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [9000, 0, 100]], ['generated mix 11', [480, [4200, 3600, 3000, 2500, 2100, 1800], 20000], [20000, 1, 500]], ['generated mix 19', [800.5, [4200, 3600, 3000, 2500, 2100, 1800], 20000], [28836, 1, 801]]], [['generated mix 21', [1700, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [50000, 3, 2000]], ['generated mix 5', [480, [5000, 4900, 1000, 900, 800, 700], 9000], [10000, 2, 1000]], ['skip a break', [400, [5000, 4900, 1000, 900, 800, 700], 0], [10000, 2, 1000]], ['on break', [500, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [18000, 1, 500]], ['fraction', [800.5, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [28836, 1, 801]], ['tie keeps actual', [450, [4000, 3600, 3000, 2500, 2100, 1800], 9000], [18000, 0, 450]], ['generated mix 22', [499.5, [5000, 4900, 1000, 900, 800, 700], 20000], [20000, 2, 1000]], ['generated mix 30', [1999.2, [5000, 4900, 1000, 900, 800, 700], 9000], [18000, 3, 2000]]], [['generated mix 40', [9000, [4237, 3611, 3044, 2517, 2150, 1833], 0], [183300, 5, 10000]], ['generated mix 5', [480, [5000, 4900, 1000, 900, 800, 700], 9000], [10000, 2, 1000]], ['minimum', [100, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [9000, 0, 100]], ['deficit to 1000', [850, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [30000, 2, 1000]], ['skip a break', [400, [5000, 4900, 1000, 900, 800, 700], 0], [10000, 2, 1000]], ['on break', [500, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [18000, 1, 500]], ['generated mix 32', [850, [5000, 4900, 1000, 900, 800, 700], 9000], [10000, 2, 1000]], ['generated mix 41', [4200, [5000, 4900, 1000, 900, 800, 700], 9000], [37800, 3, 4200]]], [['generated mix 57', [450, [4237, 3611, 3044, 2517, 2150, 1833], 20000], [20000, 1, 500]], ['generated mix 5', [480, [5000, 4900, 1000, 900, 800, 700], 9000], [10000, 2, 1000]], ['tie keeps actual', [450, [4000, 3600, 3000, 2500, 2100, 1800], 9000], [18000, 0, 450]], ['deficit to 500', [450, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [18000, 1, 500]], ['minimum', [100, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [9000, 0, 100]], ['deficit to 1000', [850, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [30000, 2, 1000]], ['generated mix 43', [850, [5000, 4900, 1000, 900, 800, 700], 20000], [20000, 2, 1000]], ['generated mix 51', [9000, [5000, 4900, 1000, 900, 800, 700], 0], [70000, 5, 10000]]]]
for label, args, expected in fixtures[N-1]:
check(label, 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 |
|---|---|---|---|
| deficit to 500 | [18900, 0, 450] | [18000, 1, 500] | Failed |
| generated mix 5 | [24000, 0, 480] | [10000, 2, 1000] | Failed |
| on break | [18000, 1, 500] | [18000, 1, 500] | Passed |
| fraction | [28836, 1, 801] | [28836, 1, 801] | Passed |
| tie keeps actual | [18000, 0, 450] | [18000, 0, 450] | Passed |
| minimum | [9000, 0, 100] | [9000, 0, 100] | Passed |
| generated mix 7 | [20160, 0, 480] | [18000, 1, 500] | Failed |
| generated mix 15 | [20000, 2, 1700] | [20000, 2, 1700] | Passed |
SHA-256 / 93989aa055c5d0f1a1e9389a76abd033213f28e40673ac0e3b57be149a7b72b0
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(weight, rates, min_charge):
BREAKS = [0, 500, 1000, 2000, 5000, 10000]
w = max(1, math.ceil(weight))
idx = max(i for i, b in enumerate(BREAKS) if w >= b)
cost = -(-w * rates[idx] // 100)
best = [cost, idx, w]
for j in range(idx + 1, min(idx + 2, len(BREAKS))):
alt = BREAKS[j] * rates[j] // 100
if alt < best[0]:
best = [alt, j, BREAKS[j]]
return [max(best[0], min_charge), best[1], best[2]]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['deficit to 500', [450, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [18000, 1, 500]], ['generated mix 5', [480, [5000, 4900, 1000, 900, 800, 700], 9000], [10000, 2, 1000]], ['on break', [500, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [18000, 1, 500]], ['fraction', [800.5, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [28836, 1, 801]], ['tie keeps actual', [450, [4000, 3600, 3000, 2500, 2100, 1800], 9000], [18000, 0, 450]], ['minimum', [100, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [9000, 0, 100]], ['generated mix 7', [480, [4200, 3600, 3000, 2500, 2100, 1800], 0], [18000, 1, 500]], ['generated mix 15', [1700, [5000, 4900, 1000, 900, 800, 700], 20000], [20000, 2, 1700]]], [['generated mix 8', [450, [5000, 4900, 1000, 900, 800, 700], 9000], [10000, 2, 1000]], ['generated mix 5', [480, [5000, 4900, 1000, 900, 800, 700], 9000], [10000, 2, 1000]], ['fraction', [800.5, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [28836, 1, 801]], ['tie keeps actual', [450, [4000, 3600, 3000, 2500, 2100, 1800], 9000], [18000, 0, 450]], ['deficit to 500', [450, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [18000, 1, 500]], ['minimum', [100, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [9000, 0, 100]], ['generated mix 11', [480, [4200, 3600, 3000, 2500, 2100, 1800], 20000], [20000, 1, 500]], ['generated mix 19', [800.5, [4200, 3600, 3000, 2500, 2100, 1800], 20000], [28836, 1, 801]]], [['generated mix 21', [1700, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [50000, 3, 2000]], ['generated mix 5', [480, [5000, 4900, 1000, 900, 800, 700], 9000], [10000, 2, 1000]], ['skip a break', [400, [5000, 4900, 1000, 900, 800, 700], 0], [10000, 2, 1000]], ['on break', [500, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [18000, 1, 500]], ['fraction', [800.5, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [28836, 1, 801]], ['tie keeps actual', [450, [4000, 3600, 3000, 2500, 2100, 1800], 9000], [18000, 0, 450]], ['generated mix 22', [499.5, [5000, 4900, 1000, 900, 800, 700], 20000], [20000, 2, 1000]], ['generated mix 30', [1999.2, [5000, 4900, 1000, 900, 800, 700], 9000], [18000, 3, 2000]]], [['generated mix 40', [9000, [4237, 3611, 3044, 2517, 2150, 1833], 0], [183300, 5, 10000]], ['generated mix 5', [480, [5000, 4900, 1000, 900, 800, 700], 9000], [10000, 2, 1000]], ['minimum', [100, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [9000, 0, 100]], ['deficit to 1000', [850, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [30000, 2, 1000]], ['skip a break', [400, [5000, 4900, 1000, 900, 800, 700], 0], [10000, 2, 1000]], ['on break', [500, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [18000, 1, 500]], ['generated mix 32', [850, [5000, 4900, 1000, 900, 800, 700], 9000], [10000, 2, 1000]], ['generated mix 41', [4200, [5000, 4900, 1000, 900, 800, 700], 9000], [37800, 3, 4200]]], [['generated mix 57', [450, [4237, 3611, 3044, 2517, 2150, 1833], 20000], [20000, 1, 500]], ['generated mix 5', [480, [5000, 4900, 1000, 900, 800, 700], 9000], [10000, 2, 1000]], ['tie keeps actual', [450, [4000, 3600, 3000, 2500, 2100, 1800], 9000], [18000, 0, 450]], ['deficit to 500', [450, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [18000, 1, 500]], ['minimum', [100, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [9000, 0, 100]], ['deficit to 1000', [850, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [30000, 2, 1000]], ['generated mix 43', [850, [5000, 4900, 1000, 900, 800, 700], 20000], [20000, 2, 1000]], ['generated mix 51', [9000, [5000, 4900, 1000, 900, 800, 700], 0], [70000, 5, 10000]]]]
for label, args, expected in fixtures[N-1]:
check(label, 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 |
|---|---|---|---|
| deficit to 500 | [18000, 1, 500] | [18000, 1, 500] | Passed |
| generated mix 5 | [24000, 0, 480] | [10000, 2, 1000] | Failed |
| on break | [18000, 1, 500] | [18000, 1, 500] | Passed |
| fraction | [28836, 1, 801] | [28836, 1, 801] | Passed |
| tie keeps actual | [18000, 0, 450] | [18000, 0, 450] | Passed |
| minimum | [9000, 0, 100] | [9000, 0, 100] | Passed |
| generated mix 7 | [18000, 1, 500] | [18000, 1, 500] | Passed |
| generated mix 15 | [20000, 2, 1700] | [20000, 2, 1700] | Passed |
SHA-256 / a444c415ae98937a9a03a1924636115ccd298f168db4257bb71019d8f19e4f7a
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(weight, rates, min_charge):
BREAKS = [0, 500, 1000, 2000, 5000, 10000]
w = max(1, math.ceil(weight))
idx = max(i for i, b in enumerate(BREAKS) if w >= b)
cost = -(-w * rates[idx] // 100)
best = [cost, idx, w]
for j in range(idx + 1, len(BREAKS)):
alt = BREAKS[j] * rates[j] // 100
if alt < best[0]:
best = [alt, j, BREAKS[j]]
return [max(best[0], min_charge), best[1], best[2]]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['deficit to 500', [450, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [18000, 1, 500]], ['generated mix 5', [480, [5000, 4900, 1000, 900, 800, 700], 9000], [10000, 2, 1000]], ['on break', [500, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [18000, 1, 500]], ['fraction', [800.5, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [28836, 1, 801]], ['tie keeps actual', [450, [4000, 3600, 3000, 2500, 2100, 1800], 9000], [18000, 0, 450]], ['minimum', [100, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [9000, 0, 100]], ['generated mix 7', [480, [4200, 3600, 3000, 2500, 2100, 1800], 0], [18000, 1, 500]], ['generated mix 15', [1700, [5000, 4900, 1000, 900, 800, 700], 20000], [20000, 2, 1700]]], [['generated mix 8', [450, [5000, 4900, 1000, 900, 800, 700], 9000], [10000, 2, 1000]], ['generated mix 5', [480, [5000, 4900, 1000, 900, 800, 700], 9000], [10000, 2, 1000]], ['fraction', [800.5, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [28836, 1, 801]], ['tie keeps actual', [450, [4000, 3600, 3000, 2500, 2100, 1800], 9000], [18000, 0, 450]], ['deficit to 500', [450, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [18000, 1, 500]], ['minimum', [100, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [9000, 0, 100]], ['generated mix 11', [480, [4200, 3600, 3000, 2500, 2100, 1800], 20000], [20000, 1, 500]], ['generated mix 19', [800.5, [4200, 3600, 3000, 2500, 2100, 1800], 20000], [28836, 1, 801]]], [['generated mix 21', [1700, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [50000, 3, 2000]], ['generated mix 5', [480, [5000, 4900, 1000, 900, 800, 700], 9000], [10000, 2, 1000]], ['skip a break', [400, [5000, 4900, 1000, 900, 800, 700], 0], [10000, 2, 1000]], ['on break', [500, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [18000, 1, 500]], ['fraction', [800.5, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [28836, 1, 801]], ['tie keeps actual', [450, [4000, 3600, 3000, 2500, 2100, 1800], 9000], [18000, 0, 450]], ['generated mix 22', [499.5, [5000, 4900, 1000, 900, 800, 700], 20000], [20000, 2, 1000]], ['generated mix 30', [1999.2, [5000, 4900, 1000, 900, 800, 700], 9000], [18000, 3, 2000]]], [['generated mix 40', [9000, [4237, 3611, 3044, 2517, 2150, 1833], 0], [183300, 5, 10000]], ['generated mix 5', [480, [5000, 4900, 1000, 900, 800, 700], 9000], [10000, 2, 1000]], ['minimum', [100, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [9000, 0, 100]], ['deficit to 1000', [850, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [30000, 2, 1000]], ['skip a break', [400, [5000, 4900, 1000, 900, 800, 700], 0], [10000, 2, 1000]], ['on break', [500, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [18000, 1, 500]], ['generated mix 32', [850, [5000, 4900, 1000, 900, 800, 700], 9000], [10000, 2, 1000]], ['generated mix 41', [4200, [5000, 4900, 1000, 900, 800, 700], 9000], [37800, 3, 4200]]], [['generated mix 57', [450, [4237, 3611, 3044, 2517, 2150, 1833], 20000], [20000, 1, 500]], ['generated mix 5', [480, [5000, 4900, 1000, 900, 800, 700], 9000], [10000, 2, 1000]], ['tie keeps actual', [450, [4000, 3600, 3000, 2500, 2100, 1800], 9000], [18000, 0, 450]], ['deficit to 500', [450, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [18000, 1, 500]], ['minimum', [100, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [9000, 0, 100]], ['deficit to 1000', [850, [4200, 3600, 3000, 2500, 2100, 1800], 9000], [30000, 2, 1000]], ['generated mix 43', [850, [5000, 4900, 1000, 900, 800, 700], 20000], [20000, 2, 1000]], ['generated mix 51', [9000, [5000, 4900, 1000, 900, 800, 700], 0], [70000, 5, 10000]]]]
for label, args, expected in fixtures[N-1]:
check(label, 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 |
|---|---|---|---|
| deficit to 500 | [18000, 1, 500] | [18000, 1, 500] | Passed |
| generated mix 5 | [10000, 2, 1000] | [10000, 2, 1000] | Passed |
| on break | [18000, 1, 500] | [18000, 1, 500] | Passed |
| fraction | [28836, 1, 801] | [28836, 1, 801] | Passed |
| tie keeps actual | [18000, 0, 450] | [18000, 0, 450] | Passed |
| minimum | [9000, 0, 100] | [9000, 0, 100] | Passed |
| generated mix 7 | [18000, 1, 500] | [18000, 1, 500] | Passed |
| generated mix 15 | [20000, 2, 1700] | [20000, 2, 1700] | Passed |
SHA-256 / 1a2dd178911fb6aa5258a65d697d2b8ce5e0dc47364b9c1ec812694b591ae4e0
Verification & scope
Stipulated break table; no freight class or accessorials. 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:52:17.117200+00:00.
Case digest / c511ae330a0e5434e33cb9932186bfb5478f7e10ff0d6bd81afb8f006eb5eb17