FA-65106 / Epidemic compartment models / Open access
Age-structured force of infection: susceptible base · case 01
Expected infections include people who are already infected or immune.
ROOT CAUSE
The infection probability is applied to the whole age band instead of its susceptibles.
THE FAILURE
The infection probability is applied to the whole age band instead of its susceptibles.
Unsuccessful approach: Subtracting current infectives still counts recovered and vaccinated members as susceptible.
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 * susceptibility[a] * pressure)
new = [sizes[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]),
('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]),
('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]),
('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]),
('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]),
('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]),
('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]),
('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]),
('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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: three age bands | [[0.019, 0.0166, 0.0087], [3.7641, 8.2315, 2.5987], 14.5943] | [[0.019, 0.0166, 0.0087], [3.3877, 7.4083, 2.5121], 13.3081] | Failed |
| regression: asymmetric school contacts | [[0.041429, 0.020952], [12.1746, 14.5141], 26.6887] | [[0.041429, 0.020952], [11.363, 14.3067], 25.6697] | Failed |
| regression: empty elderly band | [[0.038, 0.046, 0.021], [3.7287, 4.4958, 0.0], 8.2245] | [[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, 26.0], [50.0, 50.0], 100.0] | [[29.0, 26.0], [20.0, 25.0], 45.0] | Failed |
| regression: single group | [[0.0315], [31.009], 31.009] | [[0.0315], [27.9081], 27.9081] | Failed |
| regression: reduced child susceptibility | [[0.011, 0.0288], [4.3759, 17.0335], 21.4094] | [[0.011, 0.0288], [4.2665, 15.6141], 19.8806] | Failed |
SHA-256 / 62c78f320ffba6572ba5ab72305521afc8fe5ac7e528a82f6826fd1968fcfb9c
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 * susceptibility[a] * pressure)
new = [(sizes[a] - infected[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]),
('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]),
('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]),
('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]),
('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]),
('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]),
('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]),
('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]),
('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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: three age bands | [[0.019, 0.0166, 0.0087], [3.67, 7.9022, 2.5727], 14.1449] | [[0.019, 0.0166, 0.0087], [3.3877, 7.4083, 2.5121], 13.3081] | Failed |
| regression: asymmetric school contacts | [[0.041429, 0.020952], [11.7688, 14.4104], 26.1792] | [[0.041429, 0.020952], [11.363, 14.3067], 25.6697] | Failed |
| regression: empty elderly band | [[0.038, 0.046, 0.021], [3.6168, 4.316, 0.0], 7.9328] | [[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, 26.0], [20.0, 25.0], 45.0] | [[29.0, 26.0], [20.0, 25.0], 45.0] | Passed |
| regression: single group | [[0.0315], [29.4586], 29.4586] | [[0.0315], [27.9081], 27.9081] | Failed |
| regression: reduced child susceptibility | [[0.011, 0.0288], [4.354, 16.1819], 20.5359] | [[0.011, 0.0288], [4.2665, 15.6141], 19.8806] | Failed |
SHA-256 / ce489879078f73e60a5e83d40d2154ae744fb4948bcfc64e471f013fead4be1a
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.798942+00:00.
Case digest / 55f2befb608062f533093e92f2f1ae55dab922132967455f809a5b05ab49e481