FAILURE MAP
← Case archive

FA-63586 / Actuarial life tables / Open access

Mortality improvement projection: Improvement is applied linearly · case 01

Long projections over-improve mortality.

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

ROOT CAUSE

The factor uses 1-AA*t instead of (1-AA)^t.

VERIFIED REPAIR

Compound the annual improvement.

Unsuccessful approach: (1+AA)^(-t) is a different compounding convention.

Case contract

Input q {age: per 100000 at base_year}, aa {age: annual improvement per 10000}, age, year, n, mode static|generational. For k<n: attained age age+k, projection year = year+k (generational) or year (static); q = min(1, q_base*(1-AA)^(year-base)) with negative exponents de-improving. Missing age -> 'missing age <a>'. Return rates rounded to 8.

Why this case matters

Life-table arithmetic compounds across ages, so one misplaced index or assumption shifts every downstream value.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(x):
    out=[]
    for k in range(x['n']):
        age=x['age']+k
        yr=x['year']+k if x['mode']=='generational' else x['year']
        key=str(age)
        if key not in x['q'] or key not in x['aa']: return 'missing age '+key
        f=1-Fraction(x['aa'][key],10000)*(yr-x['base_year'])
        q=min(Fraction(1),Fraction(x['q'][key],100000)*f)
        out.append(round(float(q),8))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['generational projection', {'q': {'60': 501, '61': 591, '62': 681, '63': 771, '64': 861, '65': 951, '66': 1041, '67': 1131, '68': 1221, '69': 1311, '70': 1401, '71': 1491, '72': 1581, '73': 1671, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, [0.00464535, 0.00541411, 0.00617001, 0.00691562, 0.00765345]], ['static projection', {'q': {'60': 501, '61': 591, '62': 681, '63': 771, '64': 861, '65': 951, '66': 1041, '67': 1131, '68': 1221, '69': 1311, '70': 1401, '71': 1491, '72': 1581, '73': 1671, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 61, 'year': 2030, 'n': 4, 'mode': 'static', 'base_year': 2020}, [0.00510686, 0.00591448, 0.00673016, 0.00755396]], ['before base year', {'q': {'60': 501, '61': 591, '62': 681, '63': 771, '64': 861, '65': 951, '66': 1041, '67': 1131, '68': 1221, '69': 1311, '70': 1401, '71': 1491, '72': 1581, '73': 1671, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 63, 'year': 2014, 'n': 3, 'mode': 'generational', 'base_year': 2020}, [0.00836511, 0.00919216, 0.01000074]], ['de-improvement near one', {'q': {'60': 501, '61': 591, '62': 681, '63': 771, '64': 861, '65': 951, '66': 1041, '67': 1131, '68': 1221, '69': 1311, '70': 1401, '71': 1491, '72': 1581, '73': 1671, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 73, 'year': 2000, 'n': 2, 'mode': 'static', 'base_year': 2020}, [0.01982084, 1.0]], ['base year exactly', {'q': {'60': 501, '61': 591, '62': 681, '63': 771, '64': 861, '65': 951, '66': 1041, '67': 1131, '68': 1221, '69': 1311, '70': 1401, '71': 1491, '72': 1581, '73': 1671, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2020, 'n': 3, 'mode': 'static', 'base_year': 2020}, [0.00681, 0.00771, 0.00861]], ['missing age', {'q': {'60': 501, '61': 591, '62': 681, '63': 771, '64': 861, '65': 951, '66': 1041, '67': 1131, '68': 1221, '69': 1311, '70': 1401, '71': 1491, '72': 1581, '73': 1671, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 72, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, 'missing age 75'], ['long generational', {'q': {'60': 501, '61': 591, '62': 681, '63': 771, '64': 861, '65': 951, '66': 1041, '67': 1131, '68': 1221, '69': 1311, '70': 1401, '71': 1491, '72': 1581, '73': 1671, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2021, 'n': 8, 'mode': 'generational', 'base_year': 2020}, [0.00493485, 0.00573985, 0.00652797, 0.00730202, 0.00806471, 0.00881867, 0.00956642, 0.01031041]]], [['generational projection', {'q': {'60': 502, '61': 592, '62': 682, '63': 772, '64': 862, '65': 952, '66': 1042, '67': 1132, '68': 1222, '69': 1312, '70': 1402, '71': 1492, '72': 1582, '73': 1672, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, [0.00635578, 0.00711541, 0.00786552, 0.00860862, 0.00934717]], ['static projection', {'q': {'60': 502, '61': 592, '62': 682, '63': 772, '64': 862, '65': 952, '66': 1042, '67': 1132, '68': 1222, '69': 1312, '70': 1402, '71': 1492, '72': 1582, '73': 1672, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2030, 'n': 4, 'mode': 'static', 'base_year': 2020}, [0.00431585, 0.0051155, 0.00592316, 0.00673889]], ['before base year', {'q': {'60': 502, '61': 592, '62': 682, '63': 772, '64': 862, '65': 952, '66': 1042, '67': 1132, '68': 1222, '69': 1312, '70': 1402, '71': 1492, '72': 1582, '73': 1672, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 61, 'year': 2014, 'n': 3, 'mode': 'generational', 'base_year': 2020}, [0.00646222, 0.00731812, 0.00815134]], ['de-improvement near one', {'q': {'60': 502, '61': 592, '62': 682, '63': 772, '64': 862, '65': 952, '66': 1042, '67': 1132, '68': 1222, '69': 1312, '70': 1402, '71': 1492, '72': 1582, '73': 1672, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 73, 'year': 2000, 'n': 2, 'mode': 'static', 'base_year': 2020}, [0.0198327, 1.0]], ['base year exactly', {'q': {'60': 502, '61': 592, '62': 682, '63': 772, '64': 862, '65': 952, '66': 1042, '67': 1132, '68': 1222, '69': 1312, '70': 1402, '71': 1492, '72': 1582, '73': 1672, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2020, 'n': 3, 'mode': 'static', 'base_year': 2020}, [0.00682, 0.00772, 0.00862]], ['missing age', {'q': {'60': 502, '61': 592, '62': 682, '63': 772, '64': 862, '65': 952, '66': 1042, '67': 1132, '68': 1222, '69': 1312, '70': 1402, '71': 1492, '72': 1582, '73': 1672, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 72, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, 'missing age 75'], ['long generational', {'q': {'60': 502, '61': 592, '62': 682, '63': 772, '64': 862, '65': 952, '66': 1042, '67': 1132, '68': 1222, '69': 1312, '70': 1402, '71': 1492, '72': 1582, '73': 1672, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2021, 'n': 8, 'mode': 'generational', 'base_year': 2020}, [0.0049447, 0.00574956, 0.00653755, 0.00731149, 0.00807408, 0.00882794, 0.00957561, 0.01031953]]], [['generational projection', {'q': {'60': 503, '61': 593, '62': 683, '63': 773, '64': 863, '65': 953, '66': 1043, '67': 1133, '68': 1223, '69': 1313, '70': 1403, '71': 1493, '72': 1583, '73': 1673, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, [0.0063651, 0.00712463, 0.00787464, 0.00861767, 0.00935614]], ['static projection', {'q': {'60': 503, '61': 593, '62': 683, '63': 773, '64': 863, '65': 953, '66': 1043, '67': 1133, '68': 1223, '69': 1313, '70': 1403, '71': 1493, '72': 1583, '73': 1673, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 63, 'year': 2030, 'n': 4, 'mode': 'static', 'base_year': 2020}, [0.00674762, 0.00757151, 0.00840357, 0.00924387]], ['before base year', {'q': {'60': 503, '61': 593, '62': 683, '63': 773, '64': 863, '65': 953, '66': 1043, '67': 1133, '68': 1223, '69': 1313, '70': 1403, '71': 1493, '72': 1583, '73': 1673, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 61, 'year': 2014, 'n': 3, 'mode': 'generational', 'base_year': 2020}, [0.00647314, 0.00732885, 0.0081619]], ['de-improvement near one', {'q': {'60': 503, '61': 593, '62': 683, '63': 773, '64': 863, '65': 953, '66': 1043, '67': 1133, '68': 1223, '69': 1313, '70': 1403, '71': 1493, '72': 1583, '73': 1673, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 73, 'year': 2000, 'n': 2, 'mode': 'static', 'base_year': 2020}, [0.01984456, 1.0]], ['base year exactly', {'q': {'60': 503, '61': 593, '62': 683, '63': 773, '64': 863, '65': 953, '66': 1043, '67': 1133, '68': 1223, '69': 1313, '70': 1403, '71': 1493, '72': 1583, '73': 1673, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2020, 'n': 3, 'mode': 'static', 'base_year': 2020}, [0.00683, 0.00773, 0.00863]], ['missing age', {'q': {'60': 503, '61': 593, '62': 683, '63': 773, '64': 863, '65': 953, '66': 1043, '67': 1133, '68': 1223, '69': 1313, '70': 1403, '71': 1493, '72': 1583, '73': 1673, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 72, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, 'missing age 75'], ['long generational', {'q': {'60': 503, '61': 593, '62': 683, '63': 773, '64': 863, '65': 953, '66': 1043, '67': 1133, '68': 1223, '69': 1313, '70': 1403, '71': 1493, '72': 1583, '73': 1673, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2021, 'n': 8, 'mode': 'generational', 'base_year': 2020}, [0.00495455, 0.00575928, 0.00654714, 0.00732096, 0.00808345, 0.00883722, 0.0095848, 0.01032864]]], [['generational projection', {'q': {'60': 504, '61': 594, '62': 684, '63': 774, '64': 864, '65': 954, '66': 1044, '67': 1134, '68': 1224, '69': 1314, '70': 1404, '71': 1494, '72': 1584, '73': 1674, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 63, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, [0.00723147, 0.00798761, 0.00873591, 0.00947886, 0.01021888]], ['static projection', {'q': {'60': 504, '61': 594, '62': 684, '63': 774, '64': 864, '65': 954, '66': 1044, '67': 1134, '68': 1224, '69': 1314, '70': 1404, '71': 1494, '72': 1584, '73': 1674, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2030, 'n': 4, 'mode': 'static', 'base_year': 2020}, [0.00594053, 0.00675635, 0.00758028, 0.00841239]], ['before base year', {'q': {'60': 504, '61': 594, '62': 684, '63': 774, '64': 864, '65': 954, '66': 1044, '67': 1134, '68': 1224, '69': 1314, '70': 1404, '71': 1494, '72': 1584, '73': 1674, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 64, 'year': 2014, 'n': 3, 'mode': 'generational', 'base_year': 2020}, [0.00934568, 0.01015928, 0.01095652]], ['de-improvement near one', {'q': {'60': 504, '61': 594, '62': 684, '63': 774, '64': 864, '65': 954, '66': 1044, '67': 1134, '68': 1224, '69': 1314, '70': 1404, '71': 1494, '72': 1584, '73': 1674, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 73, 'year': 2000, 'n': 2, 'mode': 'static', 'base_year': 2020}, [0.01985643, 1.0]], ['base year exactly', {'q': {'60': 504, '61': 594, '62': 684, '63': 774, '64': 864, '65': 954, '66': 1044, '67': 1134, '68': 1224, '69': 1314, '70': 1404, '71': 1494, '72': 1584, '73': 1674, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2020, 'n': 3, 'mode': 'static', 'base_year': 2020}, [0.00684, 0.00774, 0.00864]], ['missing age', {'q': {'60': 504, '61': 594, '62': 684, '63': 774, '64': 864, '65': 954, '66': 1044, '67': 1134, '68': 1224, '69': 1314, '70': 1404, '71': 1494, '72': 1584, '73': 1674, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 72, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, 'missing age 75'], ['long generational', {'q': {'60': 504, '61': 594, '62': 684, '63': 774, '64': 864, '65': 954, '66': 1044, '67': 1134, '68': 1224, '69': 1314, '70': 1404, '71': 1494, '72': 1584, '73': 1674, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2021, 'n': 8, 'mode': 'generational', 'base_year': 2020}, [0.0049644, 0.00576899, 0.00655672, 0.00733043, 0.00809281, 0.00884649, 0.00959399, 0.01033776]]], [['generational projection', {'q': {'60': 505, '61': 595, '62': 685, '63': 775, '64': 865, '65': 955, '66': 1045, '67': 1135, '68': 1225, '69': 1315, '70': 1405, '71': 1495, '72': 1585, '73': 1675, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, [0.00638374, 0.00714306, 0.00789289, 0.00863575, 0.00937408]], ['static projection', {'q': {'60': 505, '61': 595, '62': 685, '63': 775, '64': 865, '65': 955, '66': 1045, '67': 1135, '68': 1225, '69': 1315, '70': 1405, '71': 1495, '72': 1585, '73': 1675, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2030, 'n': 4, 'mode': 'static', 'base_year': 2020}, [0.00434164, 0.00514142, 0.00594922, 0.00676507]], ['before base year', {'q': {'60': 505, '61': 595, '62': 685, '63': 775, '64': 865, '65': 955, '66': 1045, '67': 1135, '68': 1225, '69': 1315, '70': 1405, '71': 1495, '72': 1585, '73': 1675, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2014, 'n': 3, 'mode': 'generational', 'base_year': 2020}, [0.00552935, 0.00640079, 0.00724741]], ['de-improvement near one', {'q': {'60': 505, '61': 595, '62': 685, '63': 775, '64': 865, '65': 955, '66': 1045, '67': 1135, '68': 1225, '69': 1315, '70': 1405, '71': 1495, '72': 1585, '73': 1675, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 73, 'year': 2000, 'n': 2, 'mode': 'static', 'base_year': 2020}, [0.01986829, 1.0]], ['base year exactly', {'q': {'60': 505, '61': 595, '62': 685, '63': 775, '64': 865, '65': 955, '66': 1045, '67': 1135, '68': 1225, '69': 1315, '70': 1405, '71': 1495, '72': 1585, '73': 1675, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2020, 'n': 3, 'mode': 'static', 'base_year': 2020}, [0.00685, 0.00775, 0.00865]], ['missing age', {'q': {'60': 505, '61': 595, '62': 685, '63': 775, '64': 865, '65': 955, '66': 1045, '67': 1135, '68': 1225, '69': 1315, '70': 1405, '71': 1495, '72': 1585, '73': 1675, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 72, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, 'missing age 75'], ['long generational', {'q': {'60': 505, '61': 595, '62': 685, '63': 775, '64': 865, '65': 955, '66': 1045, '67': 1135, '68': 1225, '69': 1315, '70': 1405, '71': 1495, '72': 1585, '73': 1675, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2021, 'n': 8, 'mode': 'generational', 'base_year': 2020}, [0.00497425, 0.0057787, 0.00656631, 0.0073399, 0.00810218, 0.00885576, 0.00960318, 0.01034688]]]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
generational projection[0.00463425, 0.00539583, 0.00614262, 0.00687732, 0.00760263][0.00464535, 0.00541411, 0.00617001, 0.00691562, 0.00765345]Failed
static projection[0.00505305, 0.0058566, 0.00666915, 0.0074907][0.00510686, 0.00591448, 0.00673016, 0.00755396]Failed
before base year[0.00833451, 0.00916965, 0.0099855][0.00836511, 0.00919216, 0.01000074]Failed
de-improvement near one[0.0195507, 1.0][0.01982084, 1.0]Failed
base year exactly[0.00681, 0.00771, 0.00861][0.00681, 0.00771, 0.00861]Passed
missing agemissing age 75missing age 75Passed
long generational[0.00493485, 0.00573861, 0.00652398, 0.00729366, 0.00805035, 0.00879675, 0.00953556, 0.01026948][0.00493485, 0.00573985, 0.00652797, 0.00730202, 0.00806471, 0.00881867, 0.00956642, 0.01031041]Failed

SHA-256 / 360f14a47939dffee3c15b49c566a4547f557b0b7d70f36efeae781c928c7ae5

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(x):
    out=[]
    for k in range(x['n']):
        age=x['age']+k
        yr=x['year']+k if x['mode']=='generational' else x['year']
        key=str(age)
        if key not in x['q'] or key not in x['aa']: return 'missing age '+key
        f=(1+Fraction(x['aa'][key],10000))**(x['base_year']-yr)
        q=min(Fraction(1),Fraction(x['q'][key],100000)*f)
        out.append(round(float(q),8))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['generational projection', {'q': {'60': 501, '61': 591, '62': 681, '63': 771, '64': 861, '65': 951, '66': 1041, '67': 1131, '68': 1221, '69': 1311, '70': 1401, '71': 1491, '72': 1581, '73': 1671, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, [0.00464535, 0.00541411, 0.00617001, 0.00691562, 0.00765345]], ['static projection', {'q': {'60': 501, '61': 591, '62': 681, '63': 771, '64': 861, '65': 951, '66': 1041, '67': 1131, '68': 1221, '69': 1311, '70': 1401, '71': 1491, '72': 1581, '73': 1671, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 61, 'year': 2030, 'n': 4, 'mode': 'static', 'base_year': 2020}, [0.00510686, 0.00591448, 0.00673016, 0.00755396]], ['before base year', {'q': {'60': 501, '61': 591, '62': 681, '63': 771, '64': 861, '65': 951, '66': 1041, '67': 1131, '68': 1221, '69': 1311, '70': 1401, '71': 1491, '72': 1581, '73': 1671, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 63, 'year': 2014, 'n': 3, 'mode': 'generational', 'base_year': 2020}, [0.00836511, 0.00919216, 0.01000074]], ['de-improvement near one', {'q': {'60': 501, '61': 591, '62': 681, '63': 771, '64': 861, '65': 951, '66': 1041, '67': 1131, '68': 1221, '69': 1311, '70': 1401, '71': 1491, '72': 1581, '73': 1671, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 73, 'year': 2000, 'n': 2, 'mode': 'static', 'base_year': 2020}, [0.01982084, 1.0]], ['base year exactly', {'q': {'60': 501, '61': 591, '62': 681, '63': 771, '64': 861, '65': 951, '66': 1041, '67': 1131, '68': 1221, '69': 1311, '70': 1401, '71': 1491, '72': 1581, '73': 1671, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2020, 'n': 3, 'mode': 'static', 'base_year': 2020}, [0.00681, 0.00771, 0.00861]], ['missing age', {'q': {'60': 501, '61': 591, '62': 681, '63': 771, '64': 861, '65': 951, '66': 1041, '67': 1131, '68': 1221, '69': 1311, '70': 1401, '71': 1491, '72': 1581, '73': 1671, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 72, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, 'missing age 75'], ['long generational', {'q': {'60': 501, '61': 591, '62': 681, '63': 771, '64': 861, '65': 951, '66': 1041, '67': 1131, '68': 1221, '69': 1311, '70': 1401, '71': 1491, '72': 1581, '73': 1671, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2021, 'n': 8, 'mode': 'generational', 'base_year': 2020}, [0.00493485, 0.00573985, 0.00652797, 0.00730202, 0.00806471, 0.00881867, 0.00956642, 0.01031041]]], [['generational projection', {'q': {'60': 502, '61': 592, '62': 682, '63': 772, '64': 862, '65': 952, '66': 1042, '67': 1132, '68': 1222, '69': 1312, '70': 1402, '71': 1492, '72': 1582, '73': 1672, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, [0.00635578, 0.00711541, 0.00786552, 0.00860862, 0.00934717]], ['static projection', {'q': {'60': 502, '61': 592, '62': 682, '63': 772, '64': 862, '65': 952, '66': 1042, '67': 1132, '68': 1222, '69': 1312, '70': 1402, '71': 1492, '72': 1582, '73': 1672, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2030, 'n': 4, 'mode': 'static', 'base_year': 2020}, [0.00431585, 0.0051155, 0.00592316, 0.00673889]], ['before base year', {'q': {'60': 502, '61': 592, '62': 682, '63': 772, '64': 862, '65': 952, '66': 1042, '67': 1132, '68': 1222, '69': 1312, '70': 1402, '71': 1492, '72': 1582, '73': 1672, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 61, 'year': 2014, 'n': 3, 'mode': 'generational', 'base_year': 2020}, [0.00646222, 0.00731812, 0.00815134]], ['de-improvement near one', {'q': {'60': 502, '61': 592, '62': 682, '63': 772, '64': 862, '65': 952, '66': 1042, '67': 1132, '68': 1222, '69': 1312, '70': 1402, '71': 1492, '72': 1582, '73': 1672, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 73, 'year': 2000, 'n': 2, 'mode': 'static', 'base_year': 2020}, [0.0198327, 1.0]], ['base year exactly', {'q': {'60': 502, '61': 592, '62': 682, '63': 772, '64': 862, '65': 952, '66': 1042, '67': 1132, '68': 1222, '69': 1312, '70': 1402, '71': 1492, '72': 1582, '73': 1672, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2020, 'n': 3, 'mode': 'static', 'base_year': 2020}, [0.00682, 0.00772, 0.00862]], ['missing age', {'q': {'60': 502, '61': 592, '62': 682, '63': 772, '64': 862, '65': 952, '66': 1042, '67': 1132, '68': 1222, '69': 1312, '70': 1402, '71': 1492, '72': 1582, '73': 1672, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 72, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, 'missing age 75'], ['long generational', {'q': {'60': 502, '61': 592, '62': 682, '63': 772, '64': 862, '65': 952, '66': 1042, '67': 1132, '68': 1222, '69': 1312, '70': 1402, '71': 1492, '72': 1582, '73': 1672, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2021, 'n': 8, 'mode': 'generational', 'base_year': 2020}, [0.0049447, 0.00574956, 0.00653755, 0.00731149, 0.00807408, 0.00882794, 0.00957561, 0.01031953]]], [['generational projection', {'q': {'60': 503, '61': 593, '62': 683, '63': 773, '64': 863, '65': 953, '66': 1043, '67': 1133, '68': 1223, '69': 1313, '70': 1403, '71': 1493, '72': 1583, '73': 1673, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, [0.0063651, 0.00712463, 0.00787464, 0.00861767, 0.00935614]], ['static projection', {'q': {'60': 503, '61': 593, '62': 683, '63': 773, '64': 863, '65': 953, '66': 1043, '67': 1133, '68': 1223, '69': 1313, '70': 1403, '71': 1493, '72': 1583, '73': 1673, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 63, 'year': 2030, 'n': 4, 'mode': 'static', 'base_year': 2020}, [0.00674762, 0.00757151, 0.00840357, 0.00924387]], ['before base year', {'q': {'60': 503, '61': 593, '62': 683, '63': 773, '64': 863, '65': 953, '66': 1043, '67': 1133, '68': 1223, '69': 1313, '70': 1403, '71': 1493, '72': 1583, '73': 1673, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 61, 'year': 2014, 'n': 3, 'mode': 'generational', 'base_year': 2020}, [0.00647314, 0.00732885, 0.0081619]], ['de-improvement near one', {'q': {'60': 503, '61': 593, '62': 683, '63': 773, '64': 863, '65': 953, '66': 1043, '67': 1133, '68': 1223, '69': 1313, '70': 1403, '71': 1493, '72': 1583, '73': 1673, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 73, 'year': 2000, 'n': 2, 'mode': 'static', 'base_year': 2020}, [0.01984456, 1.0]], ['base year exactly', {'q': {'60': 503, '61': 593, '62': 683, '63': 773, '64': 863, '65': 953, '66': 1043, '67': 1133, '68': 1223, '69': 1313, '70': 1403, '71': 1493, '72': 1583, '73': 1673, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2020, 'n': 3, 'mode': 'static', 'base_year': 2020}, [0.00683, 0.00773, 0.00863]], ['missing age', {'q': {'60': 503, '61': 593, '62': 683, '63': 773, '64': 863, '65': 953, '66': 1043, '67': 1133, '68': 1223, '69': 1313, '70': 1403, '71': 1493, '72': 1583, '73': 1673, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 72, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, 'missing age 75'], ['long generational', {'q': {'60': 503, '61': 593, '62': 683, '63': 773, '64': 863, '65': 953, '66': 1043, '67': 1133, '68': 1223, '69': 1313, '70': 1403, '71': 1493, '72': 1583, '73': 1673, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2021, 'n': 8, 'mode': 'generational', 'base_year': 2020}, [0.00495455, 0.00575928, 0.00654714, 0.00732096, 0.00808345, 0.00883722, 0.0095848, 0.01032864]]], [['generational projection', {'q': {'60': 504, '61': 594, '62': 684, '63': 774, '64': 864, '65': 954, '66': 1044, '67': 1134, '68': 1224, '69': 1314, '70': 1404, '71': 1494, '72': 1584, '73': 1674, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 63, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, [0.00723147, 0.00798761, 0.00873591, 0.00947886, 0.01021888]], ['static projection', {'q': {'60': 504, '61': 594, '62': 684, '63': 774, '64': 864, '65': 954, '66': 1044, '67': 1134, '68': 1224, '69': 1314, '70': 1404, '71': 1494, '72': 1584, '73': 1674, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2030, 'n': 4, 'mode': 'static', 'base_year': 2020}, [0.00594053, 0.00675635, 0.00758028, 0.00841239]], ['before base year', {'q': {'60': 504, '61': 594, '62': 684, '63': 774, '64': 864, '65': 954, '66': 1044, '67': 1134, '68': 1224, '69': 1314, '70': 1404, '71': 1494, '72': 1584, '73': 1674, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 64, 'year': 2014, 'n': 3, 'mode': 'generational', 'base_year': 2020}, [0.00934568, 0.01015928, 0.01095652]], ['de-improvement near one', {'q': {'60': 504, '61': 594, '62': 684, '63': 774, '64': 864, '65': 954, '66': 1044, '67': 1134, '68': 1224, '69': 1314, '70': 1404, '71': 1494, '72': 1584, '73': 1674, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 73, 'year': 2000, 'n': 2, 'mode': 'static', 'base_year': 2020}, [0.01985643, 1.0]], ['base year exactly', {'q': {'60': 504, '61': 594, '62': 684, '63': 774, '64': 864, '65': 954, '66': 1044, '67': 1134, '68': 1224, '69': 1314, '70': 1404, '71': 1494, '72': 1584, '73': 1674, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2020, 'n': 3, 'mode': 'static', 'base_year': 2020}, [0.00684, 0.00774, 0.00864]], ['missing age', {'q': {'60': 504, '61': 594, '62': 684, '63': 774, '64': 864, '65': 954, '66': 1044, '67': 1134, '68': 1224, '69': 1314, '70': 1404, '71': 1494, '72': 1584, '73': 1674, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 72, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, 'missing age 75'], ['long generational', {'q': {'60': 504, '61': 594, '62': 684, '63': 774, '64': 864, '65': 954, '66': 1044, '67': 1134, '68': 1224, '69': 1314, '70': 1404, '71': 1494, '72': 1584, '73': 1674, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2021, 'n': 8, 'mode': 'generational', 'base_year': 2020}, [0.0049644, 0.00576899, 0.00655672, 0.00733043, 0.00809281, 0.00884649, 0.00959399, 0.01033776]]], [['generational projection', {'q': {'60': 505, '61': 595, '62': 685, '63': 775, '64': 865, '65': 955, '66': 1045, '67': 1135, '68': 1225, '69': 1315, '70': 1405, '71': 1495, '72': 1585, '73': 1675, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, [0.00638374, 0.00714306, 0.00789289, 0.00863575, 0.00937408]], ['static projection', {'q': {'60': 505, '61': 595, '62': 685, '63': 775, '64': 865, '65': 955, '66': 1045, '67': 1135, '68': 1225, '69': 1315, '70': 1405, '71': 1495, '72': 1585, '73': 1675, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2030, 'n': 4, 'mode': 'static', 'base_year': 2020}, [0.00434164, 0.00514142, 0.00594922, 0.00676507]], ['before base year', {'q': {'60': 505, '61': 595, '62': 685, '63': 775, '64': 865, '65': 955, '66': 1045, '67': 1135, '68': 1225, '69': 1315, '70': 1405, '71': 1495, '72': 1585, '73': 1675, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2014, 'n': 3, 'mode': 'generational', 'base_year': 2020}, [0.00552935, 0.00640079, 0.00724741]], ['de-improvement near one', {'q': {'60': 505, '61': 595, '62': 685, '63': 775, '64': 865, '65': 955, '66': 1045, '67': 1135, '68': 1225, '69': 1315, '70': 1405, '71': 1495, '72': 1585, '73': 1675, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 73, 'year': 2000, 'n': 2, 'mode': 'static', 'base_year': 2020}, [0.01986829, 1.0]], ['base year exactly', {'q': {'60': 505, '61': 595, '62': 685, '63': 775, '64': 865, '65': 955, '66': 1045, '67': 1135, '68': 1225, '69': 1315, '70': 1405, '71': 1495, '72': 1585, '73': 1675, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2020, 'n': 3, 'mode': 'static', 'base_year': 2020}, [0.00685, 0.00775, 0.00865]], ['missing age', {'q': {'60': 505, '61': 595, '62': 685, '63': 775, '64': 865, '65': 955, '66': 1045, '67': 1135, '68': 1225, '69': 1315, '70': 1405, '71': 1495, '72': 1585, '73': 1675, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 72, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, 'missing age 75'], ['long generational', {'q': {'60': 505, '61': 595, '62': 685, '63': 775, '64': 865, '65': 955, '66': 1045, '67': 1135, '68': 1225, '69': 1315, '70': 1405, '71': 1495, '72': 1585, '73': 1675, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2021, 'n': 8, 'mode': 'generational', 'base_year': 2020}, [0.00497425, 0.0057787, 0.00656631, 0.0073399, 0.00810218, 0.00885576, 0.00960318, 0.01034688]]]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
generational projection[0.00465058, 0.00542095, 0.00617848, 0.00692571, 0.00766511][0.00464535, 0.00541411, 0.00617001, 0.00691562, 0.00765345]Failed
static projection[0.00511761, 0.00592608, 0.00674244, 0.00756674][0.00510686, 0.00591448, 0.00673016, 0.00755396]Failed
before base year[0.00835597, 0.00918439, 0.00999449][0.00836511, 0.00919216, 0.01000074]Failed
de-improvement near one[0.01979222, 1.0][0.01982084, 1.0]Failed
base year exactly[0.00681, 0.00771, 0.00861][0.00681, 0.00771, 0.00861]Passed
missing agemissing age 75missing age 75Passed
long generational[0.00493596, 0.00574227, 0.00653181, 0.00730734, 0.00807153, 0.00882694, 0.00957607, 0.01032133][0.00493485, 0.00573985, 0.00652797, 0.00730202, 0.00806471, 0.00881867, 0.00956642, 0.01031041]Failed

SHA-256 / fb422b74550bf692067143e93df16fb14d546313d46d0df0568f2b1b73baa72b

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(x):
    out=[]
    for k in range(x['n']):
        age=x['age']+k
        yr=x['year']+k if x['mode']=='generational' else x['year']
        key=str(age)
        if key not in x['q'] or key not in x['aa']: return 'missing age '+key
        f=(1-Fraction(x['aa'][key],10000))**(yr-x['base_year'])
        q=min(Fraction(1),Fraction(x['q'][key],100000)*f)
        out.append(round(float(q),8))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['generational projection', {'q': {'60': 501, '61': 591, '62': 681, '63': 771, '64': 861, '65': 951, '66': 1041, '67': 1131, '68': 1221, '69': 1311, '70': 1401, '71': 1491, '72': 1581, '73': 1671, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, [0.00464535, 0.00541411, 0.00617001, 0.00691562, 0.00765345]], ['static projection', {'q': {'60': 501, '61': 591, '62': 681, '63': 771, '64': 861, '65': 951, '66': 1041, '67': 1131, '68': 1221, '69': 1311, '70': 1401, '71': 1491, '72': 1581, '73': 1671, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 61, 'year': 2030, 'n': 4, 'mode': 'static', 'base_year': 2020}, [0.00510686, 0.00591448, 0.00673016, 0.00755396]], ['before base year', {'q': {'60': 501, '61': 591, '62': 681, '63': 771, '64': 861, '65': 951, '66': 1041, '67': 1131, '68': 1221, '69': 1311, '70': 1401, '71': 1491, '72': 1581, '73': 1671, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 63, 'year': 2014, 'n': 3, 'mode': 'generational', 'base_year': 2020}, [0.00836511, 0.00919216, 0.01000074]], ['de-improvement near one', {'q': {'60': 501, '61': 591, '62': 681, '63': 771, '64': 861, '65': 951, '66': 1041, '67': 1131, '68': 1221, '69': 1311, '70': 1401, '71': 1491, '72': 1581, '73': 1671, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 73, 'year': 2000, 'n': 2, 'mode': 'static', 'base_year': 2020}, [0.01982084, 1.0]], ['base year exactly', {'q': {'60': 501, '61': 591, '62': 681, '63': 771, '64': 861, '65': 951, '66': 1041, '67': 1131, '68': 1221, '69': 1311, '70': 1401, '71': 1491, '72': 1581, '73': 1671, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2020, 'n': 3, 'mode': 'static', 'base_year': 2020}, [0.00681, 0.00771, 0.00861]], ['missing age', {'q': {'60': 501, '61': 591, '62': 681, '63': 771, '64': 861, '65': 951, '66': 1041, '67': 1131, '68': 1221, '69': 1311, '70': 1401, '71': 1491, '72': 1581, '73': 1671, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 72, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, 'missing age 75'], ['long generational', {'q': {'60': 501, '61': 591, '62': 681, '63': 771, '64': 861, '65': 951, '66': 1041, '67': 1131, '68': 1221, '69': 1311, '70': 1401, '71': 1491, '72': 1581, '73': 1671, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2021, 'n': 8, 'mode': 'generational', 'base_year': 2020}, [0.00493485, 0.00573985, 0.00652797, 0.00730202, 0.00806471, 0.00881867, 0.00956642, 0.01031041]]], [['generational projection', {'q': {'60': 502, '61': 592, '62': 682, '63': 772, '64': 862, '65': 952, '66': 1042, '67': 1132, '68': 1222, '69': 1312, '70': 1402, '71': 1492, '72': 1582, '73': 1672, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, [0.00635578, 0.00711541, 0.00786552, 0.00860862, 0.00934717]], ['static projection', {'q': {'60': 502, '61': 592, '62': 682, '63': 772, '64': 862, '65': 952, '66': 1042, '67': 1132, '68': 1222, '69': 1312, '70': 1402, '71': 1492, '72': 1582, '73': 1672, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2030, 'n': 4, 'mode': 'static', 'base_year': 2020}, [0.00431585, 0.0051155, 0.00592316, 0.00673889]], ['before base year', {'q': {'60': 502, '61': 592, '62': 682, '63': 772, '64': 862, '65': 952, '66': 1042, '67': 1132, '68': 1222, '69': 1312, '70': 1402, '71': 1492, '72': 1582, '73': 1672, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 61, 'year': 2014, 'n': 3, 'mode': 'generational', 'base_year': 2020}, [0.00646222, 0.00731812, 0.00815134]], ['de-improvement near one', {'q': {'60': 502, '61': 592, '62': 682, '63': 772, '64': 862, '65': 952, '66': 1042, '67': 1132, '68': 1222, '69': 1312, '70': 1402, '71': 1492, '72': 1582, '73': 1672, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 73, 'year': 2000, 'n': 2, 'mode': 'static', 'base_year': 2020}, [0.0198327, 1.0]], ['base year exactly', {'q': {'60': 502, '61': 592, '62': 682, '63': 772, '64': 862, '65': 952, '66': 1042, '67': 1132, '68': 1222, '69': 1312, '70': 1402, '71': 1492, '72': 1582, '73': 1672, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2020, 'n': 3, 'mode': 'static', 'base_year': 2020}, [0.00682, 0.00772, 0.00862]], ['missing age', {'q': {'60': 502, '61': 592, '62': 682, '63': 772, '64': 862, '65': 952, '66': 1042, '67': 1132, '68': 1222, '69': 1312, '70': 1402, '71': 1492, '72': 1582, '73': 1672, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 72, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, 'missing age 75'], ['long generational', {'q': {'60': 502, '61': 592, '62': 682, '63': 772, '64': 862, '65': 952, '66': 1042, '67': 1132, '68': 1222, '69': 1312, '70': 1402, '71': 1492, '72': 1582, '73': 1672, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2021, 'n': 8, 'mode': 'generational', 'base_year': 2020}, [0.0049447, 0.00574956, 0.00653755, 0.00731149, 0.00807408, 0.00882794, 0.00957561, 0.01031953]]], [['generational projection', {'q': {'60': 503, '61': 593, '62': 683, '63': 773, '64': 863, '65': 953, '66': 1043, '67': 1133, '68': 1223, '69': 1313, '70': 1403, '71': 1493, '72': 1583, '73': 1673, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, [0.0063651, 0.00712463, 0.00787464, 0.00861767, 0.00935614]], ['static projection', {'q': {'60': 503, '61': 593, '62': 683, '63': 773, '64': 863, '65': 953, '66': 1043, '67': 1133, '68': 1223, '69': 1313, '70': 1403, '71': 1493, '72': 1583, '73': 1673, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 63, 'year': 2030, 'n': 4, 'mode': 'static', 'base_year': 2020}, [0.00674762, 0.00757151, 0.00840357, 0.00924387]], ['before base year', {'q': {'60': 503, '61': 593, '62': 683, '63': 773, '64': 863, '65': 953, '66': 1043, '67': 1133, '68': 1223, '69': 1313, '70': 1403, '71': 1493, '72': 1583, '73': 1673, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 61, 'year': 2014, 'n': 3, 'mode': 'generational', 'base_year': 2020}, [0.00647314, 0.00732885, 0.0081619]], ['de-improvement near one', {'q': {'60': 503, '61': 593, '62': 683, '63': 773, '64': 863, '65': 953, '66': 1043, '67': 1133, '68': 1223, '69': 1313, '70': 1403, '71': 1493, '72': 1583, '73': 1673, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 73, 'year': 2000, 'n': 2, 'mode': 'static', 'base_year': 2020}, [0.01984456, 1.0]], ['base year exactly', {'q': {'60': 503, '61': 593, '62': 683, '63': 773, '64': 863, '65': 953, '66': 1043, '67': 1133, '68': 1223, '69': 1313, '70': 1403, '71': 1493, '72': 1583, '73': 1673, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2020, 'n': 3, 'mode': 'static', 'base_year': 2020}, [0.00683, 0.00773, 0.00863]], ['missing age', {'q': {'60': 503, '61': 593, '62': 683, '63': 773, '64': 863, '65': 953, '66': 1043, '67': 1133, '68': 1223, '69': 1313, '70': 1403, '71': 1493, '72': 1583, '73': 1673, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 72, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, 'missing age 75'], ['long generational', {'q': {'60': 503, '61': 593, '62': 683, '63': 773, '64': 863, '65': 953, '66': 1043, '67': 1133, '68': 1223, '69': 1313, '70': 1403, '71': 1493, '72': 1583, '73': 1673, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2021, 'n': 8, 'mode': 'generational', 'base_year': 2020}, [0.00495455, 0.00575928, 0.00654714, 0.00732096, 0.00808345, 0.00883722, 0.0095848, 0.01032864]]], [['generational projection', {'q': {'60': 504, '61': 594, '62': 684, '63': 774, '64': 864, '65': 954, '66': 1044, '67': 1134, '68': 1224, '69': 1314, '70': 1404, '71': 1494, '72': 1584, '73': 1674, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 63, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, [0.00723147, 0.00798761, 0.00873591, 0.00947886, 0.01021888]], ['static projection', {'q': {'60': 504, '61': 594, '62': 684, '63': 774, '64': 864, '65': 954, '66': 1044, '67': 1134, '68': 1224, '69': 1314, '70': 1404, '71': 1494, '72': 1584, '73': 1674, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2030, 'n': 4, 'mode': 'static', 'base_year': 2020}, [0.00594053, 0.00675635, 0.00758028, 0.00841239]], ['before base year', {'q': {'60': 504, '61': 594, '62': 684, '63': 774, '64': 864, '65': 954, '66': 1044, '67': 1134, '68': 1224, '69': 1314, '70': 1404, '71': 1494, '72': 1584, '73': 1674, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 64, 'year': 2014, 'n': 3, 'mode': 'generational', 'base_year': 2020}, [0.00934568, 0.01015928, 0.01095652]], ['de-improvement near one', {'q': {'60': 504, '61': 594, '62': 684, '63': 774, '64': 864, '65': 954, '66': 1044, '67': 1134, '68': 1224, '69': 1314, '70': 1404, '71': 1494, '72': 1584, '73': 1674, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 73, 'year': 2000, 'n': 2, 'mode': 'static', 'base_year': 2020}, [0.01985643, 1.0]], ['base year exactly', {'q': {'60': 504, '61': 594, '62': 684, '63': 774, '64': 864, '65': 954, '66': 1044, '67': 1134, '68': 1224, '69': 1314, '70': 1404, '71': 1494, '72': 1584, '73': 1674, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2020, 'n': 3, 'mode': 'static', 'base_year': 2020}, [0.00684, 0.00774, 0.00864]], ['missing age', {'q': {'60': 504, '61': 594, '62': 684, '63': 774, '64': 864, '65': 954, '66': 1044, '67': 1134, '68': 1224, '69': 1314, '70': 1404, '71': 1494, '72': 1584, '73': 1674, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 72, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, 'missing age 75'], ['long generational', {'q': {'60': 504, '61': 594, '62': 684, '63': 774, '64': 864, '65': 954, '66': 1044, '67': 1134, '68': 1224, '69': 1314, '70': 1404, '71': 1494, '72': 1584, '73': 1674, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2021, 'n': 8, 'mode': 'generational', 'base_year': 2020}, [0.0049644, 0.00576899, 0.00655672, 0.00733043, 0.00809281, 0.00884649, 0.00959399, 0.01033776]]], [['generational projection', {'q': {'60': 505, '61': 595, '62': 685, '63': 775, '64': 865, '65': 955, '66': 1045, '67': 1135, '68': 1225, '69': 1315, '70': 1405, '71': 1495, '72': 1585, '73': 1675, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, [0.00638374, 0.00714306, 0.00789289, 0.00863575, 0.00937408]], ['static projection', {'q': {'60': 505, '61': 595, '62': 685, '63': 775, '64': 865, '65': 955, '66': 1045, '67': 1135, '68': 1225, '69': 1315, '70': 1405, '71': 1495, '72': 1585, '73': 1675, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2030, 'n': 4, 'mode': 'static', 'base_year': 2020}, [0.00434164, 0.00514142, 0.00594922, 0.00676507]], ['before base year', {'q': {'60': 505, '61': 595, '62': 685, '63': 775, '64': 865, '65': 955, '66': 1045, '67': 1135, '68': 1225, '69': 1315, '70': 1405, '71': 1495, '72': 1585, '73': 1675, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2014, 'n': 3, 'mode': 'generational', 'base_year': 2020}, [0.00552935, 0.00640079, 0.00724741]], ['de-improvement near one', {'q': {'60': 505, '61': 595, '62': 685, '63': 775, '64': 865, '65': 955, '66': 1045, '67': 1135, '68': 1225, '69': 1315, '70': 1405, '71': 1495, '72': 1585, '73': 1675, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 73, 'year': 2000, 'n': 2, 'mode': 'static', 'base_year': 2020}, [0.01986829, 1.0]], ['base year exactly', {'q': {'60': 505, '61': 595, '62': 685, '63': 775, '64': 865, '65': 955, '66': 1045, '67': 1135, '68': 1225, '69': 1315, '70': 1405, '71': 1495, '72': 1585, '73': 1675, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2020, 'n': 3, 'mode': 'static', 'base_year': 2020}, [0.00685, 0.00775, 0.00865]], ['missing age', {'q': {'60': 505, '61': 595, '62': 685, '63': 775, '64': 865, '65': 955, '66': 1045, '67': 1135, '68': 1225, '69': 1315, '70': 1405, '71': 1495, '72': 1585, '73': 1675, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 72, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, 'missing age 75'], ['long generational', {'q': {'60': 505, '61': 595, '62': 685, '63': 775, '64': 865, '65': 955, '66': 1045, '67': 1135, '68': 1225, '69': 1315, '70': 1405, '71': 1495, '72': 1585, '73': 1675, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2021, 'n': 8, 'mode': 'generational', 'base_year': 2020}, [0.00497425, 0.0057787, 0.00656631, 0.0073399, 0.00810218, 0.00885576, 0.00960318, 0.01034688]]]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
generational projection[0.00464535, 0.00541411, 0.00617001, 0.00691562, 0.00765345][0.00464535, 0.00541411, 0.00617001, 0.00691562, 0.00765345]Passed
static projection[0.00510686, 0.00591448, 0.00673016, 0.00755396][0.00510686, 0.00591448, 0.00673016, 0.00755396]Passed
before base year[0.00836511, 0.00919216, 0.01000074][0.00836511, 0.00919216, 0.01000074]Passed
de-improvement near one[0.01982084, 1.0][0.01982084, 1.0]Passed
base year exactly[0.00681, 0.00771, 0.00861][0.00681, 0.00771, 0.00861]Passed
missing agemissing age 75missing age 75Passed
long generational[0.00493485, 0.00573985, 0.00652797, 0.00730202, 0.00806471, 0.00881867, 0.00956642, 0.01031041][0.00493485, 0.00573985, 0.00652797, 0.00730202, 0.00806471, 0.00881867, 0.00956642, 0.01031041]Passed

SHA-256 / bf9a12263a8cb31ff8afdeda9a148468f5327fa1956bcf1c478d55d8fbeaca5a

Verification & scope

A deterministic bounded teaching model of a stipulated toy actuarial contract. Rates are small synthetic tables, exact rationals are used where practical and floats are rounded at the output; it makes no claim of conformance with any published table, standard of practice or regulation. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:47:15.780007+00:00.

Case digest / 8e3cc6cc91c6b81d2f5212f608513203bb57631176d83d98508041324d62a072