FAILURE MAP
← Case archive

FA-65746 / Ecological population dynamics / Open access

Discrete delayed logistic (Hutchinson) with lag: overshoot reference · case 01

Overshoot is measured from the initial density instead of carrying capacity.

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

ROOT CAUSE

The reference level is N0.

THE FAILURE

The reference level is N0.

Unsuccessful approach: Excluding the initial value ignores a start above capacity.

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 hist[0]
        now = hist[t]
        hist.append(max(0.0, now + r * now * (1 - past / k)))
    over = max(0.0, max(hist) - hist[0])
    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]),
  ('regression: 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]),
  ('regression: 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]),
  ('regression: 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]),
  ('regression: 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]),
  ('regression: 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, 17.2, 29.584, 50.8845, 84.5904, 132.2425, 184.2037, 206.9118, 153.541], 196.9118][[10.0, 17.2, 29.584, 50.8845, 84.5904, 132.2425, 184.2037, 206.9118, 153.541], 106.9118]Failed
regression: no lag[[10.0, 14.5, 20.6988, 28.9059, 39.1811, 51.0959, 63.5899], 53.5899][[10.0, 14.5, 20.6988, 28.9059, 39.1811, 51.0959, 63.5899], 0.0]Failed
regression: long lag oscillation[[50.0, 65.0, 84.5, 109.85, 142.805, 172.794, 188.8639, 177.702, 132.0628, 74.3825, 34.723], 138.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, 127.5, 108.375, 99.4341, 96.9358, 97.1004], 0.0][[150.0, 127.5, 108.375, 99.4341, 96.9358, 97.1004], 50.0]Failed
regression: one-step lag[[20.0, 41.6, 86.528, 168.7642, 283.6643, 336.8272, 167.7447, 30.0325], 316.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, 0.0, 0.0, 0.0, 0.0], 0.0][[180.0, 0.0, 0.0, 0.0, 0.0], 80.0]Failed

SHA-256 / 9ef37a044815214947bb998d056aae88a65a19641264b7dec312d6c1d6c58c17

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 hist[0]
        now = hist[t]
        hist.append(max(0.0, now + r * now * (1 - past / k)))
    over = max(0.0, max(hist[1:] or [0.0]) - 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]),
  ('regression: 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]),
  ('regression: 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]),
  ('regression: 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]),
  ('regression: 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]),
  ('regression: 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, 17.2, 29.584, 50.8845, 84.5904, 132.2425, 184.2037, 206.9118, 153.541], 106.9118][[10.0, 17.2, 29.584, 50.8845, 84.5904, 132.2425, 184.2037, 206.9118, 153.541], 106.9118]Passed
regression: 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, 65.0, 84.5, 109.85, 142.805, 172.794, 188.8639, 177.702, 132.0628, 74.3825, 34.723], 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]Passed
regression: start above capacity[[150.0, 127.5, 108.375, 99.4341, 96.9358, 97.1004], 27.5][[150.0, 127.5, 108.375, 99.4341, 96.9358, 97.1004], 50.0]Failed
regression: one-step lag[[20.0, 41.6, 86.528, 168.7642, 283.6643, 336.8272, 167.7447, 30.0325], 136.8272][[20.0, 41.6, 86.528, 168.7642, 283.6643, 336.8272, 167.7447, 30.0325], 136.8272]Passed
control: zero steps[[30.0], 0.0][[30.0], 0.0]Passed
regression: crash to zero[[180.0, 0.0, 0.0, 0.0, 0.0], 0.0][[180.0, 0.0, 0.0, 0.0, 0.0], 80.0]Failed

SHA-256 / 5f3c80f049f2b40009ba9e6d8dd7f19d43b4134426902cee608f7814717a252a

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

Case digest / 8a16e0e1324d005bddd5ca535e5d9fe2afe82e3ab103274a46518b1f51a9ab51