FAILURE MAP
← Case archive

FA-65311 / Epidemic compartment models / Open access

Two-patch SIR with daily migration: infected mobility · case 01

The epidemic never reaches an unseeded patch.

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

ROOT CAUSE

Infectious individuals are excluded from travel.

THE FAILURE

Infectious individuals are excluded from travel.

Unsuccessful approach: Excluding recovered travellers distorts patch immunity.

Case contract

Each day: local frequency-dependent SIR in each patch using the current patch size, then every compartment exchanges fraction travel of each patch simultaneously; return [S pair, I pair, R pair] rounded 3.

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, gamma, pops, i0s, travel, days):
    s = [float(pops[k] - i0s[k]) for k in range(2)]
    i = [float(x) for x in i0s]
    r = [0.0, 0.0]
    for _ in range(days):
        n = [s[k] + i[k] + r[k] for k in range(2)]
        inf = [beta * s[k] * i[k] / n[k] if n[k] > 0 else 0.0 for k in range(2)]
        rec = [gamma * i[k] for k in range(2)]
        for k in range(2):
            s[k] -= inf[k]
            i[k] += inf[k] - rec[k]
            r[k] += rec[k]
        for comp in (s, r):
            a, b = comp[0] * travel, comp[1] * travel
            comp[0] += b - a
            comp[1] += a - b
    return [[round(x, 3) for x in s], [round(x, 3) for x in i], [round(x, 3) for x in r]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: city and town',
   (0.5, 0.2, [1000, 200], [10, 0], 0.05, 10),
   [[611.99, 397.105], [74.874, 37.65], [52.607, 25.773]]),
  ('control: isolated patches',
   (0.4, 0.2, [500, 500], [5, 0], 0.0, 8),
   [[464.204, 500.0], [19.812, 0.0], [15.984, 0.0]]),
  ('regression: high mobility',
   (0.6, 0.25, [300, 900], [0, 9], 0.3, 6),
   [[557.673, 559.801], [25.331, 25.533], [15.766, 15.895]]),
  ('regression: both seeded',
   (0.3, 0.1, [800, 400], [4, 4], 0.1, 12),
   [[565.74, 538.406], [32.741, 32.614], [15.262, 15.237]]),
  ('control: boundary zero days',
   (0.5, 0.2, [100, 100], [1, 1], 0.1, 0),
   [[99.0, 99.0], [1.0, 1.0], [0.0, 0.0]]),
  ('regression: equal patches',
   (0.5, 0.2, [400, 400], [8, 0], 0.2, 5),
   [[377.224, 380.426], [15.15, 13.039], [7.625, 6.535]]),
  ('regression: tiny second patch',
   (0.7, 0.3, [2000, 50], [20, 0], 0.02, 9),
   [[1241.271, 264.206], [242.617, 45.744], [216.332, 39.829]])],
 [('regression: city and town',
   (0.5, 0.2, [1000, 200], [10, 0], 0.05, 10),
   [[611.99, 397.105], [74.874, 37.65], [52.607, 25.773]]),
  ('control: isolated patches',
   (0.4, 0.2, [500, 500], [5, 0], 0.0, 8),
   [[464.204, 500.0], [19.812, 0.0], [15.984, 0.0]]),
  ('regression: high mobility',
   (0.6, 0.25, [300, 900], [0, 9], 0.3, 6),
   [[557.673, 559.801], [25.331, 25.533], [15.766, 15.895]]),
  ('regression: both seeded',
   (0.3, 0.1, [800, 400], [4, 4], 0.1, 12),
   [[565.74, 538.406], [32.741, 32.614], [15.262, 15.237]]),
  ('control: boundary zero days',
   (0.5, 0.2, [100, 100], [1, 1], 0.1, 0),
   [[99.0, 99.0], [1.0, 1.0], [0.0, 0.0]]),
  ('regression: equal patches',
   (0.5, 0.2, [400, 400], [8, 0], 0.2, 5),
   [[377.224, 380.426], [15.15, 13.039], [7.625, 6.535]]),
  ('regression: tiny second patch',
   (0.7, 0.3, [2000, 50], [20, 0], 0.02, 9),
   [[1241.271, 264.206], [242.617, 45.744], [216.332, 39.829]])],
 [('regression: city and town',
   (0.5, 0.2, [1000, 200], [10, 0], 0.05, 10),
   [[611.99, 397.105], [74.874, 37.65], [52.607, 25.773]]),
  ('control: isolated patches',
   (0.4, 0.2, [500, 500], [5, 0], 0.0, 8),
   [[464.204, 500.0], [19.812, 0.0], [15.984, 0.0]]),
  ('regression: high mobility',
   (0.6, 0.25, [300, 900], [0, 9], 0.3, 6),
   [[557.673, 559.801], [25.331, 25.533], [15.766, 15.895]]),
  ('regression: both seeded',
   (0.3, 0.1, [800, 400], [4, 4], 0.1, 12),
   [[565.74, 538.406], [32.741, 32.614], [15.262, 15.237]]),
  ('control: boundary zero days',
   (0.5, 0.2, [100, 100], [1, 1], 0.1, 0),
   [[99.0, 99.0], [1.0, 1.0], [0.0, 0.0]]),
  ('regression: equal patches',
   (0.5, 0.2, [400, 400], [8, 0], 0.2, 5),
   [[377.224, 380.426], [15.15, 13.039], [7.625, 6.535]]),
  ('regression: tiny second patch',
   (0.7, 0.3, [2000, 50], [20, 0], 0.02, 9),
   [[1241.271, 264.206], [242.617, 45.744], [216.332, 39.829]])],
 [('regression: city and town',
   (0.5, 0.2, [1000, 200], [10, 0], 0.05, 10),
   [[611.99, 397.105], [74.874, 37.65], [52.607, 25.773]]),
  ('control: isolated patches',
   (0.4, 0.2, [500, 500], [5, 0], 0.0, 8),
   [[464.204, 500.0], [19.812, 0.0], [15.984, 0.0]]),
  ('regression: high mobility',
   (0.6, 0.25, [300, 900], [0, 9], 0.3, 6),
   [[557.673, 559.801], [25.331, 25.533], [15.766, 15.895]]),
  ('regression: both seeded',
   (0.3, 0.1, [800, 400], [4, 4], 0.1, 12),
   [[565.74, 538.406], [32.741, 32.614], [15.262, 15.237]]),
  ('control: boundary zero days',
   (0.5, 0.2, [100, 100], [1, 1], 0.1, 0),
   [[99.0, 99.0], [1.0, 1.0], [0.0, 0.0]]),
  ('regression: equal patches',
   (0.5, 0.2, [400, 400], [8, 0], 0.2, 5),
   [[377.224, 380.426], [15.15, 13.039], [7.625, 6.535]]),
  ('regression: tiny second patch',
   (0.7, 0.3, [2000, 50], [20, 0], 0.02, 9),
   [[1241.271, 264.206], [242.617, 45.744], [216.332, 39.829]])],
 [('regression: city and town',
   (0.5, 0.2, [1000, 200], [10, 0], 0.05, 10),
   [[611.99, 397.105], [74.874, 37.65], [52.607, 25.773]]),
  ('control: isolated patches',
   (0.4, 0.2, [500, 500], [5, 0], 0.0, 8),
   [[464.204, 500.0], [19.812, 0.0], [15.984, 0.0]]),
  ('regression: high mobility',
   (0.6, 0.25, [300, 900], [0, 9], 0.3, 6),
   [[557.673, 559.801], [25.331, 25.533], [15.766, 15.895]]),
  ('regression: both seeded',
   (0.3, 0.1, [800, 400], [4, 4], 0.1, 12),
   [[565.74, 538.406], [32.741, 32.614], [15.262, 15.237]]),
  ('control: boundary zero days',
   (0.5, 0.2, [100, 100], [1, 1], 0.1, 0),
   [[99.0, 99.0], [1.0, 1.0], [0.0, 0.0]]),
  ('regression: equal patches',
   (0.5, 0.2, [400, 400], [8, 0], 0.2, 5),
   [[377.224, 380.426], [15.15, 13.039], [7.625, 6.535]]),
  ('regression: tiny second patch',
   (0.7, 0.3, [2000, 50], [20, 0], 0.02, 9),
   [[1241.271, 264.206], [242.617, 45.744], [216.332, 39.829]])]]
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: city and town[[587.893, 430.529], [104.983, 0.0], [65.042, 11.552]][[611.99, 397.105], [74.874, 37.65], [52.607, 25.773]]Failed
control: isolated patches[[464.204, 500.0], [19.812, 0.0], [15.984, 0.0]][[464.204, 500.0], [19.812, 0.0], [15.984, 0.0]]Passed
regression: high mobility[[564.757, 555.204], [0.0, 48.808], [12.924, 18.307]][[557.673, 559.801], [25.331, 25.533], [15.766, 15.895]]Failed
regression: both seeded[[565.68, 538.465], [32.893, 32.463], [15.285, 15.215]][[565.74, 538.406], [32.741, 32.614], [15.262, 15.237]]Failed
control: boundary zero days[[99.0, 99.0], [1.0, 1.0], [0.0, 0.0]][[99.0, 99.0], [1.0, 1.0], [0.0, 0.0]]Passed
regression: equal patches[[373.353, 385.239], [27.368, 0.0], [9.412, 4.628]][[377.224, 380.426], [15.15, 13.039], [7.625, 6.535]]Failed
regression: tiny second patch[[1205.061, 314.427], [277.356, 0.0], [237.92, 15.236]][[1241.271, 264.206], [242.617, 45.744], [216.332, 39.829]]Failed

SHA-256 / 1f3cb3866d668d0fe5fea58f6346fd385853c92aec4dfb23441797c68f7bab6a

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(beta, gamma, pops, i0s, travel, days):
    s = [float(pops[k] - i0s[k]) for k in range(2)]
    i = [float(x) for x in i0s]
    r = [0.0, 0.0]
    for _ in range(days):
        n = [s[k] + i[k] + r[k] for k in range(2)]
        inf = [beta * s[k] * i[k] / n[k] if n[k] > 0 else 0.0 for k in range(2)]
        rec = [gamma * i[k] for k in range(2)]
        for k in range(2):
            s[k] -= inf[k]
            i[k] += inf[k] - rec[k]
            r[k] += rec[k]
        for comp in (s, i):
            a, b = comp[0] * travel, comp[1] * travel
            comp[0] += b - a
            comp[1] += a - b
    return [[round(x, 3) for x in s], [round(x, 3) for x in i], [round(x, 3) for x in r]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: city and town',
   (0.5, 0.2, [1000, 200], [10, 0], 0.05, 10),
   [[611.99, 397.105], [74.874, 37.65], [52.607, 25.773]]),
  ('control: isolated patches',
   (0.4, 0.2, [500, 500], [5, 0], 0.0, 8),
   [[464.204, 500.0], [19.812, 0.0], [15.984, 0.0]]),
  ('regression: high mobility',
   (0.6, 0.25, [300, 900], [0, 9], 0.3, 6),
   [[557.673, 559.801], [25.331, 25.533], [15.766, 15.895]]),
  ('regression: both seeded',
   (0.3, 0.1, [800, 400], [4, 4], 0.1, 12),
   [[565.74, 538.406], [32.741, 32.614], [15.262, 15.237]]),
  ('control: boundary zero days',
   (0.5, 0.2, [100, 100], [1, 1], 0.1, 0),
   [[99.0, 99.0], [1.0, 1.0], [0.0, 0.0]]),
  ('regression: equal patches',
   (0.5, 0.2, [400, 400], [8, 0], 0.2, 5),
   [[377.224, 380.426], [15.15, 13.039], [7.625, 6.535]]),
  ('regression: tiny second patch',
   (0.7, 0.3, [2000, 50], [20, 0], 0.02, 9),
   [[1241.271, 264.206], [242.617, 45.744], [216.332, 39.829]])],
 [('regression: city and town',
   (0.5, 0.2, [1000, 200], [10, 0], 0.05, 10),
   [[611.99, 397.105], [74.874, 37.65], [52.607, 25.773]]),
  ('control: isolated patches',
   (0.4, 0.2, [500, 500], [5, 0], 0.0, 8),
   [[464.204, 500.0], [19.812, 0.0], [15.984, 0.0]]),
  ('regression: high mobility',
   (0.6, 0.25, [300, 900], [0, 9], 0.3, 6),
   [[557.673, 559.801], [25.331, 25.533], [15.766, 15.895]]),
  ('regression: both seeded',
   (0.3, 0.1, [800, 400], [4, 4], 0.1, 12),
   [[565.74, 538.406], [32.741, 32.614], [15.262, 15.237]]),
  ('control: boundary zero days',
   (0.5, 0.2, [100, 100], [1, 1], 0.1, 0),
   [[99.0, 99.0], [1.0, 1.0], [0.0, 0.0]]),
  ('regression: equal patches',
   (0.5, 0.2, [400, 400], [8, 0], 0.2, 5),
   [[377.224, 380.426], [15.15, 13.039], [7.625, 6.535]]),
  ('regression: tiny second patch',
   (0.7, 0.3, [2000, 50], [20, 0], 0.02, 9),
   [[1241.271, 264.206], [242.617, 45.744], [216.332, 39.829]])],
 [('regression: city and town',
   (0.5, 0.2, [1000, 200], [10, 0], 0.05, 10),
   [[611.99, 397.105], [74.874, 37.65], [52.607, 25.773]]),
  ('control: isolated patches',
   (0.4, 0.2, [500, 500], [5, 0], 0.0, 8),
   [[464.204, 500.0], [19.812, 0.0], [15.984, 0.0]]),
  ('regression: high mobility',
   (0.6, 0.25, [300, 900], [0, 9], 0.3, 6),
   [[557.673, 559.801], [25.331, 25.533], [15.766, 15.895]]),
  ('regression: both seeded',
   (0.3, 0.1, [800, 400], [4, 4], 0.1, 12),
   [[565.74, 538.406], [32.741, 32.614], [15.262, 15.237]]),
  ('control: boundary zero days',
   (0.5, 0.2, [100, 100], [1, 1], 0.1, 0),
   [[99.0, 99.0], [1.0, 1.0], [0.0, 0.0]]),
  ('regression: equal patches',
   (0.5, 0.2, [400, 400], [8, 0], 0.2, 5),
   [[377.224, 380.426], [15.15, 13.039], [7.625, 6.535]]),
  ('regression: tiny second patch',
   (0.7, 0.3, [2000, 50], [20, 0], 0.02, 9),
   [[1241.271, 264.206], [242.617, 45.744], [216.332, 39.829]])],
 [('regression: city and town',
   (0.5, 0.2, [1000, 200], [10, 0], 0.05, 10),
   [[611.99, 397.105], [74.874, 37.65], [52.607, 25.773]]),
  ('control: isolated patches',
   (0.4, 0.2, [500, 500], [5, 0], 0.0, 8),
   [[464.204, 500.0], [19.812, 0.0], [15.984, 0.0]]),
  ('regression: high mobility',
   (0.6, 0.25, [300, 900], [0, 9], 0.3, 6),
   [[557.673, 559.801], [25.331, 25.533], [15.766, 15.895]]),
  ('regression: both seeded',
   (0.3, 0.1, [800, 400], [4, 4], 0.1, 12),
   [[565.74, 538.406], [32.741, 32.614], [15.262, 15.237]]),
  ('control: boundary zero days',
   (0.5, 0.2, [100, 100], [1, 1], 0.1, 0),
   [[99.0, 99.0], [1.0, 1.0], [0.0, 0.0]]),
  ('regression: equal patches',
   (0.5, 0.2, [400, 400], [8, 0], 0.2, 5),
   [[377.224, 380.426], [15.15, 13.039], [7.625, 6.535]]),
  ('regression: tiny second patch',
   (0.7, 0.3, [2000, 50], [20, 0], 0.02, 9),
   [[1241.271, 264.206], [242.617, 45.744], [216.332, 39.829]])],
 [('regression: city and town',
   (0.5, 0.2, [1000, 200], [10, 0], 0.05, 10),
   [[611.99, 397.105], [74.874, 37.65], [52.607, 25.773]]),
  ('control: isolated patches',
   (0.4, 0.2, [500, 500], [5, 0], 0.0, 8),
   [[464.204, 500.0], [19.812, 0.0], [15.984, 0.0]]),
  ('regression: high mobility',
   (0.6, 0.25, [300, 900], [0, 9], 0.3, 6),
   [[557.673, 559.801], [25.331, 25.533], [15.766, 15.895]]),
  ('regression: both seeded',
   (0.3, 0.1, [800, 400], [4, 4], 0.1, 12),
   [[565.74, 538.406], [32.741, 32.614], [15.262, 15.237]]),
  ('control: boundary zero days',
   (0.5, 0.2, [100, 100], [1, 1], 0.1, 0),
   [[99.0, 99.0], [1.0, 1.0], [0.0, 0.0]]),
  ('regression: equal patches',
   (0.5, 0.2, [400, 400], [8, 0], 0.2, 5),
   [[377.224, 380.426], [15.15, 13.039], [7.625, 6.535]]),
  ('regression: tiny second patch',
   (0.7, 0.3, [2000, 50], [20, 0], 0.02, 9),
   [[1241.271, 264.206], [242.617, 45.744], [216.332, 39.829]])]]
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: city and town[[612.65, 396.679], [74.336, 38.015], [59.609, 18.711]][[611.99, 397.105], [74.874, 37.65], [52.607, 25.773]]Failed
control: isolated patches[[464.204, 500.0], [19.812, 0.0], [15.984, 0.0]][[464.204, 500.0], [19.812, 0.0], [15.984, 0.0]]Passed
regression: high mobility[[557.654, 559.836], [25.351, 25.503], [13.47, 18.187]][[557.673, 559.801], [25.331, 25.533], [15.766, 15.895]]Failed
regression: both seeded[[565.741, 538.405], [32.741, 32.614], [15.276, 15.223]][[565.74, 538.406], [32.741, 32.614], [15.262, 15.237]]Failed
control: boundary zero days[[99.0, 99.0], [1.0, 1.0], [0.0, 0.0]][[99.0, 99.0], [1.0, 1.0], [0.0, 0.0]]Passed
regression: equal patches[[377.261, 380.417], [15.117, 13.049], [9.617, 4.539]][[377.224, 380.426], [15.15, 13.039], [7.625, 6.535]]Failed
regression: tiny second patch[[1243.051, 262.597], [241.23, 47.027], [228.727, 27.368]][[1241.271, 264.206], [242.617, 45.744], [216.332, 39.829]]Failed

SHA-256 / fb9ad9df9ae3c4eb8f0d47d59c549f2054018bf78aac81f42b5cbb8f172e4ae7

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

Case digest / 427014065bc6e344406835eadd96aee7bffa89f6d9487eedf0e978a95ee8e729