FAILURE MAP
← Case archive

FA-65101 / Epidemic compartment models / Open access

Age-structured force of infection: susceptibility multiplier · case 01

Groups with reduced susceptibility are infected at full rate.

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

ROOT CAUSE

The age-specific susceptibility factor is ignored.

THE FAILURE

The age-specific susceptibility factor is ignored.

Unsuccessful approach: Using mean susceptibility erases group differences.

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[b]
        lam.append(beta * 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]),
  ('control: 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: 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]),
  ('regression: 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]),
  ('control: 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]),
  ('control: 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]),
  ('regression: 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]),
  ('control: 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: 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]),
  ('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])],
 [('control: 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: 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]),
  ('regression: 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]),
  ('control: 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]),
  ('control: 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]),
  ('regression: 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.02075, 0.00725], [3.3877, 9.2413, 2.0949], 14.7239][[0.019, 0.0166, 0.0087], [3.3877, 7.4083, 2.5121], 13.3081]Failed
control: 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.014], [3.3558, 4.271, 0.0], 7.6268][[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
control: high pressure saturates[[29.0, 26.0], [20.0, 25.0], 45.0][[29.0, 26.0], [20.0, 25.0], 45.0]Passed
regression: single group[[0.035], [30.9551], 30.9551][[0.0315], [27.9081], 27.9081]Failed
regression: reduced child susceptibility[[0.022, 0.0288], [8.4863, 15.6141], 24.1004][[0.011, 0.0288], [4.2665, 15.6141], 19.8806]Failed

SHA-256 / 577bc0542dcee26b9b131893071a2ef362987d7f4633a8766e1148cd5bbd213c

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] / sizes[b]
        lam.append(beta * pressure * sum(susceptibility) / g)
    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]),
  ('control: 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: 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]),
  ('regression: 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]),
  ('control: 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]),
  ('control: 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]),
  ('regression: 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]),
  ('control: 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: 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]),
  ('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])],
 [('control: 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: 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]),
  ('regression: 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]),
  ('control: 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]),
  ('control: 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]),
  ('regression: 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.02075, 0.00725], [3.3877, 9.2413, 2.0949], 14.7239][[0.019, 0.0166, 0.0087], [3.3877, 7.4083, 2.5121], 13.3081]Failed
control: 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.044333, 0.053667, 0.016333], [3.9028, 4.9639, 0.0], 8.8668][[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
control: high pressure saturates[[29.0, 26.0], [20.0, 25.0], 45.0][[29.0, 26.0], [20.0, 25.0], 45.0]Passed
regression: single group[[0.0315], [27.9081], 27.9081][[0.0315], [27.9081], 27.9081]Passed
regression: reduced child susceptibility[[0.0165, 0.0216], [6.3822, 11.7526], 18.1348][[0.011, 0.0288], [4.2665, 15.6141], 19.8806]Failed

SHA-256 / 2b579f84aea0958730c92cdac75c6276bac9090280977b2ad2e06f09210e0bac

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 7 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

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

Case digest / d5753c179e8115e59f3652dfb5decb976675054c29dcc2504d4025884181252e