FA-66191 / Aviation weight and balance / Open access
Offsetting adds and removes net out of the LMC tolerance · case 01
Swapping 300 kg of cargo for 290 kg is annotated as an LMC instead of requiring a new loadsheet.
ROOT CAUSE
The weight tolerance tests the net change instead of the gross amount of weight moved.
VERIFIED REPAIR
Compare the sum of all changed weights against the LMC weight tolerance.
Unsuccessful approach: Counting only additions ignores large offloads.
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 abs(dw) > 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']], [['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]]], [['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']], [['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]]], [['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]]]]
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 | ['LMC', 68009, 52.1] | NEW_LOADSHEET | Failed |
| 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 | ['LMC', 64145, 45.2] | NEW_LOADSHEET | Failed |
| sampled case 2 | ['LMC', 68630, 30.9] | NEW_LOADSHEET | Failed |
| sampled case 3 | NEW_LOADSHEET | NEW_LOADSHEET | Passed |
SHA-256 / 879a45ca67843b269ea4f04912458891f669b354b3cc993e1460c8a7f236d5d9
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 if s > 0 else 0
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']], [['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]]], [['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']], [['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]]], [['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]]]]
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 | ['LMC', 68009, 52.1] | NEW_LOADSHEET | Failed |
| 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 | ['LMC', 64145, 45.2] | NEW_LOADSHEET | Failed |
| sampled case 2 | ['LMC', 68630, 30.9] | NEW_LOADSHEET | Failed |
| sampled case 3 | NEW_LOADSHEET | NEW_LOADSHEET | Passed |
SHA-256 / 2f393d7a03156c50ccc47e8514d30009a041b157c21e4ddb9e397090747ea534
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']], [['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]]], [['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']], [['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]]], [['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]]]]
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 |
SHA-256 / b12bb44aa01412285acbd72732350600fb95cff9a384d4e4e73ed2c1785f5622
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.080105+00:00.
Case digest / 084b608e7282f8f8fd7032cf6e536269f6e22ba3b7c5e1610f762b87cc68b9da