FA-68576 / Toll and parking fee computation / Open access
Express lane dynamic price: the HOV free threshold is hard-coded · case 01
Express lane dynamic price returns a wrong result when the HOV free threshold is hard-coded.
ROOT CAUSE
Vehicles with exactly the free occupancy are charged.
VERIFIED REPAIR
Restore the HOV free threshold rule so that the step reads `x['occupancy'] >= x['hov_free_min']`.
Unsuccessful approach: Hard-coding three ignores facilities configured for HOV2 or HOV4 free travel.
Case contract
Input {density, prev_price, bands: [[density upto, price]] ascending, max_step, min_price, max_price, occupancy, hov_free_min, hov2_pct}. The target is the first band whose upto is >= density, else max_price. The posted price moves from prev_price toward the target by at most max_step either way, then is clamped to [min_price, max_price]. Vehicles with occupancy >= hov_free_min pay 0; occupancy 2 (when not free) pays hov2_pct percent floored to 5 cents. Return [posted, charged].
Why this case matters
Fee engines bill customers in integer cents; a wrong boundary, rounding stage or cap scope silently over- or under-charges.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
target = x['max_price']
for upto, price in x['bands']:
if x['density'] <= upto:
target = price
break
prev = x['prev_price']
step = max(-x['max_step'], min(x['max_step'], target - prev))
price = max(x['min_price'], min(x['max_price'], prev + step))
if x['occupancy'] > x['hov_free_min']:
return [price, 0]
if x['occupancy'] == 2:
return [price, price * x['hov2_pct'] // 100 // 5 * 5]
return [price, price]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[({'density': 33, 'prev_price': 975, 'bands': [[26, 225], [33, 250], [37, 350], [38, 775]], 'max_step': 25, 'min_price': 50, 'max_price': 800, 'occupancy': 2, 'hov_free_min': 2, 'hov2_pct': 50}, [800, 0]), ({'density': 20, 'prev_price': 300, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 70}, [350, 245]), ({'density': 25, 'prev_price': 0, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [50, 50]), ({'density': 45, 'prev_price': 1100, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [1000, 1000]), ({'density': 14, 'prev_price': 1100, 'bands': [[14, 125], [20, 175], [23, 475], [37, 800]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 50}, [1000, 0]), ({'density': 41, 'prev_price': 475, 'bands': [[18, 400], [21, 850], [41, 925], [43, 1000]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 3, 'hov_free_min': 4, 'hov2_pct': 70}, [575, 575]), ({'density': 16, 'prev_price': 1100, 'bands': [[16, 275], [18, 500], [29, 800], [30, 975]], 'max_step': 50, 'min_price': 50, 'max_price': 800, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 50}, [800, 0]), ({'density': 22, 'prev_price': 25, 'bands': [[22, 200], [26, 250], [34, 525], [42, 825]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 50}, [125, 0])], [({'density': 20, 'prev_price': 575, 'bands': [[16, 50], [17, 225], [20, 325], [35, 575]], 'max_step': 25, 'min_price': 50, 'max_price': 800, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 50}, [550, 0]), ({'density': 25, 'prev_price': 800, 'bands': [[19, 50], [23, 450], [38, 650], [39, 775]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 70}, [700, 0]), ({'density': 20, 'prev_price': 300, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 70}, [350, 245]), ({'density': 12, 'prev_price': 450, 'bands': [[12, 75], [35, 400], [42, 800], [44, 825]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 2, 'hov2_pct': 70}, [400, 0]), ({'density': 25, 'prev_price': 0, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [50, 50]), ({'density': 45, 'prev_price': 1100, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [1000, 1000]), ({'density': 24, 'prev_price': 600, 'bands': [[11, 75], [21, 675], [24, 850], [36, 925]], 'max_step': 25, 'min_price': 50, 'max_price': 1200, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 50}, [625, 0]), ({'density': 41, 'prev_price': 0, 'bands': [[13, 400], [14, 550], [24, 775], [39, 975]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 3, 'hov_free_min': 4, 'hov2_pct': 50}, [100, 100])], [({'density': 34, 'prev_price': 1125, 'bands': [[16, 200], [23, 450], [32, 600], [34, 875]], 'max_step': 25, 'min_price': 50, 'max_price': 1200, 'occupancy': 3, 'hov_free_min': 4, 'hov2_pct': 70}, [1100, 1100]), ({'density': 25, 'prev_price': 0, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [50, 50]), ({'density': 45, 'prev_price': 1100, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [1000, 1000]), ({'density': 18, 'prev_price': 200, 'bands': [[18, 200], [26, 300], [38, 475], [40, 825]], 'max_step': 25, 'min_price': 50, 'max_price': 1200, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 50}, [200, 0]), ({'density': 26, 'prev_price': 1050, 'bands': [[15, 225], [23, 250], [29, 650], [40, 1000]], 'max_step': 25, 'min_price': 50, 'max_price': 1200, 'occupancy': 4, 'hov_free_min': 4, 'hov2_pct': 70}, [1025, 0]), ({'density': 20, 'prev_price': 300, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 70}, [350, 245]), ({'density': 26, 'prev_price': 750, 'bands': [[13, 50], [22, 625], [26, 875], [43, 1000]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [800, 800]), ({'density': 18, 'prev_price': 0, 'bands': [[16, 150], [18, 550], [36, 675], [41, 1000]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 2, 'hov2_pct': 50}, [50, 0])], [({'density': 41, 'prev_price': 325, 'bands': [[16, 100], [25, 225], [32, 500], [44, 675]], 'max_step': 25, 'min_price': 50, 'max_price': 800, 'occupancy': 2, 'hov_free_min': 2, 'hov2_pct': 70}, [350, 0]), ({'density': 25, 'prev_price': 0, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [50, 50]), ({'density': 34, 'prev_price': 550, 'bands': [[21, 50], [27, 525], [32, 675], [34, 750]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 4, 'hov_free_min': 4, 'hov2_pct': 50}, [650, 0]), ({'density': 17, 'prev_price': 1025, 'bands': [[10, 325], [17, 350], [29, 550], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 800, 'occupancy': 3, 'hov_free_min': 4, 'hov2_pct': 50}, [800, 800]), ({'density': 21, 'prev_price': 775, 'bands': [[18, 50], [21, 75], [23, 775], [37, 925]], 'max_step': 100, 'min_price': 50, 'max_price': 1200, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 70}, [675, 0]), ({'density': 20, 'prev_price': 300, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 70}, [350, 245]), ({'density': 45, 'prev_price': 1100, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [1000, 1000]), ({'density': 23, 'prev_price': 1200, 'bands': [[21, 125], [23, 175], [25, 325], [37, 725]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [1000, 1000])], [({'density': 29, 'prev_price': 350, 'bands': [[11, 200], [12, 425], [29, 550], [43, 750]], 'max_step': 50, 'min_price': 50, 'max_price': 800, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 50}, [400, 0]), ({'density': 41, 'prev_price': 800, 'bands': [[12, 125], [15, 150], [18, 475], [41, 575]], 'max_step': 50, 'min_price': 50, 'max_price': 1200, 'occupancy': 3, 'hov_free_min': 4, 'hov2_pct': 70}, [750, 750]), ({'density': 35, 'prev_price': 1275, 'bands': [[30, 200], [31, 475], [35, 550], [37, 675]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 3, 'hov_free_min': 4, 'hov2_pct': 50}, [1000, 1000]), ({'density': 25, 'prev_price': 0, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [50, 50]), ({'density': 45, 'prev_price': 1100, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [1000, 1000]), ({'density': 34, 'prev_price': 1225, 'bands': [[15, 175], [28, 450], [32, 575], [34, 950]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 2, 'hov2_pct': 70}, [1000, 0]), ({'density': 20, 'prev_price': 300, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 70}, [350, 245]), ({'density': 39, 'prev_price': 100, 'bands': [[13, 375], [31, 450], [37, 725], [43, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 800, 'occupancy': 4, 'hov_free_min': 4, 'hov2_pct': 70}, [150, 0])]]
for i, (args, expected) in enumerate(fixtures[N-1]):
check('fee oracle' + ' %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 |
|---|---|---|---|
| fee oracle 0 | [800, 400] | [800, 0] | Failed |
| fee oracle 1 | [350, 245] | [350, 245] | Passed |
| fee oracle 2 | [50, 50] | [50, 50] | Passed |
| fee oracle 3 | [1000, 1000] | [1000, 1000] | Passed |
| fee oracle 4 | [1000, 1000] | [1000, 0] | Failed |
| fee oracle 5 | [575, 575] | [575, 575] | Passed |
| fee oracle 6 | [800, 800] | [800, 0] | Failed |
| fee oracle 7 | [125, 125] | [125, 0] | Failed |
SHA-256 / f19699eef75ab9b4c739c47c0a524d00b7cc7d3cdcf8226a8d1610c3ed19df93
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
target = x['max_price']
for upto, price in x['bands']:
if x['density'] <= upto:
target = price
break
prev = x['prev_price']
step = max(-x['max_step'], min(x['max_step'], target - prev))
price = max(x['min_price'], min(x['max_price'], prev + step))
if x['occupancy'] >= 3:
return [price, 0]
if x['occupancy'] == 2:
return [price, price * x['hov2_pct'] // 100 // 5 * 5]
return [price, price]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[({'density': 33, 'prev_price': 975, 'bands': [[26, 225], [33, 250], [37, 350], [38, 775]], 'max_step': 25, 'min_price': 50, 'max_price': 800, 'occupancy': 2, 'hov_free_min': 2, 'hov2_pct': 50}, [800, 0]), ({'density': 20, 'prev_price': 300, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 70}, [350, 245]), ({'density': 25, 'prev_price': 0, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [50, 50]), ({'density': 45, 'prev_price': 1100, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [1000, 1000]), ({'density': 14, 'prev_price': 1100, 'bands': [[14, 125], [20, 175], [23, 475], [37, 800]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 50}, [1000, 0]), ({'density': 41, 'prev_price': 475, 'bands': [[18, 400], [21, 850], [41, 925], [43, 1000]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 3, 'hov_free_min': 4, 'hov2_pct': 70}, [575, 575]), ({'density': 16, 'prev_price': 1100, 'bands': [[16, 275], [18, 500], [29, 800], [30, 975]], 'max_step': 50, 'min_price': 50, 'max_price': 800, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 50}, [800, 0]), ({'density': 22, 'prev_price': 25, 'bands': [[22, 200], [26, 250], [34, 525], [42, 825]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 50}, [125, 0])], [({'density': 20, 'prev_price': 575, 'bands': [[16, 50], [17, 225], [20, 325], [35, 575]], 'max_step': 25, 'min_price': 50, 'max_price': 800, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 50}, [550, 0]), ({'density': 25, 'prev_price': 800, 'bands': [[19, 50], [23, 450], [38, 650], [39, 775]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 70}, [700, 0]), ({'density': 20, 'prev_price': 300, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 70}, [350, 245]), ({'density': 12, 'prev_price': 450, 'bands': [[12, 75], [35, 400], [42, 800], [44, 825]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 2, 'hov2_pct': 70}, [400, 0]), ({'density': 25, 'prev_price': 0, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [50, 50]), ({'density': 45, 'prev_price': 1100, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [1000, 1000]), ({'density': 24, 'prev_price': 600, 'bands': [[11, 75], [21, 675], [24, 850], [36, 925]], 'max_step': 25, 'min_price': 50, 'max_price': 1200, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 50}, [625, 0]), ({'density': 41, 'prev_price': 0, 'bands': [[13, 400], [14, 550], [24, 775], [39, 975]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 3, 'hov_free_min': 4, 'hov2_pct': 50}, [100, 100])], [({'density': 34, 'prev_price': 1125, 'bands': [[16, 200], [23, 450], [32, 600], [34, 875]], 'max_step': 25, 'min_price': 50, 'max_price': 1200, 'occupancy': 3, 'hov_free_min': 4, 'hov2_pct': 70}, [1100, 1100]), ({'density': 25, 'prev_price': 0, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [50, 50]), ({'density': 45, 'prev_price': 1100, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [1000, 1000]), ({'density': 18, 'prev_price': 200, 'bands': [[18, 200], [26, 300], [38, 475], [40, 825]], 'max_step': 25, 'min_price': 50, 'max_price': 1200, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 50}, [200, 0]), ({'density': 26, 'prev_price': 1050, 'bands': [[15, 225], [23, 250], [29, 650], [40, 1000]], 'max_step': 25, 'min_price': 50, 'max_price': 1200, 'occupancy': 4, 'hov_free_min': 4, 'hov2_pct': 70}, [1025, 0]), ({'density': 20, 'prev_price': 300, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 70}, [350, 245]), ({'density': 26, 'prev_price': 750, 'bands': [[13, 50], [22, 625], [26, 875], [43, 1000]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [800, 800]), ({'density': 18, 'prev_price': 0, 'bands': [[16, 150], [18, 550], [36, 675], [41, 1000]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 2, 'hov2_pct': 50}, [50, 0])], [({'density': 41, 'prev_price': 325, 'bands': [[16, 100], [25, 225], [32, 500], [44, 675]], 'max_step': 25, 'min_price': 50, 'max_price': 800, 'occupancy': 2, 'hov_free_min': 2, 'hov2_pct': 70}, [350, 0]), ({'density': 25, 'prev_price': 0, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [50, 50]), ({'density': 34, 'prev_price': 550, 'bands': [[21, 50], [27, 525], [32, 675], [34, 750]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 4, 'hov_free_min': 4, 'hov2_pct': 50}, [650, 0]), ({'density': 17, 'prev_price': 1025, 'bands': [[10, 325], [17, 350], [29, 550], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 800, 'occupancy': 3, 'hov_free_min': 4, 'hov2_pct': 50}, [800, 800]), ({'density': 21, 'prev_price': 775, 'bands': [[18, 50], [21, 75], [23, 775], [37, 925]], 'max_step': 100, 'min_price': 50, 'max_price': 1200, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 70}, [675, 0]), ({'density': 20, 'prev_price': 300, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 70}, [350, 245]), ({'density': 45, 'prev_price': 1100, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [1000, 1000]), ({'density': 23, 'prev_price': 1200, 'bands': [[21, 125], [23, 175], [25, 325], [37, 725]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [1000, 1000])], [({'density': 29, 'prev_price': 350, 'bands': [[11, 200], [12, 425], [29, 550], [43, 750]], 'max_step': 50, 'min_price': 50, 'max_price': 800, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 50}, [400, 0]), ({'density': 41, 'prev_price': 800, 'bands': [[12, 125], [15, 150], [18, 475], [41, 575]], 'max_step': 50, 'min_price': 50, 'max_price': 1200, 'occupancy': 3, 'hov_free_min': 4, 'hov2_pct': 70}, [750, 750]), ({'density': 35, 'prev_price': 1275, 'bands': [[30, 200], [31, 475], [35, 550], [37, 675]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 3, 'hov_free_min': 4, 'hov2_pct': 50}, [1000, 1000]), ({'density': 25, 'prev_price': 0, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [50, 50]), ({'density': 45, 'prev_price': 1100, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [1000, 1000]), ({'density': 34, 'prev_price': 1225, 'bands': [[15, 175], [28, 450], [32, 575], [34, 950]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 2, 'hov2_pct': 70}, [1000, 0]), ({'density': 20, 'prev_price': 300, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 70}, [350, 245]), ({'density': 39, 'prev_price': 100, 'bands': [[13, 375], [31, 450], [37, 725], [43, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 800, 'occupancy': 4, 'hov_free_min': 4, 'hov2_pct': 70}, [150, 0])]]
for i, (args, expected) in enumerate(fixtures[N-1]):
check('fee oracle' + ' %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 |
|---|---|---|---|
| fee oracle 0 | [800, 400] | [800, 0] | Failed |
| fee oracle 1 | [350, 245] | [350, 245] | Passed |
| fee oracle 2 | [50, 50] | [50, 50] | Passed |
| fee oracle 3 | [1000, 1000] | [1000, 1000] | Passed |
| fee oracle 4 | [1000, 0] | [1000, 0] | Passed |
| fee oracle 5 | [575, 0] | [575, 575] | Failed |
| fee oracle 6 | [800, 0] | [800, 0] | Passed |
| fee oracle 7 | [125, 0] | [125, 0] | Passed |
SHA-256 / 626fb50900c44722b3fba5fb5ac32ae1f631970ae64e2ae741f0fc79fc6ea2d7
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
target = x['max_price']
for upto, price in x['bands']:
if x['density'] <= upto:
target = price
break
prev = x['prev_price']
step = max(-x['max_step'], min(x['max_step'], target - prev))
price = max(x['min_price'], min(x['max_price'], prev + step))
if x['occupancy'] >= x['hov_free_min']:
return [price, 0]
if x['occupancy'] == 2:
return [price, price * x['hov2_pct'] // 100 // 5 * 5]
return [price, price]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[({'density': 33, 'prev_price': 975, 'bands': [[26, 225], [33, 250], [37, 350], [38, 775]], 'max_step': 25, 'min_price': 50, 'max_price': 800, 'occupancy': 2, 'hov_free_min': 2, 'hov2_pct': 50}, [800, 0]), ({'density': 20, 'prev_price': 300, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 70}, [350, 245]), ({'density': 25, 'prev_price': 0, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [50, 50]), ({'density': 45, 'prev_price': 1100, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [1000, 1000]), ({'density': 14, 'prev_price': 1100, 'bands': [[14, 125], [20, 175], [23, 475], [37, 800]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 50}, [1000, 0]), ({'density': 41, 'prev_price': 475, 'bands': [[18, 400], [21, 850], [41, 925], [43, 1000]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 3, 'hov_free_min': 4, 'hov2_pct': 70}, [575, 575]), ({'density': 16, 'prev_price': 1100, 'bands': [[16, 275], [18, 500], [29, 800], [30, 975]], 'max_step': 50, 'min_price': 50, 'max_price': 800, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 50}, [800, 0]), ({'density': 22, 'prev_price': 25, 'bands': [[22, 200], [26, 250], [34, 525], [42, 825]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 50}, [125, 0])], [({'density': 20, 'prev_price': 575, 'bands': [[16, 50], [17, 225], [20, 325], [35, 575]], 'max_step': 25, 'min_price': 50, 'max_price': 800, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 50}, [550, 0]), ({'density': 25, 'prev_price': 800, 'bands': [[19, 50], [23, 450], [38, 650], [39, 775]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 70}, [700, 0]), ({'density': 20, 'prev_price': 300, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 70}, [350, 245]), ({'density': 12, 'prev_price': 450, 'bands': [[12, 75], [35, 400], [42, 800], [44, 825]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 2, 'hov2_pct': 70}, [400, 0]), ({'density': 25, 'prev_price': 0, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [50, 50]), ({'density': 45, 'prev_price': 1100, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [1000, 1000]), ({'density': 24, 'prev_price': 600, 'bands': [[11, 75], [21, 675], [24, 850], [36, 925]], 'max_step': 25, 'min_price': 50, 'max_price': 1200, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 50}, [625, 0]), ({'density': 41, 'prev_price': 0, 'bands': [[13, 400], [14, 550], [24, 775], [39, 975]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 3, 'hov_free_min': 4, 'hov2_pct': 50}, [100, 100])], [({'density': 34, 'prev_price': 1125, 'bands': [[16, 200], [23, 450], [32, 600], [34, 875]], 'max_step': 25, 'min_price': 50, 'max_price': 1200, 'occupancy': 3, 'hov_free_min': 4, 'hov2_pct': 70}, [1100, 1100]), ({'density': 25, 'prev_price': 0, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [50, 50]), ({'density': 45, 'prev_price': 1100, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [1000, 1000]), ({'density': 18, 'prev_price': 200, 'bands': [[18, 200], [26, 300], [38, 475], [40, 825]], 'max_step': 25, 'min_price': 50, 'max_price': 1200, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 50}, [200, 0]), ({'density': 26, 'prev_price': 1050, 'bands': [[15, 225], [23, 250], [29, 650], [40, 1000]], 'max_step': 25, 'min_price': 50, 'max_price': 1200, 'occupancy': 4, 'hov_free_min': 4, 'hov2_pct': 70}, [1025, 0]), ({'density': 20, 'prev_price': 300, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 70}, [350, 245]), ({'density': 26, 'prev_price': 750, 'bands': [[13, 50], [22, 625], [26, 875], [43, 1000]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [800, 800]), ({'density': 18, 'prev_price': 0, 'bands': [[16, 150], [18, 550], [36, 675], [41, 1000]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 2, 'hov2_pct': 50}, [50, 0])], [({'density': 41, 'prev_price': 325, 'bands': [[16, 100], [25, 225], [32, 500], [44, 675]], 'max_step': 25, 'min_price': 50, 'max_price': 800, 'occupancy': 2, 'hov_free_min': 2, 'hov2_pct': 70}, [350, 0]), ({'density': 25, 'prev_price': 0, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [50, 50]), ({'density': 34, 'prev_price': 550, 'bands': [[21, 50], [27, 525], [32, 675], [34, 750]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 4, 'hov_free_min': 4, 'hov2_pct': 50}, [650, 0]), ({'density': 17, 'prev_price': 1025, 'bands': [[10, 325], [17, 350], [29, 550], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 800, 'occupancy': 3, 'hov_free_min': 4, 'hov2_pct': 50}, [800, 800]), ({'density': 21, 'prev_price': 775, 'bands': [[18, 50], [21, 75], [23, 775], [37, 925]], 'max_step': 100, 'min_price': 50, 'max_price': 1200, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 70}, [675, 0]), ({'density': 20, 'prev_price': 300, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 70}, [350, 245]), ({'density': 45, 'prev_price': 1100, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [1000, 1000]), ({'density': 23, 'prev_price': 1200, 'bands': [[21, 125], [23, 175], [25, 325], [37, 725]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [1000, 1000])], [({'density': 29, 'prev_price': 350, 'bands': [[11, 200], [12, 425], [29, 550], [43, 750]], 'max_step': 50, 'min_price': 50, 'max_price': 800, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 50}, [400, 0]), ({'density': 41, 'prev_price': 800, 'bands': [[12, 125], [15, 150], [18, 475], [41, 575]], 'max_step': 50, 'min_price': 50, 'max_price': 1200, 'occupancy': 3, 'hov_free_min': 4, 'hov2_pct': 70}, [750, 750]), ({'density': 35, 'prev_price': 1275, 'bands': [[30, 200], [31, 475], [35, 550], [37, 675]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 3, 'hov_free_min': 4, 'hov2_pct': 50}, [1000, 1000]), ({'density': 25, 'prev_price': 0, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [50, 50]), ({'density': 45, 'prev_price': 1100, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [1000, 1000]), ({'density': 34, 'prev_price': 1225, 'bands': [[15, 175], [28, 450], [32, 575], [34, 950]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 2, 'hov2_pct': 70}, [1000, 0]), ({'density': 20, 'prev_price': 300, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 70}, [350, 245]), ({'density': 39, 'prev_price': 100, 'bands': [[13, 375], [31, 450], [37, 725], [43, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 800, 'occupancy': 4, 'hov_free_min': 4, 'hov2_pct': 70}, [150, 0])]]
for i, (args, expected) in enumerate(fixtures[N-1]):
check('fee oracle' + ' %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 |
|---|---|---|---|
| fee oracle 0 | [800, 0] | [800, 0] | Passed |
| fee oracle 1 | [350, 245] | [350, 245] | Passed |
| fee oracle 2 | [50, 50] | [50, 50] | Passed |
| fee oracle 3 | [1000, 1000] | [1000, 1000] | Passed |
| fee oracle 4 | [1000, 0] | [1000, 0] | Passed |
| fee oracle 5 | [575, 575] | [575, 575] | Passed |
| fee oracle 6 | [800, 0] | [800, 0] | Passed |
| fee oracle 7 | [125, 0] | [125, 0] | Passed |
SHA-256 / a23ed68bfd852a45b28deffdcd139845f9f29fe13b19652e3a0d1148fa8d2b95
Verification & scope
A deterministic, bounded toy model with a stipulated contract; it makes no claim of conformance to any agency manual or standard. 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:48:03.512588+00:00.
Case digest / 8df99f1c597caa9026e7d24b103cd060258c5fff0083e66749f28214846c9f2d