FA-65091 / Epidemic compartment models / Open access
Age-structured force of infection: contact orientation · case 01
Pressure on children uses the contacts adults report making with children.
ROOT CAUSE
The contact matrix is read transposed.
VERIFIED REPAIR
Restore the contact orientation rule: `contacts[a][b] * infected[b] / sizes[b]`.
Unsuccessful approach: Symmetrising the matrix averages away reciprocal asymmetry required by the contract.
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[b][a] * 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 = [[('control: 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: 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]),
('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])],
[('control: 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]),
('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]),
('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])],
[('control: 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: 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])],
[('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: 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]),
('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])],
[('control: 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: 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: 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| control: 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.043571, 0.010952], [11.938, 7.5159], 19.4539] | [[0.041429, 0.020952], [11.363, 14.3067], 25.6697] | Failed |
| control: 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 |
| 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 |
| control: single group | [[0.0315], [27.9081], 27.9081] | [[0.0315], [27.9081], 27.9081] | Passed |
| regression: reduced child susceptibility | [[0.007, 0.0296], [2.7205, 16.0414], 18.7619] | [[0.011, 0.0288], [4.2665, 15.6141], 19.8806] | Failed |
SHA-256 / 4c840f14196db361d4338bd2079a91a14417eacd6eb302140a8ac4d3ffbed448
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] + contacts[b][a]) / 2 * 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 = [[('control: 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: 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]),
('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])],
[('control: 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]),
('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]),
('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])],
[('control: 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: 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])],
[('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: 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]),
('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])],
[('control: 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: 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: 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| control: 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.0425, 0.015952], [11.6507, 10.9198], 22.5705] | [[0.041429, 0.020952], [11.363, 14.3067], 25.6697] | Failed |
| control: 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 |
| 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 |
| control: single group | [[0.0315], [27.9081], 27.9081] | [[0.0315], [27.9081], 27.9081] | Passed |
| regression: reduced child susceptibility | [[0.009, 0.0292], [3.4943, 15.8278], 19.322] | [[0.011, 0.0288], [4.2665, 15.6141], 19.8806] | Failed |
SHA-256 / e3e3d849d99333af507747391080808d9375fa1522ca2b2583cfa867004a253a
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 = [[('control: 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: 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]),
('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])],
[('control: 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]),
('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]),
('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])],
[('control: 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: 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])],
[('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: 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]),
('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])],
[('control: 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: 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: 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| control: 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: 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 |
| 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 |
| 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 / f9c141808246641c1c69d373b0c8cfd5bcc3ba744c82682bfba834a5f13f6914
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.741683+00:00.
Case digest / 8d15b25b8dc7998bd83343142d88fbed77fd1e81dad506afa81a41d93de2e11f