FA-65346 / Ecological population dynamics / Open access
Discrete logistic population with constant quota harvest: harvest timing · case 01
Small stocks survive quotas that should wipe them out before spawning.
ROOT CAUSE
The quota is taken after reproduction instead of before.
VERIFIED REPAIR
Restore the harvest timing rule: `n -= harvest / if n <= 0: / traj.append(0.0) / break / n = n + r * n * (1 - n / k)`.
Unsuccessful approach: Computing growth from the pre-harvest stock still credits removed fish with reproduction.
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 = n + r * n * (1 - n / k)
n -= harvest
if n <= 0:
traj.append(0.0)
break
traj.append(round(n, 4))
return traj
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: 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]),
('regression: 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]),
('regression: 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: 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: 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]),
('regression: 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: 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]),
('regression: two-year collapse', (60, 0.2, 500, 40, 6), [60.0, 23.84, 0.0])],
[('regression: 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]),
('regression: quota exceeds growth collapse',
(300, 0.3, 1000, 120, 10),
[300.0, 224.28, 132.3017, 15.9468, 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: invalid carrying capacity', (100, 0.5, 0, 10, 5), None),
('control: zero years', (100, 0.5, 500, 10, 0), [100.0]),
('regression: 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]),
('regression: two-year collapse', (60, 0.2, 500, 40, 6), [60.0, 23.84, 0.0])],
[('regression: 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]),
('regression: 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]),
('regression: 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: 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: 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]),
('regression: 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: 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]),
('regression: 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: cod-like stock light quota | [500.0, 580.0, 657.44, 727.5251, 786.818, 833.9122, 869.3132, 894.7563, 912.4233] | [500.0, 579.84, 658.4077, 730.745, 792.9796, 843.1725, 881.3963, 909.1534, 928.5772] | Failed |
| regression: quota exceeds growth collapse | [300.0, 243.0, 178.1853, 102.1159, 9.6224, 0.0] | [300.0, 224.28, 132.3017, 15.9468, 0.0] | Failed |
| regression: quota equals stock exactly | [50.0, 21.875, 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 |
| regression: above carrying capacity | [1200.0, 1070.0, 1022.55, 1001.0207, 990.5099, 985.2099, 982.4956] | [1200.0, 1076.95, 1031.2338, 1010.3915, 1000.1957, 995.0498, 992.4131] | Failed |
| control: invalid carrying capacity | None | None | Passed |
| control: zero years | [100.0] | [100.0] | Passed |
SHA-256 / 047daef8f86d7f03c4fe5b3cda395581601d01e58ed414deb2311331c0fa3ccd
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):
grown = r * n * (1 - n / k)
n -= harvest
if n <= 0:
traj.append(0.0)
break
n = n + grown
traj.append(round(n, 4))
return traj
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: 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]),
('regression: 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]),
('regression: 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: 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: 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]),
('regression: 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: 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]),
('regression: two-year collapse', (60, 0.2, 500, 40, 6), [60.0, 23.84, 0.0])],
[('regression: 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]),
('regression: quota exceeds growth collapse',
(300, 0.3, 1000, 120, 10),
[300.0, 224.28, 132.3017, 15.9468, 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: invalid carrying capacity', (100, 0.5, 0, 10, 5), None),
('control: zero years', (100, 0.5, 500, 10, 0), [100.0]),
('regression: 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]),
('regression: two-year collapse', (60, 0.2, 500, 40, 6), [60.0, 23.84, 0.0])],
[('regression: 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]),
('regression: 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]),
('regression: 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: 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: 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]),
('regression: 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: 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]),
('regression: 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: cod-like stock light quota | [500.0, 580.0, 657.44, 727.5251, 786.818, 833.9122, 869.3132, 894.7563, 912.4233] | [500.0, 579.84, 658.4077, 730.745, 792.9796, 843.1725, 881.3963, 909.1534, 928.5772] | Failed |
| regression: quota exceeds growth collapse | [300.0, 243.0, 178.1853, 102.1159, 0.0] | [300.0, 224.28, 132.3017, 15.9468, 0.0] | Failed |
| 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 |
| regression: above carrying capacity | [1200.0, 1070.0, 1022.55, 1001.0207, 990.5099, 985.2099, 982.4956] | [1200.0, 1076.95, 1031.2338, 1010.3915, 1000.1957, 995.0498, 992.4131] | Failed |
| control: invalid carrying capacity | None | None | Passed |
| control: zero years | [100.0] | [100.0] | Passed |
SHA-256 / 3e3069a35e8739f42e9a514f372d94b33d935618a7b6ddeda6c62a07ba6cf22d
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 = [[('regression: 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]),
('regression: 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]),
('regression: 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: 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: 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]),
('regression: 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: 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]),
('regression: two-year collapse', (60, 0.2, 500, 40, 6), [60.0, 23.84, 0.0])],
[('regression: 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]),
('regression: quota exceeds growth collapse',
(300, 0.3, 1000, 120, 10),
[300.0, 224.28, 132.3017, 15.9468, 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: invalid carrying capacity', (100, 0.5, 0, 10, 5), None),
('control: zero years', (100, 0.5, 500, 10, 0), [100.0]),
('regression: 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]),
('regression: two-year collapse', (60, 0.2, 500, 40, 6), [60.0, 23.84, 0.0])],
[('regression: 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]),
('regression: 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]),
('regression: 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: 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: 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]),
('regression: 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: 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]),
('regression: 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: 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 |
| regression: 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 |
| regression: 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 capacity | None | None | Passed |
| control: zero years | [100.0] | [100.0] | Passed |
SHA-256 / 0dcdd2dc18d411e1ba98489b3aff259c88be6ec2606eaeb1c90efba342c45f54
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.184556+00:00.
Case digest / d52dc15f810ea093ee472ca45eb61e5da6598dc96e1587870a5535b5fc8330bb