FAILURE MAP
← Case archive

FA-65111 / Epidemic compartment models / Open access

Age-structured force of infection: pressure accumulator reset · case 01

Later age groups accumulate the pressure computed for earlier groups.

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

ROOT CAUSE

The pressure accumulator is initialised once, outside the age-group loop.

VERIFIED REPAIR

Restore the pressure accumulator reset rule: `lam = [] / for a in range(g): / pressure = 0.0`.

Unsuccessful approach: Resetting inside the inner loop keeps only the last contact group.

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 = []
    pressure = 0.0
    for a in range(g):
        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]),
  ('regression: empty elderly band',
   (0.2, [[5, 1, 1], [1, 5, 1], [1, 1, 5]], [100, 100, 0], [3, 4, 0], [90, 95, 0], [1.0, 1.0, 1.5]),
   [[0.038, 0.046, 0.021], [3.3558, 4.271, 0.0], 7.6268]),
  ('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: 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]),
  ('regression: empty elderly band',
   (0.2, [[5, 1, 1], [1, 5, 1], [1, 1, 5]], [100, 100, 0], [3, 4, 0], [90, 95, 0], [1.0, 1.0, 1.5]),
   [[0.038, 0.046, 0.021], [3.3558, 4.271, 0.0], 7.6268]),
  ('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]),
  ('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: 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]),
  ('regression: empty elderly band',
   (0.2, [[5, 1, 1], [1, 5, 1], [1, 1, 5]], [100, 100, 0], [3, 4, 0], [90, 95, 0], [1.0, 1.0, 1.5]),
   [[0.038, 0.046, 0.021], [3.3558, 4.271, 0.0], 7.6268]),
  ('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.0318, 0.0564], [3.3877, 14.0849, 15.9033], 33.3759][[0.019, 0.0166, 0.0087], [3.3877, 7.4083, 2.5121], 13.3081]Failed
regression: asymmetric school contacts[[0.041429, 0.062381], [11.363, 41.7278], 53.0908][[0.041429, 0.020952], [11.363, 14.3067], 25.6697]Failed
regression: empty elderly band[[0.038, 0.084, 0.147], [3.3558, 7.654, 0.0], 11.0099][[0.038, 0.046, 0.021], [3.3558, 4.271, 0.0], 7.6268]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, 55.0], [20.0, 25.0], 45.0][[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.011, 0.0508], [4.2665, 27.2422], 31.5087][[0.011, 0.0288], [4.2665, 15.6141], 19.8806]Failed

SHA-256 / a56746ed0ce5e3141ebec0a6a6388a335953d268e5d3377ae6d7efc80fce6c6a

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):
        for b in range(g):
            pressure = 0.0
            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]),
  ('regression: empty elderly band',
   (0.2, [[5, 1, 1], [1, 5, 1], [1, 1, 5]], [100, 100, 0], [3, 4, 0], [90, 95, 0], [1.0, 1.0, 1.5]),
   [[0.038, 0.046, 0.021], [3.3558, 4.271, 0.0], 7.6268]),
  ('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: 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]),
  ('regression: empty elderly band',
   (0.2, [[5, 1, 1], [1, 5, 1], [1, 1, 5]], [100, 100, 0], [3, 4, 0], [90, 95, 0], [1.0, 1.0, 1.5]),
   [[0.038, 0.046, 0.021], [3.3558, 4.271, 0.0], 7.6268]),
  ('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]),
  ('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: 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]),
  ('regression: empty elderly band',
   (0.2, [[5, 1, 1], [1, 5, 1], [1, 1, 5]], [100, 100, 0], [3, 4, 0], [90, 95, 0], [1.0, 1.0, 1.5]),
   [[0.038, 0.046, 0.021], [3.3558, 4.271, 0.0], 7.6268]),
  ('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.0005, 0.0008, 0.0024], [0.09, 0.3599, 0.6952], 1.145][[0.019, 0.0166, 0.0087], [3.3877, 7.4083, 2.5121], 13.3081]Failed
regression: asymmetric school contacts[[0.001429, 0.004286], [0.3997, 2.9508], 3.3505][[0.041429, 0.020952], [11.363, 14.3067], 25.6697]Failed
regression: empty elderly band[[0.0, 0.0, 0.0], [0.0, 0.0, 0.0], 0.0][[0.038, 0.046, 0.021], [3.3558, 4.271, 0.0], 7.6268]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[[5.0, 20.0], [19.8652, 25.0], 44.8652][[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.008, 0.028], [3.1076, 15.1864], 18.294][[0.011, 0.0288], [4.2665, 15.6141], 19.8806]Failed

SHA-256 / 7ca2d47408642d93bc137eb1af00aff2b478d67a448f10fbe08461b2afd559b3

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]),
  ('regression: empty elderly band',
   (0.2, [[5, 1, 1], [1, 5, 1], [1, 1, 5]], [100, 100, 0], [3, 4, 0], [90, 95, 0], [1.0, 1.0, 1.5]),
   [[0.038, 0.046, 0.021], [3.3558, 4.271, 0.0], 7.6268]),
  ('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: 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]),
  ('regression: empty elderly band',
   (0.2, [[5, 1, 1], [1, 5, 1], [1, 1, 5]], [100, 100, 0], [3, 4, 0], [90, 95, 0], [1.0, 1.0, 1.5]),
   [[0.038, 0.046, 0.021], [3.3558, 4.271, 0.0], 7.6268]),
  ('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]),
  ('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: 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]),
  ('regression: empty elderly band',
   (0.2, [[5, 1, 1], [1, 5, 1], [1, 1, 5]], [100, 100, 0], [3, 4, 0], [90, 95, 0], [1.0, 1.0, 1.5]),
   [[0.038, 0.046, 0.021], [3.3558, 4.271, 0.0], 7.6268]),
  ('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
regression: empty elderly band[[0.038, 0.046, 0.021], [3.3558, 4.271, 0.0], 7.6268][[0.038, 0.046, 0.021], [3.3558, 4.271, 0.0], 7.6268]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

SHA-256 / 2bfc956da825b41a122a943ae5ef87007d27e3b0113d7bfcd14de879442874ac

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.799356+00:00.

Case digest / 44776643443a5e71380aff2e8d1f9f09703fd7ff04f94312176b4ca7e338195f