broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    w, cg, cat = x
    if w < 1500: return 'ERR_BELOW_EMPTY'
    maxw = 2550 if cat == 'normal' else 2200
    if w <= 1950:
        fwd = 35.0
    else:
        fwd = 35.0 + (w - 1950) * (41.0 - 35.0) / (2550 - 1950)
    aft = 47.3 if cat == 'normal' else 40.5
    if cg < fwd - 1e-9: return 'FWD'
    if cg > aft + 1e-9: return 'AFT'
    return 'OVERWEIGHT' if w > maxw else 'IN'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['mid-envelope normal', [2110, 42.0, 'normal'], 'IN'], ['on sloped forward line', [2250, 38.0, 'normal'], 'IN'], ['on aft limit utility', [2000, 40.5, 'utility'], 'IN'], ['utility overweight but normal legal', [2301, 42.0, 'utility'], 'OVERWEIGHT'], ['exactly max gross normal', [2550, 41.0, 'normal'], 'IN'], ['forward of sloped line', [2400, 39.1, 'normal'], 'FWD'], ['aft of utility limit', [2100, 41.1, 'utility'], 'AFT'], ['below empty weight', [1499, 40.0, 'normal'], 'ERR_BELOW_EMPTY'], ['exactly empty weight', [1500, 36.0, 'utility'], 'IN'], ['sampled case 1', [2415, 48.96, 'normal'], 'AFT'], ['sampled case 2', [2550, 34.9, 'normal'], 'FWD'], ['sampled case 3', [1950, 42.86, 'utility'], 'AFT'], ['regression: overweight check ordering', [2609, 33.3, 'utility'], 'OVERWEIGHT']], [['mid-envelope normal', [2120, 42.0, 'normal'], 'IN'], ['on sloped forward line', [2250, 38.0, 'normal'], 'IN'], ['on aft limit utility', [2000, 40.5, 'utility'], 'IN'], ['utility overweight but normal legal', [2302, 42.0, 'utility'], 'OVERWEIGHT'], ['exactly max gross normal', [2550, 41.0, 'normal'], 'IN'], ['forward of sloped line', [2400, 39.2, 'normal'], 'FWD'], ['aft of utility limit', [2100, 41.2, 'utility'], 'AFT'], ['below empty weight', [1498, 40.0, 'normal'], 'ERR_BELOW_EMPTY'], ['exactly empty weight', [1500, 36.0, 'utility'], 'IN'], ['sampled case 1', [1950, 37.89, 'utility'], 'IN'], ['sampled case 2', [2561, 48.01, 'normal'], 'OVERWEIGHT'], ['sampled case 3', [2550, 45.7, 'normal'], 'IN'], ['regression: overweight check ordering', [2455, 38.7, 'utility'], 'OVERWEIGHT']], [['mid-envelope normal', [2130, 42.0, 'normal'], 'IN'], ['on sloped forward line', [2250, 38.0, 'normal'], 'IN'], ['on aft limit utility', [2000, 40.5, 'utility'], 'IN'], ['utility overweight but normal legal', [2303, 42.0, 'utility'], 'OVERWEIGHT'], ['exactly max gross normal', [2550, 41.0, 'normal'], 'IN'], ['forward of sloped line', [2400, 39.3, 'normal'], 'FWD'], ['aft of utility limit', [2100, 41.3, 'utility'], 'AFT'], ['below empty weight', [1497, 40.0, 'normal'], 'ERR_BELOW_EMPTY'], ['exactly empty weight', [1500, 36.0, 'utility'], 'IN'], ['sampled case 1', [1950, 34.67, 'utility'], 'FWD'], ['sampled case 2', [1500, 42.58, 'utility'], 'AFT'], ['sampled case 3', [2200, 48.0, 'utility'], 'AFT'], ['regression: overweight check ordering', [2261, 34.31, 'utility'], 'OVERWEIGHT']], [['mid-envelope normal', [2140, 42.0, 'normal'], 'IN'], ['on sloped forward line', [2250, 38.0, 'normal'], 'IN'], ['on aft limit utility', [2000, 40.5, 'utility'], 'IN'], ['utility overweight but normal legal', [2304, 42.0, 'utility'], 'OVERWEIGHT'], ['exactly max gross normal', [2550, 41.0, 'normal'], 'IN'], ['forward of sloped line', [2400, 39.4, 'normal'], 'FWD'], ['aft of utility limit', [2100, 41.4, 'utility'], 'AFT'], ['below empty weight', [1496, 40.0, 'normal'], 'ERR_BELOW_EMPTY'], ['exactly empty weight', [1500, 36.0, 'utility'], 'IN'], ['sampled case 1', [2200, 42.7, 'normal'], 'IN'], ['sampled case 2', [1969, 47.53, 'normal'], 'AFT'], ['sampled case 3', [1500, 48.2, 'normal'], 'AFT'], ['regression: overweight check ordering', [2550, 33.05, 'utility'], 'OVERWEIGHT']], [['mid-envelope normal', [2150, 42.0, 'normal'], 'IN'], ['on sloped forward line', [2250, 38.0, 'normal'], 'IN'], ['on aft limit utility', [2000, 40.5, 'utility'], 'IN'], ['utility overweight but normal legal', [2305, 42.0, 'utility'], 'OVERWEIGHT'], ['exactly max gross normal', [2550, 41.0, 'normal'], 'IN'], ['forward of sloped line', [2400, 39.5, 'normal'], 'IN'], ['aft of utility limit', [2100, 41.5, 'utility'], 'AFT'], ['below empty weight', [1495, 40.0, 'normal'], 'ERR_BELOW_EMPTY'], ['exactly empty weight', [1500, 36.0, 'utility'], 'IN'], ['sampled case 1', [1950, 45.06, 'normal'], 'IN'], ['sampled case 2', [2200, 43.63, 'utility'], 'AFT'], ['sampled case 3', [2200, 41.43, 'normal'], 'IN'], ['regression: overweight check ordering', [2550, 35.9, 'utility'], 'OVERWEIGHT']]]
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    w, cg, cat = x
    if w < 1500: return 'ERR_BELOW_EMPTY'
    maxw = 2550 if cat == 'normal' else 2200
    if w <= 1950:
        fwd = 35.0
    else:
        fwd = 35.0 + (w - 1950) * (41.0 - 35.0) / (2550 - 1950)
    aft = 47.3 if cat == 'normal' else 40.5
    if cg < fwd - 1e-9: return 'FWD'
    if w > maxw: return 'OVERWEIGHT'
    if cg > aft + 1e-9: return 'AFT'
    return 'IN'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['mid-envelope normal', [2110, 42.0, 'normal'], 'IN'], ['on sloped forward line', [2250, 38.0, 'normal'], 'IN'], ['on aft limit utility', [2000, 40.5, 'utility'], 'IN'], ['utility overweight but normal legal', [2301, 42.0, 'utility'], 'OVERWEIGHT'], ['exactly max gross normal', [2550, 41.0, 'normal'], 'IN'], ['forward of sloped line', [2400, 39.1, 'normal'], 'FWD'], ['aft of utility limit', [2100, 41.1, 'utility'], 'AFT'], ['below empty weight', [1499, 40.0, 'normal'], 'ERR_BELOW_EMPTY'], ['exactly empty weight', [1500, 36.0, 'utility'], 'IN'], ['sampled case 1', [2415, 48.96, 'normal'], 'AFT'], ['sampled case 2', [2550, 34.9, 'normal'], 'FWD'], ['sampled case 3', [1950, 42.86, 'utility'], 'AFT'], ['regression: overweight check ordering', [2609, 33.3, 'utility'], 'OVERWEIGHT']], [['mid-envelope normal', [2120, 42.0, 'normal'], 'IN'], ['on sloped forward line', [2250, 38.0, 'normal'], 'IN'], ['on aft limit utility', [2000, 40.5, 'utility'], 'IN'], ['utility overweight but normal legal', [2302, 42.0, 'utility'], 'OVERWEIGHT'], ['exactly max gross normal', [2550, 41.0, 'normal'], 'IN'], ['forward of sloped line', [2400, 39.2, 'normal'], 'FWD'], ['aft of utility limit', [2100, 41.2, 'utility'], 'AFT'], ['below empty weight', [1498, 40.0, 'normal'], 'ERR_BELOW_EMPTY'], ['exactly empty weight', [1500, 36.0, 'utility'], 'IN'], ['sampled case 1', [1950, 37.89, 'utility'], 'IN'], ['sampled case 2', [2561, 48.01, 'normal'], 'OVERWEIGHT'], ['sampled case 3', [2550, 45.7, 'normal'], 'IN'], ['regression: overweight check ordering', [2455, 38.7, 'utility'], 'OVERWEIGHT']], [['mid-envelope normal', [2130, 42.0, 'normal'], 'IN'], ['on sloped forward line', [2250, 38.0, 'normal'], 'IN'], ['on aft limit utility', [2000, 40.5, 'utility'], 'IN'], ['utility overweight but normal legal', [2303, 42.0, 'utility'], 'OVERWEIGHT'], ['exactly max gross normal', [2550, 41.0, 'normal'], 'IN'], ['forward of sloped line', [2400, 39.3, 'normal'], 'FWD'], ['aft of utility limit', [2100, 41.3, 'utility'], 'AFT'], ['below empty weight', [1497, 40.0, 'normal'], 'ERR_BELOW_EMPTY'], ['exactly empty weight', [1500, 36.0, 'utility'], 'IN'], ['sampled case 1', [1950, 34.67, 'utility'], 'FWD'], ['sampled case 2', [1500, 42.58, 'utility'], 'AFT'], ['sampled case 3', [2200, 48.0, 'utility'], 'AFT'], ['regression: overweight check ordering', [2261, 34.31, 'utility'], 'OVERWEIGHT']], [['mid-envelope normal', [2140, 42.0, 'normal'], 'IN'], ['on sloped forward line', [2250, 38.0, 'normal'], 'IN'], ['on aft limit utility', [2000, 40.5, 'utility'], 'IN'], ['utility overweight but normal legal', [2304, 42.0, 'utility'], 'OVERWEIGHT'], ['exactly max gross normal', [2550, 41.0, 'normal'], 'IN'], ['forward of sloped line', [2400, 39.4, 'normal'], 'FWD'], ['aft of utility limit', [2100, 41.4, 'utility'], 'AFT'], ['below empty weight', [1496, 40.0, 'normal'], 'ERR_BELOW_EMPTY'], ['exactly empty weight', [1500, 36.0, 'utility'], 'IN'], ['sampled case 1', [2200, 42.7, 'normal'], 'IN'], ['sampled case 2', [1969, 47.53, 'normal'], 'AFT'], ['sampled case 3', [1500, 48.2, 'normal'], 'AFT'], ['regression: overweight check ordering', [2550, 33.05, 'utility'], 'OVERWEIGHT']], [['mid-envelope normal', [2150, 42.0, 'normal'], 'IN'], ['on sloped forward line', [2250, 38.0, 'normal'], 'IN'], ['on aft limit utility', [2000, 40.5, 'utility'], 'IN'], ['utility overweight but normal legal', [2305, 42.0, 'utility'], 'OVERWEIGHT'], ['exactly max gross normal', [2550, 41.0, 'normal'], 'IN'], ['forward of sloped line', [2400, 39.5, 'normal'], 'IN'], ['aft of utility limit', [2100, 41.5, 'utility'], 'AFT'], ['below empty weight', [1495, 40.0, 'normal'], 'ERR_BELOW_EMPTY'], ['exactly empty weight', [1500, 36.0, 'utility'], 'IN'], ['sampled case 1', [1950, 45.06, 'normal'], 'IN'], ['sampled case 2', [2200, 43.63, 'utility'], 'AFT'], ['sampled case 3', [2200, 41.43, 'normal'], 'IN'], ['regression: overweight check ordering', [2550, 35.9, 'utility'], 'OVERWEIGHT']]]
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)

prompt:
An overweight aircraft with a forward or aft CG is reported as a CG problem instead of OVERWEIGHT.

Input [weight lb, CG in, 'normal'|'utility']. Below 1500 lb -> 'ERR_BELOW_EMPTY'. Max weight 2550 normal / 2200 utility -> 'OVERWEIGHT' first. Forward limit 35.0 in up to 1950 lb then linear to 41.0 in at 2550 lb; aft limit 47.3 normal / 40.5 utility. Limits inclusive; else 'FWD','AFT','IN'.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    w, cg, cat = x
    if w <= 1500: return 'ERR_BELOW_EMPTY'
    maxw = 2550 if cat == 'normal' else 2200
    if w > maxw: return 'OVERWEIGHT'
    if w <= 1950:
        fwd = 35.0
    else:
        fwd = 35.0 + (w - 1950) * (41.0 - 35.0) / (2550 - 1950)
    aft = 47.3 if cat == 'normal' else 40.5
    if cg < fwd - 1e-9: return 'FWD'
    if cg > aft + 1e-9: return 'AFT'
    return 'IN'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['mid-envelope normal', [2110, 42.0, 'normal'], 'IN'], ['on sloped forward line', [2250, 38.0, 'normal'], 'IN'], ['on aft limit utility', [2000, 40.5, 'utility'], 'IN'], ['utility overweight but normal legal', [2301, 42.0, 'utility'], 'OVERWEIGHT'], ['exactly max gross normal', [2550, 41.0, 'normal'], 'IN'], ['forward of sloped line', [2400, 39.1, 'normal'], 'FWD'], ['aft of utility limit', [2100, 41.1, 'utility'], 'AFT'], ['below empty weight', [1499, 40.0, 'normal'], 'ERR_BELOW_EMPTY'], ['exactly empty weight', [1500, 36.0, 'utility'], 'IN'], ['sampled case 1', [2415, 48.96, 'normal'], 'AFT'], ['sampled case 2', [2550, 34.9, 'normal'], 'FWD'], ['sampled case 3', [1950, 42.86, 'utility'], 'AFT']], [['mid-envelope normal', [2120, 42.0, 'normal'], 'IN'], ['on sloped forward line', [2250, 38.0, 'normal'], 'IN'], ['on aft limit utility', [2000, 40.5, 'utility'], 'IN'], ['utility overweight but normal legal', [2302, 42.0, 'utility'], 'OVERWEIGHT'], ['exactly max gross normal', [2550, 41.0, 'normal'], 'IN'], ['forward of sloped line', [2400, 39.2, 'normal'], 'FWD'], ['aft of utility limit', [2100, 41.2, 'utility'], 'AFT'], ['below empty weight', [1498, 40.0, 'normal'], 'ERR_BELOW_EMPTY'], ['exactly empty weight', [1500, 36.0, 'utility'], 'IN'], ['sampled case 1', [1950, 37.89, 'utility'], 'IN'], ['sampled case 2', [2561, 48.01, 'normal'], 'OVERWEIGHT'], ['sampled case 3', [2550, 45.7, 'normal'], 'IN']], [['mid-envelope normal', [2130, 42.0, 'normal'], 'IN'], ['on sloped forward line', [2250, 38.0, 'normal'], 'IN'], ['on aft limit utility', [2000, 40.5, 'utility'], 'IN'], ['utility overweight but normal legal', [2303, 42.0, 'utility'], 'OVERWEIGHT'], ['exactly max gross normal', [2550, 41.0, 'normal'], 'IN'], ['forward of sloped line', [2400, 39.3, 'normal'], 'FWD'], ['aft of utility limit', [2100, 41.3, 'utility'], 'AFT'], ['below empty weight', [1497, 40.0, 'normal'], 'ERR_BELOW_EMPTY'], ['exactly empty weight', [1500, 36.0, 'utility'], 'IN'], ['sampled case 1', [1950, 34.67, 'utility'], 'FWD'], ['sampled case 2', [1500, 42.58, 'utility'], 'AFT'], ['sampled case 3', [2200, 48.0, 'utility'], 'AFT']], [['mid-envelope normal', [2140, 42.0, 'normal'], 'IN'], ['on sloped forward line', [2250, 38.0, 'normal'], 'IN'], ['on aft limit utility', [2000, 40.5, 'utility'], 'IN'], ['utility overweight but normal legal', [2304, 42.0, 'utility'], 'OVERWEIGHT'], ['exactly max gross normal', [2550, 41.0, 'normal'], 'IN'], ['forward of sloped line', [2400, 39.4, 'normal'], 'FWD'], ['aft of utility limit', [2100, 41.4, 'utility'], 'AFT'], ['below empty weight', [1496, 40.0, 'normal'], 'ERR_BELOW_EMPTY'], ['exactly empty weight', [1500, 36.0, 'utility'], 'IN'], ['sampled case 1', [2200, 42.7, 'normal'], 'IN'], ['sampled case 2', [1969, 47.53, 'normal'], 'AFT'], ['sampled case 3', [1500, 48.2, 'normal'], 'AFT']], [['mid-envelope normal', [2150, 42.0, 'normal'], 'IN'], ['on sloped forward line', [2250, 38.0, 'normal'], 'IN'], ['on aft limit utility', [2000, 40.5, 'utility'], 'IN'], ['utility overweight but normal legal', [2305, 42.0, 'utility'], 'OVERWEIGHT'], ['exactly max gross normal', [2550, 41.0, 'normal'], 'IN'], ['forward of sloped line', [2400, 39.5, 'normal'], 'IN'], ['aft of utility limit', [2100, 41.5, 'utility'], 'AFT'], ['below empty weight', [1495, 40.0, 'normal'], 'ERR_BELOW_EMPTY'], ['exactly empty weight', [1500, 36.0, 'utility'], 'IN'], ['sampled case 1', [1950, 45.06, 'normal'], 'IN'], ['sampled case 2', [2200, 43.63, 'utility'], 'AFT'], ['sampled case 3', [2200, 41.43, 'normal'], 'IN']]]
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)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    w, cg, cat = x
    if w < 1500 and cg < 35.0: return 'ERR_BELOW_EMPTY'
    maxw = 2550 if cat == 'normal' else 2200
    if w > maxw: return 'OVERWEIGHT'
    if w <= 1950:
        fwd = 35.0
    else:
        fwd = 35.0 + (w - 1950) * (41.0 - 35.0) / (2550 - 1950)
    aft = 47.3 if cat == 'normal' else 40.5
    if cg < fwd - 1e-9: return 'FWD'
    if cg > aft + 1e-9: return 'AFT'
    return 'IN'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['mid-envelope normal', [2110, 42.0, 'normal'], 'IN'], ['on sloped forward line', [2250, 38.0, 'normal'], 'IN'], ['on aft limit utility', [2000, 40.5, 'utility'], 'IN'], ['utility overweight but normal legal', [2301, 42.0, 'utility'], 'OVERWEIGHT'], ['exactly max gross normal', [2550, 41.0, 'normal'], 'IN'], ['forward of sloped line', [2400, 39.1, 'normal'], 'FWD'], ['aft of utility limit', [2100, 41.1, 'utility'], 'AFT'], ['below empty weight', [1499, 40.0, 'normal'], 'ERR_BELOW_EMPTY'], ['exactly empty weight', [1500, 36.0, 'utility'], 'IN'], ['sampled case 1', [2415, 48.96, 'normal'], 'AFT'], ['sampled case 2', [2550, 34.9, 'normal'], 'FWD'], ['sampled case 3', [1950, 42.86, 'utility'], 'AFT']], [['mid-envelope normal', [2120, 42.0, 'normal'], 'IN'], ['on sloped forward line', [2250, 38.0, 'normal'], 'IN'], ['on aft limit utility', [2000, 40.5, 'utility'], 'IN'], ['utility overweight but normal legal', [2302, 42.0, 'utility'], 'OVERWEIGHT'], ['exactly max gross normal', [2550, 41.0, 'normal'], 'IN'], ['forward of sloped line', [2400, 39.2, 'normal'], 'FWD'], ['aft of utility limit', [2100, 41.2, 'utility'], 'AFT'], ['below empty weight', [1498, 40.0, 'normal'], 'ERR_BELOW_EMPTY'], ['exactly empty weight', [1500, 36.0, 'utility'], 'IN'], ['sampled case 1', [1950, 37.89, 'utility'], 'IN'], ['sampled case 2', [2561, 48.01, 'normal'], 'OVERWEIGHT'], ['sampled case 3', [2550, 45.7, 'normal'], 'IN']], [['mid-envelope normal', [2130, 42.0, 'normal'], 'IN'], ['on sloped forward line', [2250, 38.0, 'normal'], 'IN'], ['on aft limit utility', [2000, 40.5, 'utility'], 'IN'], ['utility overweight but normal legal', [2303, 42.0, 'utility'], 'OVERWEIGHT'], ['exactly max gross normal', [2550, 41.0, 'normal'], 'IN'], ['forward of sloped line', [2400, 39.3, 'normal'], 'FWD'], ['aft of utility limit', [2100, 41.3, 'utility'], 'AFT'], ['below empty weight', [1497, 40.0, 'normal'], 'ERR_BELOW_EMPTY'], ['exactly empty weight', [1500, 36.0, 'utility'], 'IN'], ['sampled case 1', [1950, 34.67, 'utility'], 'FWD'], ['sampled case 2', [1500, 42.58, 'utility'], 'AFT'], ['sampled case 3', [2200, 48.0, 'utility'], 'AFT']], [['mid-envelope normal', [2140, 42.0, 'normal'], 'IN'], ['on sloped forward line', [2250, 38.0, 'normal'], 'IN'], ['on aft limit utility', [2000, 40.5, 'utility'], 'IN'], ['utility overweight but normal legal', [2304, 42.0, 'utility'], 'OVERWEIGHT'], ['exactly max gross normal', [2550, 41.0, 'normal'], 'IN'], ['forward of sloped line', [2400, 39.4, 'normal'], 'FWD'], ['aft of utility limit', [2100, 41.4, 'utility'], 'AFT'], ['below empty weight', [1496, 40.0, 'normal'], 'ERR_BELOW_EMPTY'], ['exactly empty weight', [1500, 36.0, 'utility'], 'IN'], ['sampled case 1', [2200, 42.7, 'normal'], 'IN'], ['sampled case 2', [1969, 47.53, 'normal'], 'AFT'], ['sampled case 3', [1500, 48.2, 'normal'], 'AFT']], [['mid-envelope normal', [2150, 42.0, 'normal'], 'IN'], ['on sloped forward line', [2250, 38.0, 'normal'], 'IN'], ['on aft limit utility', [2000, 40.5, 'utility'], 'IN'], ['utility overweight but normal legal', [2305, 42.0, 'utility'], 'OVERWEIGHT'], ['exactly max gross normal', [2550, 41.0, 'normal'], 'IN'], ['forward of sloped line', [2400, 39.5, 'normal'], 'IN'], ['aft of utility limit', [2100, 41.5, 'utility'], 'AFT'], ['below empty weight', [1495, 40.0, 'normal'], 'ERR_BELOW_EMPTY'], ['exactly empty weight', [1500, 36.0, 'utility'], 'IN'], ['sampled case 1', [1950, 45.06, 'normal'], 'IN'], ['sampled case 2', [2200, 43.63, 'utility'], 'AFT'], ['sampled case 3', [2200, 41.43, 'normal'], 'IN']]]
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)

prompt:
A ferry configuration at exactly the minimum weight returns ERR_BELOW_EMPTY.

Input [weight lb, CG in, 'normal'|'utility']. Below 1500 lb -> 'ERR_BELOW_EMPTY'. Max weight 2550 normal / 2200 utility -> 'OVERWEIGHT' first. Forward limit 35.0 in up to 1950 lb then linear to 41.0 in at 2550 lb; aft limit 47.3 normal / 40.5 utility. Limits inclusive; else 'FWD','AFT','IN'.

split: open-access


prompt:
Every loaded item pushes the index strongly aft, even items at the reference station.

Input {'dow','doi','ref','c','k','lemac','mac','items':[[kg,arm m]]}. Item index = kg*(arm-ref)/c; the dry operating index already contains K. Total index = doi + item indices; CG arm = ref + (index-K)*c/total weight; %MAC = (CG-LEMAC)/MAC*100. Return [index r2, %MAC r1].

split: open-access


prompt:
The %MAC is several percent aft for every load and does not match the balance chart.

Input {'dow','doi','ref','c','k','lemac','mac','items':[[kg,arm m]]}. Item index = kg*(arm-ref)/c; the dry operating index already contains K. Total index = doi + item indices; CG arm = ref + (index-K)*c/total weight; %MAC = (CG-LEMAC)/MAC*100. Return [index r2, %MAC r1].

split: open-access


prompt:
Totals are high by exactly K and the aircraft looks aft-loaded even when empty.

Input {'dow','doi','ref','c','k','lemac','mac','items':[[kg,arm m]]}. Item index = kg*(arm-ref)/c; the dry operating index already contains K. Total index = doi + item indices; CG arm = ref + (index-K)*c/total weight; %MAC = (CG-LEMAC)/MAC*100. Return [index r2, %MAC r1].

split: open-access


prompt:
The reported %MAC is offset by the distance between the reference station and the leading edge.

Input {'dow','doi','ref','c','k','lemac','mac','items':[[kg,arm m]]}. Item index = kg*(arm-ref)/c; the dry operating index already contains K. Total index = doi + item indices; CG arm = ref + (index-K)*c/total weight; %MAC = (CG-LEMAC)/MAC*100. Return [index r2, %MAC r1].

split: open-access


prompt:
Index contributions are correct only when C happens to be 1000 and drift for other aircraft types.

Input {'dow','doi','ref','c','k','lemac','mac','items':[[kg,arm m]]}. Item index = kg*(arm-ref)/c; the dry operating index already contains K. Total index = doi + item indices; CG arm = ref + (index-K)*c/total weight; %MAC = (CG-LEMAC)/MAC*100. Return [index r2, %MAC r1].

split: open-access


prompt:
%MAC drifts further from the chart the heavier the payload, while the index itself is correct.

Input {'dow','doi','ref','c','k','lemac','mac','items':[[kg,arm m]]}. Item index = kg*(arm-ref)/c; the dry operating index already contains K. Total index = doi + item indices; CG arm = ref + (index-K)*c/total weight; %MAC = (CG-LEMAC)/MAC*100. Return [index r2, %MAC r1].

split: open-access


source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    cands = [('MTOW', x['mtow']), ('MLW', x['mlw'] + x['trip_fuel'] - x['taxi_fuel']), ('MZFW', x['mzfw'] + x['takeoff_fuel']), ('MRW', x['mrw'] - x['taxi_fuel'])]
    best = cands[0]
    for c in cands[1:]:
        if c[1] < best[1]:
            best = c
    payload = best[1] - x['oew'] - x['takeoff_fuel']
    if payload < 0:
        payload = 0
    return [best[1], payload, best[0]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['long sector MTOW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 16100, 'trip_fuel': 13000}, [70000, 11900, 'MTOW']], ['short sector MLW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 61000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 5010, 'trip_fuel': 2000}, [63000, 15990, 'MLW']], ['tankering MZFW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 7000, 'trip_fuel': 5510}, [67000, 18000, 'MZFW']], ['ramp limited heavy taxi', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70200, 'taxi_fuel': 501, 'takeoff_fuel': 20000, 'trip_fuel': 16000}, [69699, 7699, 'MRW']], ['MTOW and MLW tie', {'oew': 42000, 'mtow': 68000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 12000, 'trip_fuel': 4000}, [68000, 14000, 'MTOW']], ['no payload possible', {'oew': 58000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 15100, 'trip_fuel': 12000}, [70000, 0, 'MTOW']], ['sampled case 1', {'oew': 45200, 'mtow': 63600, 'mlw': 62300, 'mzfw': 57500, 'mrw': 64200, 'taxi_fuel': 500, 'takeoff_fuel': 9200, 'trip_fuel': 5700}, [63600, 9200, 'MTOW']], ['sampled case 2', {'oew': 35600, 'mtow': 48200, 'mlw': 46600, 'mzfw': 44800, 'mrw': 48400, 'taxi_fuel': 400, 'takeoff_fuel': 4100, 'trip_fuel': 500}, [47100, 7400, 'MLW']], ['sampled case 3', {'oew': 36100, 'mtow': 50400, 'mlw': 48100, 'mzfw': 42500, 'mrw': 50400, 'taxi_fuel': 800, 'takeoff_fuel': 20900, 'trip_fuel': 16300}, [49600, 0, 'MRW']]], [['long sector MTOW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 16200, 'trip_fuel': 13000}, [70000, 11800, 'MTOW']], ['short sector MLW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 61000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 5020, 'trip_fuel': 2000}, [63000, 15980, 'MLW']], ['tankering MZFW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 7000, 'trip_fuel': 5520}, [67000, 18000, 'MZFW']], ['ramp limited heavy taxi', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70200, 'taxi_fuel': 502, 'takeoff_fuel': 20000, 'trip_fuel': 16000}, [69698, 7698, 'MRW']], ['MTOW and MLW tie', {'oew': 42000, 'mtow': 68000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 12000, 'trip_fuel': 4000}, [68000, 14000, 'MTOW']], ['no payload possible', {'oew': 58000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 15200, 'trip_fuel': 12000}, [70000, 0, 'MTOW']], ['sampled case 1', {'oew': 48000, 'mtow': 71700, 'mlw': 60600, 'mzfw': 59700, 'mrw': 72100, 'taxi_fuel': 300, 'takeoff_fuel': 17500, 'trip_fuel': 14300}, [71700, 6200, 'MTOW']], ['sampled case 2', {'oew': 45100, 'mtow': 57700, 'mlw': 55900, 'mzfw': 50100, 'mrw': 57900, 'taxi_fuel': 200, 'takeoff_fuel': 5800, 'trip_fuel': 3300}, [55900, 5000, 'MZFW']], ['sampled case 3', {'oew': 38900, 'mtow': 70900, 'mlw': 64200, 'mzfw': 58600, 'mrw': 71100, 'taxi_fuel': 800, 'takeoff_fuel': 19800, 'trip_fuel': 17300}, [70300, 11600, 'MRW']]], [['long sector MTOW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 16300, 'trip_fuel': 13000}, [70000, 11700, 'MTOW']], ['short sector MLW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 61000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 5030, 'trip_fuel': 2000}, [63000, 15970, 'MLW']], ['tankering MZFW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 7000, 'trip_fuel': 5530}, [67000, 18000, 'MZFW']], ['ramp limited heavy taxi', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70200, 'taxi_fuel': 503, 'takeoff_fuel': 20000, 'trip_fuel': 16000}, [69697, 7697, 'MRW']], ['MTOW and MLW tie', {'oew': 42000, 'mtow': 68000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 12000, 'trip_fuel': 4000}, [68000, 14000, 'MTOW']], ['no payload possible', {'oew': 58000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 15300, 'trip_fuel': 12000}, [70000, 0, 'MTOW']], ['sampled case 1', {'oew': 41500, 'mtow': 65300, 'mlw': 54900, 'mzfw': 51800, 'mrw': 65500, 'taxi_fuel': 800, 'takeoff_fuel': 15200, 'trip_fuel': 11100}, [64700, 8000, 'MRW']], ['sampled case 2', {'oew': 48100, 'mtow': 69500, 'mlw': 66400, 'mzfw': 60800, 'mrw': 70100, 'taxi_fuel': 400, 'takeoff_fuel': 8000, 'trip_fuel': 3500}, [68800, 12700, 'MZFW']], ['sampled case 3', {'oew': 48200, 'mtow': 70500, 'mlw': 63100, 'mzfw': 61400, 'mrw': 70700, 'taxi_fuel': 500, 'takeoff_fuel': 10300, 'trip_fuel': 8800}, [70200, 11700, 'MRW']]], [['long sector MTOW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 16400, 'trip_fuel': 13000}, [70000, 11600, 'MTOW']], ['short sector MLW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 61000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 5040, 'trip_fuel': 2000}, [63000, 15960, 'MLW']], ['tankering MZFW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 7000, 'trip_fuel': 5540}, [67000, 18000, 'MZFW']], ['ramp limited heavy taxi', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70200, 'taxi_fuel': 504, 'takeoff_fuel': 20000, 'trip_fuel': 16000}, [69696, 7696, 'MRW']], ['MTOW and MLW tie', {'oew': 42000, 'mtow': 68000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 12000, 'trip_fuel': 4000}, [68000, 14000, 'MTOW']], ['no payload possible', {'oew': 58000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 15400, 'trip_fuel': 12000}, [70000, 0, 'MTOW']], ['sampled case 1', {'oew': 44100, 'mtow': 69600, 'mlw': 65500, 'mzfw': 61100, 'mrw': 70200, 'taxi_fuel': 200, 'takeoff_fuel': 3000, 'trip_fuel': 500}, [64100, 17000, 'MZFW']], ['sampled case 2', {'oew': 37600, 'mtow': 51800, 'mlw': 48800, 'mzfw': 47700, 'mrw': 52400, 'taxi_fuel': 800, 'takeoff_fuel': 6100, 'trip_fuel': 2300}, [51100, 7400, 'MLW']], ['sampled case 3', {'oew': 48900, 'mtow': 68600, 'mlw': 60100, 'mzfw': 56600, 'mrw': 69000, 'taxi_fuel': 300, 'takeoff_fuel': 23600, 'trip_fuel': 19400}, [68600, 0, 'MTOW']]], [['long sector MTOW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 16500, 'trip_fuel': 13000}, [70000, 11500, 'MTOW']], ['short sector MLW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 61000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 5050, 'trip_fuel': 2000}, [63000, 15950, 'MLW']], ['tankering MZFW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 7000, 'trip_fuel': 5550}, [67000, 18000, 'MZFW']], ['ramp limited heavy taxi', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70200, 'taxi_fuel': 505, 'takeoff_fuel': 20000, 'trip_fuel': 16000}, [69695, 7695, 'MRW']], ['MTOW and MLW tie', {'oew': 42000, 'mtow': 68000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 12000, 'trip_fuel': 4000}, [68000, 14000, 'MTOW']], ['no payload possible', {'oew': 58000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 15500, 'trip_fuel': 12000}, [70000, 0, 'MTOW']], ['sampled case 1', {'oew': 40700, 'mtow': 68300, 'mlw': 61100, 'mzfw': 59900, 'mrw': 68300, 'taxi_fuel': 300, 'takeoff_fuel': 7200, 'trip_fuel': 4000}, [65100, 17200, 'MLW']], ['sampled case 2', {'oew': 41600, 'mtow': 69800, 'mlw': 66700, 'mzfw': 61300, 'mrw': 69800, 'taxi_fuel': 400, 'takeoff_fuel': 18100, 'trip_fuel': 14300}, [69400, 9700, 'MRW']], ['sampled case 3', {'oew': 46200, 'mtow': 65500, 'mlw': 55600, 'mzfw': 54600, 'mrw': 65700, 'taxi_fuel': 800, 'takeoff_fuel': 8400, 'trip_fuel': 4900}, [60500, 5900, 'MLW']]]]
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)

prompt:
Short sectors with lots of reserve fuel report a higher allowed takeoff weight than the landing limit permits.

Input weights in kg. Allowed takeoff weight = lowest of MTOW, MLW+trip fuel, MZFW+takeoff fuel, MRW-taxi fuel; ties go to the earlier entry in that order. Allowed payload = allowed TOW - OEW - takeoff fuel, floored at 0. Return [allowed TOW, payload, limiting name].

split: open-access


source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    cands = [('MTOW', x['mtow']), ('MLW', x['mlw'] + x['trip_fuel']), ('MZFW', x['mzfw'] + x['takeoff_fuel'] + x['taxi_fuel']), ('MRW', x['mrw'] - x['taxi_fuel'])]
    best = cands[0]
    for c in cands[1:]:
        if c[1] < best[1]:
            best = c
    payload = best[1] - x['oew'] - x['takeoff_fuel']
    if payload < 0:
        payload = 0
    return [best[1], payload, best[0]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['long sector MTOW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 16100, 'trip_fuel': 13000}, [70000, 11900, 'MTOW']], ['short sector MLW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 61000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 5010, 'trip_fuel': 2000}, [63000, 15990, 'MLW']], ['tankering MZFW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 7000, 'trip_fuel': 5510}, [67000, 18000, 'MZFW']], ['ramp limited heavy taxi', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70200, 'taxi_fuel': 501, 'takeoff_fuel': 20000, 'trip_fuel': 16000}, [69699, 7699, 'MRW']], ['MTOW and MLW tie', {'oew': 42000, 'mtow': 68000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 12000, 'trip_fuel': 4000}, [68000, 14000, 'MTOW']], ['no payload possible', {'oew': 58000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 15100, 'trip_fuel': 12000}, [70000, 0, 'MTOW']], ['sampled case 1', {'oew': 45200, 'mtow': 63600, 'mlw': 62300, 'mzfw': 57500, 'mrw': 64200, 'taxi_fuel': 500, 'takeoff_fuel': 9200, 'trip_fuel': 5700}, [63600, 9200, 'MTOW']], ['sampled case 2', {'oew': 35600, 'mtow': 48200, 'mlw': 46600, 'mzfw': 44800, 'mrw': 48400, 'taxi_fuel': 400, 'takeoff_fuel': 4100, 'trip_fuel': 500}, [47100, 7400, 'MLW']], ['sampled case 3', {'oew': 36100, 'mtow': 50400, 'mlw': 48100, 'mzfw': 42500, 'mrw': 50400, 'taxi_fuel': 800, 'takeoff_fuel': 20900, 'trip_fuel': 16300}, [49600, 0, 'MRW']]], [['long sector MTOW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 16200, 'trip_fuel': 13000}, [70000, 11800, 'MTOW']], ['short sector MLW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 61000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 5020, 'trip_fuel': 2000}, [63000, 15980, 'MLW']], ['tankering MZFW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 7000, 'trip_fuel': 5520}, [67000, 18000, 'MZFW']], ['ramp limited heavy taxi', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70200, 'taxi_fuel': 502, 'takeoff_fuel': 20000, 'trip_fuel': 16000}, [69698, 7698, 'MRW']], ['MTOW and MLW tie', {'oew': 42000, 'mtow': 68000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 12000, 'trip_fuel': 4000}, [68000, 14000, 'MTOW']], ['no payload possible', {'oew': 58000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 15200, 'trip_fuel': 12000}, [70000, 0, 'MTOW']], ['sampled case 1', {'oew': 48000, 'mtow': 71700, 'mlw': 60600, 'mzfw': 59700, 'mrw': 72100, 'taxi_fuel': 300, 'takeoff_fuel': 17500, 'trip_fuel': 14300}, [71700, 6200, 'MTOW']], ['sampled case 2', {'oew': 45100, 'mtow': 57700, 'mlw': 55900, 'mzfw': 50100, 'mrw': 57900, 'taxi_fuel': 200, 'takeoff_fuel': 5800, 'trip_fuel': 3300}, [55900, 5000, 'MZFW']], ['sampled case 3', {'oew': 38900, 'mtow': 70900, 'mlw': 64200, 'mzfw': 58600, 'mrw': 71100, 'taxi_fuel': 800, 'takeoff_fuel': 19800, 'trip_fuel': 17300}, [70300, 11600, 'MRW']]], [['long sector MTOW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 16300, 'trip_fuel': 13000}, [70000, 11700, 'MTOW']], ['short sector MLW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 61000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 5030, 'trip_fuel': 2000}, [63000, 15970, 'MLW']], ['tankering MZFW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 7000, 'trip_fuel': 5530}, [67000, 18000, 'MZFW']], ['ramp limited heavy taxi', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70200, 'taxi_fuel': 503, 'takeoff_fuel': 20000, 'trip_fuel': 16000}, [69697, 7697, 'MRW']], ['MTOW and MLW tie', {'oew': 42000, 'mtow': 68000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 12000, 'trip_fuel': 4000}, [68000, 14000, 'MTOW']], ['no payload possible', {'oew': 58000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 15300, 'trip_fuel': 12000}, [70000, 0, 'MTOW']], ['sampled case 1', {'oew': 41500, 'mtow': 65300, 'mlw': 54900, 'mzfw': 51800, 'mrw': 65500, 'taxi_fuel': 800, 'takeoff_fuel': 15200, 'trip_fuel': 11100}, [64700, 8000, 'MRW']], ['sampled case 2', {'oew': 48100, 'mtow': 69500, 'mlw': 66400, 'mzfw': 60800, 'mrw': 70100, 'taxi_fuel': 400, 'takeoff_fuel': 8000, 'trip_fuel': 3500}, [68800, 12700, 'MZFW']], ['sampled case 3', {'oew': 48200, 'mtow': 70500, 'mlw': 63100, 'mzfw': 61400, 'mrw': 70700, 'taxi_fuel': 500, 'takeoff_fuel': 10300, 'trip_fuel': 8800}, [70200, 11700, 'MRW']]], [['long sector MTOW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 16400, 'trip_fuel': 13000}, [70000, 11600, 'MTOW']], ['short sector MLW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 61000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 5040, 'trip_fuel': 2000}, [63000, 15960, 'MLW']], ['tankering MZFW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 7000, 'trip_fuel': 5540}, [67000, 18000, 'MZFW']], ['ramp limited heavy taxi', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70200, 'taxi_fuel': 504, 'takeoff_fuel': 20000, 'trip_fuel': 16000}, [69696, 7696, 'MRW']], ['MTOW and MLW tie', {'oew': 42000, 'mtow': 68000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 12000, 'trip_fuel': 4000}, [68000, 14000, 'MTOW']], ['no payload possible', {'oew': 58000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 15400, 'trip_fuel': 12000}, [70000, 0, 'MTOW']], ['sampled case 1', {'oew': 44100, 'mtow': 69600, 'mlw': 65500, 'mzfw': 61100, 'mrw': 70200, 'taxi_fuel': 200, 'takeoff_fuel': 3000, 'trip_fuel': 500}, [64100, 17000, 'MZFW']], ['sampled case 2', {'oew': 37600, 'mtow': 51800, 'mlw': 48800, 'mzfw': 47700, 'mrw': 52400, 'taxi_fuel': 800, 'takeoff_fuel': 6100, 'trip_fuel': 2300}, [51100, 7400, 'MLW']], ['sampled case 3', {'oew': 48900, 'mtow': 68600, 'mlw': 60100, 'mzfw': 56600, 'mrw': 69000, 'taxi_fuel': 300, 'takeoff_fuel': 23600, 'trip_fuel': 19400}, [68600, 0, 'MTOW']]], [['long sector MTOW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 16500, 'trip_fuel': 13000}, [70000, 11500, 'MTOW']], ['short sector MLW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 61000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 5050, 'trip_fuel': 2000}, [63000, 15950, 'MLW']], ['tankering MZFW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 7000, 'trip_fuel': 5550}, [67000, 18000, 'MZFW']], ['ramp limited heavy taxi', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70200, 'taxi_fuel': 505, 'takeoff_fuel': 20000, 'trip_fuel': 16000}, [69695, 7695, 'MRW']], ['MTOW and MLW tie', {'oew': 42000, 'mtow': 68000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 12000, 'trip_fuel': 4000}, [68000, 14000, 'MTOW']], ['no payload possible', {'oew': 58000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 15500, 'trip_fuel': 12000}, [70000, 0, 'MTOW']], ['sampled case 1', {'oew': 40700, 'mtow': 68300, 'mlw': 61100, 'mzfw': 59900, 'mrw': 68300, 'taxi_fuel': 300, 'takeoff_fuel': 7200, 'trip_fuel': 4000}, [65100, 17200, 'MLW']], ['sampled case 2', {'oew': 41600, 'mtow': 69800, 'mlw': 66700, 'mzfw': 61300, 'mrw': 69800, 'taxi_fuel': 400, 'takeoff_fuel': 18100, 'trip_fuel': 14300}, [69400, 9700, 'MRW']], ['sampled case 3', {'oew': 46200, 'mtow': 65500, 'mlw': 55600, 'mzfw': 54600, 'mrw': 65700, 'taxi_fuel': 800, 'takeoff_fuel': 8400, 'trip_fuel': 4900}, [60500, 5900, 'MLW']]]]
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)

prompt:
Flights carrying reserve or tankered fuel are payload-limited far below the MZFW structural allowance.

Input weights in kg. Allowed takeoff weight = lowest of MTOW, MLW+trip fuel, MZFW+takeoff fuel, MRW-taxi fuel; ties go to the earlier entry in that order. Allowed payload = allowed TOW - OEW - takeoff fuel, floored at 0. Return [allowed TOW, payload, limiting name].

split: open-access


prompt:
Ramp-limited departures are allowed more takeoff weight than the aircraft may weigh on the ramp.

Input weights in kg. Allowed takeoff weight = lowest of MTOW, MLW+trip fuel, MZFW+takeoff fuel, MRW-taxi fuel; ties go to the earlier entry in that order. Allowed payload = allowed TOW - OEW - takeoff fuel, floored at 0. Return [allowed TOW, payload, limiting name].

split: open-access


source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    cands = [('MTOW', x['mtow']), ('MLW', x['mlw'] + x['trip_fuel']), ('MZFW', x['mzfw'] + x['takeoff_fuel']), ('MRW', x['mrw'] - x['taxi_fuel'])]
    best = cands[-1]
    for c in cands[1:]:
        if c[1] <= best[1] and c[0] != best[0]:
            best = c
    payload = best[1] - x['oew'] - x['takeoff_fuel']
    if payload < 0:
        payload = 0
    return [best[1], payload, best[0]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['long sector MTOW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 16100, 'trip_fuel': 13000}, [70000, 11900, 'MTOW']], ['short sector MLW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 61000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 5010, 'trip_fuel': 2000}, [63000, 15990, 'MLW']], ['tankering MZFW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 7000, 'trip_fuel': 5510}, [67000, 18000, 'MZFW']], ['ramp limited heavy taxi', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70200, 'taxi_fuel': 501, 'takeoff_fuel': 20000, 'trip_fuel': 16000}, [69699, 7699, 'MRW']], ['MTOW and MLW tie', {'oew': 42000, 'mtow': 68000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 12000, 'trip_fuel': 4000}, [68000, 14000, 'MTOW']], ['no payload possible', {'oew': 58000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 15100, 'trip_fuel': 12000}, [70000, 0, 'MTOW']], ['sampled case 1', {'oew': 45200, 'mtow': 63600, 'mlw': 62300, 'mzfw': 57500, 'mrw': 64200, 'taxi_fuel': 500, 'takeoff_fuel': 9200, 'trip_fuel': 5700}, [63600, 9200, 'MTOW']], ['sampled case 2', {'oew': 35600, 'mtow': 48200, 'mlw': 46600, 'mzfw': 44800, 'mrw': 48400, 'taxi_fuel': 400, 'takeoff_fuel': 4100, 'trip_fuel': 500}, [47100, 7400, 'MLW']], ['sampled case 3', {'oew': 36100, 'mtow': 50400, 'mlw': 48100, 'mzfw': 42500, 'mrw': 50400, 'taxi_fuel': 800, 'takeoff_fuel': 20900, 'trip_fuel': 16300}, [49600, 0, 'MRW']]], [['long sector MTOW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 16200, 'trip_fuel': 13000}, [70000, 11800, 'MTOW']], ['short sector MLW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 61000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 5020, 'trip_fuel': 2000}, [63000, 15980, 'MLW']], ['tankering MZFW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 7000, 'trip_fuel': 5520}, [67000, 18000, 'MZFW']], ['ramp limited heavy taxi', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70200, 'taxi_fuel': 502, 'takeoff_fuel': 20000, 'trip_fuel': 16000}, [69698, 7698, 'MRW']], ['MTOW and MLW tie', {'oew': 42000, 'mtow': 68000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 12000, 'trip_fuel': 4000}, [68000, 14000, 'MTOW']], ['no payload possible', {'oew': 58000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 15200, 'trip_fuel': 12000}, [70000, 0, 'MTOW']], ['sampled case 1', {'oew': 48000, 'mtow': 71700, 'mlw': 60600, 'mzfw': 59700, 'mrw': 72100, 'taxi_fuel': 300, 'takeoff_fuel': 17500, 'trip_fuel': 14300}, [71700, 6200, 'MTOW']], ['sampled case 2', {'oew': 45100, 'mtow': 57700, 'mlw': 55900, 'mzfw': 50100, 'mrw': 57900, 'taxi_fuel': 200, 'takeoff_fuel': 5800, 'trip_fuel': 3300}, [55900, 5000, 'MZFW']], ['sampled case 3', {'oew': 38900, 'mtow': 70900, 'mlw': 64200, 'mzfw': 58600, 'mrw': 71100, 'taxi_fuel': 800, 'takeoff_fuel': 19800, 'trip_fuel': 17300}, [70300, 11600, 'MRW']]], [['long sector MTOW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 16300, 'trip_fuel': 13000}, [70000, 11700, 'MTOW']], ['short sector MLW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 61000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 5030, 'trip_fuel': 2000}, [63000, 15970, 'MLW']], ['tankering MZFW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 7000, 'trip_fuel': 5530}, [67000, 18000, 'MZFW']], ['ramp limited heavy taxi', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70200, 'taxi_fuel': 503, 'takeoff_fuel': 20000, 'trip_fuel': 16000}, [69697, 7697, 'MRW']], ['MTOW and MLW tie', {'oew': 42000, 'mtow': 68000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 12000, 'trip_fuel': 4000}, [68000, 14000, 'MTOW']], ['no payload possible', {'oew': 58000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 15300, 'trip_fuel': 12000}, [70000, 0, 'MTOW']], ['sampled case 1', {'oew': 41500, 'mtow': 65300, 'mlw': 54900, 'mzfw': 51800, 'mrw': 65500, 'taxi_fuel': 800, 'takeoff_fuel': 15200, 'trip_fuel': 11100}, [64700, 8000, 'MRW']], ['sampled case 2', {'oew': 48100, 'mtow': 69500, 'mlw': 66400, 'mzfw': 60800, 'mrw': 70100, 'taxi_fuel': 400, 'takeoff_fuel': 8000, 'trip_fuel': 3500}, [68800, 12700, 'MZFW']], ['sampled case 3', {'oew': 48200, 'mtow': 70500, 'mlw': 63100, 'mzfw': 61400, 'mrw': 70700, 'taxi_fuel': 500, 'takeoff_fuel': 10300, 'trip_fuel': 8800}, [70200, 11700, 'MRW']]], [['long sector MTOW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 16400, 'trip_fuel': 13000}, [70000, 11600, 'MTOW']], ['short sector MLW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 61000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 5040, 'trip_fuel': 2000}, [63000, 15960, 'MLW']], ['tankering MZFW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 7000, 'trip_fuel': 5540}, [67000, 18000, 'MZFW']], ['ramp limited heavy taxi', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70200, 'taxi_fuel': 504, 'takeoff_fuel': 20000, 'trip_fuel': 16000}, [69696, 7696, 'MRW']], ['MTOW and MLW tie', {'oew': 42000, 'mtow': 68000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 12000, 'trip_fuel': 4000}, [68000, 14000, 'MTOW']], ['no payload possible', {'oew': 58000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 15400, 'trip_fuel': 12000}, [70000, 0, 'MTOW']], ['sampled case 1', {'oew': 44100, 'mtow': 69600, 'mlw': 65500, 'mzfw': 61100, 'mrw': 70200, 'taxi_fuel': 200, 'takeoff_fuel': 3000, 'trip_fuel': 500}, [64100, 17000, 'MZFW']], ['sampled case 2', {'oew': 37600, 'mtow': 51800, 'mlw': 48800, 'mzfw': 47700, 'mrw': 52400, 'taxi_fuel': 800, 'takeoff_fuel': 6100, 'trip_fuel': 2300}, [51100, 7400, 'MLW']], ['sampled case 3', {'oew': 48900, 'mtow': 68600, 'mlw': 60100, 'mzfw': 56600, 'mrw': 69000, 'taxi_fuel': 300, 'takeoff_fuel': 23600, 'trip_fuel': 19400}, [68600, 0, 'MTOW']]], [['long sector MTOW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 16500, 'trip_fuel': 13000}, [70000, 11500, 'MTOW']], ['short sector MLW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 61000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 5050, 'trip_fuel': 2000}, [63000, 15950, 'MLW']], ['tankering MZFW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 7000, 'trip_fuel': 5550}, [67000, 18000, 'MZFW']], ['ramp limited heavy taxi', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70200, 'taxi_fuel': 505, 'takeoff_fuel': 20000, 'trip_fuel': 16000}, [69695, 7695, 'MRW']], ['MTOW and MLW tie', {'oew': 42000, 'mtow': 68000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 12000, 'trip_fuel': 4000}, [68000, 14000, 'MTOW']], ['no payload possible', {'oew': 58000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 15500, 'trip_fuel': 12000}, [70000, 0, 'MTOW']], ['sampled case 1', {'oew': 40700, 'mtow': 68300, 'mlw': 61100, 'mzfw': 59900, 'mrw': 68300, 'taxi_fuel': 300, 'takeoff_fuel': 7200, 'trip_fuel': 4000}, [65100, 17200, 'MLW']], ['sampled case 2', {'oew': 41600, 'mtow': 69800, 'mlw': 66700, 'mzfw': 61300, 'mrw': 69800, 'taxi_fuel': 400, 'takeoff_fuel': 18100, 'trip_fuel': 14300}, [69400, 9700, 'MRW']], ['sampled case 3', {'oew': 46200, 'mtow': 65500, 'mlw': 55600, 'mzfw': 54600, 'mrw': 65700, 'taxi_fuel': 800, 'takeoff_fuel': 8400, 'trip_fuel': 4900}, [60500, 5900, 'MLW']]]]
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)

prompt:
When MTOW equals the landing-derived limit the loadsheet names MLW as limiting.

Input weights in kg. Allowed takeoff weight = lowest of MTOW, MLW+trip fuel, MZFW+takeoff fuel, MRW-taxi fuel; ties go to the earlier entry in that order. Allowed payload = allowed TOW - OEW - takeoff fuel, floored at 0. Return [allowed TOW, payload, limiting name].

split: open-access


source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    cands = [('MTOW', x['mtow']), ('MLW', x['mlw'] + x['trip_fuel']), ('MZFW', x['mzfw'] + x['takeoff_fuel']), ('MRW', x['mrw'] - x['taxi_fuel'])]
    best = cands[0]
    for c in cands[1:]:
        if c[1] < best[1]:
            best = c
    payload = best[1] - x['oew'] - x['takeoff_fuel']
    if payload < 0:
        payload = abs(payload)
    return [best[1], payload, best[0]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['long sector MTOW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 16100, 'trip_fuel': 13000}, [70000, 11900, 'MTOW']], ['short sector MLW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 61000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 5010, 'trip_fuel': 2000}, [63000, 15990, 'MLW']], ['tankering MZFW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 7000, 'trip_fuel': 5510}, [67000, 18000, 'MZFW']], ['ramp limited heavy taxi', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70200, 'taxi_fuel': 501, 'takeoff_fuel': 20000, 'trip_fuel': 16000}, [69699, 7699, 'MRW']], ['MTOW and MLW tie', {'oew': 42000, 'mtow': 68000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 12000, 'trip_fuel': 4000}, [68000, 14000, 'MTOW']], ['no payload possible', {'oew': 58000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 15100, 'trip_fuel': 12000}, [70000, 0, 'MTOW']], ['sampled case 1', {'oew': 45200, 'mtow': 63600, 'mlw': 62300, 'mzfw': 57500, 'mrw': 64200, 'taxi_fuel': 500, 'takeoff_fuel': 9200, 'trip_fuel': 5700}, [63600, 9200, 'MTOW']], ['sampled case 2', {'oew': 35600, 'mtow': 48200, 'mlw': 46600, 'mzfw': 44800, 'mrw': 48400, 'taxi_fuel': 400, 'takeoff_fuel': 4100, 'trip_fuel': 500}, [47100, 7400, 'MLW']], ['sampled case 3', {'oew': 36100, 'mtow': 50400, 'mlw': 48100, 'mzfw': 42500, 'mrw': 50400, 'taxi_fuel': 800, 'takeoff_fuel': 20900, 'trip_fuel': 16300}, [49600, 0, 'MRW']]], [['long sector MTOW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 16200, 'trip_fuel': 13000}, [70000, 11800, 'MTOW']], ['short sector MLW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 61000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 5020, 'trip_fuel': 2000}, [63000, 15980, 'MLW']], ['tankering MZFW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 7000, 'trip_fuel': 5520}, [67000, 18000, 'MZFW']], ['ramp limited heavy taxi', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70200, 'taxi_fuel': 502, 'takeoff_fuel': 20000, 'trip_fuel': 16000}, [69698, 7698, 'MRW']], ['MTOW and MLW tie', {'oew': 42000, 'mtow': 68000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 12000, 'trip_fuel': 4000}, [68000, 14000, 'MTOW']], ['no payload possible', {'oew': 58000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 15200, 'trip_fuel': 12000}, [70000, 0, 'MTOW']], ['sampled case 1', {'oew': 48000, 'mtow': 71700, 'mlw': 60600, 'mzfw': 59700, 'mrw': 72100, 'taxi_fuel': 300, 'takeoff_fuel': 17500, 'trip_fuel': 14300}, [71700, 6200, 'MTOW']], ['sampled case 2', {'oew': 45100, 'mtow': 57700, 'mlw': 55900, 'mzfw': 50100, 'mrw': 57900, 'taxi_fuel': 200, 'takeoff_fuel': 5800, 'trip_fuel': 3300}, [55900, 5000, 'MZFW']], ['sampled case 3', {'oew': 38900, 'mtow': 70900, 'mlw': 64200, 'mzfw': 58600, 'mrw': 71100, 'taxi_fuel': 800, 'takeoff_fuel': 19800, 'trip_fuel': 17300}, [70300, 11600, 'MRW']]], [['long sector MTOW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 16300, 'trip_fuel': 13000}, [70000, 11700, 'MTOW']], ['short sector MLW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 61000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 5030, 'trip_fuel': 2000}, [63000, 15970, 'MLW']], ['tankering MZFW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 7000, 'trip_fuel': 5530}, [67000, 18000, 'MZFW']], ['ramp limited heavy taxi', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70200, 'taxi_fuel': 503, 'takeoff_fuel': 20000, 'trip_fuel': 16000}, [69697, 7697, 'MRW']], ['MTOW and MLW tie', {'oew': 42000, 'mtow': 68000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 12000, 'trip_fuel': 4000}, [68000, 14000, 'MTOW']], ['no payload possible', {'oew': 58000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 15300, 'trip_fuel': 12000}, [70000, 0, 'MTOW']], ['sampled case 1', {'oew': 41500, 'mtow': 65300, 'mlw': 54900, 'mzfw': 51800, 'mrw': 65500, 'taxi_fuel': 800, 'takeoff_fuel': 15200, 'trip_fuel': 11100}, [64700, 8000, 'MRW']], ['sampled case 2', {'oew': 48100, 'mtow': 69500, 'mlw': 66400, 'mzfw': 60800, 'mrw': 70100, 'taxi_fuel': 400, 'takeoff_fuel': 8000, 'trip_fuel': 3500}, [68800, 12700, 'MZFW']], ['sampled case 3', {'oew': 48200, 'mtow': 70500, 'mlw': 63100, 'mzfw': 61400, 'mrw': 70700, 'taxi_fuel': 500, 'takeoff_fuel': 10300, 'trip_fuel': 8800}, [70200, 11700, 'MRW']]], [['long sector MTOW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 16400, 'trip_fuel': 13000}, [70000, 11600, 'MTOW']], ['short sector MLW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 61000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 5040, 'trip_fuel': 2000}, [63000, 15960, 'MLW']], ['tankering MZFW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 7000, 'trip_fuel': 5540}, [67000, 18000, 'MZFW']], ['ramp limited heavy taxi', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70200, 'taxi_fuel': 504, 'takeoff_fuel': 20000, 'trip_fuel': 16000}, [69696, 7696, 'MRW']], ['MTOW and MLW tie', {'oew': 42000, 'mtow': 68000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 12000, 'trip_fuel': 4000}, [68000, 14000, 'MTOW']], ['no payload possible', {'oew': 58000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 15400, 'trip_fuel': 12000}, [70000, 0, 'MTOW']], ['sampled case 1', {'oew': 44100, 'mtow': 69600, 'mlw': 65500, 'mzfw': 61100, 'mrw': 70200, 'taxi_fuel': 200, 'takeoff_fuel': 3000, 'trip_fuel': 500}, [64100, 17000, 'MZFW']], ['sampled case 2', {'oew': 37600, 'mtow': 51800, 'mlw': 48800, 'mzfw': 47700, 'mrw': 52400, 'taxi_fuel': 800, 'takeoff_fuel': 6100, 'trip_fuel': 2300}, [51100, 7400, 'MLW']], ['sampled case 3', {'oew': 48900, 'mtow': 68600, 'mlw': 60100, 'mzfw': 56600, 'mrw': 69000, 'taxi_fuel': 300, 'takeoff_fuel': 23600, 'trip_fuel': 19400}, [68600, 0, 'MTOW']]], [['long sector MTOW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 16500, 'trip_fuel': 13000}, [70000, 11500, 'MTOW']], ['short sector MLW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 61000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 5050, 'trip_fuel': 2000}, [63000, 15950, 'MLW']], ['tankering MZFW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 7000, 'trip_fuel': 5550}, [67000, 18000, 'MZFW']], ['ramp limited heavy taxi', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70200, 'taxi_fuel': 505, 'takeoff_fuel': 20000, 'trip_fuel': 16000}, [69695, 7695, 'MRW']], ['MTOW and MLW tie', {'oew': 42000, 'mtow': 68000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 12000, 'trip_fuel': 4000}, [68000, 14000, 'MTOW']], ['no payload possible', {'oew': 58000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 15500, 'trip_fuel': 12000}, [70000, 0, 'MTOW']], ['sampled case 1', {'oew': 40700, 'mtow': 68300, 'mlw': 61100, 'mzfw': 59900, 'mrw': 68300, 'taxi_fuel': 300, 'takeoff_fuel': 7200, 'trip_fuel': 4000}, [65100, 17200, 'MLW']], ['sampled case 2', {'oew': 41600, 'mtow': 69800, 'mlw': 66700, 'mzfw': 61300, 'mrw': 69800, 'taxi_fuel': 400, 'takeoff_fuel': 18100, 'trip_fuel': 14300}, [69400, 9700, 'MRW']], ['sampled case 3', {'oew': 46200, 'mtow': 65500, 'mlw': 55600, 'mzfw': 54600, 'mrw': 65700, 'taxi_fuel': 800, 'takeoff_fuel': 8400, 'trip_fuel': 4900}, [60500, 5900, 'MLW']]]]
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)

prompt:
A heavy aircraft with a full fuel load shows a negative payload allowance on the loadsheet.

Input weights in kg. Allowed takeoff weight = lowest of MTOW, MLW+trip fuel, MZFW+takeoff fuel, MRW-taxi fuel; ties go to the earlier entry in that order. Allowed payload = allowed TOW - OEW - takeoff fuel, floored at 0. Return [allowed TOW, payload, limiting name].

split: open-access


source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    cands = [('MTOW', x['mtow']), ('MLW', x['mlw'] + x['trip_fuel']), ('MZFW', x['mzfw'] + x['takeoff_fuel']), ('MRW', x['mrw'] - x['taxi_fuel'])]
    best = cands[0]
    for c in cands[1:]:
        if c[1] < best[1]:
            best = c
    payload = min(x['mtow'], x['mzfw'] + x['takeoff_fuel']) - x['oew'] - x['takeoff_fuel']
    if payload < 0:
        payload = 0
    return [best[1], payload, best[0]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['long sector MTOW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 16100, 'trip_fuel': 13000}, [70000, 11900, 'MTOW']], ['short sector MLW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 61000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 5010, 'trip_fuel': 2000}, [63000, 15990, 'MLW']], ['tankering MZFW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 7000, 'trip_fuel': 5510}, [67000, 18000, 'MZFW']], ['ramp limited heavy taxi', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70200, 'taxi_fuel': 501, 'takeoff_fuel': 20000, 'trip_fuel': 16000}, [69699, 7699, 'MRW']], ['MTOW and MLW tie', {'oew': 42000, 'mtow': 68000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 12000, 'trip_fuel': 4000}, [68000, 14000, 'MTOW']], ['no payload possible', {'oew': 58000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 15100, 'trip_fuel': 12000}, [70000, 0, 'MTOW']], ['sampled case 1', {'oew': 45200, 'mtow': 63600, 'mlw': 62300, 'mzfw': 57500, 'mrw': 64200, 'taxi_fuel': 500, 'takeoff_fuel': 9200, 'trip_fuel': 5700}, [63600, 9200, 'MTOW']], ['sampled case 2', {'oew': 35600, 'mtow': 48200, 'mlw': 46600, 'mzfw': 44800, 'mrw': 48400, 'taxi_fuel': 400, 'takeoff_fuel': 4100, 'trip_fuel': 500}, [47100, 7400, 'MLW']], ['sampled case 3', {'oew': 36100, 'mtow': 50400, 'mlw': 48100, 'mzfw': 42500, 'mrw': 50400, 'taxi_fuel': 800, 'takeoff_fuel': 20900, 'trip_fuel': 16300}, [49600, 0, 'MRW']]], [['long sector MTOW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 16200, 'trip_fuel': 13000}, [70000, 11800, 'MTOW']], ['short sector MLW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 61000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 5020, 'trip_fuel': 2000}, [63000, 15980, 'MLW']], ['tankering MZFW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 7000, 'trip_fuel': 5520}, [67000, 18000, 'MZFW']], ['ramp limited heavy taxi', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70200, 'taxi_fuel': 502, 'takeoff_fuel': 20000, 'trip_fuel': 16000}, [69698, 7698, 'MRW']], ['MTOW and MLW tie', {'oew': 42000, 'mtow': 68000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 12000, 'trip_fuel': 4000}, [68000, 14000, 'MTOW']], ['no payload possible', {'oew': 58000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 15200, 'trip_fuel': 12000}, [70000, 0, 'MTOW']], ['sampled case 1', {'oew': 48000, 'mtow': 71700, 'mlw': 60600, 'mzfw': 59700, 'mrw': 72100, 'taxi_fuel': 300, 'takeoff_fuel': 17500, 'trip_fuel': 14300}, [71700, 6200, 'MTOW']], ['sampled case 2', {'oew': 45100, 'mtow': 57700, 'mlw': 55900, 'mzfw': 50100, 'mrw': 57900, 'taxi_fuel': 200, 'takeoff_fuel': 5800, 'trip_fuel': 3300}, [55900, 5000, 'MZFW']], ['sampled case 3', {'oew': 38900, 'mtow': 70900, 'mlw': 64200, 'mzfw': 58600, 'mrw': 71100, 'taxi_fuel': 800, 'takeoff_fuel': 19800, 'trip_fuel': 17300}, [70300, 11600, 'MRW']]], [['long sector MTOW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 16300, 'trip_fuel': 13000}, [70000, 11700, 'MTOW']], ['short sector MLW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 61000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 5030, 'trip_fuel': 2000}, [63000, 15970, 'MLW']], ['tankering MZFW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 7000, 'trip_fuel': 5530}, [67000, 18000, 'MZFW']], ['ramp limited heavy taxi', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70200, 'taxi_fuel': 503, 'takeoff_fuel': 20000, 'trip_fuel': 16000}, [69697, 7697, 'MRW']], ['MTOW and MLW tie', {'oew': 42000, 'mtow': 68000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 12000, 'trip_fuel': 4000}, [68000, 14000, 'MTOW']], ['no payload possible', {'oew': 58000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 15300, 'trip_fuel': 12000}, [70000, 0, 'MTOW']], ['sampled case 1', {'oew': 41500, 'mtow': 65300, 'mlw': 54900, 'mzfw': 51800, 'mrw': 65500, 'taxi_fuel': 800, 'takeoff_fuel': 15200, 'trip_fuel': 11100}, [64700, 8000, 'MRW']], ['sampled case 2', {'oew': 48100, 'mtow': 69500, 'mlw': 66400, 'mzfw': 60800, 'mrw': 70100, 'taxi_fuel': 400, 'takeoff_fuel': 8000, 'trip_fuel': 3500}, [68800, 12700, 'MZFW']], ['sampled case 3', {'oew': 48200, 'mtow': 70500, 'mlw': 63100, 'mzfw': 61400, 'mrw': 70700, 'taxi_fuel': 500, 'takeoff_fuel': 10300, 'trip_fuel': 8800}, [70200, 11700, 'MRW']]], [['long sector MTOW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 16400, 'trip_fuel': 13000}, [70000, 11600, 'MTOW']], ['short sector MLW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 61000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 5040, 'trip_fuel': 2000}, [63000, 15960, 'MLW']], ['tankering MZFW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 7000, 'trip_fuel': 5540}, [67000, 18000, 'MZFW']], ['ramp limited heavy taxi', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70200, 'taxi_fuel': 504, 'takeoff_fuel': 20000, 'trip_fuel': 16000}, [69696, 7696, 'MRW']], ['MTOW and MLW tie', {'oew': 42000, 'mtow': 68000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 12000, 'trip_fuel': 4000}, [68000, 14000, 'MTOW']], ['no payload possible', {'oew': 58000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 15400, 'trip_fuel': 12000}, [70000, 0, 'MTOW']], ['sampled case 1', {'oew': 44100, 'mtow': 69600, 'mlw': 65500, 'mzfw': 61100, 'mrw': 70200, 'taxi_fuel': 200, 'takeoff_fuel': 3000, 'trip_fuel': 500}, [64100, 17000, 'MZFW']], ['sampled case 2', {'oew': 37600, 'mtow': 51800, 'mlw': 48800, 'mzfw': 47700, 'mrw': 52400, 'taxi_fuel': 800, 'takeoff_fuel': 6100, 'trip_fuel': 2300}, [51100, 7400, 'MLW']], ['sampled case 3', {'oew': 48900, 'mtow': 68600, 'mlw': 60100, 'mzfw': 56600, 'mrw': 69000, 'taxi_fuel': 300, 'takeoff_fuel': 23600, 'trip_fuel': 19400}, [68600, 0, 'MTOW']]], [['long sector MTOW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 16500, 'trip_fuel': 13000}, [70000, 11500, 'MTOW']], ['short sector MLW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 61000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 5050, 'trip_fuel': 2000}, [63000, 15950, 'MLW']], ['tankering MZFW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 7000, 'trip_fuel': 5550}, [67000, 18000, 'MZFW']], ['ramp limited heavy taxi', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70200, 'taxi_fuel': 505, 'takeoff_fuel': 20000, 'trip_fuel': 16000}, [69695, 7695, 'MRW']], ['MTOW and MLW tie', {'oew': 42000, 'mtow': 68000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 12000, 'trip_fuel': 4000}, [68000, 14000, 'MTOW']], ['no payload possible', {'oew': 58000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 15500, 'trip_fuel': 12000}, [70000, 0, 'MTOW']], ['sampled case 1', {'oew': 40700, 'mtow': 68300, 'mlw': 61100, 'mzfw': 59900, 'mrw': 68300, 'taxi_fuel': 300, 'takeoff_fuel': 7200, 'trip_fuel': 4000}, [65100, 17200, 'MLW']], ['sampled case 2', {'oew': 41600, 'mtow': 69800, 'mlw': 66700, 'mzfw': 61300, 'mrw': 69800, 'taxi_fuel': 400, 'takeoff_fuel': 18100, 'trip_fuel': 14300}, [69400, 9700, 'MRW']], ['sampled case 3', {'oew': 46200, 'mtow': 65500, 'mlw': 55600, 'mzfw': 54600, 'mrw': 65700, 'taxi_fuel': 800, 'takeoff_fuel': 8400, 'trip_fuel': 4900}, [60500, 5900, 'MLW']]]]
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)

prompt:
Landing- or ramp-limited flights are offered payload that only the takeoff limit would allow.

Input weights in kg. Allowed takeoff weight = lowest of MTOW, MLW+trip fuel, MZFW+takeoff fuel, MRW-taxi fuel; ties go to the earlier entry in that order. Allowed payload = allowed TOW - OEW - takeoff fuel, floored at 0. Return [allowed TOW, payload, limiting name].

split: open-access


source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    cands = [('MTOW', x['mtow']), ('MLW', x['mlw'] + x['trip_fuel']), ('MZFW', x['mzfw'] + x['takeoff_fuel'])]
    if x['mrw'] < x['mtow']: cands.append(('MRW', x['mrw']))
    best = cands[0]
    for c in cands[1:]:
        if c[1] < best[1]:
            best = c
    payload = best[1] - x['oew'] - x['takeoff_fuel']
    if payload < 0:
        payload = 0
    return [best[1], payload, best[0]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['long sector MTOW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 16100, 'trip_fuel': 13000}, [70000, 11900, 'MTOW']], ['short sector MLW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 61000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 5010, 'trip_fuel': 2000}, [63000, 15990, 'MLW']], ['tankering MZFW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 7000, 'trip_fuel': 5510}, [67000, 18000, 'MZFW']], ['ramp limited heavy taxi', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70200, 'taxi_fuel': 501, 'takeoff_fuel': 20000, 'trip_fuel': 16000}, [69699, 7699, 'MRW']], ['MTOW and MLW tie', {'oew': 42000, 'mtow': 68000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 12000, 'trip_fuel': 4000}, [68000, 14000, 'MTOW']], ['no payload possible', {'oew': 58000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 15100, 'trip_fuel': 12000}, [70000, 0, 'MTOW']], ['sampled case 1', {'oew': 45200, 'mtow': 63600, 'mlw': 62300, 'mzfw': 57500, 'mrw': 64200, 'taxi_fuel': 500, 'takeoff_fuel': 9200, 'trip_fuel': 5700}, [63600, 9200, 'MTOW']], ['sampled case 2', {'oew': 35600, 'mtow': 48200, 'mlw': 46600, 'mzfw': 44800, 'mrw': 48400, 'taxi_fuel': 400, 'takeoff_fuel': 4100, 'trip_fuel': 500}, [47100, 7400, 'MLW']], ['sampled case 3', {'oew': 36100, 'mtow': 50400, 'mlw': 48100, 'mzfw': 42500, 'mrw': 50400, 'taxi_fuel': 800, 'takeoff_fuel': 20900, 'trip_fuel': 16300}, [49600, 0, 'MRW']]], [['long sector MTOW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 16200, 'trip_fuel': 13000}, [70000, 11800, 'MTOW']], ['short sector MLW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 61000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 5020, 'trip_fuel': 2000}, [63000, 15980, 'MLW']], ['tankering MZFW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 7000, 'trip_fuel': 5520}, [67000, 18000, 'MZFW']], ['ramp limited heavy taxi', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70200, 'taxi_fuel': 502, 'takeoff_fuel': 20000, 'trip_fuel': 16000}, [69698, 7698, 'MRW']], ['MTOW and MLW tie', {'oew': 42000, 'mtow': 68000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 12000, 'trip_fuel': 4000}, [68000, 14000, 'MTOW']], ['no payload possible', {'oew': 58000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 15200, 'trip_fuel': 12000}, [70000, 0, 'MTOW']], ['sampled case 1', {'oew': 48000, 'mtow': 71700, 'mlw': 60600, 'mzfw': 59700, 'mrw': 72100, 'taxi_fuel': 300, 'takeoff_fuel': 17500, 'trip_fuel': 14300}, [71700, 6200, 'MTOW']], ['sampled case 2', {'oew': 45100, 'mtow': 57700, 'mlw': 55900, 'mzfw': 50100, 'mrw': 57900, 'taxi_fuel': 200, 'takeoff_fuel': 5800, 'trip_fuel': 3300}, [55900, 5000, 'MZFW']], ['sampled case 3', {'oew': 38900, 'mtow': 70900, 'mlw': 64200, 'mzfw': 58600, 'mrw': 71100, 'taxi_fuel': 800, 'takeoff_fuel': 19800, 'trip_fuel': 17300}, [70300, 11600, 'MRW']]], [['long sector MTOW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 16300, 'trip_fuel': 13000}, [70000, 11700, 'MTOW']], ['short sector MLW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 61000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 5030, 'trip_fuel': 2000}, [63000, 15970, 'MLW']], ['tankering MZFW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 7000, 'trip_fuel': 5530}, [67000, 18000, 'MZFW']], ['ramp limited heavy taxi', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70200, 'taxi_fuel': 503, 'takeoff_fuel': 20000, 'trip_fuel': 16000}, [69697, 7697, 'MRW']], ['MTOW and MLW tie', {'oew': 42000, 'mtow': 68000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 12000, 'trip_fuel': 4000}, [68000, 14000, 'MTOW']], ['no payload possible', {'oew': 58000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 15300, 'trip_fuel': 12000}, [70000, 0, 'MTOW']], ['sampled case 1', {'oew': 41500, 'mtow': 65300, 'mlw': 54900, 'mzfw': 51800, 'mrw': 65500, 'taxi_fuel': 800, 'takeoff_fuel': 15200, 'trip_fuel': 11100}, [64700, 8000, 'MRW']], ['sampled case 2', {'oew': 48100, 'mtow': 69500, 'mlw': 66400, 'mzfw': 60800, 'mrw': 70100, 'taxi_fuel': 400, 'takeoff_fuel': 8000, 'trip_fuel': 3500}, [68800, 12700, 'MZFW']], ['sampled case 3', {'oew': 48200, 'mtow': 70500, 'mlw': 63100, 'mzfw': 61400, 'mrw': 70700, 'taxi_fuel': 500, 'takeoff_fuel': 10300, 'trip_fuel': 8800}, [70200, 11700, 'MRW']]], [['long sector MTOW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 16400, 'trip_fuel': 13000}, [70000, 11600, 'MTOW']], ['short sector MLW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 61000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 5040, 'trip_fuel': 2000}, [63000, 15960, 'MLW']], ['tankering MZFW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 7000, 'trip_fuel': 5540}, [67000, 18000, 'MZFW']], ['ramp limited heavy taxi', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70200, 'taxi_fuel': 504, 'takeoff_fuel': 20000, 'trip_fuel': 16000}, [69696, 7696, 'MRW']], ['MTOW and MLW tie', {'oew': 42000, 'mtow': 68000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 12000, 'trip_fuel': 4000}, [68000, 14000, 'MTOW']], ['no payload possible', {'oew': 58000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 15400, 'trip_fuel': 12000}, [70000, 0, 'MTOW']], ['sampled case 1', {'oew': 44100, 'mtow': 69600, 'mlw': 65500, 'mzfw': 61100, 'mrw': 70200, 'taxi_fuel': 200, 'takeoff_fuel': 3000, 'trip_fuel': 500}, [64100, 17000, 'MZFW']], ['sampled case 2', {'oew': 37600, 'mtow': 51800, 'mlw': 48800, 'mzfw': 47700, 'mrw': 52400, 'taxi_fuel': 800, 'takeoff_fuel': 6100, 'trip_fuel': 2300}, [51100, 7400, 'MLW']], ['sampled case 3', {'oew': 48900, 'mtow': 68600, 'mlw': 60100, 'mzfw': 56600, 'mrw': 69000, 'taxi_fuel': 300, 'takeoff_fuel': 23600, 'trip_fuel': 19400}, [68600, 0, 'MTOW']]], [['long sector MTOW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 16500, 'trip_fuel': 13000}, [70000, 11500, 'MTOW']], ['short sector MLW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 61000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 5050, 'trip_fuel': 2000}, [63000, 15950, 'MLW']], ['tankering MZFW limited', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 7000, 'trip_fuel': 5550}, [67000, 18000, 'MZFW']], ['ramp limited heavy taxi', {'oew': 42000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70200, 'taxi_fuel': 505, 'takeoff_fuel': 20000, 'trip_fuel': 16000}, [69695, 7695, 'MRW']], ['MTOW and MLW tie', {'oew': 42000, 'mtow': 68000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 12000, 'trip_fuel': 4000}, [68000, 14000, 'MTOW']], ['no payload possible', {'oew': 58000, 'mtow': 70000, 'mlw': 64000, 'mzfw': 60000, 'mrw': 70400, 'taxi_fuel': 300, 'takeoff_fuel': 15500, 'trip_fuel': 12000}, [70000, 0, 'MTOW']], ['sampled case 1', {'oew': 40700, 'mtow': 68300, 'mlw': 61100, 'mzfw': 59900, 'mrw': 68300, 'taxi_fuel': 300, 'takeoff_fuel': 7200, 'trip_fuel': 4000}, [65100, 17200, 'MLW']], ['sampled case 2', {'oew': 41600, 'mtow': 69800, 'mlw': 66700, 'mzfw': 61300, 'mrw': 69800, 'taxi_fuel': 400, 'takeoff_fuel': 18100, 'trip_fuel': 14300}, [69400, 9700, 'MRW']], ['sampled case 3', {'oew': 46200, 'mtow': 65500, 'mlw': 55600, 'mzfw': 54600, 'mrw': 65700, 'taxi_fuel': 800, 'takeoff_fuel': 8400, 'trip_fuel': 4900}, [60500, 5900, 'MLW']]]]
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)

prompt:
With heavy taxi fuel the planned takeoff weight exceeds what the ramp limit allows.

Input weights in kg. Allowed takeoff weight = lowest of MTOW, MLW+trip fuel, MZFW+takeoff fuel, MRW-taxi fuel; ties go to the earlier entry in that order. Allowed payload = allowed TOW - OEW - takeoff fuel, floored at 0. Return [allowed TOW, payload, limiting name].

split: open-access


prompt:
After moving the computed weight the CG still falls a fraction short of the target.

Input [total lb, current CG, target CG, from-station arm, to-station arm]. Weight to move = W*dCG/dArm, rounded UP to a whole pound after clearing float noise at 6 decimals. Same station -> 'ERR_SAME_STATION'; zero dCG -> 0; a move that shifts CG the wrong way -> 'ERR_DIRECTION'.

split: open-access


prompt:
Moving cargo forward is recommended to move the CG aft.

Input [total lb, current CG, target CG, from-station arm, to-station arm]. Weight to move = W*dCG/dArm, rounded UP to a whole pound after clearing float noise at 6 decimals. Same station -> 'ERR_SAME_STATION'; zero dCG -> 0; a move that shifts CG the wrong way -> 'ERR_DIRECTION'.

split: open-access


prompt:
Required shift weights are far too small for aft stations and do not depend on where the load comes from.

Input [total lb, current CG, target CG, from-station arm, to-station arm]. Weight to move = W*dCG/dArm, rounded UP to a whole pound after clearing float noise at 6 decimals. Same station -> 'ERR_SAME_STATION'; zero dCG -> 0; a move that shifts CG the wrong way -> 'ERR_DIRECTION'.

split: open-access


prompt:
A shift that should be exactly 18 lb is reported as 19 lb.

Input [total lb, current CG, target CG, from-station arm, to-station arm]. Weight to move = W*dCG/dArm, rounded UP to a whole pound after clearing float noise at 6 decimals. Same station -> 'ERR_SAME_STATION'; zero dCG -> 0; a move that shifts CG the wrong way -> 'ERR_DIRECTION'.

split: open-access


prompt:
Asking to reach the CG the aircraft already has returns ERR_DIRECTION for aft station moves.

Input [total lb, current CG, target CG, from-station arm, to-station arm]. Weight to move = W*dCG/dArm, rounded UP to a whole pound after clearing float noise at 6 decimals. Same station -> 'ERR_SAME_STATION'; zero dCG -> 0; a move that shifts CG the wrong way -> 'ERR_DIRECTION'.

split: open-access


prompt:
An aft-CG aircraft is ballasted all the way to the forward limit, adding hundreds of unnecessary pounds.

Input [W lb, CG, fwd limit, aft limit, ballast arm, max weight]. Inside inclusive limits -> 0. Otherwise ballast B brings CG to the violated limit: B = W*(CG-limit)/(limit-arm), rounded up to whole lb; ballast arm not on the corrective side of that limit -> 'ERR_BALLAST_ARM'; W+B above max -> 'ERR_OVERWEIGHT'.

split: open-access


prompt:
The computed ballast leaves the CG slightly outside the limit.

Input [W lb, CG, fwd limit, aft limit, ballast arm, max weight]. Inside inclusive limits -> 0. Otherwise ballast B brings CG to the violated limit: B = W*(CG-limit)/(limit-arm), rounded up to whole lb; ballast arm not on the corrective side of that limit -> 'ERR_BALLAST_ARM'; W+B above max -> 'ERR_OVERWEIGHT'.

split: open-access


prompt:
A forward-CG aircraft with a nose ballast station gets a negative ballast weight instead of an error.

Input [W lb, CG, fwd limit, aft limit, ballast arm, max weight]. Inside inclusive limits -> 0. Otherwise ballast B brings CG to the violated limit: B = W*(CG-limit)/(limit-arm), rounded up to whole lb; ballast arm not on the corrective side of that limit -> 'ERR_BALLAST_ARM'; W+B above max -> 'ERR_OVERWEIGHT'.

split: open-access


prompt:
A CG exactly on the forward or aft limit produces a nonzero ballast or an error.

Input [W lb, CG, fwd limit, aft limit, ballast arm, max weight]. Inside inclusive limits -> 0. Otherwise ballast B brings CG to the violated limit: B = W*(CG-limit)/(limit-arm), rounded up to whole lb; ballast arm not on the corrective side of that limit -> 'ERR_BALLAST_ARM'; W+B above max -> 'ERR_OVERWEIGHT'.

split: open-access


prompt:
Ballast that pushes the aircraft over maximum weight is approved.

Input [W lb, CG, fwd limit, aft limit, ballast arm, max weight]. Inside inclusive limits -> 0. Otherwise ballast B brings CG to the violated limit: B = W*(CG-limit)/(limit-arm), rounded up to whole lb; ballast arm not on the corrective side of that limit -> 'ERR_BALLAST_ARM'; W+B above max -> 'ERR_OVERWEIGHT'.

split: open-access


prompt:
Winter loadsheets are lighter than summer ones for the same passenger count.

Input {'season','rows':[[arm, adults, children, lap infants]],'bags':[[arm,count]]}. Standard weights: adult 190/195, child 82/87 (summer/winter); lap infants weigh 0 (included with the adult); bags 28 lb. Rows are numbered from 1; more than 3 seated (adults+children) -> 'ERR_ROW_<n>_SEATS'; more infants than adults -> 'ERR_ROW_<n>_INFANTS'. Return [weight, moment r1].

split: open-access


prompt:
Rows with lap infants report extra weight that is already included in the adult standard.

Input {'season','rows':[[arm, adults, children, lap infants]],'bags':[[arm,count]]}. Standard weights: adult 190/195, child 82/87 (summer/winter); lap infants weigh 0 (included with the adult); bags 28 lb. Rows are numbered from 1; more than 3 seated (adults+children) -> 'ERR_ROW_<n>_SEATS'; more infants than adults -> 'ERR_ROW_<n>_INFANTS'. Return [weight, moment r1].

split: open-access


prompt:
A row with one adult, one child and two lap infants is accepted.

Input {'season','rows':[[arm, adults, children, lap infants]],'bags':[[arm,count]]}. Standard weights: adult 190/195, child 82/87 (summer/winter); lap infants weigh 0 (included with the adult); bags 28 lb. Rows are numbered from 1; more than 3 seated (adults+children) -> 'ERR_ROW_<n>_SEATS'; more infants than adults -> 'ERR_ROW_<n>_INFANTS'. Return [weight, moment r1].

split: open-access


prompt:
A full row of three adults each holding an infant is rejected for seat capacity.

Input {'season','rows':[[arm, adults, children, lap infants]],'bags':[[arm,count]]}. Standard weights: adult 190/195, child 82/87 (summer/winter); lap infants weigh 0 (included with the adult); bags 28 lb. Rows are numbered from 1; more than 3 seated (adults+children) -> 'ERR_ROW_<n>_SEATS'; more infants than adults -> 'ERR_ROW_<n>_INFANTS'. Return [weight, moment r1].

split: open-access


prompt:
Bag weight appears in the total but the hold barely moves the moment.

Input {'season','rows':[[arm, adults, children, lap infants]],'bags':[[arm,count]]}. Standard weights: adult 190/195, child 82/87 (summer/winter); lap infants weigh 0 (included with the adult); bags 28 lb. Rows are numbered from 1; more than 3 seated (adults+children) -> 'ERR_ROW_<n>_SEATS'; more infants than adults -> 'ERR_ROW_<n>_INFANTS'. Return [weight, moment r1].

split: open-access


prompt:
The cabin crew are told to fix row 0, or the row in front of the actual problem row.

Input {'season','rows':[[arm, adults, children, lap infants]],'bags':[[arm,count]]}. Standard weights: adult 190/195, child 82/87 (summer/winter); lap infants weigh 0 (included with the adult); bags 28 lb. Rows are numbered from 1; more than 3 seated (adults+children) -> 'ERR_ROW_<n>_SEATS'; more infants than adults -> 'ERR_ROW_<n>_INFANTS'. Return [weight, moment r1].

split: open-access


prompt:
Landing CG moves the wrong way as fuel is used and ends far aft.

Input {'tow','tocg','burn_gal','fuel_arm','density','mlw','env':[fwd,aft]}. Burned fuel weight = gallons*density removed at the fuel arm. Status 'MLW' if landing weight exceeds MLW (checked first), 'CG' if landing CG outside the inclusive envelope, else 'OK'. Return [LW r1, LCG r2, status].

split: open-access


prompt:
Landing weight is barely below takeoff weight and MLW exceedances are reported after long flights.

Input {'tow','tocg','burn_gal','fuel_arm','density','mlw','env':[fwd,aft]}. Burned fuel weight = gallons*density removed at the fuel arm. Status 'MLW' if landing weight exceeds MLW (checked first), 'CG' if landing CG outside the inclusive envelope, else 'OK'. Return [LW r1, LCG r2, status].

split: open-access


prompt:
Landing CG is systematically forward and grows worse with longer flights.

Input {'tow','tocg','burn_gal','fuel_arm','density','mlw','env':[fwd,aft]}. Burned fuel weight = gallons*density removed at the fuel arm. Status 'MLW' if landing weight exceeds MLW (checked first), 'CG' if landing CG outside the inclusive envelope, else 'OK'. Return [LW r1, LCG r2, status].

split: open-access


prompt:
A flight planned to land at exactly the maximum landing weight is reported MLW.

Input {'tow','tocg','burn_gal','fuel_arm','density','mlw','env':[fwd,aft]}. Burned fuel weight = gallons*density removed at the fuel arm. Status 'MLW' if landing weight exceeds MLW (checked first), 'CG' if landing CG outside the inclusive envelope, else 'OK'. Return [LW r1, LCG r2, status].

split: open-access


prompt:
A takeoff CG inside limits is reported OK even when the burn drives the landing CG out.

Input {'tow','tocg','burn_gal','fuel_arm','density','mlw','env':[fwd,aft]}. Burned fuel weight = gallons*density removed at the fuel arm. Status 'MLW' if landing weight exceeds MLW (checked first), 'CG' if landing CG outside the inclusive envelope, else 'OK'. Return [LW r1, LCG r2, status].

split: open-access


prompt:
Tanks whose quantity is not a multiple of the step size end with negative fuel and a skewed final CG.

Input {'zfw','zfm','tanks':[[name,arm,gal]],'order':[names],'step','density'}. Fuel burns in 'order', one step (or the tank remainder, no carry) at a time; a tank listed again after being emptied burns nothing; unlisted tanks are unusable but their fuel stays on board. CG is sampled at start and after each step. Return [start CG, min CG, max CG, final CG] rounded 2.

split: open-access


prompt:
When the most aft CG occurs at takeoff, the reported maximum is the first in-flight sample instead.

Input {'zfw','zfm','tanks':[[name,arm,gal]],'order':[names],'step','density'}. Fuel burns in 'order', one step (or the tank remainder, no carry) at a time; a tank listed again after being emptied burns nothing; unlisted tanks are unusable but their fuel stays on board. CG is sampled at start and after each step. Return [start CG, min CG, max CG, final CG] rounded 2.

split: open-access


prompt:
A full tip tank that is not in the burn order disappears from the CG trajectory.

Input {'zfw','zfm','tanks':[[name,arm,gal]],'order':[names],'step','density'}. Fuel burns in 'order', one step (or the tank remainder, no carry) at a time; a tank listed again after being emptied burns nothing; unlisted tanks are unusable but their fuel stays on board. CG is sampled at start and after each step. Return [start CG, min CG, max CG, final CG] rounded 2.

split: open-access


prompt:
The CG drifts steadily in one direction during burn regardless of tank location.

Input {'zfw','zfm','tanks':[[name,arm,gal]],'order':[names],'step','density'}. Fuel burns in 'order', one step (or the tank remainder, no carry) at a time; a tank listed again after being emptied burns nothing; unlisted tanks are unusable but their fuel stays on board. CG is sampled at start and after each step. Return [start CG, min CG, max CG, final CG] rounded 2.

split: open-access


prompt:
Listing a tank again after it was emptied burns its original quantity a second time.

Input {'zfw','zfm','tanks':[[name,arm,gal]],'order':[names],'step','density'}. Fuel burns in 'order', one step (or the tank remainder, no carry) at a time; a tank listed again after being emptied burns nothing; unlisted tanks are unusable but their fuel stays on board. CG is sampled at start and after each step. Return [start CG, min CG, max CG, final CG] rounded 2.

split: open-access


prompt:
Items documented in millimetres land ten times further aft than their real station.

Input [[quantity, 'kg'|'lb', arm, 'in'|'cm'|'mm']]. Convert to lb (1 kg = 2.20462 lb) and inches (2.54 cm, 25.4 mm per inch); other units -> 'ERR_UNIT'; total weight <= 0 -> 'ERR_WEIGHT'. Return [weight lb r1, reduced moment (lb-in/1000) r2, CG in r2 computed from the unreduced moment].

split: open-access


prompt:
Metric-documented items weigh less than half their real value in pounds.

Input [[quantity, 'kg'|'lb', arm, 'in'|'cm'|'mm']]. Convert to lb (1 kg = 2.20462 lb) and inches (2.54 cm, 25.4 mm per inch); other units -> 'ERR_UNIT'; total weight <= 0 -> 'ERR_WEIGHT'. Return [weight lb r1, reduced moment (lb-in/1000) r2, CG in r2 computed from the unreduced moment].

split: open-access


prompt:
The reduced moment read off the loading graph is ten times too large.

Input [[quantity, 'kg'|'lb', arm, 'in'|'cm'|'mm']]. Convert to lb (1 kg = 2.20462 lb) and inches (2.54 cm, 25.4 mm per inch); other units -> 'ERR_UNIT'; total weight <= 0 -> 'ERR_WEIGHT'. Return [weight lb r1, reduced moment (lb-in/1000) r2, CG in r2 computed from the unreduced moment].

split: open-access


prompt:
The loaded CG is reported near zero inches.

Input [[quantity, 'kg'|'lb', arm, 'in'|'cm'|'mm']]. Convert to lb (1 kg = 2.20462 lb) and inches (2.54 cm, 25.4 mm per inch); other units -> 'ERR_UNIT'; total weight <= 0 -> 'ERR_WEIGHT'. Return [weight lb r1, reduced moment (lb-in/1000) r2, CG in r2 computed from the unreduced moment].

split: open-access


prompt:
A stone or metre entry is added at face value instead of being rejected.

Input [[quantity, 'kg'|'lb', arm, 'in'|'cm'|'mm']]. Convert to lb (1 kg = 2.20462 lb) and inches (2.54 cm, 25.4 mm per inch); other units -> 'ERR_UNIT'; total weight <= 0 -> 'ERR_WEIGHT'. Return [weight lb r1, reduced moment (lb-in/1000) r2, CG in r2 computed from the unreduced moment].

split: open-access


prompt:
A heavy engine on a small skid passes the floor-loading check.

Input {'compartments':{name:[max lb, area sqft, max lb/sqft]},'pieces':[[compartment, lb, footprint sqft]]}. Per piece in order: unknown compartment -> 'UNKNOWN:i'; footprint <= 0 -> 'FOOTPRINT:i'; both exclude the piece from totals. Piece weight/footprint above the floor limit -> 'PSF:c:i' (piece still loaded). Then per compartment in sorted order, total above max -> 'OVER:c'. i is the zero-based index in the whole piece list.

split: open-access


prompt:
Filling the bulk hold to exactly 800 lb raises an OVER finding.

Input {'compartments':{name:[max lb, area sqft, max lb/sqft]},'pieces':[[compartment, lb, footprint sqft]]}. Per piece in order: unknown compartment -> 'UNKNOWN:i'; footprint <= 0 -> 'FOOTPRINT:i'; both exclude the piece from totals. Piece weight/footprint above the floor limit -> 'PSF:c:i' (piece still loaded). Then per compartment in sorted order, total above max -> 'OVER:c'. i is the zero-based index in the whole piece list.

split: open-access


prompt:
Later pieces in a compartment are flagged for floor pressure caused by earlier pieces.

Input {'compartments':{name:[max lb, area sqft, max lb/sqft]},'pieces':[[compartment, lb, footprint sqft]]}. Per piece in order: unknown compartment -> 'UNKNOWN:i'; footprint <= 0 -> 'FOOTPRINT:i'; both exclude the piece from totals. Piece weight/footprint above the floor limit -> 'PSF:c:i' (piece still loaded). Then per compartment in sorted order, total above max -> 'OVER:c'. i is the zero-based index in the whole piece list.

split: open-access


prompt:
Load controllers are pointed at the wrong manifest line for over-pressure pieces.

Input {'compartments':{name:[max lb, area sqft, max lb/sqft]},'pieces':[[compartment, lb, footprint sqft]]}. Per piece in order: unknown compartment -> 'UNKNOWN:i'; footprint <= 0 -> 'FOOTPRINT:i'; both exclude the piece from totals. Piece weight/footprint above the floor limit -> 'PSF:c:i' (piece still loaded). Then per compartment in sorted order, total above max -> 'OVER:c'. i is the zero-based index in the whole piece list.

split: open-access


prompt:
A rejected zero-footprint piece still pushes its compartment into OVER.

Input {'compartments':{name:[max lb, area sqft, max lb/sqft]},'pieces':[[compartment, lb, footprint sqft]]}. Per piece in order: unknown compartment -> 'UNKNOWN:i'; footprint <= 0 -> 'FOOTPRINT:i'; both exclude the piece from totals. Piece weight/footprint above the floor limit -> 'PSF:c:i' (piece still loaded). Then per compartment in sorted order, total above max -> 'OVER:c'. i is the zero-based index in the whole piece list.

split: open-access


prompt:
Values between nodes are mirrored: a CG just aft of a node gets nearly the next node trim.

Input {'pmac','flaps','tables':{flap string:[[%MAC, trim units] ascending]}}. Missing flap table -> 'ERR_FLAPS'; %MAC outside the table's inclusive range -> 'ERR_RANGE' (no extrapolation or clamping); otherwise linear interpolation between bracketing nodes, rounded to 0.1 unit.

split: open-access


prompt:
A CG exactly at the forward or aft table limit returns ERR_RANGE.

Input {'pmac','flaps','tables':{flap string:[[%MAC, trim units] ascending]}}. Missing flap table -> 'ERR_FLAPS'; %MAC outside the table's inclusive range -> 'ERR_RANGE' (no extrapolation or clamping); otherwise linear interpolation between bracketing nodes, rounded to 0.1 unit.

split: open-access


prompt:
A CG beyond the certified trim table produces a plausible-looking trim setting.

Input {'pmac','flaps','tables':{flap string:[[%MAC, trim units] ascending]}}. Missing flap table -> 'ERR_FLAPS'; %MAC outside the table's inclusive range -> 'ERR_RANGE' (no extrapolation or clamping); otherwise linear interpolation between bracketing nodes, rounded to 0.1 unit.

split: open-access


prompt:
Trim jumps in steps and differs by up to half a percent of MAC worth of trim.

Input {'pmac','flaps','tables':{flap string:[[%MAC, trim units] ascending]}}. Missing flap table -> 'ERR_FLAPS'; %MAC outside the table's inclusive range -> 'ERR_RANGE' (no extrapolation or clamping); otherwise linear interpolation between bracketing nodes, rounded to 0.1 unit.

split: open-access


prompt:
Flaps 10 returns a trim from the flaps 15 table instead of an error.

Input {'pmac','flaps','tables':{flap string:[[%MAC, trim units] ascending]}}. Missing flap table -> 'ERR_FLAPS'; %MAC outside the table's inclusive range -> 'ERR_RANGE' (no extrapolation or clamping); otherwise linear interpolation between bracketing nodes, rounded to 0.1 unit.

split: open-access


prompt:
Symmetric left and right loads produce a large lateral CG offset.

Input {'items':[[lb, longitudinal arm, lateral arm]] (first item basic empty weight; lateral right positive),'long_env':[fwd,aft],'lat_limit':L}. Longitudinal CG must be within inclusive limits; |lateral CG| <= L. Status 'BOTH','LONG','LAT' or 'OK'. Return [long CG r2, signed lateral CG r2, status].

split: open-access


prompt:
A heavy left-side hoist load is reported within limits.

Input {'items':[[lb, longitudinal arm, lateral arm]] (first item basic empty weight; lateral right positive),'long_env':[fwd,aft],'lat_limit':L}. Longitudinal CG must be within inclusive limits; |lateral CG| <= L. Status 'BOTH','LONG','LAT' or 'OK'. Return [long CG r2, signed lateral CG r2, status].

split: open-access


prompt:
The crew fixes the longitudinal problem and departs with the lateral CG still out of limits.

Input {'items':[[lb, longitudinal arm, lateral arm]] (first item basic empty weight; lateral right positive),'long_env':[fwd,aft],'lat_limit':L}. Longitudinal CG must be within inclusive limits; |lateral CG| <= L. Status 'BOTH','LONG','LAT' or 'OK'. Return [long CG r2, signed lateral CG r2, status].

split: open-access


prompt:
A load that places the lateral CG exactly at the limit is reported LAT.

Input {'items':[[lb, longitudinal arm, lateral arm]] (first item basic empty weight; lateral right positive),'long_env':[fwd,aft],'lat_limit':L}. Longitudinal CG must be within inclusive limits; |lateral CG| <= L. Status 'BOTH','LONG','LAT' or 'OK'. Return [long CG r2, signed lateral CG r2, status].

split: open-access


prompt:
One passenger in a side seat produces a lateral CG equal to the seat arm.

Input {'items':[[lb, longitudinal arm, lateral arm]] (first item basic empty weight; lateral right positive),'long_env':[fwd,aft],'lat_limit':L}. Longitudinal CG must be within inclusive limits; |lateral CG| <= L. Status 'BOTH','LONG','LAT' or 'OK'. Return [long CG r2, signed lateral CG r2, status].

split: open-access