FAILURE MAP
← Case archive

FA-65801 / Ecological population dynamics / Open access

Rosenzweig-MacArthur equilibrium and enrichment stability: predator equilibrium · case 01

Predator equilibrium is understated for slow handlers.

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

ROOT CAUSE

The attack rate is missing from the saturation factor.

VERIFIED REPAIR

Restore the predator equilibrium rule: `ps = r / a * (1 - ns / k) * (1 + a * h * ns)`.

Unsuccessful approach: Omitting h ignores handling time in the saturation factor.

Case contract

Type II predator-prey: N* = m/(a(e-hm)) requires e>hm and N*<K else ['predator-extinct', [K, 0]]; P* = (r/a)(1-N*/K)(1+ahN*); hump = (K-1/(ah))/2 for h>0 else -1; stable if N*>hump, 'hopf' if equal, else 'cycles'; values rounded 6; None for invalid parameters.

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(r, k, a, h, e, m):
    if min(r, k, a, e, m) <= 0 or h < 0:
        return None
    if e <= h * m:
        return ['predator-extinct', [float(k), 0.0]]
    ns = m / (a * (e - h * m))
    if ns >= k:
        return ['predator-extinct', [float(k), 0.0]]
    ps = r / a * (1 - ns / k) * (1 + h * ns)
    hump = (k - 1 / (a * h)) / 2 if h > 0 else -1.0
    if ns > hump:
        kind = 'stable'
    elif ns == hump:
        kind = 'hopf'
    else:
        kind = 'cycles'
    return [kind, [round(ns, 6), round(ps, 6)]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: exact hopf point', (1.0, 10.0, 1.0, 0.5, 1.5, 2.0), ['hopf', [4.0, 1.8]]),
  ('regression: enriched cycles', (1.0, 40.0, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 2.7]]),
  ('regression: poor habitat stable', (1.0, 8.0, 1.0, 0.5, 1.5, 2.0), ['stable', [4.0, 1.5]]),
  ('control: inefficient predator', (1.0, 50.0, 1.0, 0.5, 1.0, 2.0), ['predator-extinct', [50.0, 0.0]]),
  ('control: predator cannot persist capacity',
   (1.0, 3.0, 1.0, 0.5, 1.5, 2.0),
   ['predator-extinct', [3.0, 0.0]]),
  ('control: invalid rate', (0.0, 10.0, 1.0, 0.5, 1.5, 2.0), None),
  ('regression: lynx hare like', (1.2, 60.0, 0.05, 0.2, 0.6, 0.3), ['stable', [11.111111, 21.728395]])],
 [('regression: just above hump', (1.0, 10.06, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 1.807157]]),
  ('regression: just below enrichment threshold',
   (1.0, 9.94, 1.0, 0.5, 1.5, 2.0),
   ['stable', [4.0, 1.792757]]),
  ('control: inefficient predator', (1.0, 50.0, 1.0, 0.5, 1.0, 2.0), ['predator-extinct', [50.0, 0.0]]),
  ('control: predator cannot persist capacity',
   (1.0, 3.0, 1.0, 0.5, 1.5, 2.0),
   ['predator-extinct', [3.0, 0.0]]),
  ('regression: type I predator', (0.8, 30.0, 0.2, 0.0, 0.5, 0.4), ['stable', [4.0, 3.466667]]),
  ('control: invalid rate', (0.0, 10.0, 1.0, 0.5, 1.5, 2.0), None),
  ('regression: lynx hare like', (1.2, 60.0, 0.05, 0.2, 0.6, 0.3), ['stable', [11.111111, 21.728395]])],
 [('regression: exact hopf point', (1.0, 10.0, 1.0, 0.5, 1.5, 2.0), ['hopf', [4.0, 1.8]]),
  ('regression: enriched cycles', (1.0, 40.0, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 2.7]]),
  ('control: predator cannot persist capacity',
   (1.0, 3.0, 1.0, 0.5, 1.5, 2.0),
   ['predator-extinct', [3.0, 0.0]]),
  ('regression: type I predator', (0.8, 30.0, 0.2, 0.0, 0.5, 0.4), ['stable', [4.0, 3.466667]]),
  ('control: invalid rate', (0.0, 10.0, 1.0, 0.5, 1.5, 2.0), None),
  ('regression: lynx hare like', (1.2, 60.0, 0.05, 0.2, 0.6, 0.3), ['stable', [11.111111, 21.728395]]),
  ('control: borderline conversion', (1.0, 20.0, 0.5, 0.5, 0.9, 1.6), ['predator-extinct', [20.0, 0.0]])],
 [('regression: exact hopf point', (1.0, 10.0, 1.0, 0.5, 1.5, 2.0), ['hopf', [4.0, 1.8]]),
  ('regression: enriched cycles', (1.0, 40.0, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 2.7]]),
  ('regression: poor habitat stable', (1.0, 8.0, 1.0, 0.5, 1.5, 2.0), ['stable', [4.0, 1.5]]),
  ('control: inefficient predator', (1.0, 50.0, 1.0, 0.5, 1.0, 2.0), ['predator-extinct', [50.0, 0.0]]),
  ('control: predator cannot persist capacity',
   (1.0, 3.0, 1.0, 0.5, 1.5, 2.0),
   ['predator-extinct', [3.0, 0.0]]),
  ('regression: lynx hare like', (1.2, 60.0, 0.05, 0.2, 0.6, 0.3), ['stable', [11.111111, 21.728395]]),
  ('control: borderline conversion', (1.0, 20.0, 0.5, 0.5, 0.9, 1.6), ['predator-extinct', [20.0, 0.0]])],
 [('regression: enriched cycles', (1.0, 40.0, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 2.7]]),
  ('regression: poor habitat stable', (1.0, 8.0, 1.0, 0.5, 1.5, 2.0), ['stable', [4.0, 1.5]]),
  ('regression: just above hump', (1.0, 10.06, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 1.807157]]),
  ('control: inefficient predator', (1.0, 50.0, 1.0, 0.5, 1.0, 2.0), ['predator-extinct', [50.0, 0.0]]),
  ('control: predator cannot persist capacity',
   (1.0, 3.0, 1.0, 0.5, 1.5, 2.0),
   ['predator-extinct', [3.0, 0.0]]),
  ('control: invalid rate', (0.0, 10.0, 1.0, 0.5, 1.5, 2.0), None),
  ('regression: lynx hare like', (1.2, 60.0, 0.05, 0.2, 0.6, 0.3), ['stable', [11.111111, 21.728395]])]]
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: exact hopf point['hopf', [4.0, 1.8]]['hopf', [4.0, 1.8]]Passed
regression: enriched cycles['cycles', [4.0, 2.7]]['cycles', [4.0, 2.7]]Passed
regression: poor habitat stable['stable', [4.0, 1.5]]['stable', [4.0, 1.5]]Passed
control: inefficient predator['predator-extinct', [50.0, 0.0]]['predator-extinct', [50.0, 0.0]]Passed
control: predator cannot persist capacity['predator-extinct', [3.0, 0.0]]['predator-extinct', [3.0, 0.0]]Passed
control: invalid rateNoneNonePassed
regression: lynx hare like['stable', [11.111111, 63.012346]]['stable', [11.111111, 21.728395]]Failed

SHA-256 / 07debd4ae9b1303a01a8d2156b08f7ed99c27e725bb84eee821df5cb15e454dd

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(r, k, a, h, e, m):
    if min(r, k, a, e, m) <= 0 or h < 0:
        return None
    if e <= h * m:
        return ['predator-extinct', [float(k), 0.0]]
    ns = m / (a * (e - h * m))
    if ns >= k:
        return ['predator-extinct', [float(k), 0.0]]
    ps = r / a * (1 - ns / k) * (1 + a * ns)
    hump = (k - 1 / (a * h)) / 2 if h > 0 else -1.0
    if ns > hump:
        kind = 'stable'
    elif ns == hump:
        kind = 'hopf'
    else:
        kind = 'cycles'
    return [kind, [round(ns, 6), round(ps, 6)]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: exact hopf point', (1.0, 10.0, 1.0, 0.5, 1.5, 2.0), ['hopf', [4.0, 1.8]]),
  ('regression: enriched cycles', (1.0, 40.0, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 2.7]]),
  ('regression: poor habitat stable', (1.0, 8.0, 1.0, 0.5, 1.5, 2.0), ['stable', [4.0, 1.5]]),
  ('control: inefficient predator', (1.0, 50.0, 1.0, 0.5, 1.0, 2.0), ['predator-extinct', [50.0, 0.0]]),
  ('control: predator cannot persist capacity',
   (1.0, 3.0, 1.0, 0.5, 1.5, 2.0),
   ['predator-extinct', [3.0, 0.0]]),
  ('control: invalid rate', (0.0, 10.0, 1.0, 0.5, 1.5, 2.0), None),
  ('regression: lynx hare like', (1.2, 60.0, 0.05, 0.2, 0.6, 0.3), ['stable', [11.111111, 21.728395]])],
 [('regression: just above hump', (1.0, 10.06, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 1.807157]]),
  ('regression: just below enrichment threshold',
   (1.0, 9.94, 1.0, 0.5, 1.5, 2.0),
   ['stable', [4.0, 1.792757]]),
  ('control: inefficient predator', (1.0, 50.0, 1.0, 0.5, 1.0, 2.0), ['predator-extinct', [50.0, 0.0]]),
  ('control: predator cannot persist capacity',
   (1.0, 3.0, 1.0, 0.5, 1.5, 2.0),
   ['predator-extinct', [3.0, 0.0]]),
  ('regression: type I predator', (0.8, 30.0, 0.2, 0.0, 0.5, 0.4), ['stable', [4.0, 3.466667]]),
  ('control: invalid rate', (0.0, 10.0, 1.0, 0.5, 1.5, 2.0), None),
  ('regression: lynx hare like', (1.2, 60.0, 0.05, 0.2, 0.6, 0.3), ['stable', [11.111111, 21.728395]])],
 [('regression: exact hopf point', (1.0, 10.0, 1.0, 0.5, 1.5, 2.0), ['hopf', [4.0, 1.8]]),
  ('regression: enriched cycles', (1.0, 40.0, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 2.7]]),
  ('control: predator cannot persist capacity',
   (1.0, 3.0, 1.0, 0.5, 1.5, 2.0),
   ['predator-extinct', [3.0, 0.0]]),
  ('regression: type I predator', (0.8, 30.0, 0.2, 0.0, 0.5, 0.4), ['stable', [4.0, 3.466667]]),
  ('control: invalid rate', (0.0, 10.0, 1.0, 0.5, 1.5, 2.0), None),
  ('regression: lynx hare like', (1.2, 60.0, 0.05, 0.2, 0.6, 0.3), ['stable', [11.111111, 21.728395]]),
  ('control: borderline conversion', (1.0, 20.0, 0.5, 0.5, 0.9, 1.6), ['predator-extinct', [20.0, 0.0]])],
 [('regression: exact hopf point', (1.0, 10.0, 1.0, 0.5, 1.5, 2.0), ['hopf', [4.0, 1.8]]),
  ('regression: enriched cycles', (1.0, 40.0, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 2.7]]),
  ('regression: poor habitat stable', (1.0, 8.0, 1.0, 0.5, 1.5, 2.0), ['stable', [4.0, 1.5]]),
  ('control: inefficient predator', (1.0, 50.0, 1.0, 0.5, 1.0, 2.0), ['predator-extinct', [50.0, 0.0]]),
  ('control: predator cannot persist capacity',
   (1.0, 3.0, 1.0, 0.5, 1.5, 2.0),
   ['predator-extinct', [3.0, 0.0]]),
  ('regression: lynx hare like', (1.2, 60.0, 0.05, 0.2, 0.6, 0.3), ['stable', [11.111111, 21.728395]]),
  ('control: borderline conversion', (1.0, 20.0, 0.5, 0.5, 0.9, 1.6), ['predator-extinct', [20.0, 0.0]])],
 [('regression: enriched cycles', (1.0, 40.0, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 2.7]]),
  ('regression: poor habitat stable', (1.0, 8.0, 1.0, 0.5, 1.5, 2.0), ['stable', [4.0, 1.5]]),
  ('regression: just above hump', (1.0, 10.06, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 1.807157]]),
  ('control: inefficient predator', (1.0, 50.0, 1.0, 0.5, 1.0, 2.0), ['predator-extinct', [50.0, 0.0]]),
  ('control: predator cannot persist capacity',
   (1.0, 3.0, 1.0, 0.5, 1.5, 2.0),
   ['predator-extinct', [3.0, 0.0]]),
  ('control: invalid rate', (0.0, 10.0, 1.0, 0.5, 1.5, 2.0), None),
  ('regression: lynx hare like', (1.2, 60.0, 0.05, 0.2, 0.6, 0.3), ['stable', [11.111111, 21.728395]])]]
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: exact hopf point['hopf', [4.0, 3.0]]['hopf', [4.0, 1.8]]Failed
regression: enriched cycles['cycles', [4.0, 4.5]]['cycles', [4.0, 2.7]]Failed
regression: poor habitat stable['stable', [4.0, 2.5]]['stable', [4.0, 1.5]]Failed
control: inefficient predator['predator-extinct', [50.0, 0.0]]['predator-extinct', [50.0, 0.0]]Passed
control: predator cannot persist capacity['predator-extinct', [3.0, 0.0]]['predator-extinct', [3.0, 0.0]]Passed
control: invalid rateNoneNonePassed
regression: lynx hare like['stable', [11.111111, 30.419753]]['stable', [11.111111, 21.728395]]Failed

SHA-256 / 6820dd8ba70cf4c54ccb78cb6ce2218d4e2edc8b048472a39304c44ad8576dd4

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(r, k, a, h, e, m):
    if min(r, k, a, e, m) <= 0 or h < 0:
        return None
    if e <= h * m:
        return ['predator-extinct', [float(k), 0.0]]
    ns = m / (a * (e - h * m))
    if ns >= k:
        return ['predator-extinct', [float(k), 0.0]]
    ps = r / a * (1 - ns / k) * (1 + a * h * ns)
    hump = (k - 1 / (a * h)) / 2 if h > 0 else -1.0
    if ns > hump:
        kind = 'stable'
    elif ns == hump:
        kind = 'hopf'
    else:
        kind = 'cycles'
    return [kind, [round(ns, 6), round(ps, 6)]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: exact hopf point', (1.0, 10.0, 1.0, 0.5, 1.5, 2.0), ['hopf', [4.0, 1.8]]),
  ('regression: enriched cycles', (1.0, 40.0, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 2.7]]),
  ('regression: poor habitat stable', (1.0, 8.0, 1.0, 0.5, 1.5, 2.0), ['stable', [4.0, 1.5]]),
  ('control: inefficient predator', (1.0, 50.0, 1.0, 0.5, 1.0, 2.0), ['predator-extinct', [50.0, 0.0]]),
  ('control: predator cannot persist capacity',
   (1.0, 3.0, 1.0, 0.5, 1.5, 2.0),
   ['predator-extinct', [3.0, 0.0]]),
  ('control: invalid rate', (0.0, 10.0, 1.0, 0.5, 1.5, 2.0), None),
  ('regression: lynx hare like', (1.2, 60.0, 0.05, 0.2, 0.6, 0.3), ['stable', [11.111111, 21.728395]])],
 [('regression: just above hump', (1.0, 10.06, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 1.807157]]),
  ('regression: just below enrichment threshold',
   (1.0, 9.94, 1.0, 0.5, 1.5, 2.0),
   ['stable', [4.0, 1.792757]]),
  ('control: inefficient predator', (1.0, 50.0, 1.0, 0.5, 1.0, 2.0), ['predator-extinct', [50.0, 0.0]]),
  ('control: predator cannot persist capacity',
   (1.0, 3.0, 1.0, 0.5, 1.5, 2.0),
   ['predator-extinct', [3.0, 0.0]]),
  ('regression: type I predator', (0.8, 30.0, 0.2, 0.0, 0.5, 0.4), ['stable', [4.0, 3.466667]]),
  ('control: invalid rate', (0.0, 10.0, 1.0, 0.5, 1.5, 2.0), None),
  ('regression: lynx hare like', (1.2, 60.0, 0.05, 0.2, 0.6, 0.3), ['stable', [11.111111, 21.728395]])],
 [('regression: exact hopf point', (1.0, 10.0, 1.0, 0.5, 1.5, 2.0), ['hopf', [4.0, 1.8]]),
  ('regression: enriched cycles', (1.0, 40.0, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 2.7]]),
  ('control: predator cannot persist capacity',
   (1.0, 3.0, 1.0, 0.5, 1.5, 2.0),
   ['predator-extinct', [3.0, 0.0]]),
  ('regression: type I predator', (0.8, 30.0, 0.2, 0.0, 0.5, 0.4), ['stable', [4.0, 3.466667]]),
  ('control: invalid rate', (0.0, 10.0, 1.0, 0.5, 1.5, 2.0), None),
  ('regression: lynx hare like', (1.2, 60.0, 0.05, 0.2, 0.6, 0.3), ['stable', [11.111111, 21.728395]]),
  ('control: borderline conversion', (1.0, 20.0, 0.5, 0.5, 0.9, 1.6), ['predator-extinct', [20.0, 0.0]])],
 [('regression: exact hopf point', (1.0, 10.0, 1.0, 0.5, 1.5, 2.0), ['hopf', [4.0, 1.8]]),
  ('regression: enriched cycles', (1.0, 40.0, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 2.7]]),
  ('regression: poor habitat stable', (1.0, 8.0, 1.0, 0.5, 1.5, 2.0), ['stable', [4.0, 1.5]]),
  ('control: inefficient predator', (1.0, 50.0, 1.0, 0.5, 1.0, 2.0), ['predator-extinct', [50.0, 0.0]]),
  ('control: predator cannot persist capacity',
   (1.0, 3.0, 1.0, 0.5, 1.5, 2.0),
   ['predator-extinct', [3.0, 0.0]]),
  ('regression: lynx hare like', (1.2, 60.0, 0.05, 0.2, 0.6, 0.3), ['stable', [11.111111, 21.728395]]),
  ('control: borderline conversion', (1.0, 20.0, 0.5, 0.5, 0.9, 1.6), ['predator-extinct', [20.0, 0.0]])],
 [('regression: enriched cycles', (1.0, 40.0, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 2.7]]),
  ('regression: poor habitat stable', (1.0, 8.0, 1.0, 0.5, 1.5, 2.0), ['stable', [4.0, 1.5]]),
  ('regression: just above hump', (1.0, 10.06, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 1.807157]]),
  ('control: inefficient predator', (1.0, 50.0, 1.0, 0.5, 1.0, 2.0), ['predator-extinct', [50.0, 0.0]]),
  ('control: predator cannot persist capacity',
   (1.0, 3.0, 1.0, 0.5, 1.5, 2.0),
   ['predator-extinct', [3.0, 0.0]]),
  ('control: invalid rate', (0.0, 10.0, 1.0, 0.5, 1.5, 2.0), None),
  ('regression: lynx hare like', (1.2, 60.0, 0.05, 0.2, 0.6, 0.3), ['stable', [11.111111, 21.728395]])]]
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: exact hopf point['hopf', [4.0, 1.8]]['hopf', [4.0, 1.8]]Passed
regression: enriched cycles['cycles', [4.0, 2.7]]['cycles', [4.0, 2.7]]Passed
regression: poor habitat stable['stable', [4.0, 1.5]]['stable', [4.0, 1.5]]Passed
control: inefficient predator['predator-extinct', [50.0, 0.0]]['predator-extinct', [50.0, 0.0]]Passed
control: predator cannot persist capacity['predator-extinct', [3.0, 0.0]]['predator-extinct', [3.0, 0.0]]Passed
control: invalid rateNoneNonePassed
regression: lynx hare like['stable', [11.111111, 21.728395]]['stable', [11.111111, 21.728395]]Passed

SHA-256 / 00564b49a251e8a75c81d2d35b9c6d46df2f350d2ec1e48c36210f76dc2ab5f3

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

Case digest / 8e3b46647971e6e802b4c2a78070b6e71b3a1f2ce88231efb53e58df3201703c