FAILURE MAP
← Case archive

FA-68586 / Toll and parking fee computation / Open access

Express lane dynamic price: densities beyond the table hold the previous price · case 01

Express lane dynamic price returns a wrong result when densities beyond the table hold the previous price.

Verified by executionVariant 1 · 8 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

Densities beyond the last band target the last band price instead of the maximum price.

VERIFIED REPAIR

Restore the density beyond table rule so that the step reads `target = x['max_price']`.

Unsuccessful approach: Holding the previous price freezes pricing exactly when congestion is worst.

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['bands'][-1][1]
    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': 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': 50, 'prev_price': 775, 'bands': [[17, 175], [19, 425], [21, 700], [32, 750]], 'max_step': 25, 'min_price': 50, 'max_price': 1200, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 50}, [800, 0]), ({'density': 38, 'prev_price': 225, 'bands': [[10, 225], [20, 575], [29, 650], [38, 750]], 'max_step': 25, 'min_price': 50, 'max_price': 1200, 'occupancy': 1, 'hov_free_min': 4, 'hov2_pct': 50}, [250, 250]), ({'density': 26, 'prev_price': 1050, 'bands': [[24, 125], [26, 275], [27, 750], [43, 925]], 'max_step': 25, 'min_price': 50, 'max_price': 1200, 'occupancy': 4, 'hov_free_min': 3, 'hov2_pct': 50}, [1025, 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': 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': 36, 'prev_price': 1025, 'bands': [[17, 50], [22, 550], [27, 725], [35, 975]], 'max_step': 25, 'min_price': 50, 'max_price': 1200, 'occupancy': 4, 'hov_free_min': 3, 'hov2_pct': 70}, [1050, 0]), ({'density': 43, 'prev_price': 1150, 'bands': [[10, 375], [12, 575], [21, 625], [36, 875]], 'max_step': 50, 'min_price': 50, 'max_price': 1200, 'occupancy': 2, 'hov_free_min': 2, 'hov2_pct': 70}, [1200, 0])], [({'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': 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': 775, 'bands': [[16, 175], [22, 200], [29, 225], [35, 450]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [800, 800]), ({'density': 48, 'prev_price': 950, 'bands': [[12, 100], [14, 175], [38, 500], [42, 925]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 4, 'hov2_pct': 70}, [1000, 1000]), ({'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': 700, 'bands': [[16, 50], [22, 475], [23, 675], [32, 700]], 'max_step': 50, 'min_price': 50, 'max_price': 800, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [750, 750]), ({'density': 29, 'prev_price': 0, 'bands': [[16, 675], [29, 850], [33, 875], [34, 975]], 'max_step': 25, 'min_price': 50, 'max_price': 800, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 50}, [50, 0]), ({'density': 36, 'prev_price': 225, 'bands': [[10, 75], [18, 300], [27, 625], [34, 900]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 70}, [250, 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': 900, 'bands': [[22, 200], [24, 325], [33, 800], [41, 925]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 2, 'hov2_pct': 70}, [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': 49, 'prev_price': 900, 'bands': [[16, 650], [20, 850], [23, 925], [34, 950]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [1000, 1000]), ({'density': 14, 'prev_price': 525, 'bands': [[13, 200], [14, 350], [19, 850], [27, 925]], 'max_step': 25, 'min_price': 50, 'max_price': 800, 'occupancy': 4, 'hov_free_min': 2, 'hov2_pct': 70}, [500, 0]), ({'density': 48, 'prev_price': 175, 'bands': [[19, 275], [28, 325], [31, 675], [39, 725]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 4, 'hov_free_min': 2, 'hov2_pct': 50}, [225, 0]), ({'density': 50, 'prev_price': 1050, 'bands': [[11, 75], [15, 725], [29, 750], [32, 875]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 4, 'hov_free_min': 4, 'hov2_pct': 70}, [1000, 0]), ({'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': 48, 'prev_price': 900, 'bands': [[24, 250], [29, 275], [32, 975], [41, 1000]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 3, 'hov_free_min': 2, 'hov2_pct': 50}, [950, 0]), ({'density': 40, 'prev_price': 925, 'bands': [[12, 225], [32, 250], [34, 300], [37, 650]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 2, 'hov2_pct': 50}, [1000, 1000]), ({'density': 33, 'prev_price': 25, 'bands': [[20, 75], [21, 225], [33, 375], [34, 800]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 70}, [50, 35]), ({'density': 36, 'prev_price': 325, 'bands': [[26, 150], [33, 550], [36, 650], [38, 850]], 'max_step': 100, 'min_price': 50, 'max_price': 1200, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [425, 425]), ({'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': 50, 'prev_price': 50, 'bands': [[10, 375], [12, 475], [23, 525], [32, 575]], 'max_step': 100, 'min_price': 50, 'max_price': 1200, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [150, 150]), ({'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': 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': 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': 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': 800, 'bands': [[20, 50], [22, 350], [32, 450], [44, 575]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 50}, [825, 410]), ({'density': 45, 'prev_price': 1000, 'bands': [[19, 100], [30, 150], [34, 500], [37, 875]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 4, 'hov_free_min': 3, 'hov2_pct': 70}, [1000, 0]), ({'density': 50, 'prev_price': 425, 'bands': [[11, 200], [33, 250], [36, 500], [42, 625]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 2, 'hov2_pct': 70}, [525, 525]), ({'density': 45, 'prev_price': 700, 'bands': [[18, 50], [20, 425], [29, 675], [34, 800]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 4, 'hov_free_min': 2, 'hov2_pct': 70}, [750, 0]), ({'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': 33, 'prev_price': 1025, 'bands': [[17, 350], [20, 600], [33, 650], [38, 825]], 'max_step': 100, 'min_price': 50, 'max_price': 800, 'occupancy': 2, 'hov_free_min': 2, 'hov2_pct': 50}, [800, 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 fixtureActualExpectedOutcome
fee oracle 0[1000, 1000][1000, 1000]Passed
fee oracle 1[750, 0][800, 0]Failed
fee oracle 2[250, 250][250, 250]Passed
fee oracle 3[1025, 0][1025, 0]Passed
fee oracle 4[50, 50][50, 50]Passed
fee oracle 5[350, 245][350, 245]Passed
fee oracle 6[1000, 0][1050, 0]Failed
fee oracle 7[1100, 0][1200, 0]Failed

SHA-256 / 236e00d69263b55402d95e76e26295a4605e728b7a8ac0c35869c71abb56ea54

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    target = x['prev_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': 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': 50, 'prev_price': 775, 'bands': [[17, 175], [19, 425], [21, 700], [32, 750]], 'max_step': 25, 'min_price': 50, 'max_price': 1200, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 50}, [800, 0]), ({'density': 38, 'prev_price': 225, 'bands': [[10, 225], [20, 575], [29, 650], [38, 750]], 'max_step': 25, 'min_price': 50, 'max_price': 1200, 'occupancy': 1, 'hov_free_min': 4, 'hov2_pct': 50}, [250, 250]), ({'density': 26, 'prev_price': 1050, 'bands': [[24, 125], [26, 275], [27, 750], [43, 925]], 'max_step': 25, 'min_price': 50, 'max_price': 1200, 'occupancy': 4, 'hov_free_min': 3, 'hov2_pct': 50}, [1025, 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': 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': 36, 'prev_price': 1025, 'bands': [[17, 50], [22, 550], [27, 725], [35, 975]], 'max_step': 25, 'min_price': 50, 'max_price': 1200, 'occupancy': 4, 'hov_free_min': 3, 'hov2_pct': 70}, [1050, 0]), ({'density': 43, 'prev_price': 1150, 'bands': [[10, 375], [12, 575], [21, 625], [36, 875]], 'max_step': 50, 'min_price': 50, 'max_price': 1200, 'occupancy': 2, 'hov_free_min': 2, 'hov2_pct': 70}, [1200, 0])], [({'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': 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': 775, 'bands': [[16, 175], [22, 200], [29, 225], [35, 450]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [800, 800]), ({'density': 48, 'prev_price': 950, 'bands': [[12, 100], [14, 175], [38, 500], [42, 925]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 4, 'hov2_pct': 70}, [1000, 1000]), ({'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': 700, 'bands': [[16, 50], [22, 475], [23, 675], [32, 700]], 'max_step': 50, 'min_price': 50, 'max_price': 800, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [750, 750]), ({'density': 29, 'prev_price': 0, 'bands': [[16, 675], [29, 850], [33, 875], [34, 975]], 'max_step': 25, 'min_price': 50, 'max_price': 800, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 50}, [50, 0]), ({'density': 36, 'prev_price': 225, 'bands': [[10, 75], [18, 300], [27, 625], [34, 900]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 70}, [250, 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': 900, 'bands': [[22, 200], [24, 325], [33, 800], [41, 925]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 2, 'hov2_pct': 70}, [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': 49, 'prev_price': 900, 'bands': [[16, 650], [20, 850], [23, 925], [34, 950]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [1000, 1000]), ({'density': 14, 'prev_price': 525, 'bands': [[13, 200], [14, 350], [19, 850], [27, 925]], 'max_step': 25, 'min_price': 50, 'max_price': 800, 'occupancy': 4, 'hov_free_min': 2, 'hov2_pct': 70}, [500, 0]), ({'density': 48, 'prev_price': 175, 'bands': [[19, 275], [28, 325], [31, 675], [39, 725]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 4, 'hov_free_min': 2, 'hov2_pct': 50}, [225, 0]), ({'density': 50, 'prev_price': 1050, 'bands': [[11, 75], [15, 725], [29, 750], [32, 875]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 4, 'hov_free_min': 4, 'hov2_pct': 70}, [1000, 0]), ({'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': 48, 'prev_price': 900, 'bands': [[24, 250], [29, 275], [32, 975], [41, 1000]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 3, 'hov_free_min': 2, 'hov2_pct': 50}, [950, 0]), ({'density': 40, 'prev_price': 925, 'bands': [[12, 225], [32, 250], [34, 300], [37, 650]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 2, 'hov2_pct': 50}, [1000, 1000]), ({'density': 33, 'prev_price': 25, 'bands': [[20, 75], [21, 225], [33, 375], [34, 800]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 70}, [50, 35]), ({'density': 36, 'prev_price': 325, 'bands': [[26, 150], [33, 550], [36, 650], [38, 850]], 'max_step': 100, 'min_price': 50, 'max_price': 1200, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [425, 425]), ({'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': 50, 'prev_price': 50, 'bands': [[10, 375], [12, 475], [23, 525], [32, 575]], 'max_step': 100, 'min_price': 50, 'max_price': 1200, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [150, 150]), ({'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': 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': 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': 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': 800, 'bands': [[20, 50], [22, 350], [32, 450], [44, 575]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 50}, [825, 410]), ({'density': 45, 'prev_price': 1000, 'bands': [[19, 100], [30, 150], [34, 500], [37, 875]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 4, 'hov_free_min': 3, 'hov2_pct': 70}, [1000, 0]), ({'density': 50, 'prev_price': 425, 'bands': [[11, 200], [33, 250], [36, 500], [42, 625]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 2, 'hov2_pct': 70}, [525, 525]), ({'density': 45, 'prev_price': 700, 'bands': [[18, 50], [20, 425], [29, 675], [34, 800]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 4, 'hov_free_min': 2, 'hov2_pct': 70}, [750, 0]), ({'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': 33, 'prev_price': 1025, 'bands': [[17, 350], [20, 600], [33, 650], [38, 825]], 'max_step': 100, 'min_price': 50, 'max_price': 800, 'occupancy': 2, 'hov_free_min': 2, 'hov2_pct': 50}, [800, 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 fixtureActualExpectedOutcome
fee oracle 0[1000, 1000][1000, 1000]Passed
fee oracle 1[775, 0][800, 0]Failed
fee oracle 2[250, 250][250, 250]Passed
fee oracle 3[1025, 0][1025, 0]Passed
fee oracle 4[50, 50][50, 50]Passed
fee oracle 5[350, 245][350, 245]Passed
fee oracle 6[1025, 0][1050, 0]Failed
fee oracle 7[1150, 0][1200, 0]Failed

SHA-256 / 82390c211be085347e757a7f4e435cab6baaa3eb857ef9696ffdc2eb7457f8be

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': 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': 50, 'prev_price': 775, 'bands': [[17, 175], [19, 425], [21, 700], [32, 750]], 'max_step': 25, 'min_price': 50, 'max_price': 1200, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 50}, [800, 0]), ({'density': 38, 'prev_price': 225, 'bands': [[10, 225], [20, 575], [29, 650], [38, 750]], 'max_step': 25, 'min_price': 50, 'max_price': 1200, 'occupancy': 1, 'hov_free_min': 4, 'hov2_pct': 50}, [250, 250]), ({'density': 26, 'prev_price': 1050, 'bands': [[24, 125], [26, 275], [27, 750], [43, 925]], 'max_step': 25, 'min_price': 50, 'max_price': 1200, 'occupancy': 4, 'hov_free_min': 3, 'hov2_pct': 50}, [1025, 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': 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': 36, 'prev_price': 1025, 'bands': [[17, 50], [22, 550], [27, 725], [35, 975]], 'max_step': 25, 'min_price': 50, 'max_price': 1200, 'occupancy': 4, 'hov_free_min': 3, 'hov2_pct': 70}, [1050, 0]), ({'density': 43, 'prev_price': 1150, 'bands': [[10, 375], [12, 575], [21, 625], [36, 875]], 'max_step': 50, 'min_price': 50, 'max_price': 1200, 'occupancy': 2, 'hov_free_min': 2, 'hov2_pct': 70}, [1200, 0])], [({'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': 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': 775, 'bands': [[16, 175], [22, 200], [29, 225], [35, 450]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [800, 800]), ({'density': 48, 'prev_price': 950, 'bands': [[12, 100], [14, 175], [38, 500], [42, 925]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 4, 'hov2_pct': 70}, [1000, 1000]), ({'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': 700, 'bands': [[16, 50], [22, 475], [23, 675], [32, 700]], 'max_step': 50, 'min_price': 50, 'max_price': 800, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [750, 750]), ({'density': 29, 'prev_price': 0, 'bands': [[16, 675], [29, 850], [33, 875], [34, 975]], 'max_step': 25, 'min_price': 50, 'max_price': 800, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 50}, [50, 0]), ({'density': 36, 'prev_price': 225, 'bands': [[10, 75], [18, 300], [27, 625], [34, 900]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 70}, [250, 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': 900, 'bands': [[22, 200], [24, 325], [33, 800], [41, 925]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 2, 'hov2_pct': 70}, [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': 49, 'prev_price': 900, 'bands': [[16, 650], [20, 850], [23, 925], [34, 950]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [1000, 1000]), ({'density': 14, 'prev_price': 525, 'bands': [[13, 200], [14, 350], [19, 850], [27, 925]], 'max_step': 25, 'min_price': 50, 'max_price': 800, 'occupancy': 4, 'hov_free_min': 2, 'hov2_pct': 70}, [500, 0]), ({'density': 48, 'prev_price': 175, 'bands': [[19, 275], [28, 325], [31, 675], [39, 725]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 4, 'hov_free_min': 2, 'hov2_pct': 50}, [225, 0]), ({'density': 50, 'prev_price': 1050, 'bands': [[11, 75], [15, 725], [29, 750], [32, 875]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 4, 'hov_free_min': 4, 'hov2_pct': 70}, [1000, 0]), ({'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': 48, 'prev_price': 900, 'bands': [[24, 250], [29, 275], [32, 975], [41, 1000]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 3, 'hov_free_min': 2, 'hov2_pct': 50}, [950, 0]), ({'density': 40, 'prev_price': 925, 'bands': [[12, 225], [32, 250], [34, 300], [37, 650]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 2, 'hov2_pct': 50}, [1000, 1000]), ({'density': 33, 'prev_price': 25, 'bands': [[20, 75], [21, 225], [33, 375], [34, 800]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 70}, [50, 35]), ({'density': 36, 'prev_price': 325, 'bands': [[26, 150], [33, 550], [36, 650], [38, 850]], 'max_step': 100, 'min_price': 50, 'max_price': 1200, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [425, 425]), ({'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': 50, 'prev_price': 50, 'bands': [[10, 375], [12, 475], [23, 525], [32, 575]], 'max_step': 100, 'min_price': 50, 'max_price': 1200, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [150, 150]), ({'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': 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': 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': 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': 800, 'bands': [[20, 50], [22, 350], [32, 450], [44, 575]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 50}, [825, 410]), ({'density': 45, 'prev_price': 1000, 'bands': [[19, 100], [30, 150], [34, 500], [37, 875]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 4, 'hov_free_min': 3, 'hov2_pct': 70}, [1000, 0]), ({'density': 50, 'prev_price': 425, 'bands': [[11, 200], [33, 250], [36, 500], [42, 625]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 2, 'hov2_pct': 70}, [525, 525]), ({'density': 45, 'prev_price': 700, 'bands': [[18, 50], [20, 425], [29, 675], [34, 800]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 4, 'hov_free_min': 2, 'hov2_pct': 70}, [750, 0]), ({'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': 33, 'prev_price': 1025, 'bands': [[17, 350], [20, 600], [33, 650], [38, 825]], 'max_step': 100, 'min_price': 50, 'max_price': 800, 'occupancy': 2, 'hov_free_min': 2, 'hov2_pct': 50}, [800, 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 fixtureActualExpectedOutcome
fee oracle 0[1000, 1000][1000, 1000]Passed
fee oracle 1[800, 0][800, 0]Passed
fee oracle 2[250, 250][250, 250]Passed
fee oracle 3[1025, 0][1025, 0]Passed
fee oracle 4[50, 50][50, 50]Passed
fee oracle 5[350, 245][350, 245]Passed
fee oracle 6[1050, 0][1050, 0]Passed
fee oracle 7[1200, 0][1200, 0]Passed

SHA-256 / 201af94f87c784f30ffa8e1211ed5c1ee30f4b36d6dec6e040723d6e9e571233

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.558810+00:00.

Case digest / 085626e591cce7754fe3c309ab4a721f1fc44e5e6ddd6f71540417759afa6ea0