FA-63086 / Insurance premium rating / Open access
Bonus-malus class transitions: Class history records the class before each transition · case 01
The reported class history lags one year behind the transitions.
ROOT CAUSE
The path is appended before the year's transition is applied.
VERIFIED REPAIR
Append the class after applying each year's transition.
Unsuccessful approach: Appending the final class after the loop keeps the lag and adds the start class.
Case contract
Input start class 1..18 (else 'invalid class'), claims per year, coeffs (18 per mille values, class 1 best), base. Per year: 0 claims -> class-1 (floor 1); 3+ claims -> class 18; otherwise class+3*claims (ceiling 18). Return [class after each year, floor(base*coeff/1000+1/2) for the final class].
Why this case matters
No-claims discount systems compound a transition error across every renewal.
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):
c=x['start']
if not 1<=c<=18: return 'invalid class'
path=[]
for k in x['claims']:
path.append(c)
if k==0: c=max(1,c-1)
elif k>=3: c=18
else: c=min(18,c+3*k)
prem=math.floor(x['base']*Fraction(x['coeffs'][c-1],1000)+Fraction(1,2))
return [path,prem]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['claim-free years reach best class', {'start': 2, 'claims': [0, 0, 0, 0], 'coeffs': [451, 475, 500, 526, 550, 575, 601, 625, 650, 676, 700, 725, 751, 775, 800, 826, 850, 875], 'base': 146808}, [[1, 1, 1, 1], 66210]], ['two claims in a year', {'start': 5, 'claims': [0, 2, 0], 'coeffs': [451, 475, 500, 526, 550, 575, 601, 625, 650, 676, 700, 725, 751, 775, 800, 826, 850, 875], 'base': 90458}, [[4, 10, 9], 58798]], ['three claims hits worst class', {'start': 3, 'claims': [3, 0], 'coeffs': [451, 475, 500, 526, 550, 575, 601, 625, 650, 676, 700, 725, 751, 775, 800, 826, 850, 875], 'base': 97168}, [[18, 17], 82593]], ['single claim then recovery', {'start': 10, 'claims': [1, 0, 0], 'coeffs': [451, 475, 500, 526, 550, 575, 601, 625, 650, 676, 700, 725, 751, 775, 800, 826, 850, 875], 'base': 140983}, [[13, 12, 11], 98688]], ['climb to ceiling', {'start': 15, 'claims': [1, 2], 'coeffs': [451, 475, 500, 526, 550, 575, 601, 625, 650, 676, 700, 725, 751, 775, 800, 826, 850, 875], 'base': 84370}, [[18, 18], 73824]], ['start at worst class', {'start': 18, 'claims': [0, 1], 'coeffs': [451, 475, 500, 526, 550, 575, 601, 625, 650, 676, 700, 725, 751, 775, 800, 826, 850, 875], 'base': 105979}, [[17, 18], 92732]], ['invalid start class 19', {'start': 19, 'claims': [0], 'coeffs': [451, 475, 500, 526, 550, 575, 601, 625, 650, 676, 700, 725, 751, 775, 800, 826, 850, 875], 'base': 125381}, 'invalid class'], ['invalid start class 0', {'start': 0, 'claims': [1], 'coeffs': [451, 475, 500, 526, 550, 575, 601, 625, 650, 676, 700, 725, 751, 775, 800, 826, 850, 875], 'base': 98621}, 'invalid class'], ['random history', {'start': 7, 'claims': [0, 4, 2, 4, 1], 'coeffs': [451, 475, 500, 526, 550, 575, 601, 625, 650, 676, 700, 725, 751, 775, 800, 826, 850, 875], 'base': 65715}, [[6, 18, 18, 18, 18], 57501]]], [['claim-free years reach best class', {'start': 3, 'claims': [0, 0, 0, 0], 'coeffs': [452, 475, 500, 527, 550, 575, 602, 625, 650, 677, 700, 725, 752, 775, 800, 827, 850, 875], 'base': 103817}, [[2, 1, 1, 1], 46925]], ['two claims in a year', {'start': 8, 'claims': [0, 2, 0], 'coeffs': [452, 475, 500, 527, 550, 575, 602, 625, 650, 677, 700, 725, 752, 775, 800, 827, 850, 875], 'base': 111089}, [[7, 13, 12], 80540]], ['three claims hits worst class', {'start': 2, 'claims': [3, 0], 'coeffs': [452, 475, 500, 527, 550, 575, 602, 625, 650, 677, 700, 725, 752, 775, 800, 827, 850, 875], 'base': 137399}, [[18, 17], 116789]], ['single claim then recovery', {'start': 10, 'claims': [1, 0, 0], 'coeffs': [452, 475, 500, 527, 550, 575, 602, 625, 650, 677, 700, 725, 752, 775, 800, 827, 850, 875], 'base': 124097}, [[13, 12, 11], 86868]], ['climb to ceiling', {'start': 15, 'claims': [1, 2], 'coeffs': [452, 475, 500, 527, 550, 575, 602, 625, 650, 677, 700, 725, 752, 775, 800, 827, 850, 875], 'base': 114574}, [[18, 18], 100252]], ['start at worst class', {'start': 18, 'claims': [0, 1], 'coeffs': [452, 475, 500, 527, 550, 575, 602, 625, 650, 677, 700, 725, 752, 775, 800, 827, 850, 875], 'base': 138853}, [[17, 18], 121496]], ['invalid start class 19', {'start': 19, 'claims': [0], 'coeffs': [452, 475, 500, 527, 550, 575, 602, 625, 650, 677, 700, 725, 752, 775, 800, 827, 850, 875], 'base': 59406}, 'invalid class'], ['invalid start class 0', {'start': 0, 'claims': [1], 'coeffs': [452, 475, 500, 527, 550, 575, 602, 625, 650, 677, 700, 725, 752, 775, 800, 827, 850, 875], 'base': 55013}, 'invalid class'], ['random history', {'start': 2, 'claims': [0, 0, 0, 1, 0], 'coeffs': [452, 475, 500, 527, 550, 575, 602, 625, 650, 677, 700, 725, 752, 775, 800, 827, 850, 875], 'base': 62595}, [[1, 1, 1, 4, 3], 31298]]], [['claim-free years reach best class', {'start': 2, 'claims': [0, 0, 0, 0], 'coeffs': [453, 475, 500, 528, 550, 575, 603, 625, 650, 678, 700, 725, 753, 775, 800, 828, 850, 875], 'base': 133221}, [[1, 1, 1, 1], 60349]], ['two claims in a year', {'start': 3, 'claims': [0, 2, 0], 'coeffs': [453, 475, 500, 528, 550, 575, 603, 625, 650, 678, 700, 725, 753, 775, 800, 828, 850, 875], 'base': 61229}, [[2, 8, 7], 36921]], ['three claims hits worst class', {'start': 3, 'claims': [3, 0], 'coeffs': [453, 475, 500, 528, 550, 575, 603, 625, 650, 678, 700, 725, 753, 775, 800, 828, 850, 875], 'base': 85457}, [[18, 17], 72638]], ['single claim then recovery', {'start': 5, 'claims': [1, 0, 0], 'coeffs': [453, 475, 500, 528, 550, 575, 603, 625, 650, 678, 700, 725, 753, 775, 800, 828, 850, 875], 'base': 81249}, [[8, 7, 6], 46718]], ['climb to ceiling', {'start': 15, 'claims': [1, 2], 'coeffs': [453, 475, 500, 528, 550, 575, 603, 625, 650, 678, 700, 725, 753, 775, 800, 828, 850, 875], 'base': 115930}, [[18, 18], 101439]], ['start at worst class', {'start': 18, 'claims': [0, 1], 'coeffs': [453, 475, 500, 528, 550, 575, 603, 625, 650, 678, 700, 725, 753, 775, 800, 828, 850, 875], 'base': 83911}, [[17, 18], 73422]], ['invalid start class 19', {'start': 19, 'claims': [0], 'coeffs': [453, 475, 500, 528, 550, 575, 603, 625, 650, 678, 700, 725, 753, 775, 800, 828, 850, 875], 'base': 144591}, 'invalid class'], ['invalid start class 0', {'start': 0, 'claims': [1], 'coeffs': [453, 475, 500, 528, 550, 575, 603, 625, 650, 678, 700, 725, 753, 775, 800, 828, 850, 875], 'base': 42294}, 'invalid class'], ['random history', {'start': 5, 'claims': [4, 1, 4, 0, 0], 'coeffs': [453, 475, 500, 528, 550, 575, 603, 625, 650, 678, 700, 725, 753, 775, 800, 828, 850, 875], 'base': 55571}, [[18, 18, 18, 17, 16], 46013]]], [['claim-free years reach best class', {'start': 3, 'claims': [0, 0, 0, 0], 'coeffs': [454, 475, 500, 529, 550, 575, 604, 625, 650, 679, 700, 725, 754, 775, 800, 829, 850, 875], 'base': 96489}, [[2, 1, 1, 1], 43806]], ['two claims in a year', {'start': 8, 'claims': [0, 2, 0], 'coeffs': [454, 475, 500, 529, 550, 575, 604, 625, 650, 679, 700, 725, 754, 775, 800, 829, 850, 875], 'base': 119023}, [[7, 13, 12], 86292]], ['three claims hits worst class', {'start': 6, 'claims': [3, 0], 'coeffs': [454, 475, 500, 529, 550, 575, 604, 625, 650, 679, 700, 725, 754, 775, 800, 829, 850, 875], 'base': 90708}, [[18, 17], 77102]], ['single claim then recovery', {'start': 7, 'claims': [1, 0, 0], 'coeffs': [454, 475, 500, 529, 550, 575, 604, 625, 650, 679, 700, 725, 754, 775, 800, 829, 850, 875], 'base': 64319}, [[10, 9, 8], 40199]], ['climb to ceiling', {'start': 15, 'claims': [1, 2], 'coeffs': [454, 475, 500, 529, 550, 575, 604, 625, 650, 679, 700, 725, 754, 775, 800, 829, 850, 875], 'base': 83553}, [[18, 18], 73109]], ['start at worst class', {'start': 18, 'claims': [0, 1], 'coeffs': [454, 475, 500, 529, 550, 575, 604, 625, 650, 679, 700, 725, 754, 775, 800, 829, 850, 875], 'base': 98493}, [[17, 18], 86181]], ['invalid start class 19', {'start': 19, 'claims': [0], 'coeffs': [454, 475, 500, 529, 550, 575, 604, 625, 650, 679, 700, 725, 754, 775, 800, 829, 850, 875], 'base': 149772}, 'invalid class'], ['invalid start class 0', {'start': 0, 'claims': [1], 'coeffs': [454, 475, 500, 529, 550, 575, 604, 625, 650, 679, 700, 725, 754, 775, 800, 829, 850, 875], 'base': 59187}, 'invalid class'], ['random history', {'start': 15, 'claims': [1, 2, 1, 0, 4], 'coeffs': [454, 475, 500, 529, 550, 575, 604, 625, 650, 679, 700, 725, 754, 775, 800, 829, 850, 875], 'base': 119786}, [[18, 18, 18, 17, 18], 104813]]], [['claim-free years reach best class', {'start': 3, 'claims': [0, 0, 0, 0], 'coeffs': [455, 475, 500, 530, 550, 575, 605, 625, 650, 680, 700, 725, 755, 775, 800, 830, 850, 875], 'base': 57394}, [[2, 1, 1, 1], 26114]], ['two claims in a year', {'start': 4, 'claims': [0, 2, 0], 'coeffs': [455, 475, 500, 530, 550, 575, 605, 625, 650, 680, 700, 725, 755, 775, 800, 830, 850, 875], 'base': 84488}, [[3, 9, 8], 52805]], ['three claims hits worst class', {'start': 3, 'claims': [3, 0], 'coeffs': [455, 475, 500, 530, 550, 575, 605, 625, 650, 680, 700, 725, 755, 775, 800, 830, 850, 875], 'base': 51146}, [[18, 17], 43474]], ['single claim then recovery', {'start': 8, 'claims': [1, 0, 0], 'coeffs': [455, 475, 500, 530, 550, 575, 605, 625, 650, 680, 700, 725, 755, 775, 800, 830, 850, 875], 'base': 127242}, [[11, 10, 9], 82707]], ['climb to ceiling', {'start': 15, 'claims': [1, 2], 'coeffs': [455, 475, 500, 530, 550, 575, 605, 625, 650, 680, 700, 725, 755, 775, 800, 830, 850, 875], 'base': 49757}, [[18, 18], 43537]], ['start at worst class', {'start': 18, 'claims': [0, 1], 'coeffs': [455, 475, 500, 530, 550, 575, 605, 625, 650, 680, 700, 725, 755, 775, 800, 830, 850, 875], 'base': 119155}, [[17, 18], 104261]], ['invalid start class 19', {'start': 19, 'claims': [0], 'coeffs': [455, 475, 500, 530, 550, 575, 605, 625, 650, 680, 700, 725, 755, 775, 800, 830, 850, 875], 'base': 64005}, 'invalid class'], ['invalid start class 0', {'start': 0, 'claims': [1], 'coeffs': [455, 475, 500, 530, 550, 575, 605, 625, 650, 680, 700, 725, 755, 775, 800, 830, 850, 875], 'base': 65254}, 'invalid class'], ['random history', {'start': 12, 'claims': [2, 2, 2, 2, 1], 'coeffs': [455, 475, 500, 530, 550, 575, 605, 625, 650, 680, 700, 725, 755, 775, 800, 830, 850, 875], 'base': 118970}, [[18, 18, 18, 18, 18], 104099]]]]
for label, args, expected in fixtures[N-1]:
check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| claim-free years reach best class | [[2, 1, 1, 1], 66210] | [[1, 1, 1, 1], 66210] | Failed |
| two claims in a year | [[5, 4, 10], 58798] | [[4, 10, 9], 58798] | Failed |
| three claims hits worst class | [[3, 18], 82593] | [[18, 17], 82593] | Failed |
| single claim then recovery | [[10, 13, 12], 98688] | [[13, 12, 11], 98688] | Failed |
| climb to ceiling | [[15, 18], 73824] | [[18, 18], 73824] | Failed |
| start at worst class | [[18, 17], 92732] | [[17, 18], 92732] | Failed |
| invalid start class 19 | invalid class | invalid class | Passed |
| invalid start class 0 | invalid class | invalid class | Passed |
| random history | [[7, 6, 18, 18, 18], 57501] | [[6, 18, 18, 18, 18], 57501] | Failed |
SHA-256 / 97499dfb5aaaca1b1ba2b477d7be30a674431950160721bd245b219907e716d4
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):
c=x['start']
if not 1<=c<=18: return 'invalid class'
path=[]
for k in x['claims']:
path.append(c)
if k==0: c=max(1,c-1)
elif k>=3: c=18
else: c=min(18,c+3*k)
path.append(c)
prem=math.floor(x['base']*Fraction(x['coeffs'][c-1],1000)+Fraction(1,2))
return [path,prem]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['claim-free years reach best class', {'start': 2, 'claims': [0, 0, 0, 0], 'coeffs': [451, 475, 500, 526, 550, 575, 601, 625, 650, 676, 700, 725, 751, 775, 800, 826, 850, 875], 'base': 146808}, [[1, 1, 1, 1], 66210]], ['two claims in a year', {'start': 5, 'claims': [0, 2, 0], 'coeffs': [451, 475, 500, 526, 550, 575, 601, 625, 650, 676, 700, 725, 751, 775, 800, 826, 850, 875], 'base': 90458}, [[4, 10, 9], 58798]], ['three claims hits worst class', {'start': 3, 'claims': [3, 0], 'coeffs': [451, 475, 500, 526, 550, 575, 601, 625, 650, 676, 700, 725, 751, 775, 800, 826, 850, 875], 'base': 97168}, [[18, 17], 82593]], ['single claim then recovery', {'start': 10, 'claims': [1, 0, 0], 'coeffs': [451, 475, 500, 526, 550, 575, 601, 625, 650, 676, 700, 725, 751, 775, 800, 826, 850, 875], 'base': 140983}, [[13, 12, 11], 98688]], ['climb to ceiling', {'start': 15, 'claims': [1, 2], 'coeffs': [451, 475, 500, 526, 550, 575, 601, 625, 650, 676, 700, 725, 751, 775, 800, 826, 850, 875], 'base': 84370}, [[18, 18], 73824]], ['start at worst class', {'start': 18, 'claims': [0, 1], 'coeffs': [451, 475, 500, 526, 550, 575, 601, 625, 650, 676, 700, 725, 751, 775, 800, 826, 850, 875], 'base': 105979}, [[17, 18], 92732]], ['invalid start class 19', {'start': 19, 'claims': [0], 'coeffs': [451, 475, 500, 526, 550, 575, 601, 625, 650, 676, 700, 725, 751, 775, 800, 826, 850, 875], 'base': 125381}, 'invalid class'], ['invalid start class 0', {'start': 0, 'claims': [1], 'coeffs': [451, 475, 500, 526, 550, 575, 601, 625, 650, 676, 700, 725, 751, 775, 800, 826, 850, 875], 'base': 98621}, 'invalid class'], ['random history', {'start': 7, 'claims': [0, 4, 2, 4, 1], 'coeffs': [451, 475, 500, 526, 550, 575, 601, 625, 650, 676, 700, 725, 751, 775, 800, 826, 850, 875], 'base': 65715}, [[6, 18, 18, 18, 18], 57501]]], [['claim-free years reach best class', {'start': 3, 'claims': [0, 0, 0, 0], 'coeffs': [452, 475, 500, 527, 550, 575, 602, 625, 650, 677, 700, 725, 752, 775, 800, 827, 850, 875], 'base': 103817}, [[2, 1, 1, 1], 46925]], ['two claims in a year', {'start': 8, 'claims': [0, 2, 0], 'coeffs': [452, 475, 500, 527, 550, 575, 602, 625, 650, 677, 700, 725, 752, 775, 800, 827, 850, 875], 'base': 111089}, [[7, 13, 12], 80540]], ['three claims hits worst class', {'start': 2, 'claims': [3, 0], 'coeffs': [452, 475, 500, 527, 550, 575, 602, 625, 650, 677, 700, 725, 752, 775, 800, 827, 850, 875], 'base': 137399}, [[18, 17], 116789]], ['single claim then recovery', {'start': 10, 'claims': [1, 0, 0], 'coeffs': [452, 475, 500, 527, 550, 575, 602, 625, 650, 677, 700, 725, 752, 775, 800, 827, 850, 875], 'base': 124097}, [[13, 12, 11], 86868]], ['climb to ceiling', {'start': 15, 'claims': [1, 2], 'coeffs': [452, 475, 500, 527, 550, 575, 602, 625, 650, 677, 700, 725, 752, 775, 800, 827, 850, 875], 'base': 114574}, [[18, 18], 100252]], ['start at worst class', {'start': 18, 'claims': [0, 1], 'coeffs': [452, 475, 500, 527, 550, 575, 602, 625, 650, 677, 700, 725, 752, 775, 800, 827, 850, 875], 'base': 138853}, [[17, 18], 121496]], ['invalid start class 19', {'start': 19, 'claims': [0], 'coeffs': [452, 475, 500, 527, 550, 575, 602, 625, 650, 677, 700, 725, 752, 775, 800, 827, 850, 875], 'base': 59406}, 'invalid class'], ['invalid start class 0', {'start': 0, 'claims': [1], 'coeffs': [452, 475, 500, 527, 550, 575, 602, 625, 650, 677, 700, 725, 752, 775, 800, 827, 850, 875], 'base': 55013}, 'invalid class'], ['random history', {'start': 2, 'claims': [0, 0, 0, 1, 0], 'coeffs': [452, 475, 500, 527, 550, 575, 602, 625, 650, 677, 700, 725, 752, 775, 800, 827, 850, 875], 'base': 62595}, [[1, 1, 1, 4, 3], 31298]]], [['claim-free years reach best class', {'start': 2, 'claims': [0, 0, 0, 0], 'coeffs': [453, 475, 500, 528, 550, 575, 603, 625, 650, 678, 700, 725, 753, 775, 800, 828, 850, 875], 'base': 133221}, [[1, 1, 1, 1], 60349]], ['two claims in a year', {'start': 3, 'claims': [0, 2, 0], 'coeffs': [453, 475, 500, 528, 550, 575, 603, 625, 650, 678, 700, 725, 753, 775, 800, 828, 850, 875], 'base': 61229}, [[2, 8, 7], 36921]], ['three claims hits worst class', {'start': 3, 'claims': [3, 0], 'coeffs': [453, 475, 500, 528, 550, 575, 603, 625, 650, 678, 700, 725, 753, 775, 800, 828, 850, 875], 'base': 85457}, [[18, 17], 72638]], ['single claim then recovery', {'start': 5, 'claims': [1, 0, 0], 'coeffs': [453, 475, 500, 528, 550, 575, 603, 625, 650, 678, 700, 725, 753, 775, 800, 828, 850, 875], 'base': 81249}, [[8, 7, 6], 46718]], ['climb to ceiling', {'start': 15, 'claims': [1, 2], 'coeffs': [453, 475, 500, 528, 550, 575, 603, 625, 650, 678, 700, 725, 753, 775, 800, 828, 850, 875], 'base': 115930}, [[18, 18], 101439]], ['start at worst class', {'start': 18, 'claims': [0, 1], 'coeffs': [453, 475, 500, 528, 550, 575, 603, 625, 650, 678, 700, 725, 753, 775, 800, 828, 850, 875], 'base': 83911}, [[17, 18], 73422]], ['invalid start class 19', {'start': 19, 'claims': [0], 'coeffs': [453, 475, 500, 528, 550, 575, 603, 625, 650, 678, 700, 725, 753, 775, 800, 828, 850, 875], 'base': 144591}, 'invalid class'], ['invalid start class 0', {'start': 0, 'claims': [1], 'coeffs': [453, 475, 500, 528, 550, 575, 603, 625, 650, 678, 700, 725, 753, 775, 800, 828, 850, 875], 'base': 42294}, 'invalid class'], ['random history', {'start': 5, 'claims': [4, 1, 4, 0, 0], 'coeffs': [453, 475, 500, 528, 550, 575, 603, 625, 650, 678, 700, 725, 753, 775, 800, 828, 850, 875], 'base': 55571}, [[18, 18, 18, 17, 16], 46013]]], [['claim-free years reach best class', {'start': 3, 'claims': [0, 0, 0, 0], 'coeffs': [454, 475, 500, 529, 550, 575, 604, 625, 650, 679, 700, 725, 754, 775, 800, 829, 850, 875], 'base': 96489}, [[2, 1, 1, 1], 43806]], ['two claims in a year', {'start': 8, 'claims': [0, 2, 0], 'coeffs': [454, 475, 500, 529, 550, 575, 604, 625, 650, 679, 700, 725, 754, 775, 800, 829, 850, 875], 'base': 119023}, [[7, 13, 12], 86292]], ['three claims hits worst class', {'start': 6, 'claims': [3, 0], 'coeffs': [454, 475, 500, 529, 550, 575, 604, 625, 650, 679, 700, 725, 754, 775, 800, 829, 850, 875], 'base': 90708}, [[18, 17], 77102]], ['single claim then recovery', {'start': 7, 'claims': [1, 0, 0], 'coeffs': [454, 475, 500, 529, 550, 575, 604, 625, 650, 679, 700, 725, 754, 775, 800, 829, 850, 875], 'base': 64319}, [[10, 9, 8], 40199]], ['climb to ceiling', {'start': 15, 'claims': [1, 2], 'coeffs': [454, 475, 500, 529, 550, 575, 604, 625, 650, 679, 700, 725, 754, 775, 800, 829, 850, 875], 'base': 83553}, [[18, 18], 73109]], ['start at worst class', {'start': 18, 'claims': [0, 1], 'coeffs': [454, 475, 500, 529, 550, 575, 604, 625, 650, 679, 700, 725, 754, 775, 800, 829, 850, 875], 'base': 98493}, [[17, 18], 86181]], ['invalid start class 19', {'start': 19, 'claims': [0], 'coeffs': [454, 475, 500, 529, 550, 575, 604, 625, 650, 679, 700, 725, 754, 775, 800, 829, 850, 875], 'base': 149772}, 'invalid class'], ['invalid start class 0', {'start': 0, 'claims': [1], 'coeffs': [454, 475, 500, 529, 550, 575, 604, 625, 650, 679, 700, 725, 754, 775, 800, 829, 850, 875], 'base': 59187}, 'invalid class'], ['random history', {'start': 15, 'claims': [1, 2, 1, 0, 4], 'coeffs': [454, 475, 500, 529, 550, 575, 604, 625, 650, 679, 700, 725, 754, 775, 800, 829, 850, 875], 'base': 119786}, [[18, 18, 18, 17, 18], 104813]]], [['claim-free years reach best class', {'start': 3, 'claims': [0, 0, 0, 0], 'coeffs': [455, 475, 500, 530, 550, 575, 605, 625, 650, 680, 700, 725, 755, 775, 800, 830, 850, 875], 'base': 57394}, [[2, 1, 1, 1], 26114]], ['two claims in a year', {'start': 4, 'claims': [0, 2, 0], 'coeffs': [455, 475, 500, 530, 550, 575, 605, 625, 650, 680, 700, 725, 755, 775, 800, 830, 850, 875], 'base': 84488}, [[3, 9, 8], 52805]], ['three claims hits worst class', {'start': 3, 'claims': [3, 0], 'coeffs': [455, 475, 500, 530, 550, 575, 605, 625, 650, 680, 700, 725, 755, 775, 800, 830, 850, 875], 'base': 51146}, [[18, 17], 43474]], ['single claim then recovery', {'start': 8, 'claims': [1, 0, 0], 'coeffs': [455, 475, 500, 530, 550, 575, 605, 625, 650, 680, 700, 725, 755, 775, 800, 830, 850, 875], 'base': 127242}, [[11, 10, 9], 82707]], ['climb to ceiling', {'start': 15, 'claims': [1, 2], 'coeffs': [455, 475, 500, 530, 550, 575, 605, 625, 650, 680, 700, 725, 755, 775, 800, 830, 850, 875], 'base': 49757}, [[18, 18], 43537]], ['start at worst class', {'start': 18, 'claims': [0, 1], 'coeffs': [455, 475, 500, 530, 550, 575, 605, 625, 650, 680, 700, 725, 755, 775, 800, 830, 850, 875], 'base': 119155}, [[17, 18], 104261]], ['invalid start class 19', {'start': 19, 'claims': [0], 'coeffs': [455, 475, 500, 530, 550, 575, 605, 625, 650, 680, 700, 725, 755, 775, 800, 830, 850, 875], 'base': 64005}, 'invalid class'], ['invalid start class 0', {'start': 0, 'claims': [1], 'coeffs': [455, 475, 500, 530, 550, 575, 605, 625, 650, 680, 700, 725, 755, 775, 800, 830, 850, 875], 'base': 65254}, 'invalid class'], ['random history', {'start': 12, 'claims': [2, 2, 2, 2, 1], 'coeffs': [455, 475, 500, 530, 550, 575, 605, 625, 650, 680, 700, 725, 755, 775, 800, 830, 850, 875], 'base': 118970}, [[18, 18, 18, 18, 18], 104099]]]]
for label, args, expected in fixtures[N-1]:
check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| claim-free years reach best class | [[2, 1, 1, 1, 1], 66210] | [[1, 1, 1, 1], 66210] | Failed |
| two claims in a year | [[5, 4, 10, 9], 58798] | [[4, 10, 9], 58798] | Failed |
| three claims hits worst class | [[3, 18, 17], 82593] | [[18, 17], 82593] | Failed |
| single claim then recovery | [[10, 13, 12, 11], 98688] | [[13, 12, 11], 98688] | Failed |
| climb to ceiling | [[15, 18, 18], 73824] | [[18, 18], 73824] | Failed |
| start at worst class | [[18, 17, 18], 92732] | [[17, 18], 92732] | Failed |
| invalid start class 19 | invalid class | invalid class | Passed |
| invalid start class 0 | invalid class | invalid class | Passed |
| random history | [[7, 6, 18, 18, 18, 18], 57501] | [[6, 18, 18, 18, 18], 57501] | Failed |
SHA-256 / 00b5f52188a9fe1c8c0f32033b4d7485d6eafa8e303cc3fb53fcd51bdebc70cd
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):
c=x['start']
if not 1<=c<=18: return 'invalid class'
path=[]
for k in x['claims']:
if k==0: c=max(1,c-1)
elif k>=3: c=18
else: c=min(18,c+3*k)
path.append(c)
prem=math.floor(x['base']*Fraction(x['coeffs'][c-1],1000)+Fraction(1,2))
return [path,prem]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['claim-free years reach best class', {'start': 2, 'claims': [0, 0, 0, 0], 'coeffs': [451, 475, 500, 526, 550, 575, 601, 625, 650, 676, 700, 725, 751, 775, 800, 826, 850, 875], 'base': 146808}, [[1, 1, 1, 1], 66210]], ['two claims in a year', {'start': 5, 'claims': [0, 2, 0], 'coeffs': [451, 475, 500, 526, 550, 575, 601, 625, 650, 676, 700, 725, 751, 775, 800, 826, 850, 875], 'base': 90458}, [[4, 10, 9], 58798]], ['three claims hits worst class', {'start': 3, 'claims': [3, 0], 'coeffs': [451, 475, 500, 526, 550, 575, 601, 625, 650, 676, 700, 725, 751, 775, 800, 826, 850, 875], 'base': 97168}, [[18, 17], 82593]], ['single claim then recovery', {'start': 10, 'claims': [1, 0, 0], 'coeffs': [451, 475, 500, 526, 550, 575, 601, 625, 650, 676, 700, 725, 751, 775, 800, 826, 850, 875], 'base': 140983}, [[13, 12, 11], 98688]], ['climb to ceiling', {'start': 15, 'claims': [1, 2], 'coeffs': [451, 475, 500, 526, 550, 575, 601, 625, 650, 676, 700, 725, 751, 775, 800, 826, 850, 875], 'base': 84370}, [[18, 18], 73824]], ['start at worst class', {'start': 18, 'claims': [0, 1], 'coeffs': [451, 475, 500, 526, 550, 575, 601, 625, 650, 676, 700, 725, 751, 775, 800, 826, 850, 875], 'base': 105979}, [[17, 18], 92732]], ['invalid start class 19', {'start': 19, 'claims': [0], 'coeffs': [451, 475, 500, 526, 550, 575, 601, 625, 650, 676, 700, 725, 751, 775, 800, 826, 850, 875], 'base': 125381}, 'invalid class'], ['invalid start class 0', {'start': 0, 'claims': [1], 'coeffs': [451, 475, 500, 526, 550, 575, 601, 625, 650, 676, 700, 725, 751, 775, 800, 826, 850, 875], 'base': 98621}, 'invalid class'], ['random history', {'start': 7, 'claims': [0, 4, 2, 4, 1], 'coeffs': [451, 475, 500, 526, 550, 575, 601, 625, 650, 676, 700, 725, 751, 775, 800, 826, 850, 875], 'base': 65715}, [[6, 18, 18, 18, 18], 57501]]], [['claim-free years reach best class', {'start': 3, 'claims': [0, 0, 0, 0], 'coeffs': [452, 475, 500, 527, 550, 575, 602, 625, 650, 677, 700, 725, 752, 775, 800, 827, 850, 875], 'base': 103817}, [[2, 1, 1, 1], 46925]], ['two claims in a year', {'start': 8, 'claims': [0, 2, 0], 'coeffs': [452, 475, 500, 527, 550, 575, 602, 625, 650, 677, 700, 725, 752, 775, 800, 827, 850, 875], 'base': 111089}, [[7, 13, 12], 80540]], ['three claims hits worst class', {'start': 2, 'claims': [3, 0], 'coeffs': [452, 475, 500, 527, 550, 575, 602, 625, 650, 677, 700, 725, 752, 775, 800, 827, 850, 875], 'base': 137399}, [[18, 17], 116789]], ['single claim then recovery', {'start': 10, 'claims': [1, 0, 0], 'coeffs': [452, 475, 500, 527, 550, 575, 602, 625, 650, 677, 700, 725, 752, 775, 800, 827, 850, 875], 'base': 124097}, [[13, 12, 11], 86868]], ['climb to ceiling', {'start': 15, 'claims': [1, 2], 'coeffs': [452, 475, 500, 527, 550, 575, 602, 625, 650, 677, 700, 725, 752, 775, 800, 827, 850, 875], 'base': 114574}, [[18, 18], 100252]], ['start at worst class', {'start': 18, 'claims': [0, 1], 'coeffs': [452, 475, 500, 527, 550, 575, 602, 625, 650, 677, 700, 725, 752, 775, 800, 827, 850, 875], 'base': 138853}, [[17, 18], 121496]], ['invalid start class 19', {'start': 19, 'claims': [0], 'coeffs': [452, 475, 500, 527, 550, 575, 602, 625, 650, 677, 700, 725, 752, 775, 800, 827, 850, 875], 'base': 59406}, 'invalid class'], ['invalid start class 0', {'start': 0, 'claims': [1], 'coeffs': [452, 475, 500, 527, 550, 575, 602, 625, 650, 677, 700, 725, 752, 775, 800, 827, 850, 875], 'base': 55013}, 'invalid class'], ['random history', {'start': 2, 'claims': [0, 0, 0, 1, 0], 'coeffs': [452, 475, 500, 527, 550, 575, 602, 625, 650, 677, 700, 725, 752, 775, 800, 827, 850, 875], 'base': 62595}, [[1, 1, 1, 4, 3], 31298]]], [['claim-free years reach best class', {'start': 2, 'claims': [0, 0, 0, 0], 'coeffs': [453, 475, 500, 528, 550, 575, 603, 625, 650, 678, 700, 725, 753, 775, 800, 828, 850, 875], 'base': 133221}, [[1, 1, 1, 1], 60349]], ['two claims in a year', {'start': 3, 'claims': [0, 2, 0], 'coeffs': [453, 475, 500, 528, 550, 575, 603, 625, 650, 678, 700, 725, 753, 775, 800, 828, 850, 875], 'base': 61229}, [[2, 8, 7], 36921]], ['three claims hits worst class', {'start': 3, 'claims': [3, 0], 'coeffs': [453, 475, 500, 528, 550, 575, 603, 625, 650, 678, 700, 725, 753, 775, 800, 828, 850, 875], 'base': 85457}, [[18, 17], 72638]], ['single claim then recovery', {'start': 5, 'claims': [1, 0, 0], 'coeffs': [453, 475, 500, 528, 550, 575, 603, 625, 650, 678, 700, 725, 753, 775, 800, 828, 850, 875], 'base': 81249}, [[8, 7, 6], 46718]], ['climb to ceiling', {'start': 15, 'claims': [1, 2], 'coeffs': [453, 475, 500, 528, 550, 575, 603, 625, 650, 678, 700, 725, 753, 775, 800, 828, 850, 875], 'base': 115930}, [[18, 18], 101439]], ['start at worst class', {'start': 18, 'claims': [0, 1], 'coeffs': [453, 475, 500, 528, 550, 575, 603, 625, 650, 678, 700, 725, 753, 775, 800, 828, 850, 875], 'base': 83911}, [[17, 18], 73422]], ['invalid start class 19', {'start': 19, 'claims': [0], 'coeffs': [453, 475, 500, 528, 550, 575, 603, 625, 650, 678, 700, 725, 753, 775, 800, 828, 850, 875], 'base': 144591}, 'invalid class'], ['invalid start class 0', {'start': 0, 'claims': [1], 'coeffs': [453, 475, 500, 528, 550, 575, 603, 625, 650, 678, 700, 725, 753, 775, 800, 828, 850, 875], 'base': 42294}, 'invalid class'], ['random history', {'start': 5, 'claims': [4, 1, 4, 0, 0], 'coeffs': [453, 475, 500, 528, 550, 575, 603, 625, 650, 678, 700, 725, 753, 775, 800, 828, 850, 875], 'base': 55571}, [[18, 18, 18, 17, 16], 46013]]], [['claim-free years reach best class', {'start': 3, 'claims': [0, 0, 0, 0], 'coeffs': [454, 475, 500, 529, 550, 575, 604, 625, 650, 679, 700, 725, 754, 775, 800, 829, 850, 875], 'base': 96489}, [[2, 1, 1, 1], 43806]], ['two claims in a year', {'start': 8, 'claims': [0, 2, 0], 'coeffs': [454, 475, 500, 529, 550, 575, 604, 625, 650, 679, 700, 725, 754, 775, 800, 829, 850, 875], 'base': 119023}, [[7, 13, 12], 86292]], ['three claims hits worst class', {'start': 6, 'claims': [3, 0], 'coeffs': [454, 475, 500, 529, 550, 575, 604, 625, 650, 679, 700, 725, 754, 775, 800, 829, 850, 875], 'base': 90708}, [[18, 17], 77102]], ['single claim then recovery', {'start': 7, 'claims': [1, 0, 0], 'coeffs': [454, 475, 500, 529, 550, 575, 604, 625, 650, 679, 700, 725, 754, 775, 800, 829, 850, 875], 'base': 64319}, [[10, 9, 8], 40199]], ['climb to ceiling', {'start': 15, 'claims': [1, 2], 'coeffs': [454, 475, 500, 529, 550, 575, 604, 625, 650, 679, 700, 725, 754, 775, 800, 829, 850, 875], 'base': 83553}, [[18, 18], 73109]], ['start at worst class', {'start': 18, 'claims': [0, 1], 'coeffs': [454, 475, 500, 529, 550, 575, 604, 625, 650, 679, 700, 725, 754, 775, 800, 829, 850, 875], 'base': 98493}, [[17, 18], 86181]], ['invalid start class 19', {'start': 19, 'claims': [0], 'coeffs': [454, 475, 500, 529, 550, 575, 604, 625, 650, 679, 700, 725, 754, 775, 800, 829, 850, 875], 'base': 149772}, 'invalid class'], ['invalid start class 0', {'start': 0, 'claims': [1], 'coeffs': [454, 475, 500, 529, 550, 575, 604, 625, 650, 679, 700, 725, 754, 775, 800, 829, 850, 875], 'base': 59187}, 'invalid class'], ['random history', {'start': 15, 'claims': [1, 2, 1, 0, 4], 'coeffs': [454, 475, 500, 529, 550, 575, 604, 625, 650, 679, 700, 725, 754, 775, 800, 829, 850, 875], 'base': 119786}, [[18, 18, 18, 17, 18], 104813]]], [['claim-free years reach best class', {'start': 3, 'claims': [0, 0, 0, 0], 'coeffs': [455, 475, 500, 530, 550, 575, 605, 625, 650, 680, 700, 725, 755, 775, 800, 830, 850, 875], 'base': 57394}, [[2, 1, 1, 1], 26114]], ['two claims in a year', {'start': 4, 'claims': [0, 2, 0], 'coeffs': [455, 475, 500, 530, 550, 575, 605, 625, 650, 680, 700, 725, 755, 775, 800, 830, 850, 875], 'base': 84488}, [[3, 9, 8], 52805]], ['three claims hits worst class', {'start': 3, 'claims': [3, 0], 'coeffs': [455, 475, 500, 530, 550, 575, 605, 625, 650, 680, 700, 725, 755, 775, 800, 830, 850, 875], 'base': 51146}, [[18, 17], 43474]], ['single claim then recovery', {'start': 8, 'claims': [1, 0, 0], 'coeffs': [455, 475, 500, 530, 550, 575, 605, 625, 650, 680, 700, 725, 755, 775, 800, 830, 850, 875], 'base': 127242}, [[11, 10, 9], 82707]], ['climb to ceiling', {'start': 15, 'claims': [1, 2], 'coeffs': [455, 475, 500, 530, 550, 575, 605, 625, 650, 680, 700, 725, 755, 775, 800, 830, 850, 875], 'base': 49757}, [[18, 18], 43537]], ['start at worst class', {'start': 18, 'claims': [0, 1], 'coeffs': [455, 475, 500, 530, 550, 575, 605, 625, 650, 680, 700, 725, 755, 775, 800, 830, 850, 875], 'base': 119155}, [[17, 18], 104261]], ['invalid start class 19', {'start': 19, 'claims': [0], 'coeffs': [455, 475, 500, 530, 550, 575, 605, 625, 650, 680, 700, 725, 755, 775, 800, 830, 850, 875], 'base': 64005}, 'invalid class'], ['invalid start class 0', {'start': 0, 'claims': [1], 'coeffs': [455, 475, 500, 530, 550, 575, 605, 625, 650, 680, 700, 725, 755, 775, 800, 830, 850, 875], 'base': 65254}, 'invalid class'], ['random history', {'start': 12, 'claims': [2, 2, 2, 2, 1], 'coeffs': [455, 475, 500, 530, 550, 575, 605, 625, 650, 680, 700, 725, 755, 775, 800, 830, 850, 875], 'base': 118970}, [[18, 18, 18, 18, 18], 104099]]]]
for label, args, expected in fixtures[N-1]:
check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| claim-free years reach best class | [[1, 1, 1, 1], 66210] | [[1, 1, 1, 1], 66210] | Passed |
| two claims in a year | [[4, 10, 9], 58798] | [[4, 10, 9], 58798] | Passed |
| three claims hits worst class | [[18, 17], 82593] | [[18, 17], 82593] | Passed |
| single claim then recovery | [[13, 12, 11], 98688] | [[13, 12, 11], 98688] | Passed |
| climb to ceiling | [[18, 18], 73824] | [[18, 18], 73824] | Passed |
| start at worst class | [[17, 18], 92732] | [[17, 18], 92732] | Passed |
| invalid start class 19 | invalid class | invalid class | Passed |
| invalid start class 0 | invalid class | invalid class | Passed |
| random history | [[6, 18, 18, 18, 18], 57501] | [[6, 18, 18, 18, 18], 57501] | Passed |
SHA-256 / 4a40919e838e037e1413a76a3e5e40ef782361238d55a7d3c63bb0e7a856d603
Verification & scope
A deterministic bounded teaching model of a stipulated toy rating contract. Amounts are integer cents and factors exact rationals; it makes no claim of conformance with any filed rating plan, bureau manual or jurisdiction. 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:10.888268+00:00.
Case digest / b649e4b13c79f3afd899c84e24350dfc539af9c2c980cbee8c9ef40a0a983a6c