FA-66201 / Aviation weight and balance / Open access
Change exactly at the LMC tolerance forces a new loadsheet · case 01
Two changes totalling exactly the tolerance are rejected.
ROOT CAUSE
The weight tolerance comparison excludes the limit value.
VERIFIED REPAIR
Allow gross changes up to and including the tolerance.
Unsuccessful approach: Moving the inclusive comparison to the index tolerance leaves the weight check wrong and breaks the index boundary.
Case contract
Input {'tow','mtow','index','index_limits','max_lmc_weight','max_lmc_index','changes':[['add'|'remove', kg, index effect of adding]]}. The weight tolerance applies to the gross sum of all changed weights (<= limit allowed); removals negate weight and index; |net index| <= limit. Then new TOW <= MTOW and new index within inclusive limits, else 'NEW_LOADSHEET'. Return ['LMC', new TOW, new index r1].
Why this case matters
Last-minute changes may be annotated on an issued loadsheet only within weight and index tolerances; offsetting changes must not hide large movements.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
gross = 0
dw = 0
di = 0.0
for kind, wt, idx in x['changes']:
s = 1 if kind == 'add' else -1
gross += wt
dw += s * wt
di += s * idx
if gross >= x['max_lmc_weight'] or abs(di) > x['max_lmc_index']: return 'NEW_LOADSHEET'
tow = x['tow'] + dw
ti = x['index'] + di
lo, hi = x['index_limits']
if tow > x['mtow'] or ti < lo or ti > hi: return 'NEW_LOADSHEET'
return ['LMC', tow, round(ti, 1)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['two late passengers', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 171, 1.5], ['add', 85, 0.8]]}, ['LMC', 68256, 54.3]], ['swap cancels net', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 300, 2.0], ['remove', 291, 1.9]]}, 'NEW_LOADSHEET'], ['exactly at weight tolerance', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 250, 1.0], ['add', 250, 1.0]]}, ['LMC', 68500, 54.0]], ['offload moves index', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['remove', 200, 3.1]]}, ['LMC', 67800, 48.9]], ['change pushes over MTOW', {'tow': 69900, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 151, 0.5]]}, 'NEW_LOADSHEET'], ['change pushes index out', {'tow': 68000, 'mtow': 70000, 'index': 68.5, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 100, 2.1]]}, 'NEW_LOADSHEET'], ['already heavy then offload', {'tow': 70200, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['remove', 150, 0.5]]}, 'NEW_LOADSHEET'], ['sampled case 1', {'tow': 64100, 'mtow': 70000, 'index': 45.9, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 3.0, 'changes': [['remove', 180, 3.4], ['remove', 155, -2.5], ['add', 35, -3.5], ['add', 345, 3.7]]}, 'NEW_LOADSHEET'], ['sampled case 2', {'tow': 68550, 'mtow': 70000, 'index': 33.1, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 400, 'max_lmc_index': 3.0, 'changes': [['add', 340, -1.0], ['remove', 260, 1.2]]}, 'NEW_LOADSHEET'], ['sampled case 3', {'tow': 61300, 'mtow': 70000, 'index': 42.1, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 400, 'max_lmc_index': 3.0, 'changes': [['add', 350, -3.5], ['remove', 30, -2.6], ['add', 230, 1.5]]}, 'NEW_LOADSHEET'], ['regression: weight tolerance boundary', {'tow': 62750, 'mtow': 70000, 'index': 35.1, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 600, 'max_lmc_index': 5.0, 'changes': [['remove', 185, -0.9], ['remove', 65, 3.5], ['remove', 300, 2.4]]}, ['LMC', 62200, 30.1]]], [['two late passengers', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 172, 1.5], ['add', 85, 0.8]]}, ['LMC', 68257, 54.3]], ['swap cancels net', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 300, 2.0], ['remove', 292, 1.9]]}, 'NEW_LOADSHEET'], ['exactly at weight tolerance', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 250, 1.0], ['add', 250, 1.0]]}, ['LMC', 68500, 54.0]], ['offload moves index', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['remove', 200, 3.2]]}, ['LMC', 67800, 48.8]], ['change pushes over MTOW', {'tow': 69900, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 152, 0.5]]}, 'NEW_LOADSHEET'], ['change pushes index out', {'tow': 68000, 'mtow': 70000, 'index': 68.5, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 100, 2.2]]}, 'NEW_LOADSHEET'], ['already heavy then offload', {'tow': 70200, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['remove', 150, 1.0]]}, 'NEW_LOADSHEET'], ['sampled case 1', {'tow': 68750, 'mtow': 70000, 'index': 62.6, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 3.0, 'changes': [['add', 275, -2.1], ['add', 25, -1.8]]}, 'NEW_LOADSHEET'], ['sampled case 2', {'tow': 64950, 'mtow': 70000, 'index': 44.5, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 600, 'max_lmc_index': 3.0, 'changes': [['add', 385, 2.3]]}, ['LMC', 65335, 46.8]], ['sampled case 3', {'tow': 65950, 'mtow': 70000, 'index': 59.8, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 3.0, 'changes': [['remove', 170, 1.7]]}, ['LMC', 65780, 58.1]], ['regression: weight tolerance boundary', {'tow': 69650, 'mtow': 70000, 'index': 48.8, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 3.0, 'changes': [['add', 115, 2.4], ['add', 245, -2.5], ['remove', 50, -3.1]]}, ['LMC', 69960, 51.8]]], [['two late passengers', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 173, 1.5], ['add', 85, 0.8]]}, ['LMC', 68258, 54.3]], ['swap cancels net', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 300, 2.0], ['remove', 293, 1.9]]}, 'NEW_LOADSHEET'], ['exactly at weight tolerance', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 250, 1.0], ['add', 250, 1.0]]}, ['LMC', 68500, 54.0]], ['offload moves index', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['remove', 200, 3.3]]}, ['LMC', 67800, 48.7]], ['change pushes over MTOW', {'tow': 69900, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 153, 0.5]]}, 'NEW_LOADSHEET'], ['change pushes index out', {'tow': 68000, 'mtow': 70000, 'index': 68.5, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 100, 2.3]]}, 'NEW_LOADSHEET'], ['already heavy then offload', {'tow': 70200, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['remove', 150, 1.5]]}, 'NEW_LOADSHEET'], ['sampled case 1', {'tow': 64750, 'mtow': 70000, 'index': 33.1, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 3.0, 'changes': [['remove', 20, 2.4], ['remove', 125, -3.9], ['remove', 190, 3.9], ['remove', 270, 3.3]]}, 'NEW_LOADSHEET'], ['sampled case 2', {'tow': 63200, 'mtow': 70000, 'index': 47.1, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 400, 'max_lmc_index': 5.0, 'changes': [['remove', 335, -0.9], ['add', 105, 3.3]]}, 'NEW_LOADSHEET'], ['sampled case 3', {'tow': 66200, 'mtow': 70000, 'index': 38.1, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 400, 'max_lmc_index': 3.0, 'changes': [['add', 150, -0.8], ['add', 95, 1.5], ['add', 140, -2.4], ['add', 150, -0.8]]}, 'NEW_LOADSHEET'], ['regression: weight tolerance boundary', {'tow': 66400, 'mtow': 70000, 'index': 50.8, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 600, 'max_lmc_index': 3.0, 'changes': [['add', 210, -3.0]]}, ['LMC', 66610, 47.8]]], [['two late passengers', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 174, 1.5], ['add', 85, 0.8]]}, ['LMC', 68259, 54.3]], ['swap cancels net', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 300, 2.0], ['remove', 294, 1.9]]}, 'NEW_LOADSHEET'], ['exactly at weight tolerance', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 250, 1.0], ['add', 250, 1.0]]}, ['LMC', 68500, 54.0]], ['offload moves index', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['remove', 200, 3.4]]}, ['LMC', 67800, 48.6]], ['change pushes over MTOW', {'tow': 69900, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 154, 0.5]]}, 'NEW_LOADSHEET'], ['change pushes index out', {'tow': 68000, 'mtow': 70000, 'index': 68.5, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 100, 2.4]]}, 'NEW_LOADSHEET'], ['already heavy then offload', {'tow': 70200, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['remove', 150, 2.0]]}, 'NEW_LOADSHEET'], ['sampled case 1', {'tow': 66150, 'mtow': 70000, 'index': 46.1, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 400, 'max_lmc_index': 3.0, 'changes': [['add', 390, 0.4], ['remove', 40, 2.1], ['add', 300, 3.5]]}, 'NEW_LOADSHEET'], ['sampled case 2', {'tow': 64000, 'mtow': 70000, 'index': 30.4, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 3.0, 'changes': [['remove', 350, 3.5], ['remove', 60, 0.9]]}, 'NEW_LOADSHEET'], ['sampled case 3', {'tow': 60650, 'mtow': 70000, 'index': 63.7, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 295, -2.6]]}, ['LMC', 60945, 61.1]], ['regression: weight tolerance boundary', {'tow': 67100, 'mtow': 70000, 'index': 51.9, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 400, 'max_lmc_index': 3.0, 'changes': [['add', 200, 3.0]]}, ['LMC', 67300, 54.9]]], [['two late passengers', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 175, 1.5], ['add', 85, 0.8]]}, ['LMC', 68260, 54.3]], ['swap cancels net', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 300, 2.0], ['remove', 295, 1.9]]}, 'NEW_LOADSHEET'], ['exactly at weight tolerance', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 250, 1.0], ['add', 250, 1.0]]}, ['LMC', 68500, 54.0]], ['offload moves index', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['remove', 200, 3.5]]}, ['LMC', 67800, 48.5]], ['change pushes over MTOW', {'tow': 69900, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 155, 0.5]]}, 'NEW_LOADSHEET'], ['change pushes index out', {'tow': 68000, 'mtow': 70000, 'index': 68.5, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 100, 2.5]]}, 'NEW_LOADSHEET'], ['already heavy then offload', {'tow': 70200, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['remove', 150, 2.5]]}, 'NEW_LOADSHEET'], ['sampled case 1', {'tow': 69850, 'mtow': 70000, 'index': 46.3, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 600, 'max_lmc_index': 5.0, 'changes': [['add', 195, -0.8], ['add', 240, -1.5]]}, 'NEW_LOADSHEET'], ['sampled case 2', {'tow': 69600, 'mtow': 70000, 'index': 31.5, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 600, 'max_lmc_index': 3.0, 'changes': [['add', 180, 3.5], ['remove', 165, 3.5]]}, ['LMC', 69615, 31.5]], ['sampled case 3', {'tow': 61550, 'mtow': 70000, 'index': 46.4, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 600, 'max_lmc_index': 5.0, 'changes': [['remove', 340, 1.9], ['remove', 260, -0.5]]}, ['LMC', 60950, 45.0]], ['regression: weight tolerance boundary', {'tow': 67100, 'mtow': 70000, 'index': 50.3, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 600, 'max_lmc_index': 5.0, 'changes': [['remove', 230, 0.1], ['add', 135, 0.2], ['add', 20, 4.0], ['remove', 105, -0.9]]}, ['LMC', 66920, 55.3]]]]
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 |
|---|---|---|---|
| two late passengers | ['LMC', 68256, 54.3] | ['LMC', 68256, 54.3] | Passed |
| swap cancels net | NEW_LOADSHEET | NEW_LOADSHEET | Passed |
| exactly at weight tolerance | NEW_LOADSHEET | ['LMC', 68500, 54.0] | Failed |
| offload moves index | ['LMC', 67800, 48.9] | ['LMC', 67800, 48.9] | Passed |
| change pushes over MTOW | NEW_LOADSHEET | NEW_LOADSHEET | Passed |
| change pushes index out | NEW_LOADSHEET | NEW_LOADSHEET | Passed |
| already heavy then offload | NEW_LOADSHEET | NEW_LOADSHEET | Passed |
| sampled case 1 | NEW_LOADSHEET | NEW_LOADSHEET | Passed |
| sampled case 2 | NEW_LOADSHEET | NEW_LOADSHEET | Passed |
| sampled case 3 | NEW_LOADSHEET | NEW_LOADSHEET | Passed |
| regression: weight tolerance boundary | ['LMC', 62200, 30.1] | ['LMC', 62200, 30.1] | Passed |
SHA-256 / 1d189f48c69f5091559cb72460cb5313d098f06bc17a87da4c55dce517aa4079
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
gross = 0
dw = 0
di = 0.0
for kind, wt, idx in x['changes']:
s = 1 if kind == 'add' else -1
gross += wt
dw += s * wt
di += s * idx
if gross > x['max_lmc_weight'] or abs(di) >= x['max_lmc_index']: return 'NEW_LOADSHEET'
tow = x['tow'] + dw
ti = x['index'] + di
lo, hi = x['index_limits']
if tow > x['mtow'] or ti < lo or ti > hi: return 'NEW_LOADSHEET'
return ['LMC', tow, round(ti, 1)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['two late passengers', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 171, 1.5], ['add', 85, 0.8]]}, ['LMC', 68256, 54.3]], ['swap cancels net', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 300, 2.0], ['remove', 291, 1.9]]}, 'NEW_LOADSHEET'], ['exactly at weight tolerance', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 250, 1.0], ['add', 250, 1.0]]}, ['LMC', 68500, 54.0]], ['offload moves index', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['remove', 200, 3.1]]}, ['LMC', 67800, 48.9]], ['change pushes over MTOW', {'tow': 69900, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 151, 0.5]]}, 'NEW_LOADSHEET'], ['change pushes index out', {'tow': 68000, 'mtow': 70000, 'index': 68.5, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 100, 2.1]]}, 'NEW_LOADSHEET'], ['already heavy then offload', {'tow': 70200, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['remove', 150, 0.5]]}, 'NEW_LOADSHEET'], ['sampled case 1', {'tow': 64100, 'mtow': 70000, 'index': 45.9, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 3.0, 'changes': [['remove', 180, 3.4], ['remove', 155, -2.5], ['add', 35, -3.5], ['add', 345, 3.7]]}, 'NEW_LOADSHEET'], ['sampled case 2', {'tow': 68550, 'mtow': 70000, 'index': 33.1, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 400, 'max_lmc_index': 3.0, 'changes': [['add', 340, -1.0], ['remove', 260, 1.2]]}, 'NEW_LOADSHEET'], ['sampled case 3', {'tow': 61300, 'mtow': 70000, 'index': 42.1, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 400, 'max_lmc_index': 3.0, 'changes': [['add', 350, -3.5], ['remove', 30, -2.6], ['add', 230, 1.5]]}, 'NEW_LOADSHEET'], ['regression: weight tolerance boundary', {'tow': 62750, 'mtow': 70000, 'index': 35.1, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 600, 'max_lmc_index': 5.0, 'changes': [['remove', 185, -0.9], ['remove', 65, 3.5], ['remove', 300, 2.4]]}, ['LMC', 62200, 30.1]]], [['two late passengers', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 172, 1.5], ['add', 85, 0.8]]}, ['LMC', 68257, 54.3]], ['swap cancels net', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 300, 2.0], ['remove', 292, 1.9]]}, 'NEW_LOADSHEET'], ['exactly at weight tolerance', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 250, 1.0], ['add', 250, 1.0]]}, ['LMC', 68500, 54.0]], ['offload moves index', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['remove', 200, 3.2]]}, ['LMC', 67800, 48.8]], ['change pushes over MTOW', {'tow': 69900, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 152, 0.5]]}, 'NEW_LOADSHEET'], ['change pushes index out', {'tow': 68000, 'mtow': 70000, 'index': 68.5, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 100, 2.2]]}, 'NEW_LOADSHEET'], ['already heavy then offload', {'tow': 70200, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['remove', 150, 1.0]]}, 'NEW_LOADSHEET'], ['sampled case 1', {'tow': 68750, 'mtow': 70000, 'index': 62.6, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 3.0, 'changes': [['add', 275, -2.1], ['add', 25, -1.8]]}, 'NEW_LOADSHEET'], ['sampled case 2', {'tow': 64950, 'mtow': 70000, 'index': 44.5, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 600, 'max_lmc_index': 3.0, 'changes': [['add', 385, 2.3]]}, ['LMC', 65335, 46.8]], ['sampled case 3', {'tow': 65950, 'mtow': 70000, 'index': 59.8, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 3.0, 'changes': [['remove', 170, 1.7]]}, ['LMC', 65780, 58.1]], ['regression: weight tolerance boundary', {'tow': 69650, 'mtow': 70000, 'index': 48.8, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 3.0, 'changes': [['add', 115, 2.4], ['add', 245, -2.5], ['remove', 50, -3.1]]}, ['LMC', 69960, 51.8]]], [['two late passengers', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 173, 1.5], ['add', 85, 0.8]]}, ['LMC', 68258, 54.3]], ['swap cancels net', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 300, 2.0], ['remove', 293, 1.9]]}, 'NEW_LOADSHEET'], ['exactly at weight tolerance', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 250, 1.0], ['add', 250, 1.0]]}, ['LMC', 68500, 54.0]], ['offload moves index', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['remove', 200, 3.3]]}, ['LMC', 67800, 48.7]], ['change pushes over MTOW', {'tow': 69900, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 153, 0.5]]}, 'NEW_LOADSHEET'], ['change pushes index out', {'tow': 68000, 'mtow': 70000, 'index': 68.5, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 100, 2.3]]}, 'NEW_LOADSHEET'], ['already heavy then offload', {'tow': 70200, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['remove', 150, 1.5]]}, 'NEW_LOADSHEET'], ['sampled case 1', {'tow': 64750, 'mtow': 70000, 'index': 33.1, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 3.0, 'changes': [['remove', 20, 2.4], ['remove', 125, -3.9], ['remove', 190, 3.9], ['remove', 270, 3.3]]}, 'NEW_LOADSHEET'], ['sampled case 2', {'tow': 63200, 'mtow': 70000, 'index': 47.1, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 400, 'max_lmc_index': 5.0, 'changes': [['remove', 335, -0.9], ['add', 105, 3.3]]}, 'NEW_LOADSHEET'], ['sampled case 3', {'tow': 66200, 'mtow': 70000, 'index': 38.1, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 400, 'max_lmc_index': 3.0, 'changes': [['add', 150, -0.8], ['add', 95, 1.5], ['add', 140, -2.4], ['add', 150, -0.8]]}, 'NEW_LOADSHEET'], ['regression: weight tolerance boundary', {'tow': 66400, 'mtow': 70000, 'index': 50.8, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 600, 'max_lmc_index': 3.0, 'changes': [['add', 210, -3.0]]}, ['LMC', 66610, 47.8]]], [['two late passengers', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 174, 1.5], ['add', 85, 0.8]]}, ['LMC', 68259, 54.3]], ['swap cancels net', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 300, 2.0], ['remove', 294, 1.9]]}, 'NEW_LOADSHEET'], ['exactly at weight tolerance', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 250, 1.0], ['add', 250, 1.0]]}, ['LMC', 68500, 54.0]], ['offload moves index', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['remove', 200, 3.4]]}, ['LMC', 67800, 48.6]], ['change pushes over MTOW', {'tow': 69900, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 154, 0.5]]}, 'NEW_LOADSHEET'], ['change pushes index out', {'tow': 68000, 'mtow': 70000, 'index': 68.5, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 100, 2.4]]}, 'NEW_LOADSHEET'], ['already heavy then offload', {'tow': 70200, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['remove', 150, 2.0]]}, 'NEW_LOADSHEET'], ['sampled case 1', {'tow': 66150, 'mtow': 70000, 'index': 46.1, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 400, 'max_lmc_index': 3.0, 'changes': [['add', 390, 0.4], ['remove', 40, 2.1], ['add', 300, 3.5]]}, 'NEW_LOADSHEET'], ['sampled case 2', {'tow': 64000, 'mtow': 70000, 'index': 30.4, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 3.0, 'changes': [['remove', 350, 3.5], ['remove', 60, 0.9]]}, 'NEW_LOADSHEET'], ['sampled case 3', {'tow': 60650, 'mtow': 70000, 'index': 63.7, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 295, -2.6]]}, ['LMC', 60945, 61.1]], ['regression: weight tolerance boundary', {'tow': 67100, 'mtow': 70000, 'index': 51.9, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 400, 'max_lmc_index': 3.0, 'changes': [['add', 200, 3.0]]}, ['LMC', 67300, 54.9]]], [['two late passengers', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 175, 1.5], ['add', 85, 0.8]]}, ['LMC', 68260, 54.3]], ['swap cancels net', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 300, 2.0], ['remove', 295, 1.9]]}, 'NEW_LOADSHEET'], ['exactly at weight tolerance', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 250, 1.0], ['add', 250, 1.0]]}, ['LMC', 68500, 54.0]], ['offload moves index', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['remove', 200, 3.5]]}, ['LMC', 67800, 48.5]], ['change pushes over MTOW', {'tow': 69900, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 155, 0.5]]}, 'NEW_LOADSHEET'], ['change pushes index out', {'tow': 68000, 'mtow': 70000, 'index': 68.5, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 100, 2.5]]}, 'NEW_LOADSHEET'], ['already heavy then offload', {'tow': 70200, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['remove', 150, 2.5]]}, 'NEW_LOADSHEET'], ['sampled case 1', {'tow': 69850, 'mtow': 70000, 'index': 46.3, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 600, 'max_lmc_index': 5.0, 'changes': [['add', 195, -0.8], ['add', 240, -1.5]]}, 'NEW_LOADSHEET'], ['sampled case 2', {'tow': 69600, 'mtow': 70000, 'index': 31.5, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 600, 'max_lmc_index': 3.0, 'changes': [['add', 180, 3.5], ['remove', 165, 3.5]]}, ['LMC', 69615, 31.5]], ['sampled case 3', {'tow': 61550, 'mtow': 70000, 'index': 46.4, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 600, 'max_lmc_index': 5.0, 'changes': [['remove', 340, 1.9], ['remove', 260, -0.5]]}, ['LMC', 60950, 45.0]], ['regression: weight tolerance boundary', {'tow': 67100, 'mtow': 70000, 'index': 50.3, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 600, 'max_lmc_index': 5.0, 'changes': [['remove', 230, 0.1], ['add', 135, 0.2], ['add', 20, 4.0], ['remove', 105, -0.9]]}, ['LMC', 66920, 55.3]]]]
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 |
|---|---|---|---|
| two late passengers | ['LMC', 68256, 54.3] | ['LMC', 68256, 54.3] | Passed |
| swap cancels net | NEW_LOADSHEET | NEW_LOADSHEET | Passed |
| exactly at weight tolerance | ['LMC', 68500, 54.0] | ['LMC', 68500, 54.0] | Passed |
| offload moves index | ['LMC', 67800, 48.9] | ['LMC', 67800, 48.9] | Passed |
| change pushes over MTOW | NEW_LOADSHEET | NEW_LOADSHEET | Passed |
| change pushes index out | NEW_LOADSHEET | NEW_LOADSHEET | Passed |
| already heavy then offload | NEW_LOADSHEET | NEW_LOADSHEET | Passed |
| sampled case 1 | NEW_LOADSHEET | NEW_LOADSHEET | Passed |
| sampled case 2 | NEW_LOADSHEET | NEW_LOADSHEET | Passed |
| sampled case 3 | NEW_LOADSHEET | NEW_LOADSHEET | Passed |
| regression: weight tolerance boundary | NEW_LOADSHEET | ['LMC', 62200, 30.1] | Failed |
SHA-256 / fdfe4ee204a4fba184816edec89928be1bfbc7c23388ed34308d246a59d44856
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
gross = 0
dw = 0
di = 0.0
for kind, wt, idx in x['changes']:
s = 1 if kind == 'add' else -1
gross += wt
dw += s * wt
di += s * idx
if gross > x['max_lmc_weight'] or abs(di) > x['max_lmc_index']: return 'NEW_LOADSHEET'
tow = x['tow'] + dw
ti = x['index'] + di
lo, hi = x['index_limits']
if tow > x['mtow'] or ti < lo or ti > hi: return 'NEW_LOADSHEET'
return ['LMC', tow, round(ti, 1)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['two late passengers', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 171, 1.5], ['add', 85, 0.8]]}, ['LMC', 68256, 54.3]], ['swap cancels net', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 300, 2.0], ['remove', 291, 1.9]]}, 'NEW_LOADSHEET'], ['exactly at weight tolerance', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 250, 1.0], ['add', 250, 1.0]]}, ['LMC', 68500, 54.0]], ['offload moves index', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['remove', 200, 3.1]]}, ['LMC', 67800, 48.9]], ['change pushes over MTOW', {'tow': 69900, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 151, 0.5]]}, 'NEW_LOADSHEET'], ['change pushes index out', {'tow': 68000, 'mtow': 70000, 'index': 68.5, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 100, 2.1]]}, 'NEW_LOADSHEET'], ['already heavy then offload', {'tow': 70200, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['remove', 150, 0.5]]}, 'NEW_LOADSHEET'], ['sampled case 1', {'tow': 64100, 'mtow': 70000, 'index': 45.9, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 3.0, 'changes': [['remove', 180, 3.4], ['remove', 155, -2.5], ['add', 35, -3.5], ['add', 345, 3.7]]}, 'NEW_LOADSHEET'], ['sampled case 2', {'tow': 68550, 'mtow': 70000, 'index': 33.1, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 400, 'max_lmc_index': 3.0, 'changes': [['add', 340, -1.0], ['remove', 260, 1.2]]}, 'NEW_LOADSHEET'], ['sampled case 3', {'tow': 61300, 'mtow': 70000, 'index': 42.1, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 400, 'max_lmc_index': 3.0, 'changes': [['add', 350, -3.5], ['remove', 30, -2.6], ['add', 230, 1.5]]}, 'NEW_LOADSHEET'], ['regression: weight tolerance boundary', {'tow': 62750, 'mtow': 70000, 'index': 35.1, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 600, 'max_lmc_index': 5.0, 'changes': [['remove', 185, -0.9], ['remove', 65, 3.5], ['remove', 300, 2.4]]}, ['LMC', 62200, 30.1]]], [['two late passengers', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 172, 1.5], ['add', 85, 0.8]]}, ['LMC', 68257, 54.3]], ['swap cancels net', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 300, 2.0], ['remove', 292, 1.9]]}, 'NEW_LOADSHEET'], ['exactly at weight tolerance', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 250, 1.0], ['add', 250, 1.0]]}, ['LMC', 68500, 54.0]], ['offload moves index', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['remove', 200, 3.2]]}, ['LMC', 67800, 48.8]], ['change pushes over MTOW', {'tow': 69900, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 152, 0.5]]}, 'NEW_LOADSHEET'], ['change pushes index out', {'tow': 68000, 'mtow': 70000, 'index': 68.5, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 100, 2.2]]}, 'NEW_LOADSHEET'], ['already heavy then offload', {'tow': 70200, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['remove', 150, 1.0]]}, 'NEW_LOADSHEET'], ['sampled case 1', {'tow': 68750, 'mtow': 70000, 'index': 62.6, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 3.0, 'changes': [['add', 275, -2.1], ['add', 25, -1.8]]}, 'NEW_LOADSHEET'], ['sampled case 2', {'tow': 64950, 'mtow': 70000, 'index': 44.5, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 600, 'max_lmc_index': 3.0, 'changes': [['add', 385, 2.3]]}, ['LMC', 65335, 46.8]], ['sampled case 3', {'tow': 65950, 'mtow': 70000, 'index': 59.8, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 3.0, 'changes': [['remove', 170, 1.7]]}, ['LMC', 65780, 58.1]], ['regression: weight tolerance boundary', {'tow': 69650, 'mtow': 70000, 'index': 48.8, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 3.0, 'changes': [['add', 115, 2.4], ['add', 245, -2.5], ['remove', 50, -3.1]]}, ['LMC', 69960, 51.8]]], [['two late passengers', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 173, 1.5], ['add', 85, 0.8]]}, ['LMC', 68258, 54.3]], ['swap cancels net', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 300, 2.0], ['remove', 293, 1.9]]}, 'NEW_LOADSHEET'], ['exactly at weight tolerance', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 250, 1.0], ['add', 250, 1.0]]}, ['LMC', 68500, 54.0]], ['offload moves index', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['remove', 200, 3.3]]}, ['LMC', 67800, 48.7]], ['change pushes over MTOW', {'tow': 69900, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 153, 0.5]]}, 'NEW_LOADSHEET'], ['change pushes index out', {'tow': 68000, 'mtow': 70000, 'index': 68.5, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 100, 2.3]]}, 'NEW_LOADSHEET'], ['already heavy then offload', {'tow': 70200, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['remove', 150, 1.5]]}, 'NEW_LOADSHEET'], ['sampled case 1', {'tow': 64750, 'mtow': 70000, 'index': 33.1, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 3.0, 'changes': [['remove', 20, 2.4], ['remove', 125, -3.9], ['remove', 190, 3.9], ['remove', 270, 3.3]]}, 'NEW_LOADSHEET'], ['sampled case 2', {'tow': 63200, 'mtow': 70000, 'index': 47.1, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 400, 'max_lmc_index': 5.0, 'changes': [['remove', 335, -0.9], ['add', 105, 3.3]]}, 'NEW_LOADSHEET'], ['sampled case 3', {'tow': 66200, 'mtow': 70000, 'index': 38.1, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 400, 'max_lmc_index': 3.0, 'changes': [['add', 150, -0.8], ['add', 95, 1.5], ['add', 140, -2.4], ['add', 150, -0.8]]}, 'NEW_LOADSHEET'], ['regression: weight tolerance boundary', {'tow': 66400, 'mtow': 70000, 'index': 50.8, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 600, 'max_lmc_index': 3.0, 'changes': [['add', 210, -3.0]]}, ['LMC', 66610, 47.8]]], [['two late passengers', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 174, 1.5], ['add', 85, 0.8]]}, ['LMC', 68259, 54.3]], ['swap cancels net', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 300, 2.0], ['remove', 294, 1.9]]}, 'NEW_LOADSHEET'], ['exactly at weight tolerance', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 250, 1.0], ['add', 250, 1.0]]}, ['LMC', 68500, 54.0]], ['offload moves index', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['remove', 200, 3.4]]}, ['LMC', 67800, 48.6]], ['change pushes over MTOW', {'tow': 69900, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 154, 0.5]]}, 'NEW_LOADSHEET'], ['change pushes index out', {'tow': 68000, 'mtow': 70000, 'index': 68.5, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 100, 2.4]]}, 'NEW_LOADSHEET'], ['already heavy then offload', {'tow': 70200, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['remove', 150, 2.0]]}, 'NEW_LOADSHEET'], ['sampled case 1', {'tow': 66150, 'mtow': 70000, 'index': 46.1, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 400, 'max_lmc_index': 3.0, 'changes': [['add', 390, 0.4], ['remove', 40, 2.1], ['add', 300, 3.5]]}, 'NEW_LOADSHEET'], ['sampled case 2', {'tow': 64000, 'mtow': 70000, 'index': 30.4, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 3.0, 'changes': [['remove', 350, 3.5], ['remove', 60, 0.9]]}, 'NEW_LOADSHEET'], ['sampled case 3', {'tow': 60650, 'mtow': 70000, 'index': 63.7, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 295, -2.6]]}, ['LMC', 60945, 61.1]], ['regression: weight tolerance boundary', {'tow': 67100, 'mtow': 70000, 'index': 51.9, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 400, 'max_lmc_index': 3.0, 'changes': [['add', 200, 3.0]]}, ['LMC', 67300, 54.9]]], [['two late passengers', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 175, 1.5], ['add', 85, 0.8]]}, ['LMC', 68260, 54.3]], ['swap cancels net', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 300, 2.0], ['remove', 295, 1.9]]}, 'NEW_LOADSHEET'], ['exactly at weight tolerance', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 250, 1.0], ['add', 250, 1.0]]}, ['LMC', 68500, 54.0]], ['offload moves index', {'tow': 68000, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['remove', 200, 3.5]]}, ['LMC', 67800, 48.5]], ['change pushes over MTOW', {'tow': 69900, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 155, 0.5]]}, 'NEW_LOADSHEET'], ['change pushes index out', {'tow': 68000, 'mtow': 70000, 'index': 68.5, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['add', 100, 2.5]]}, 'NEW_LOADSHEET'], ['already heavy then offload', {'tow': 70200, 'mtow': 70000, 'index': 52.0, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 500, 'max_lmc_index': 5.0, 'changes': [['remove', 150, 2.5]]}, 'NEW_LOADSHEET'], ['sampled case 1', {'tow': 69850, 'mtow': 70000, 'index': 46.3, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 600, 'max_lmc_index': 5.0, 'changes': [['add', 195, -0.8], ['add', 240, -1.5]]}, 'NEW_LOADSHEET'], ['sampled case 2', {'tow': 69600, 'mtow': 70000, 'index': 31.5, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 600, 'max_lmc_index': 3.0, 'changes': [['add', 180, 3.5], ['remove', 165, 3.5]]}, ['LMC', 69615, 31.5]], ['sampled case 3', {'tow': 61550, 'mtow': 70000, 'index': 46.4, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 600, 'max_lmc_index': 5.0, 'changes': [['remove', 340, 1.9], ['remove', 260, -0.5]]}, ['LMC', 60950, 45.0]], ['regression: weight tolerance boundary', {'tow': 67100, 'mtow': 70000, 'index': 50.3, 'index_limits': [30.0, 70.0], 'max_lmc_weight': 600, 'max_lmc_index': 5.0, 'changes': [['remove', 230, 0.1], ['add', 135, 0.2], ['add', 20, 4.0], ['remove', 105, -0.9]]}, ['LMC', 66920, 55.3]]]]
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 |
|---|---|---|---|
| two late passengers | ['LMC', 68256, 54.3] | ['LMC', 68256, 54.3] | Passed |
| swap cancels net | NEW_LOADSHEET | NEW_LOADSHEET | Passed |
| exactly at weight tolerance | ['LMC', 68500, 54.0] | ['LMC', 68500, 54.0] | Passed |
| offload moves index | ['LMC', 67800, 48.9] | ['LMC', 67800, 48.9] | Passed |
| change pushes over MTOW | NEW_LOADSHEET | NEW_LOADSHEET | Passed |
| change pushes index out | NEW_LOADSHEET | NEW_LOADSHEET | Passed |
| already heavy then offload | NEW_LOADSHEET | NEW_LOADSHEET | Passed |
| sampled case 1 | NEW_LOADSHEET | NEW_LOADSHEET | Passed |
| sampled case 2 | NEW_LOADSHEET | NEW_LOADSHEET | Passed |
| sampled case 3 | NEW_LOADSHEET | NEW_LOADSHEET | Passed |
| regression: weight tolerance boundary | ['LMC', 62200, 30.1] | ['LMC', 62200, 30.1] | Passed |
SHA-256 / 926eeaad5f3df85f14b20870cfc56723a2db540a70d56be216f08b916b59b963
Verification & scope
A deterministic toy loading model with stipulated constants; it is not an approved aircraft flight manual procedure and makes no claim of regulatory conformance. 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:47:41.079377+00:00.
Case digest / ff7b4d8017a635e881fd2df1d5c49fe371a917906cb36f5eacb2fd0d7ca94210