FAILURE MAP
← Case archive

FA-65736 / Ecological population dynamics / Open access

Discrete delayed logistic (Hutchinson) with lag: pre-history · case 01

Early growth explodes because the population is assumed absent before time 0.

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

ROOT CAUSE

Densities before the series are taken as zero.

THE FAILURE

Densities before the series are taken as zero.

Unsuccessful approach: Assuming the population was at capacity suppresses early growth.

Case contract

hist[0]=N0; N[t+1] = max(0, N[t] + r*N[t]*(1 - N[t-lag]/K)) where values before time 0 equal N0; return [history rounded 4, overshoot max(0, max(history)-K) rounded 4].

Why this case matters

Population projections set harvest quotas, conservation status and pest-control timing; a wrong update order, boundary or rate conversion silently changes management advice.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(n0, r, k, lag, steps):
    hist = [float(n0)]
    for t in range(steps):
        past = hist[t - lag] if t - lag >= 0 else 0.0
        now = hist[t]
        hist.append(max(0.0, now + r * now * (1 - past / k)))
    over = max(0.0, max(hist) - k)
    return [[round(x, 4) for x in hist], round(over, 4)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: daphnia with 2 step lag',
   (10, 0.8, 100, 2, 8),
   [[10.0, 17.2, 29.584, 50.8845, 84.5904, 132.2425, 184.2037, 206.9118, 153.541], 106.9118]),
  ('control: no lag', (10, 0.5, 100, 0, 6), [[10.0, 14.5, 20.6988, 28.9059, 39.1811, 51.0959, 63.5899], 0.0]),
  ('regression: long lag oscillation',
   (50, 0.6, 100, 3, 10),
   [[50.0, 65.0, 84.5, 109.85, 142.805, 172.794, 188.8639, 177.702, 132.0628, 74.3825, 34.723], 88.8639]),
  ('regression: start above capacity',
   (150, 0.3, 100, 1, 5),
   [[150.0, 127.5, 108.375, 99.4341, 96.9358, 97.1004], 50.0]),
  ('regression: one-step lag',
   (20, 1.2, 200, 1, 7),
   [[20.0, 41.6, 86.528, 168.7642, 283.6643, 336.8272, 167.7447, 30.0325], 136.8272]),
  ('control: zero steps', (30, 0.5, 100, 2, 0), [[30.0], 0.0]),
  ('regression: crash to zero', (180, 2.5, 100, 1, 4), [[180.0, 0.0, 0.0, 0.0, 0.0], 80.0])],
 [('regression: daphnia with 2 step lag',
   (10, 0.8, 100, 2, 8),
   [[10.0, 17.2, 29.584, 50.8845, 84.5904, 132.2425, 184.2037, 206.9118, 153.541], 106.9118]),
  ('control: no lag', (10, 0.5, 100, 0, 6), [[10.0, 14.5, 20.6988, 28.9059, 39.1811, 51.0959, 63.5899], 0.0]),
  ('regression: long lag oscillation',
   (50, 0.6, 100, 3, 10),
   [[50.0, 65.0, 84.5, 109.85, 142.805, 172.794, 188.8639, 177.702, 132.0628, 74.3825, 34.723], 88.8639]),
  ('regression: start above capacity',
   (150, 0.3, 100, 1, 5),
   [[150.0, 127.5, 108.375, 99.4341, 96.9358, 97.1004], 50.0]),
  ('regression: one-step lag',
   (20, 1.2, 200, 1, 7),
   [[20.0, 41.6, 86.528, 168.7642, 283.6643, 336.8272, 167.7447, 30.0325], 136.8272]),
  ('control: zero steps', (30, 0.5, 100, 2, 0), [[30.0], 0.0]),
  ('regression: crash to zero', (180, 2.5, 100, 1, 4), [[180.0, 0.0, 0.0, 0.0, 0.0], 80.0])],
 [('regression: daphnia with 2 step lag',
   (10, 0.8, 100, 2, 8),
   [[10.0, 17.2, 29.584, 50.8845, 84.5904, 132.2425, 184.2037, 206.9118, 153.541], 106.9118]),
  ('control: no lag', (10, 0.5, 100, 0, 6), [[10.0, 14.5, 20.6988, 28.9059, 39.1811, 51.0959, 63.5899], 0.0]),
  ('regression: long lag oscillation',
   (50, 0.6, 100, 3, 10),
   [[50.0, 65.0, 84.5, 109.85, 142.805, 172.794, 188.8639, 177.702, 132.0628, 74.3825, 34.723], 88.8639]),
  ('regression: start above capacity',
   (150, 0.3, 100, 1, 5),
   [[150.0, 127.5, 108.375, 99.4341, 96.9358, 97.1004], 50.0]),
  ('regression: one-step lag',
   (20, 1.2, 200, 1, 7),
   [[20.0, 41.6, 86.528, 168.7642, 283.6643, 336.8272, 167.7447, 30.0325], 136.8272]),
  ('control: zero steps', (30, 0.5, 100, 2, 0), [[30.0], 0.0]),
  ('regression: crash to zero', (180, 2.5, 100, 1, 4), [[180.0, 0.0, 0.0, 0.0, 0.0], 80.0])],
 [('regression: daphnia with 2 step lag',
   (10, 0.8, 100, 2, 8),
   [[10.0, 17.2, 29.584, 50.8845, 84.5904, 132.2425, 184.2037, 206.9118, 153.541], 106.9118]),
  ('control: no lag', (10, 0.5, 100, 0, 6), [[10.0, 14.5, 20.6988, 28.9059, 39.1811, 51.0959, 63.5899], 0.0]),
  ('regression: long lag oscillation',
   (50, 0.6, 100, 3, 10),
   [[50.0, 65.0, 84.5, 109.85, 142.805, 172.794, 188.8639, 177.702, 132.0628, 74.3825, 34.723], 88.8639]),
  ('regression: start above capacity',
   (150, 0.3, 100, 1, 5),
   [[150.0, 127.5, 108.375, 99.4341, 96.9358, 97.1004], 50.0]),
  ('regression: one-step lag',
   (20, 1.2, 200, 1, 7),
   [[20.0, 41.6, 86.528, 168.7642, 283.6643, 336.8272, 167.7447, 30.0325], 136.8272]),
  ('control: zero steps', (30, 0.5, 100, 2, 0), [[30.0], 0.0]),
  ('regression: crash to zero', (180, 2.5, 100, 1, 4), [[180.0, 0.0, 0.0, 0.0, 0.0], 80.0])],
 [('regression: daphnia with 2 step lag',
   (10, 0.8, 100, 2, 8),
   [[10.0, 17.2, 29.584, 50.8845, 84.5904, 132.2425, 184.2037, 206.9118, 153.541], 106.9118]),
  ('control: no lag', (10, 0.5, 100, 0, 6), [[10.0, 14.5, 20.6988, 28.9059, 39.1811, 51.0959, 63.5899], 0.0]),
  ('regression: long lag oscillation',
   (50, 0.6, 100, 3, 10),
   [[50.0, 65.0, 84.5, 109.85, 142.805, 172.794, 188.8639, 177.702, 132.0628, 74.3825, 34.723], 88.8639]),
  ('regression: start above capacity',
   (150, 0.3, 100, 1, 5),
   [[150.0, 127.5, 108.375, 99.4341, 96.9358, 97.1004], 50.0]),
  ('regression: one-step lag',
   (20, 1.2, 200, 1, 7),
   [[20.0, 41.6, 86.528, 168.7642, 283.6643, 336.8272, 167.7447, 30.0325], 136.8272]),
  ('control: zero steps', (30, 0.5, 100, 2, 0), [[30.0], 0.0]),
  ('regression: crash to zero', (180, 2.5, 100, 1, 4), [[180.0, 0.0, 0.0, 0.0, 0.0], 80.0])]]
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: daphnia with 2 step lag[[10.0, 18.0, 32.4, 55.728, 92.2856, 142.1936, 192.5552, 204.4388, 135.4307], 104.4388][[10.0, 17.2, 29.584, 50.8845, 84.5904, 132.2425, 184.2037, 206.9118, 153.541], 106.9118]Failed
control: no lag[[10.0, 14.5, 20.6988, 28.9059, 39.1811, 51.0959, 63.5899], 0.0][[10.0, 14.5, 20.6988, 28.9059, 39.1811, 51.0959, 63.5899], 0.0]Passed
regression: long lag oscillation[[50.0, 80.0, 128.0, 204.8, 266.24, 298.1888, 248.0931, 92.0922, 0.2358, 0.0, 0.0], 198.1888][[50.0, 65.0, 84.5, 109.85, 142.805, 172.794, 188.8639, 177.702, 132.0628, 74.3825, 34.723], 88.8639]Failed
regression: start above capacity[[150.0, 195.0, 165.75, 118.5113, 95.1349, 89.8517], 95.0][[150.0, 127.5, 108.375, 99.4341, 96.9358, 97.1004], 50.0]Failed
regression: one-step lag[[20.0, 44.0, 91.52, 177.1827, 292.5074, 332.5527, 147.9712, 30.2873], 132.5527][[20.0, 41.6, 86.528, 168.7642, 283.6643, 336.8272, 167.7447, 30.0325], 136.8272]Failed
control: zero steps[[30.0], 0.0][[30.0], 0.0]Passed
regression: crash to zero[[180.0, 630.0, 0.0, 0.0, 0.0], 530.0][[180.0, 0.0, 0.0, 0.0, 0.0], 80.0]Failed

SHA-256 / 68fac43ee69763433df035d4cc15dd62ab5e51aead6bcb00e39ae21cec609cea

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(n0, r, k, lag, steps):
    hist = [float(n0)]
    for t in range(steps):
        past = hist[t - lag] if t - lag >= 0 else float(k)
        now = hist[t]
        hist.append(max(0.0, now + r * now * (1 - past / k)))
    over = max(0.0, max(hist) - k)
    return [[round(x, 4) for x in hist], round(over, 4)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: daphnia with 2 step lag',
   (10, 0.8, 100, 2, 8),
   [[10.0, 17.2, 29.584, 50.8845, 84.5904, 132.2425, 184.2037, 206.9118, 153.541], 106.9118]),
  ('control: no lag', (10, 0.5, 100, 0, 6), [[10.0, 14.5, 20.6988, 28.9059, 39.1811, 51.0959, 63.5899], 0.0]),
  ('regression: long lag oscillation',
   (50, 0.6, 100, 3, 10),
   [[50.0, 65.0, 84.5, 109.85, 142.805, 172.794, 188.8639, 177.702, 132.0628, 74.3825, 34.723], 88.8639]),
  ('regression: start above capacity',
   (150, 0.3, 100, 1, 5),
   [[150.0, 127.5, 108.375, 99.4341, 96.9358, 97.1004], 50.0]),
  ('regression: one-step lag',
   (20, 1.2, 200, 1, 7),
   [[20.0, 41.6, 86.528, 168.7642, 283.6643, 336.8272, 167.7447, 30.0325], 136.8272]),
  ('control: zero steps', (30, 0.5, 100, 2, 0), [[30.0], 0.0]),
  ('regression: crash to zero', (180, 2.5, 100, 1, 4), [[180.0, 0.0, 0.0, 0.0, 0.0], 80.0])],
 [('regression: daphnia with 2 step lag',
   (10, 0.8, 100, 2, 8),
   [[10.0, 17.2, 29.584, 50.8845, 84.5904, 132.2425, 184.2037, 206.9118, 153.541], 106.9118]),
  ('control: no lag', (10, 0.5, 100, 0, 6), [[10.0, 14.5, 20.6988, 28.9059, 39.1811, 51.0959, 63.5899], 0.0]),
  ('regression: long lag oscillation',
   (50, 0.6, 100, 3, 10),
   [[50.0, 65.0, 84.5, 109.85, 142.805, 172.794, 188.8639, 177.702, 132.0628, 74.3825, 34.723], 88.8639]),
  ('regression: start above capacity',
   (150, 0.3, 100, 1, 5),
   [[150.0, 127.5, 108.375, 99.4341, 96.9358, 97.1004], 50.0]),
  ('regression: one-step lag',
   (20, 1.2, 200, 1, 7),
   [[20.0, 41.6, 86.528, 168.7642, 283.6643, 336.8272, 167.7447, 30.0325], 136.8272]),
  ('control: zero steps', (30, 0.5, 100, 2, 0), [[30.0], 0.0]),
  ('regression: crash to zero', (180, 2.5, 100, 1, 4), [[180.0, 0.0, 0.0, 0.0, 0.0], 80.0])],
 [('regression: daphnia with 2 step lag',
   (10, 0.8, 100, 2, 8),
   [[10.0, 17.2, 29.584, 50.8845, 84.5904, 132.2425, 184.2037, 206.9118, 153.541], 106.9118]),
  ('control: no lag', (10, 0.5, 100, 0, 6), [[10.0, 14.5, 20.6988, 28.9059, 39.1811, 51.0959, 63.5899], 0.0]),
  ('regression: long lag oscillation',
   (50, 0.6, 100, 3, 10),
   [[50.0, 65.0, 84.5, 109.85, 142.805, 172.794, 188.8639, 177.702, 132.0628, 74.3825, 34.723], 88.8639]),
  ('regression: start above capacity',
   (150, 0.3, 100, 1, 5),
   [[150.0, 127.5, 108.375, 99.4341, 96.9358, 97.1004], 50.0]),
  ('regression: one-step lag',
   (20, 1.2, 200, 1, 7),
   [[20.0, 41.6, 86.528, 168.7642, 283.6643, 336.8272, 167.7447, 30.0325], 136.8272]),
  ('control: zero steps', (30, 0.5, 100, 2, 0), [[30.0], 0.0]),
  ('regression: crash to zero', (180, 2.5, 100, 1, 4), [[180.0, 0.0, 0.0, 0.0, 0.0], 80.0])],
 [('regression: daphnia with 2 step lag',
   (10, 0.8, 100, 2, 8),
   [[10.0, 17.2, 29.584, 50.8845, 84.5904, 132.2425, 184.2037, 206.9118, 153.541], 106.9118]),
  ('control: no lag', (10, 0.5, 100, 0, 6), [[10.0, 14.5, 20.6988, 28.9059, 39.1811, 51.0959, 63.5899], 0.0]),
  ('regression: long lag oscillation',
   (50, 0.6, 100, 3, 10),
   [[50.0, 65.0, 84.5, 109.85, 142.805, 172.794, 188.8639, 177.702, 132.0628, 74.3825, 34.723], 88.8639]),
  ('regression: start above capacity',
   (150, 0.3, 100, 1, 5),
   [[150.0, 127.5, 108.375, 99.4341, 96.9358, 97.1004], 50.0]),
  ('regression: one-step lag',
   (20, 1.2, 200, 1, 7),
   [[20.0, 41.6, 86.528, 168.7642, 283.6643, 336.8272, 167.7447, 30.0325], 136.8272]),
  ('control: zero steps', (30, 0.5, 100, 2, 0), [[30.0], 0.0]),
  ('regression: crash to zero', (180, 2.5, 100, 1, 4), [[180.0, 0.0, 0.0, 0.0, 0.0], 80.0])],
 [('regression: daphnia with 2 step lag',
   (10, 0.8, 100, 2, 8),
   [[10.0, 17.2, 29.584, 50.8845, 84.5904, 132.2425, 184.2037, 206.9118, 153.541], 106.9118]),
  ('control: no lag', (10, 0.5, 100, 0, 6), [[10.0, 14.5, 20.6988, 28.9059, 39.1811, 51.0959, 63.5899], 0.0]),
  ('regression: long lag oscillation',
   (50, 0.6, 100, 3, 10),
   [[50.0, 65.0, 84.5, 109.85, 142.805, 172.794, 188.8639, 177.702, 132.0628, 74.3825, 34.723], 88.8639]),
  ('regression: start above capacity',
   (150, 0.3, 100, 1, 5),
   [[150.0, 127.5, 108.375, 99.4341, 96.9358, 97.1004], 50.0]),
  ('regression: one-step lag',
   (20, 1.2, 200, 1, 7),
   [[20.0, 41.6, 86.528, 168.7642, 283.6643, 336.8272, 167.7447, 30.0325], 136.8272]),
  ('control: zero steps', (30, 0.5, 100, 2, 0), [[30.0], 0.0]),
  ('regression: crash to zero', (180, 2.5, 100, 1, 4), [[180.0, 0.0, 0.0, 0.0, 0.0], 80.0])]]
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: daphnia with 2 step lag[[10.0, 10.0, 10.0, 17.2, 29.584, 50.8845, 84.5904, 132.2425, 184.2037], 84.2037][[10.0, 17.2, 29.584, 50.8845, 84.5904, 132.2425, 184.2037, 206.9118, 153.541], 106.9118]Failed
control: no lag[[10.0, 14.5, 20.6988, 28.9059, 39.1811, 51.0959, 63.5899], 0.0][[10.0, 14.5, 20.6988, 28.9059, 39.1811, 51.0959, 63.5899], 0.0]Passed
regression: long lag oscillation[[50.0, 50.0, 50.0, 50.0, 65.0, 84.5, 109.85, 142.805, 172.794, 188.8639, 177.702], 88.8639][[50.0, 65.0, 84.5, 109.85, 142.805, 172.794, 188.8639, 177.702, 132.0628, 74.3825, 34.723], 88.8639]Failed
regression: start above capacity[[150.0, 150.0, 127.5, 108.375, 99.4341, 96.9358], 50.0][[150.0, 127.5, 108.375, 99.4341, 96.9358, 97.1004], 50.0]Failed
regression: one-step lag[[20.0, 20.0, 41.6, 86.528, 168.7642, 283.6643, 336.8272, 167.7447], 136.8272][[20.0, 41.6, 86.528, 168.7642, 283.6643, 336.8272, 167.7447, 30.0325], 136.8272]Failed
control: zero steps[[30.0], 0.0][[30.0], 0.0]Passed
regression: crash to zero[[180.0, 180.0, 0.0, 0.0, 0.0], 80.0][[180.0, 0.0, 0.0, 0.0, 0.0], 80.0]Failed

SHA-256 / cc6236765ca93ac0c5899ccb09e66e22f691d6ea8979644b6bb4fc2e3128bcfd

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

Case digest / 5f0ec4a76127d3652d000f238ac3707ce7cffdead8da80d1925c134c69c9a9c9