FAILURE MAP
← Case archive

FA-65351 / Ecological population dynamics / Open access

Discrete logistic population with constant quota harvest: extinction boundary · case 01

A stock harvested to exactly zero keeps a trajectory of zeros instead of stopping.

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

ROOT CAUSE

Extinction is only declared for strictly negative stock.

VERIFIED REPAIR

Restore the extinction boundary rule: `if n <= 0:`.

Unsuccessful approach: Excluding exactly zero from the test still misses the exact-quota collapse.

Case contract

Each year the quota is removed first; if the stock is then <= 0 the trajectory records 0.0 and stops; otherwise the survivors grow by r*N*(1-N/K); the trajectory starts with the unharvested N0; values rounded to 4; None for K<=0 or negative N0.

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, harvest, years):
    if k <= 0 or n0 < 0:
        return None
    n = float(n0)
    traj = [round(n, 4)]
    for _ in range(years):
        n -= harvest
        if n < 0:
            traj.append(0.0)
            break
        n = n + r * n * (1 - n / k)
        traj.append(round(n, 4))
    return traj
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('control: cod-like stock light quota',
   (500, 0.4, 1000, 20, 8),
   [500.0, 579.84, 658.4077, 730.745, 792.9796, 843.1725, 881.3963, 909.1534, 928.5772]),
  ('control: quota exceeds growth collapse',
   (300, 0.3, 1000, 120, 10),
   [300.0, 224.28, 132.3017, 15.9468, 0.0]),
  ('regression: quota equals stock exactly', (50, 0.5, 400, 50, 5), [50.0, 0.0]),
  ('control: no harvest recovery',
   (100, 0.6, 800, 0, 7),
   [100.0, 152.5, 226.5578, 323.9962, 439.6637, 558.4838, 659.646, 729.084]),
  ('control: above carrying capacity',
   (1200, 0.5, 1000, 10, 6),
   [1200.0, 1076.95, 1031.2338, 1010.3915, 1000.1957, 995.0498, 992.4131]),
  ('control: invalid carrying capacity', (100, 0.5, 0, 10, 5), None),
  ('control: zero years', (100, 0.5, 500, 10, 0), [100.0])],
 [('regression: quota equals stock exactly', (50, 0.5, 400, 50, 5), [50.0, 0.0]),
  ('control: no harvest recovery',
   (100, 0.6, 800, 0, 7),
   [100.0, 152.5, 226.5578, 323.9962, 439.6637, 558.4838, 659.646, 729.084]),
  ('control: above carrying capacity',
   (1200, 0.5, 1000, 10, 6),
   [1200.0, 1076.95, 1031.2338, 1010.3915, 1000.1957, 995.0498, 992.4131]),
  ('control: invalid carrying capacity', (100, 0.5, 0, 10, 5), None),
  ('control: zero years', (100, 0.5, 500, 10, 0), [100.0]),
  ('control: slow grower',
   (800, 0.1, 1000, 15, 9),
   [800.0, 801.8775, 803.6476, 805.3159, 806.8876, 808.3677, 809.7613, 811.0728, 812.3069, 813.4678]),
  ('control: two-year collapse', (60, 0.2, 500, 40, 6), [60.0, 23.84, 0.0])],
 [('control: cod-like stock light quota',
   (500, 0.4, 1000, 20, 8),
   [500.0, 579.84, 658.4077, 730.745, 792.9796, 843.1725, 881.3963, 909.1534, 928.5772]),
  ('control: quota exceeds growth collapse',
   (300, 0.3, 1000, 120, 10),
   [300.0, 224.28, 132.3017, 15.9468, 0.0]),
  ('regression: quota equals stock exactly', (50, 0.5, 400, 50, 5), [50.0, 0.0]),
  ('control: no harvest recovery',
   (100, 0.6, 800, 0, 7),
   [100.0, 152.5, 226.5578, 323.9962, 439.6637, 558.4838, 659.646, 729.084]),
  ('control: zero years', (100, 0.5, 500, 10, 0), [100.0]),
  ('control: slow grower',
   (800, 0.1, 1000, 15, 9),
   [800.0, 801.8775, 803.6476, 805.3159, 806.8876, 808.3677, 809.7613, 811.0728, 812.3069, 813.4678]),
  ('control: two-year collapse', (60, 0.2, 500, 40, 6), [60.0, 23.84, 0.0])],
 [('control: cod-like stock light quota',
   (500, 0.4, 1000, 20, 8),
   [500.0, 579.84, 658.4077, 730.745, 792.9796, 843.1725, 881.3963, 909.1534, 928.5772]),
  ('control: quota exceeds growth collapse',
   (300, 0.3, 1000, 120, 10),
   [300.0, 224.28, 132.3017, 15.9468, 0.0]),
  ('regression: quota equals stock exactly', (50, 0.5, 400, 50, 5), [50.0, 0.0]),
  ('control: no harvest recovery',
   (100, 0.6, 800, 0, 7),
   [100.0, 152.5, 226.5578, 323.9962, 439.6637, 558.4838, 659.646, 729.084]),
  ('control: above carrying capacity',
   (1200, 0.5, 1000, 10, 6),
   [1200.0, 1076.95, 1031.2338, 1010.3915, 1000.1957, 995.0498, 992.4131]),
  ('control: invalid carrying capacity', (100, 0.5, 0, 10, 5), None),
  ('control: zero years', (100, 0.5, 500, 10, 0), [100.0])],
 [('regression: quota equals stock exactly', (50, 0.5, 400, 50, 5), [50.0, 0.0]),
  ('control: no harvest recovery',
   (100, 0.6, 800, 0, 7),
   [100.0, 152.5, 226.5578, 323.9962, 439.6637, 558.4838, 659.646, 729.084]),
  ('control: above carrying capacity',
   (1200, 0.5, 1000, 10, 6),
   [1200.0, 1076.95, 1031.2338, 1010.3915, 1000.1957, 995.0498, 992.4131]),
  ('control: invalid carrying capacity', (100, 0.5, 0, 10, 5), None),
  ('control: zero years', (100, 0.5, 500, 10, 0), [100.0]),
  ('control: slow grower',
   (800, 0.1, 1000, 15, 9),
   [800.0, 801.8775, 803.6476, 805.3159, 806.8876, 808.3677, 809.7613, 811.0728, 812.3069, 813.4678]),
  ('control: two-year collapse', (60, 0.2, 500, 40, 6), [60.0, 23.84, 0.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
control: cod-like stock light quota[500.0, 579.84, 658.4077, 730.745, 792.9796, 843.1725, 881.3963, 909.1534, 928.5772][500.0, 579.84, 658.4077, 730.745, 792.9796, 843.1725, 881.3963, 909.1534, 928.5772]Passed
control: quota exceeds growth collapse[300.0, 224.28, 132.3017, 15.9468, 0.0][300.0, 224.28, 132.3017, 15.9468, 0.0]Passed
regression: quota equals stock exactly[50.0, 0.0, 0.0][50.0, 0.0]Failed
control: no harvest recovery[100.0, 152.5, 226.5578, 323.9962, 439.6637, 558.4838, 659.646, 729.084][100.0, 152.5, 226.5578, 323.9962, 439.6637, 558.4838, 659.646, 729.084]Passed
control: above carrying capacity[1200.0, 1076.95, 1031.2338, 1010.3915, 1000.1957, 995.0498, 992.4131][1200.0, 1076.95, 1031.2338, 1010.3915, 1000.1957, 995.0498, 992.4131]Passed
control: invalid carrying capacityNoneNonePassed
control: zero years[100.0][100.0]Passed

SHA-256 / b54e75edada4001ce59be9be1dea4a9821f61e7513e9e818115e2cbe69dded87

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, harvest, years):
    if k <= 0 or n0 < 0:
        return None
    n = float(n0)
    traj = [round(n, 4)]
    for _ in range(years):
        n -= harvest
        if n < 1e-9 and n != 0:
            traj.append(0.0)
            break
        n = n + r * n * (1 - n / k)
        traj.append(round(n, 4))
    return traj
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('control: cod-like stock light quota',
   (500, 0.4, 1000, 20, 8),
   [500.0, 579.84, 658.4077, 730.745, 792.9796, 843.1725, 881.3963, 909.1534, 928.5772]),
  ('control: quota exceeds growth collapse',
   (300, 0.3, 1000, 120, 10),
   [300.0, 224.28, 132.3017, 15.9468, 0.0]),
  ('regression: quota equals stock exactly', (50, 0.5, 400, 50, 5), [50.0, 0.0]),
  ('control: no harvest recovery',
   (100, 0.6, 800, 0, 7),
   [100.0, 152.5, 226.5578, 323.9962, 439.6637, 558.4838, 659.646, 729.084]),
  ('control: above carrying capacity',
   (1200, 0.5, 1000, 10, 6),
   [1200.0, 1076.95, 1031.2338, 1010.3915, 1000.1957, 995.0498, 992.4131]),
  ('control: invalid carrying capacity', (100, 0.5, 0, 10, 5), None),
  ('control: zero years', (100, 0.5, 500, 10, 0), [100.0])],
 [('regression: quota equals stock exactly', (50, 0.5, 400, 50, 5), [50.0, 0.0]),
  ('control: no harvest recovery',
   (100, 0.6, 800, 0, 7),
   [100.0, 152.5, 226.5578, 323.9962, 439.6637, 558.4838, 659.646, 729.084]),
  ('control: above carrying capacity',
   (1200, 0.5, 1000, 10, 6),
   [1200.0, 1076.95, 1031.2338, 1010.3915, 1000.1957, 995.0498, 992.4131]),
  ('control: invalid carrying capacity', (100, 0.5, 0, 10, 5), None),
  ('control: zero years', (100, 0.5, 500, 10, 0), [100.0]),
  ('control: slow grower',
   (800, 0.1, 1000, 15, 9),
   [800.0, 801.8775, 803.6476, 805.3159, 806.8876, 808.3677, 809.7613, 811.0728, 812.3069, 813.4678]),
  ('control: two-year collapse', (60, 0.2, 500, 40, 6), [60.0, 23.84, 0.0])],
 [('control: cod-like stock light quota',
   (500, 0.4, 1000, 20, 8),
   [500.0, 579.84, 658.4077, 730.745, 792.9796, 843.1725, 881.3963, 909.1534, 928.5772]),
  ('control: quota exceeds growth collapse',
   (300, 0.3, 1000, 120, 10),
   [300.0, 224.28, 132.3017, 15.9468, 0.0]),
  ('regression: quota equals stock exactly', (50, 0.5, 400, 50, 5), [50.0, 0.0]),
  ('control: no harvest recovery',
   (100, 0.6, 800, 0, 7),
   [100.0, 152.5, 226.5578, 323.9962, 439.6637, 558.4838, 659.646, 729.084]),
  ('control: zero years', (100, 0.5, 500, 10, 0), [100.0]),
  ('control: slow grower',
   (800, 0.1, 1000, 15, 9),
   [800.0, 801.8775, 803.6476, 805.3159, 806.8876, 808.3677, 809.7613, 811.0728, 812.3069, 813.4678]),
  ('control: two-year collapse', (60, 0.2, 500, 40, 6), [60.0, 23.84, 0.0])],
 [('control: cod-like stock light quota',
   (500, 0.4, 1000, 20, 8),
   [500.0, 579.84, 658.4077, 730.745, 792.9796, 843.1725, 881.3963, 909.1534, 928.5772]),
  ('control: quota exceeds growth collapse',
   (300, 0.3, 1000, 120, 10),
   [300.0, 224.28, 132.3017, 15.9468, 0.0]),
  ('regression: quota equals stock exactly', (50, 0.5, 400, 50, 5), [50.0, 0.0]),
  ('control: no harvest recovery',
   (100, 0.6, 800, 0, 7),
   [100.0, 152.5, 226.5578, 323.9962, 439.6637, 558.4838, 659.646, 729.084]),
  ('control: above carrying capacity',
   (1200, 0.5, 1000, 10, 6),
   [1200.0, 1076.95, 1031.2338, 1010.3915, 1000.1957, 995.0498, 992.4131]),
  ('control: invalid carrying capacity', (100, 0.5, 0, 10, 5), None),
  ('control: zero years', (100, 0.5, 500, 10, 0), [100.0])],
 [('regression: quota equals stock exactly', (50, 0.5, 400, 50, 5), [50.0, 0.0]),
  ('control: no harvest recovery',
   (100, 0.6, 800, 0, 7),
   [100.0, 152.5, 226.5578, 323.9962, 439.6637, 558.4838, 659.646, 729.084]),
  ('control: above carrying capacity',
   (1200, 0.5, 1000, 10, 6),
   [1200.0, 1076.95, 1031.2338, 1010.3915, 1000.1957, 995.0498, 992.4131]),
  ('control: invalid carrying capacity', (100, 0.5, 0, 10, 5), None),
  ('control: zero years', (100, 0.5, 500, 10, 0), [100.0]),
  ('control: slow grower',
   (800, 0.1, 1000, 15, 9),
   [800.0, 801.8775, 803.6476, 805.3159, 806.8876, 808.3677, 809.7613, 811.0728, 812.3069, 813.4678]),
  ('control: two-year collapse', (60, 0.2, 500, 40, 6), [60.0, 23.84, 0.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
control: cod-like stock light quota[500.0, 579.84, 658.4077, 730.745, 792.9796, 843.1725, 881.3963, 909.1534, 928.5772][500.0, 579.84, 658.4077, 730.745, 792.9796, 843.1725, 881.3963, 909.1534, 928.5772]Passed
control: quota exceeds growth collapse[300.0, 224.28, 132.3017, 15.9468, 0.0][300.0, 224.28, 132.3017, 15.9468, 0.0]Passed
regression: quota equals stock exactly[50.0, 0.0, 0.0][50.0, 0.0]Failed
control: no harvest recovery[100.0, 152.5, 226.5578, 323.9962, 439.6637, 558.4838, 659.646, 729.084][100.0, 152.5, 226.5578, 323.9962, 439.6637, 558.4838, 659.646, 729.084]Passed
control: above carrying capacity[1200.0, 1076.95, 1031.2338, 1010.3915, 1000.1957, 995.0498, 992.4131][1200.0, 1076.95, 1031.2338, 1010.3915, 1000.1957, 995.0498, 992.4131]Passed
control: invalid carrying capacityNoneNonePassed
control: zero years[100.0][100.0]Passed

SHA-256 / dc833fc1e236a7fdd57677a6082fa5424e40d0ddfcfcc9cf719b79a4de24560d

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(n0, r, k, harvest, years):
    if k <= 0 or n0 < 0:
        return None
    n = float(n0)
    traj = [round(n, 4)]
    for _ in range(years):
        n -= harvest
        if n <= 0:
            traj.append(0.0)
            break
        n = n + r * n * (1 - n / k)
        traj.append(round(n, 4))
    return traj
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('control: cod-like stock light quota',
   (500, 0.4, 1000, 20, 8),
   [500.0, 579.84, 658.4077, 730.745, 792.9796, 843.1725, 881.3963, 909.1534, 928.5772]),
  ('control: quota exceeds growth collapse',
   (300, 0.3, 1000, 120, 10),
   [300.0, 224.28, 132.3017, 15.9468, 0.0]),
  ('regression: quota equals stock exactly', (50, 0.5, 400, 50, 5), [50.0, 0.0]),
  ('control: no harvest recovery',
   (100, 0.6, 800, 0, 7),
   [100.0, 152.5, 226.5578, 323.9962, 439.6637, 558.4838, 659.646, 729.084]),
  ('control: above carrying capacity',
   (1200, 0.5, 1000, 10, 6),
   [1200.0, 1076.95, 1031.2338, 1010.3915, 1000.1957, 995.0498, 992.4131]),
  ('control: invalid carrying capacity', (100, 0.5, 0, 10, 5), None),
  ('control: zero years', (100, 0.5, 500, 10, 0), [100.0])],
 [('regression: quota equals stock exactly', (50, 0.5, 400, 50, 5), [50.0, 0.0]),
  ('control: no harvest recovery',
   (100, 0.6, 800, 0, 7),
   [100.0, 152.5, 226.5578, 323.9962, 439.6637, 558.4838, 659.646, 729.084]),
  ('control: above carrying capacity',
   (1200, 0.5, 1000, 10, 6),
   [1200.0, 1076.95, 1031.2338, 1010.3915, 1000.1957, 995.0498, 992.4131]),
  ('control: invalid carrying capacity', (100, 0.5, 0, 10, 5), None),
  ('control: zero years', (100, 0.5, 500, 10, 0), [100.0]),
  ('control: slow grower',
   (800, 0.1, 1000, 15, 9),
   [800.0, 801.8775, 803.6476, 805.3159, 806.8876, 808.3677, 809.7613, 811.0728, 812.3069, 813.4678]),
  ('control: two-year collapse', (60, 0.2, 500, 40, 6), [60.0, 23.84, 0.0])],
 [('control: cod-like stock light quota',
   (500, 0.4, 1000, 20, 8),
   [500.0, 579.84, 658.4077, 730.745, 792.9796, 843.1725, 881.3963, 909.1534, 928.5772]),
  ('control: quota exceeds growth collapse',
   (300, 0.3, 1000, 120, 10),
   [300.0, 224.28, 132.3017, 15.9468, 0.0]),
  ('regression: quota equals stock exactly', (50, 0.5, 400, 50, 5), [50.0, 0.0]),
  ('control: no harvest recovery',
   (100, 0.6, 800, 0, 7),
   [100.0, 152.5, 226.5578, 323.9962, 439.6637, 558.4838, 659.646, 729.084]),
  ('control: zero years', (100, 0.5, 500, 10, 0), [100.0]),
  ('control: slow grower',
   (800, 0.1, 1000, 15, 9),
   [800.0, 801.8775, 803.6476, 805.3159, 806.8876, 808.3677, 809.7613, 811.0728, 812.3069, 813.4678]),
  ('control: two-year collapse', (60, 0.2, 500, 40, 6), [60.0, 23.84, 0.0])],
 [('control: cod-like stock light quota',
   (500, 0.4, 1000, 20, 8),
   [500.0, 579.84, 658.4077, 730.745, 792.9796, 843.1725, 881.3963, 909.1534, 928.5772]),
  ('control: quota exceeds growth collapse',
   (300, 0.3, 1000, 120, 10),
   [300.0, 224.28, 132.3017, 15.9468, 0.0]),
  ('regression: quota equals stock exactly', (50, 0.5, 400, 50, 5), [50.0, 0.0]),
  ('control: no harvest recovery',
   (100, 0.6, 800, 0, 7),
   [100.0, 152.5, 226.5578, 323.9962, 439.6637, 558.4838, 659.646, 729.084]),
  ('control: above carrying capacity',
   (1200, 0.5, 1000, 10, 6),
   [1200.0, 1076.95, 1031.2338, 1010.3915, 1000.1957, 995.0498, 992.4131]),
  ('control: invalid carrying capacity', (100, 0.5, 0, 10, 5), None),
  ('control: zero years', (100, 0.5, 500, 10, 0), [100.0])],
 [('regression: quota equals stock exactly', (50, 0.5, 400, 50, 5), [50.0, 0.0]),
  ('control: no harvest recovery',
   (100, 0.6, 800, 0, 7),
   [100.0, 152.5, 226.5578, 323.9962, 439.6637, 558.4838, 659.646, 729.084]),
  ('control: above carrying capacity',
   (1200, 0.5, 1000, 10, 6),
   [1200.0, 1076.95, 1031.2338, 1010.3915, 1000.1957, 995.0498, 992.4131]),
  ('control: invalid carrying capacity', (100, 0.5, 0, 10, 5), None),
  ('control: zero years', (100, 0.5, 500, 10, 0), [100.0]),
  ('control: slow grower',
   (800, 0.1, 1000, 15, 9),
   [800.0, 801.8775, 803.6476, 805.3159, 806.8876, 808.3677, 809.7613, 811.0728, 812.3069, 813.4678]),
  ('control: two-year collapse', (60, 0.2, 500, 40, 6), [60.0, 23.84, 0.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
control: cod-like stock light quota[500.0, 579.84, 658.4077, 730.745, 792.9796, 843.1725, 881.3963, 909.1534, 928.5772][500.0, 579.84, 658.4077, 730.745, 792.9796, 843.1725, 881.3963, 909.1534, 928.5772]Passed
control: quota exceeds growth collapse[300.0, 224.28, 132.3017, 15.9468, 0.0][300.0, 224.28, 132.3017, 15.9468, 0.0]Passed
regression: quota equals stock exactly[50.0, 0.0][50.0, 0.0]Passed
control: no harvest recovery[100.0, 152.5, 226.5578, 323.9962, 439.6637, 558.4838, 659.646, 729.084][100.0, 152.5, 226.5578, 323.9962, 439.6637, 558.4838, 659.646, 729.084]Passed
control: above carrying capacity[1200.0, 1076.95, 1031.2338, 1010.3915, 1000.1957, 995.0498, 992.4131][1200.0, 1076.95, 1031.2338, 1010.3915, 1000.1957, 995.0498, 992.4131]Passed
control: invalid carrying capacityNoneNonePassed
control: zero years[100.0][100.0]Passed

SHA-256 / cf233f2603c3ccaf86494fc85755e4cf29b56bdb0a04c79ec7b6e6c06673489c

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

Case digest / 29d62e64354a1173401614115c8a77369fa04babb296905a679cf509eed0a894