FAILURE MAP
← Case archive

FA-65096 / Epidemic compartment models / Open access

Age-structured force of infection: prevalence denominator · case 01

Small age bands receive inflated force of infection from large ones.

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

ROOT CAUSE

Prevalence in the infector group is divided by the infectee group size.

VERIFIED REPAIR

Restore the prevalence denominator rule: `infected[b] / sizes[b]`.

Unsuccessful approach: Dividing by the total population dilutes group-specific prevalence.

Case contract

lambda[a] = beta*susceptibility[a]*sum_b contacts[a][b]*infected[b]/sizes[b] (groups with zero size skipped); expected new infections susceptible[a]*(1-exp(-lambda[a])); return [lambdas rounded 6, new infections rounded 4, total rounded 4].

Why this case matters

Compartmental epidemic calculations drive outbreak forecasts, vaccine targets and hospital planning; a single wrong flow, rate conversion or boundary silently changes every downstream number.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(beta, contacts, sizes, infected, susceptible, susceptibility):
    g = len(sizes)
    lam = []
    for a in range(g):
        pressure = 0.0
        for b in range(g):
            if sizes[b] > 0:
                pressure += contacts[a][b] * infected[b] / sizes[a]
        lam.append(beta * susceptibility[a] * pressure)
    new = [susceptible[a] * (1 - math.exp(-lam[a])) for a in range(g)]
    return [[round(x, 6) for x in lam], [round(x, 4) for x in new], round(sum(new), 4)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: three age bands',
   (0.05, [[10, 3, 1], [3, 8, 2], [1, 2, 4]], [200, 500, 300], [5, 20, 3], [180, 450, 290], [1.0, 0.8, 1.2]),
   [[0.019, 0.0166, 0.0087], [3.3877, 7.4083, 2.5121], 13.3081]),
  ('regression: asymmetric school contacts',
   (0.1, [[12, 2], [5, 6]], [300, 700], [10, 5], [280, 690], [1.0, 1.0]),
   [[0.041429, 0.020952], [11.363, 14.3067], 25.6697]),
  ('control: no infection',
   (0.3, [[4, 1], [1, 4]], [100, 100], [0, 0], [100, 100], [1.0, 1.0]),
   [[0.0, 0.0], [0.0, 0.0], 0.0]),
  ('regression: high pressure saturates',
   (2.0, [[20, 5], [5, 20]], [50, 50], [30, 25], [20, 25], [1.0, 1.0]),
   [[29.0, 26.0], [20.0, 25.0], 45.0]),
  ('control: single group', (0.1, [[7]], [1000], [50], [900], [0.9]), [[0.0315], [27.9081], 27.9081]),
  ('regression: reduced child susceptibility',
   (0.08, [[15, 4], [2, 7]], [400, 600], [2, 30], [390, 550], [0.5, 1.0]),
   [[0.011, 0.0288], [4.2665, 15.6141], 19.8806]),
  ('regression: unequal sizes',
   (0.04, [[6, 6], [1, 3]], [50, 950], [5, 5], [40, 900], [1.0, 1.3]),
   [[0.025263, 0.006021], [0.9979, 5.4027], 6.4005])],
 [('regression: three age bands',
   (0.05, [[10, 3, 1], [3, 8, 2], [1, 2, 4]], [200, 500, 300], [5, 20, 3], [180, 450, 290], [1.0, 0.8, 1.2]),
   [[0.019, 0.0166, 0.0087], [3.3877, 7.4083, 2.5121], 13.3081]),
  ('regression: asymmetric school contacts',
   (0.1, [[12, 2], [5, 6]], [300, 700], [10, 5], [280, 690], [1.0, 1.0]),
   [[0.041429, 0.020952], [11.363, 14.3067], 25.6697]),
  ('control: no infection',
   (0.3, [[4, 1], [1, 4]], [100, 100], [0, 0], [100, 100], [1.0, 1.0]),
   [[0.0, 0.0], [0.0, 0.0], 0.0]),
  ('regression: high pressure saturates',
   (2.0, [[20, 5], [5, 20]], [50, 50], [30, 25], [20, 25], [1.0, 1.0]),
   [[29.0, 26.0], [20.0, 25.0], 45.0]),
  ('control: single group', (0.1, [[7]], [1000], [50], [900], [0.9]), [[0.0315], [27.9081], 27.9081]),
  ('regression: reduced child susceptibility',
   (0.08, [[15, 4], [2, 7]], [400, 600], [2, 30], [390, 550], [0.5, 1.0]),
   [[0.011, 0.0288], [4.2665, 15.6141], 19.8806]),
  ('regression: unequal sizes',
   (0.04, [[6, 6], [1, 3]], [50, 950], [5, 5], [40, 900], [1.0, 1.3]),
   [[0.025263, 0.006021], [0.9979, 5.4027], 6.4005])],
 [('regression: three age bands',
   (0.05, [[10, 3, 1], [3, 8, 2], [1, 2, 4]], [200, 500, 300], [5, 20, 3], [180, 450, 290], [1.0, 0.8, 1.2]),
   [[0.019, 0.0166, 0.0087], [3.3877, 7.4083, 2.5121], 13.3081]),
  ('regression: asymmetric school contacts',
   (0.1, [[12, 2], [5, 6]], [300, 700], [10, 5], [280, 690], [1.0, 1.0]),
   [[0.041429, 0.020952], [11.363, 14.3067], 25.6697]),
  ('control: no infection',
   (0.3, [[4, 1], [1, 4]], [100, 100], [0, 0], [100, 100], [1.0, 1.0]),
   [[0.0, 0.0], [0.0, 0.0], 0.0]),
  ('regression: high pressure saturates',
   (2.0, [[20, 5], [5, 20]], [50, 50], [30, 25], [20, 25], [1.0, 1.0]),
   [[29.0, 26.0], [20.0, 25.0], 45.0]),
  ('control: single group', (0.1, [[7]], [1000], [50], [900], [0.9]), [[0.0315], [27.9081], 27.9081]),
  ('regression: reduced child susceptibility',
   (0.08, [[15, 4], [2, 7]], [400, 600], [2, 30], [390, 550], [0.5, 1.0]),
   [[0.011, 0.0288], [4.2665, 15.6141], 19.8806]),
  ('regression: unequal sizes',
   (0.04, [[6, 6], [1, 3]], [50, 950], [5, 5], [40, 900], [1.0, 1.3]),
   [[0.025263, 0.006021], [0.9979, 5.4027], 6.4005])],
 [('regression: three age bands',
   (0.05, [[10, 3, 1], [3, 8, 2], [1, 2, 4]], [200, 500, 300], [5, 20, 3], [180, 450, 290], [1.0, 0.8, 1.2]),
   [[0.019, 0.0166, 0.0087], [3.3877, 7.4083, 2.5121], 13.3081]),
  ('regression: asymmetric school contacts',
   (0.1, [[12, 2], [5, 6]], [300, 700], [10, 5], [280, 690], [1.0, 1.0]),
   [[0.041429, 0.020952], [11.363, 14.3067], 25.6697]),
  ('control: no infection',
   (0.3, [[4, 1], [1, 4]], [100, 100], [0, 0], [100, 100], [1.0, 1.0]),
   [[0.0, 0.0], [0.0, 0.0], 0.0]),
  ('regression: high pressure saturates',
   (2.0, [[20, 5], [5, 20]], [50, 50], [30, 25], [20, 25], [1.0, 1.0]),
   [[29.0, 26.0], [20.0, 25.0], 45.0]),
  ('control: single group', (0.1, [[7]], [1000], [50], [900], [0.9]), [[0.0315], [27.9081], 27.9081]),
  ('regression: reduced child susceptibility',
   (0.08, [[15, 4], [2, 7]], [400, 600], [2, 30], [390, 550], [0.5, 1.0]),
   [[0.011, 0.0288], [4.2665, 15.6141], 19.8806]),
  ('regression: unequal sizes',
   (0.04, [[6, 6], [1, 3]], [50, 950], [5, 5], [40, 900], [1.0, 1.3]),
   [[0.025263, 0.006021], [0.9979, 5.4027], 6.4005])],
 [('regression: three age bands',
   (0.05, [[10, 3, 1], [3, 8, 2], [1, 2, 4]], [200, 500, 300], [5, 20, 3], [180, 450, 290], [1.0, 0.8, 1.2]),
   [[0.019, 0.0166, 0.0087], [3.3877, 7.4083, 2.5121], 13.3081]),
  ('regression: asymmetric school contacts',
   (0.1, [[12, 2], [5, 6]], [300, 700], [10, 5], [280, 690], [1.0, 1.0]),
   [[0.041429, 0.020952], [11.363, 14.3067], 25.6697]),
  ('control: no infection',
   (0.3, [[4, 1], [1, 4]], [100, 100], [0, 0], [100, 100], [1.0, 1.0]),
   [[0.0, 0.0], [0.0, 0.0], 0.0]),
  ('regression: high pressure saturates',
   (2.0, [[20, 5], [5, 20]], [50, 50], [30, 25], [20, 25], [1.0, 1.0]),
   [[29.0, 26.0], [20.0, 25.0], 45.0]),
  ('control: single group', (0.1, [[7]], [1000], [50], [900], [0.9]), [[0.0315], [27.9081], 27.9081]),
  ('regression: reduced child susceptibility',
   (0.08, [[15, 4], [2, 7]], [400, 600], [2, 30], [390, 550], [0.5, 1.0]),
   [[0.011, 0.0288], [4.2665, 15.6141], 19.8806]),
  ('regression: unequal sizes',
   (0.04, [[6, 6], [1, 3]], [50, 950], [5, 5], [40, 900], [1.0, 1.3]),
   [[0.025263, 0.006021], [0.9979, 5.4027], 6.4005])]]
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
regression: three age bands[[0.02825, 0.01448, 0.0114], [5.0138, 6.4691, 3.2872], 14.7701][[0.019, 0.0166, 0.0087], [3.3877, 7.4083, 2.5121], 13.3081]Failed
regression: asymmetric school contacts[[0.043333, 0.011429], [11.8742, 7.8408], 19.715][[0.041429, 0.020952], [11.363, 14.3067], 25.6697]Failed
control: no infection[[0.0, 0.0], [0.0, 0.0], 0.0][[0.0, 0.0], [0.0, 0.0], 0.0]Passed
regression: high pressure saturates[[29.0, 26.0], [20.0, 25.0], 45.0][[29.0, 26.0], [20.0, 25.0], 45.0]Passed
control: single group[[0.0315], [27.9081], 27.9081][[0.0315], [27.9081], 27.9081]Passed
regression: reduced child susceptibility[[0.015, 0.028533], [5.8063, 15.4716], 21.2779][[0.011, 0.0288], [4.2665, 15.6141], 19.8806]Failed
regression: unequal sizes[[0.048, 0.001095], [1.8746, 0.9847], 2.8594][[0.025263, 0.006021], [0.9979, 5.4027], 6.4005]Failed

SHA-256 / d9bfd4815c0da46e4e6561d1ead401e87aa40a6881d351f8beee206c893c94bb

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(beta, contacts, sizes, infected, susceptible, susceptibility):
    g = len(sizes)
    lam = []
    for a in range(g):
        pressure = 0.0
        for b in range(g):
            if sizes[b] > 0:
                pressure += contacts[a][b] * infected[b] / sum(sizes)
        lam.append(beta * susceptibility[a] * pressure)
    new = [susceptible[a] * (1 - math.exp(-lam[a])) for a in range(g)]
    return [[round(x, 6) for x in lam], [round(x, 4) for x in new], round(sum(new), 4)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: three age bands',
   (0.05, [[10, 3, 1], [3, 8, 2], [1, 2, 4]], [200, 500, 300], [5, 20, 3], [180, 450, 290], [1.0, 0.8, 1.2]),
   [[0.019, 0.0166, 0.0087], [3.3877, 7.4083, 2.5121], 13.3081]),
  ('regression: asymmetric school contacts',
   (0.1, [[12, 2], [5, 6]], [300, 700], [10, 5], [280, 690], [1.0, 1.0]),
   [[0.041429, 0.020952], [11.363, 14.3067], 25.6697]),
  ('control: no infection',
   (0.3, [[4, 1], [1, 4]], [100, 100], [0, 0], [100, 100], [1.0, 1.0]),
   [[0.0, 0.0], [0.0, 0.0], 0.0]),
  ('regression: high pressure saturates',
   (2.0, [[20, 5], [5, 20]], [50, 50], [30, 25], [20, 25], [1.0, 1.0]),
   [[29.0, 26.0], [20.0, 25.0], 45.0]),
  ('control: single group', (0.1, [[7]], [1000], [50], [900], [0.9]), [[0.0315], [27.9081], 27.9081]),
  ('regression: reduced child susceptibility',
   (0.08, [[15, 4], [2, 7]], [400, 600], [2, 30], [390, 550], [0.5, 1.0]),
   [[0.011, 0.0288], [4.2665, 15.6141], 19.8806]),
  ('regression: unequal sizes',
   (0.04, [[6, 6], [1, 3]], [50, 950], [5, 5], [40, 900], [1.0, 1.3]),
   [[0.025263, 0.006021], [0.9979, 5.4027], 6.4005])],
 [('regression: three age bands',
   (0.05, [[10, 3, 1], [3, 8, 2], [1, 2, 4]], [200, 500, 300], [5, 20, 3], [180, 450, 290], [1.0, 0.8, 1.2]),
   [[0.019, 0.0166, 0.0087], [3.3877, 7.4083, 2.5121], 13.3081]),
  ('regression: asymmetric school contacts',
   (0.1, [[12, 2], [5, 6]], [300, 700], [10, 5], [280, 690], [1.0, 1.0]),
   [[0.041429, 0.020952], [11.363, 14.3067], 25.6697]),
  ('control: no infection',
   (0.3, [[4, 1], [1, 4]], [100, 100], [0, 0], [100, 100], [1.0, 1.0]),
   [[0.0, 0.0], [0.0, 0.0], 0.0]),
  ('regression: high pressure saturates',
   (2.0, [[20, 5], [5, 20]], [50, 50], [30, 25], [20, 25], [1.0, 1.0]),
   [[29.0, 26.0], [20.0, 25.0], 45.0]),
  ('control: single group', (0.1, [[7]], [1000], [50], [900], [0.9]), [[0.0315], [27.9081], 27.9081]),
  ('regression: reduced child susceptibility',
   (0.08, [[15, 4], [2, 7]], [400, 600], [2, 30], [390, 550], [0.5, 1.0]),
   [[0.011, 0.0288], [4.2665, 15.6141], 19.8806]),
  ('regression: unequal sizes',
   (0.04, [[6, 6], [1, 3]], [50, 950], [5, 5], [40, 900], [1.0, 1.3]),
   [[0.025263, 0.006021], [0.9979, 5.4027], 6.4005])],
 [('regression: three age bands',
   (0.05, [[10, 3, 1], [3, 8, 2], [1, 2, 4]], [200, 500, 300], [5, 20, 3], [180, 450, 290], [1.0, 0.8, 1.2]),
   [[0.019, 0.0166, 0.0087], [3.3877, 7.4083, 2.5121], 13.3081]),
  ('regression: asymmetric school contacts',
   (0.1, [[12, 2], [5, 6]], [300, 700], [10, 5], [280, 690], [1.0, 1.0]),
   [[0.041429, 0.020952], [11.363, 14.3067], 25.6697]),
  ('control: no infection',
   (0.3, [[4, 1], [1, 4]], [100, 100], [0, 0], [100, 100], [1.0, 1.0]),
   [[0.0, 0.0], [0.0, 0.0], 0.0]),
  ('regression: high pressure saturates',
   (2.0, [[20, 5], [5, 20]], [50, 50], [30, 25], [20, 25], [1.0, 1.0]),
   [[29.0, 26.0], [20.0, 25.0], 45.0]),
  ('control: single group', (0.1, [[7]], [1000], [50], [900], [0.9]), [[0.0315], [27.9081], 27.9081]),
  ('regression: reduced child susceptibility',
   (0.08, [[15, 4], [2, 7]], [400, 600], [2, 30], [390, 550], [0.5, 1.0]),
   [[0.011, 0.0288], [4.2665, 15.6141], 19.8806]),
  ('regression: unequal sizes',
   (0.04, [[6, 6], [1, 3]], [50, 950], [5, 5], [40, 900], [1.0, 1.3]),
   [[0.025263, 0.006021], [0.9979, 5.4027], 6.4005])],
 [('regression: three age bands',
   (0.05, [[10, 3, 1], [3, 8, 2], [1, 2, 4]], [200, 500, 300], [5, 20, 3], [180, 450, 290], [1.0, 0.8, 1.2]),
   [[0.019, 0.0166, 0.0087], [3.3877, 7.4083, 2.5121], 13.3081]),
  ('regression: asymmetric school contacts',
   (0.1, [[12, 2], [5, 6]], [300, 700], [10, 5], [280, 690], [1.0, 1.0]),
   [[0.041429, 0.020952], [11.363, 14.3067], 25.6697]),
  ('control: no infection',
   (0.3, [[4, 1], [1, 4]], [100, 100], [0, 0], [100, 100], [1.0, 1.0]),
   [[0.0, 0.0], [0.0, 0.0], 0.0]),
  ('regression: high pressure saturates',
   (2.0, [[20, 5], [5, 20]], [50, 50], [30, 25], [20, 25], [1.0, 1.0]),
   [[29.0, 26.0], [20.0, 25.0], 45.0]),
  ('control: single group', (0.1, [[7]], [1000], [50], [900], [0.9]), [[0.0315], [27.9081], 27.9081]),
  ('regression: reduced child susceptibility',
   (0.08, [[15, 4], [2, 7]], [400, 600], [2, 30], [390, 550], [0.5, 1.0]),
   [[0.011, 0.0288], [4.2665, 15.6141], 19.8806]),
  ('regression: unequal sizes',
   (0.04, [[6, 6], [1, 3]], [50, 950], [5, 5], [40, 900], [1.0, 1.3]),
   [[0.025263, 0.006021], [0.9979, 5.4027], 6.4005])],
 [('regression: three age bands',
   (0.05, [[10, 3, 1], [3, 8, 2], [1, 2, 4]], [200, 500, 300], [5, 20, 3], [180, 450, 290], [1.0, 0.8, 1.2]),
   [[0.019, 0.0166, 0.0087], [3.3877, 7.4083, 2.5121], 13.3081]),
  ('regression: asymmetric school contacts',
   (0.1, [[12, 2], [5, 6]], [300, 700], [10, 5], [280, 690], [1.0, 1.0]),
   [[0.041429, 0.020952], [11.363, 14.3067], 25.6697]),
  ('control: no infection',
   (0.3, [[4, 1], [1, 4]], [100, 100], [0, 0], [100, 100], [1.0, 1.0]),
   [[0.0, 0.0], [0.0, 0.0], 0.0]),
  ('regression: high pressure saturates',
   (2.0, [[20, 5], [5, 20]], [50, 50], [30, 25], [20, 25], [1.0, 1.0]),
   [[29.0, 26.0], [20.0, 25.0], 45.0]),
  ('control: single group', (0.1, [[7]], [1000], [50], [900], [0.9]), [[0.0315], [27.9081], 27.9081]),
  ('regression: reduced child susceptibility',
   (0.08, [[15, 4], [2, 7]], [400, 600], [2, 30], [390, 550], [0.5, 1.0]),
   [[0.011, 0.0288], [4.2665, 15.6141], 19.8806]),
  ('regression: unequal sizes',
   (0.04, [[6, 6], [1, 3]], [50, 950], [5, 5], [40, 900], [1.0, 1.3]),
   [[0.025263, 0.006021], [0.9979, 5.4027], 6.4005])]]
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
regression: three age bands[[0.00565, 0.00724, 0.00342], [1.0141, 3.2462, 0.9901], 5.2505][[0.019, 0.0166, 0.0087], [3.3877, 7.4083, 2.5121], 13.3081]Failed
regression: asymmetric school contacts[[0.013, 0.008], [3.6164, 5.498], 9.1144][[0.041429, 0.020952], [11.363, 14.3067], 25.6697]Failed
control: no infection[[0.0, 0.0], [0.0, 0.0], 0.0][[0.0, 0.0], [0.0, 0.0], 0.0]Passed
regression: high pressure saturates[[14.5, 13.0], [20.0, 24.9999], 44.9999][[29.0, 26.0], [20.0, 25.0], 45.0]Failed
control: single group[[0.0315], [27.9081], 27.9081][[0.0315], [27.9081], 27.9081]Passed
regression: reduced child susceptibility[[0.006, 0.01712], [2.333, 9.3359], 11.6689][[0.011, 0.0288], [4.2665, 15.6141], 19.8806]Failed
regression: unequal sizes[[0.0024, 0.00104], [0.0959, 0.9355], 1.0314][[0.025263, 0.006021], [0.9979, 5.4027], 6.4005]Failed

SHA-256 / fd14871efea6ab0086371120640008c6dd8a932a4d8ca1712c996e2dafb104de

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(beta, contacts, sizes, infected, susceptible, susceptibility):
    g = len(sizes)
    lam = []
    for a in range(g):
        pressure = 0.0
        for b in range(g):
            if sizes[b] > 0:
                pressure += contacts[a][b] * infected[b] / sizes[b]
        lam.append(beta * susceptibility[a] * pressure)
    new = [susceptible[a] * (1 - math.exp(-lam[a])) for a in range(g)]
    return [[round(x, 6) for x in lam], [round(x, 4) for x in new], round(sum(new), 4)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: three age bands',
   (0.05, [[10, 3, 1], [3, 8, 2], [1, 2, 4]], [200, 500, 300], [5, 20, 3], [180, 450, 290], [1.0, 0.8, 1.2]),
   [[0.019, 0.0166, 0.0087], [3.3877, 7.4083, 2.5121], 13.3081]),
  ('regression: asymmetric school contacts',
   (0.1, [[12, 2], [5, 6]], [300, 700], [10, 5], [280, 690], [1.0, 1.0]),
   [[0.041429, 0.020952], [11.363, 14.3067], 25.6697]),
  ('control: no infection',
   (0.3, [[4, 1], [1, 4]], [100, 100], [0, 0], [100, 100], [1.0, 1.0]),
   [[0.0, 0.0], [0.0, 0.0], 0.0]),
  ('regression: high pressure saturates',
   (2.0, [[20, 5], [5, 20]], [50, 50], [30, 25], [20, 25], [1.0, 1.0]),
   [[29.0, 26.0], [20.0, 25.0], 45.0]),
  ('control: single group', (0.1, [[7]], [1000], [50], [900], [0.9]), [[0.0315], [27.9081], 27.9081]),
  ('regression: reduced child susceptibility',
   (0.08, [[15, 4], [2, 7]], [400, 600], [2, 30], [390, 550], [0.5, 1.0]),
   [[0.011, 0.0288], [4.2665, 15.6141], 19.8806]),
  ('regression: unequal sizes',
   (0.04, [[6, 6], [1, 3]], [50, 950], [5, 5], [40, 900], [1.0, 1.3]),
   [[0.025263, 0.006021], [0.9979, 5.4027], 6.4005])],
 [('regression: three age bands',
   (0.05, [[10, 3, 1], [3, 8, 2], [1, 2, 4]], [200, 500, 300], [5, 20, 3], [180, 450, 290], [1.0, 0.8, 1.2]),
   [[0.019, 0.0166, 0.0087], [3.3877, 7.4083, 2.5121], 13.3081]),
  ('regression: asymmetric school contacts',
   (0.1, [[12, 2], [5, 6]], [300, 700], [10, 5], [280, 690], [1.0, 1.0]),
   [[0.041429, 0.020952], [11.363, 14.3067], 25.6697]),
  ('control: no infection',
   (0.3, [[4, 1], [1, 4]], [100, 100], [0, 0], [100, 100], [1.0, 1.0]),
   [[0.0, 0.0], [0.0, 0.0], 0.0]),
  ('regression: high pressure saturates',
   (2.0, [[20, 5], [5, 20]], [50, 50], [30, 25], [20, 25], [1.0, 1.0]),
   [[29.0, 26.0], [20.0, 25.0], 45.0]),
  ('control: single group', (0.1, [[7]], [1000], [50], [900], [0.9]), [[0.0315], [27.9081], 27.9081]),
  ('regression: reduced child susceptibility',
   (0.08, [[15, 4], [2, 7]], [400, 600], [2, 30], [390, 550], [0.5, 1.0]),
   [[0.011, 0.0288], [4.2665, 15.6141], 19.8806]),
  ('regression: unequal sizes',
   (0.04, [[6, 6], [1, 3]], [50, 950], [5, 5], [40, 900], [1.0, 1.3]),
   [[0.025263, 0.006021], [0.9979, 5.4027], 6.4005])],
 [('regression: three age bands',
   (0.05, [[10, 3, 1], [3, 8, 2], [1, 2, 4]], [200, 500, 300], [5, 20, 3], [180, 450, 290], [1.0, 0.8, 1.2]),
   [[0.019, 0.0166, 0.0087], [3.3877, 7.4083, 2.5121], 13.3081]),
  ('regression: asymmetric school contacts',
   (0.1, [[12, 2], [5, 6]], [300, 700], [10, 5], [280, 690], [1.0, 1.0]),
   [[0.041429, 0.020952], [11.363, 14.3067], 25.6697]),
  ('control: no infection',
   (0.3, [[4, 1], [1, 4]], [100, 100], [0, 0], [100, 100], [1.0, 1.0]),
   [[0.0, 0.0], [0.0, 0.0], 0.0]),
  ('regression: high pressure saturates',
   (2.0, [[20, 5], [5, 20]], [50, 50], [30, 25], [20, 25], [1.0, 1.0]),
   [[29.0, 26.0], [20.0, 25.0], 45.0]),
  ('control: single group', (0.1, [[7]], [1000], [50], [900], [0.9]), [[0.0315], [27.9081], 27.9081]),
  ('regression: reduced child susceptibility',
   (0.08, [[15, 4], [2, 7]], [400, 600], [2, 30], [390, 550], [0.5, 1.0]),
   [[0.011, 0.0288], [4.2665, 15.6141], 19.8806]),
  ('regression: unequal sizes',
   (0.04, [[6, 6], [1, 3]], [50, 950], [5, 5], [40, 900], [1.0, 1.3]),
   [[0.025263, 0.006021], [0.9979, 5.4027], 6.4005])],
 [('regression: three age bands',
   (0.05, [[10, 3, 1], [3, 8, 2], [1, 2, 4]], [200, 500, 300], [5, 20, 3], [180, 450, 290], [1.0, 0.8, 1.2]),
   [[0.019, 0.0166, 0.0087], [3.3877, 7.4083, 2.5121], 13.3081]),
  ('regression: asymmetric school contacts',
   (0.1, [[12, 2], [5, 6]], [300, 700], [10, 5], [280, 690], [1.0, 1.0]),
   [[0.041429, 0.020952], [11.363, 14.3067], 25.6697]),
  ('control: no infection',
   (0.3, [[4, 1], [1, 4]], [100, 100], [0, 0], [100, 100], [1.0, 1.0]),
   [[0.0, 0.0], [0.0, 0.0], 0.0]),
  ('regression: high pressure saturates',
   (2.0, [[20, 5], [5, 20]], [50, 50], [30, 25], [20, 25], [1.0, 1.0]),
   [[29.0, 26.0], [20.0, 25.0], 45.0]),
  ('control: single group', (0.1, [[7]], [1000], [50], [900], [0.9]), [[0.0315], [27.9081], 27.9081]),
  ('regression: reduced child susceptibility',
   (0.08, [[15, 4], [2, 7]], [400, 600], [2, 30], [390, 550], [0.5, 1.0]),
   [[0.011, 0.0288], [4.2665, 15.6141], 19.8806]),
  ('regression: unequal sizes',
   (0.04, [[6, 6], [1, 3]], [50, 950], [5, 5], [40, 900], [1.0, 1.3]),
   [[0.025263, 0.006021], [0.9979, 5.4027], 6.4005])],
 [('regression: three age bands',
   (0.05, [[10, 3, 1], [3, 8, 2], [1, 2, 4]], [200, 500, 300], [5, 20, 3], [180, 450, 290], [1.0, 0.8, 1.2]),
   [[0.019, 0.0166, 0.0087], [3.3877, 7.4083, 2.5121], 13.3081]),
  ('regression: asymmetric school contacts',
   (0.1, [[12, 2], [5, 6]], [300, 700], [10, 5], [280, 690], [1.0, 1.0]),
   [[0.041429, 0.020952], [11.363, 14.3067], 25.6697]),
  ('control: no infection',
   (0.3, [[4, 1], [1, 4]], [100, 100], [0, 0], [100, 100], [1.0, 1.0]),
   [[0.0, 0.0], [0.0, 0.0], 0.0]),
  ('regression: high pressure saturates',
   (2.0, [[20, 5], [5, 20]], [50, 50], [30, 25], [20, 25], [1.0, 1.0]),
   [[29.0, 26.0], [20.0, 25.0], 45.0]),
  ('control: single group', (0.1, [[7]], [1000], [50], [900], [0.9]), [[0.0315], [27.9081], 27.9081]),
  ('regression: reduced child susceptibility',
   (0.08, [[15, 4], [2, 7]], [400, 600], [2, 30], [390, 550], [0.5, 1.0]),
   [[0.011, 0.0288], [4.2665, 15.6141], 19.8806]),
  ('regression: unequal sizes',
   (0.04, [[6, 6], [1, 3]], [50, 950], [5, 5], [40, 900], [1.0, 1.3]),
   [[0.025263, 0.006021], [0.9979, 5.4027], 6.4005])]]
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
regression: three age bands[[0.019, 0.0166, 0.0087], [3.3877, 7.4083, 2.5121], 13.3081][[0.019, 0.0166, 0.0087], [3.3877, 7.4083, 2.5121], 13.3081]Passed
regression: asymmetric school contacts[[0.041429, 0.020952], [11.363, 14.3067], 25.6697][[0.041429, 0.020952], [11.363, 14.3067], 25.6697]Passed
control: no infection[[0.0, 0.0], [0.0, 0.0], 0.0][[0.0, 0.0], [0.0, 0.0], 0.0]Passed
regression: high pressure saturates[[29.0, 26.0], [20.0, 25.0], 45.0][[29.0, 26.0], [20.0, 25.0], 45.0]Passed
control: single group[[0.0315], [27.9081], 27.9081][[0.0315], [27.9081], 27.9081]Passed
regression: reduced child susceptibility[[0.011, 0.0288], [4.2665, 15.6141], 19.8806][[0.011, 0.0288], [4.2665, 15.6141], 19.8806]Passed
regression: unequal sizes[[0.025263, 0.006021], [0.9979, 5.4027], 6.4005][[0.025263, 0.006021], [0.9979, 5.4027], 6.4005]Passed

SHA-256 / 583941a7a400cbd8aef032786310a5b8ec2fbf9427b7c61628dc95c258842424

Verification & scope

Deterministic bounded teaching model with a stipulated contract; not a validated scientific or public-health modelling library. 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:30.779164+00:00.

Case digest / 863afda0a06bec6e815e8a4581c523b116c587f29457faecf58ff4d5351978c8