FAILURE MAP
← Case archive

FA-65541 / Ecological population dynamics / Open access

Lotka-Volterra competition outcome: neutral tie detection · case 01

A knife-edge isocline tie is reported as founder control or coexistence.

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

ROOT CAUSE

Neutrality requires both criteria to be zero.

VERIFIED REPAIR

Restore the neutral tie detection rule: `if c1 == 0 or c2 == 0:`.

Unsuccessful approach: An absolute tolerance of one individual labels near ties neutral.

Case contract

c1=K1*a21-K2, c2=K2*a12-K1; any zero -> neutral; c1>0,c2<0 species1 wins at [K1,0]; c1<0,c2>0 species2 at [0,K2]; otherwise interior N1=(K1-a12K2)/(1-a12a21), N2=(K2-a21K1)/(1-a12a21), coexist if both negative, founder if both positive; None for non-positive K or negative coefficients (zero allowed).

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(k1, k2, a12, a21):
    if min(k1, k2) <= 0 or min(a12, a21) < 0:
        return None
    c1 = k1 * a21 - k2
    c2 = k2 * a12 - k1
    if c1 == 0 and c2 == 0:
        return ['neutral', None]
    if c1 > 0 and c2 < 0:
        return ['species1', [float(k1), 0.0]]
    if c1 < 0 and c2 > 0:
        return ['species2', [0.0, float(k2)]]
    den = 1 - a12 * a21
    n1 = (k1 - a12 * k2) / den
    n2 = (k2 - a21 * k1) / den
    kind = 'coexist' if c1 < 0 else 'founder'
    return [kind, [round(n1, 4), round(n2, 4)]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('control: weak competition coexist', (100, 80, 0.5, 0.4), ['coexist', [75.0, 50.0]]),
  ('control: strong asymmetric species1', (100, 60, 0.5, 1.2), ['species1', [100.0, 0.0]]),
  ('control: species2 wins', (50, 120, 1.5, 0.3), ['species2', [0.0, 120.0]]),
  ('control: founder control', (100, 100, 1.5, 1.6), ['founder', [35.7143, 42.8571]]),
  ('regression: neutral tie', (100, 50, 1.0, 0.5), ['neutral', None]),
  ('control: no competition', (70, 40, 0.0, 0.0), ['coexist', [70.0, 40.0]]),
  ('regression: near tie', (100, 99.5, 1.0, 1.0), ['species1', [100.0, 0.0]])],
 [('control: founder control', (100, 100, 1.5, 1.6), ['founder', [35.7143, 42.8571]]),
  ('regression: neutral tie', (100, 50, 1.0, 0.5), ['neutral', None]),
  ('control: no competition', (70, 40, 0.0, 0.0), ['coexist', [70.0, 40.0]]),
  ('control: coexist with one strong coefficient', (200, 60, 1.5, 0.2), ['coexist', [157.1429, 28.5714]]),
  ('control: invalid negative coefficient', (100, 100, -0.1, 0.5), None),
  ('control: invalid capacity', (0, 100, 0.5, 0.5), None),
  ('regression: near tie', (100, 99.5, 1.0, 1.0), ['species1', [100.0, 0.0]])],
 [('control: weak competition coexist', (100, 80, 0.5, 0.4), ['coexist', [75.0, 50.0]]),
  ('regression: neutral tie', (100, 50, 1.0, 0.5), ['neutral', None]),
  ('control: coexist with one strong coefficient', (200, 60, 1.5, 0.2), ['coexist', [157.1429, 28.5714]]),
  ('control: invalid negative coefficient', (100, 100, -0.1, 0.5), None),
  ('control: invalid capacity', (0, 100, 0.5, 0.5), None),
  ('regression: near tie', (100, 99.5, 1.0, 1.0), ['species1', [100.0, 0.0]]),
  ('control: founder asymmetric', (90, 150, 2.0, 2.5), ['founder', [52.5, 18.75]])],
 [('control: weak competition coexist', (100, 80, 0.5, 0.4), ['coexist', [75.0, 50.0]]),
  ('control: strong asymmetric species1', (100, 60, 0.5, 1.2), ['species1', [100.0, 0.0]]),
  ('control: species2 wins', (50, 120, 1.5, 0.3), ['species2', [0.0, 120.0]]),
  ('control: founder control', (100, 100, 1.5, 1.6), ['founder', [35.7143, 42.8571]]),
  ('regression: neutral tie', (100, 50, 1.0, 0.5), ['neutral', None]),
  ('regression: near tie', (100, 99.5, 1.0, 1.0), ['species1', [100.0, 0.0]]),
  ('control: founder asymmetric', (90, 150, 2.0, 2.5), ['founder', [52.5, 18.75]])],
 [('control: strong asymmetric species1', (100, 60, 0.5, 1.2), ['species1', [100.0, 0.0]]),
  ('control: species2 wins', (50, 120, 1.5, 0.3), ['species2', [0.0, 120.0]]),
  ('control: founder control', (100, 100, 1.5, 1.6), ['founder', [35.7143, 42.8571]]),
  ('regression: neutral tie', (100, 50, 1.0, 0.5), ['neutral', None]),
  ('control: no competition', (70, 40, 0.0, 0.0), ['coexist', [70.0, 40.0]]),
  ('control: coexist with one strong coefficient', (200, 60, 1.5, 0.2), ['coexist', [157.1429, 28.5714]]),
  ('regression: near tie', (100, 99.5, 1.0, 1.0), ['species1', [100.0, 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: weak competition coexist['coexist', [75.0, 50.0]]['coexist', [75.0, 50.0]]Passed
control: strong asymmetric species1['species1', [100.0, 0.0]]['species1', [100.0, 0.0]]Passed
control: species2 wins['species2', [0.0, 120.0]]['species2', [0.0, 120.0]]Passed
control: founder control['founder', [35.7143, 42.8571]]['founder', [35.7143, 42.8571]]Passed
regression: neutral tie['founder', [100.0, 0.0]]['neutral', None]Failed
control: no competition['coexist', [70.0, 40.0]]['coexist', [70.0, 40.0]]Passed
regression: near tie['species1', [100.0, 0.0]]['species1', [100.0, 0.0]]Passed

SHA-256 / e9498e7fe609fcf258480b0629d70c5a021725bcf36879bbad29d3e3ade9597a

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(k1, k2, a12, a21):
    if min(k1, k2) <= 0 or min(a12, a21) < 0:
        return None
    c1 = k1 * a21 - k2
    c2 = k2 * a12 - k1
    if abs(c1) < 1 or abs(c2) < 1:
        return ['neutral', None]
    if c1 > 0 and c2 < 0:
        return ['species1', [float(k1), 0.0]]
    if c1 < 0 and c2 > 0:
        return ['species2', [0.0, float(k2)]]
    den = 1 - a12 * a21
    n1 = (k1 - a12 * k2) / den
    n2 = (k2 - a21 * k1) / den
    kind = 'coexist' if c1 < 0 else 'founder'
    return [kind, [round(n1, 4), round(n2, 4)]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('control: weak competition coexist', (100, 80, 0.5, 0.4), ['coexist', [75.0, 50.0]]),
  ('control: strong asymmetric species1', (100, 60, 0.5, 1.2), ['species1', [100.0, 0.0]]),
  ('control: species2 wins', (50, 120, 1.5, 0.3), ['species2', [0.0, 120.0]]),
  ('control: founder control', (100, 100, 1.5, 1.6), ['founder', [35.7143, 42.8571]]),
  ('regression: neutral tie', (100, 50, 1.0, 0.5), ['neutral', None]),
  ('control: no competition', (70, 40, 0.0, 0.0), ['coexist', [70.0, 40.0]]),
  ('regression: near tie', (100, 99.5, 1.0, 1.0), ['species1', [100.0, 0.0]])],
 [('control: founder control', (100, 100, 1.5, 1.6), ['founder', [35.7143, 42.8571]]),
  ('regression: neutral tie', (100, 50, 1.0, 0.5), ['neutral', None]),
  ('control: no competition', (70, 40, 0.0, 0.0), ['coexist', [70.0, 40.0]]),
  ('control: coexist with one strong coefficient', (200, 60, 1.5, 0.2), ['coexist', [157.1429, 28.5714]]),
  ('control: invalid negative coefficient', (100, 100, -0.1, 0.5), None),
  ('control: invalid capacity', (0, 100, 0.5, 0.5), None),
  ('regression: near tie', (100, 99.5, 1.0, 1.0), ['species1', [100.0, 0.0]])],
 [('control: weak competition coexist', (100, 80, 0.5, 0.4), ['coexist', [75.0, 50.0]]),
  ('regression: neutral tie', (100, 50, 1.0, 0.5), ['neutral', None]),
  ('control: coexist with one strong coefficient', (200, 60, 1.5, 0.2), ['coexist', [157.1429, 28.5714]]),
  ('control: invalid negative coefficient', (100, 100, -0.1, 0.5), None),
  ('control: invalid capacity', (0, 100, 0.5, 0.5), None),
  ('regression: near tie', (100, 99.5, 1.0, 1.0), ['species1', [100.0, 0.0]]),
  ('control: founder asymmetric', (90, 150, 2.0, 2.5), ['founder', [52.5, 18.75]])],
 [('control: weak competition coexist', (100, 80, 0.5, 0.4), ['coexist', [75.0, 50.0]]),
  ('control: strong asymmetric species1', (100, 60, 0.5, 1.2), ['species1', [100.0, 0.0]]),
  ('control: species2 wins', (50, 120, 1.5, 0.3), ['species2', [0.0, 120.0]]),
  ('control: founder control', (100, 100, 1.5, 1.6), ['founder', [35.7143, 42.8571]]),
  ('regression: neutral tie', (100, 50, 1.0, 0.5), ['neutral', None]),
  ('regression: near tie', (100, 99.5, 1.0, 1.0), ['species1', [100.0, 0.0]]),
  ('control: founder asymmetric', (90, 150, 2.0, 2.5), ['founder', [52.5, 18.75]])],
 [('control: strong asymmetric species1', (100, 60, 0.5, 1.2), ['species1', [100.0, 0.0]]),
  ('control: species2 wins', (50, 120, 1.5, 0.3), ['species2', [0.0, 120.0]]),
  ('control: founder control', (100, 100, 1.5, 1.6), ['founder', [35.7143, 42.8571]]),
  ('regression: neutral tie', (100, 50, 1.0, 0.5), ['neutral', None]),
  ('control: no competition', (70, 40, 0.0, 0.0), ['coexist', [70.0, 40.0]]),
  ('control: coexist with one strong coefficient', (200, 60, 1.5, 0.2), ['coexist', [157.1429, 28.5714]]),
  ('regression: near tie', (100, 99.5, 1.0, 1.0), ['species1', [100.0, 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: weak competition coexist['coexist', [75.0, 50.0]]['coexist', [75.0, 50.0]]Passed
control: strong asymmetric species1['species1', [100.0, 0.0]]['species1', [100.0, 0.0]]Passed
control: species2 wins['species2', [0.0, 120.0]]['species2', [0.0, 120.0]]Passed
control: founder control['founder', [35.7143, 42.8571]]['founder', [35.7143, 42.8571]]Passed
regression: neutral tie['neutral', None]['neutral', None]Passed
control: no competition['coexist', [70.0, 40.0]]['coexist', [70.0, 40.0]]Passed
regression: near tie['neutral', None]['species1', [100.0, 0.0]]Failed

SHA-256 / 43eab430f59fcc862f35ac3e32750595f94e310309c045700699ac8f99b6f56f

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(k1, k2, a12, a21):
    if min(k1, k2) <= 0 or min(a12, a21) < 0:
        return None
    c1 = k1 * a21 - k2
    c2 = k2 * a12 - k1
    if c1 == 0 or c2 == 0:
        return ['neutral', None]
    if c1 > 0 and c2 < 0:
        return ['species1', [float(k1), 0.0]]
    if c1 < 0 and c2 > 0:
        return ['species2', [0.0, float(k2)]]
    den = 1 - a12 * a21
    n1 = (k1 - a12 * k2) / den
    n2 = (k2 - a21 * k1) / den
    kind = 'coexist' if c1 < 0 else 'founder'
    return [kind, [round(n1, 4), round(n2, 4)]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('control: weak competition coexist', (100, 80, 0.5, 0.4), ['coexist', [75.0, 50.0]]),
  ('control: strong asymmetric species1', (100, 60, 0.5, 1.2), ['species1', [100.0, 0.0]]),
  ('control: species2 wins', (50, 120, 1.5, 0.3), ['species2', [0.0, 120.0]]),
  ('control: founder control', (100, 100, 1.5, 1.6), ['founder', [35.7143, 42.8571]]),
  ('regression: neutral tie', (100, 50, 1.0, 0.5), ['neutral', None]),
  ('control: no competition', (70, 40, 0.0, 0.0), ['coexist', [70.0, 40.0]]),
  ('regression: near tie', (100, 99.5, 1.0, 1.0), ['species1', [100.0, 0.0]])],
 [('control: founder control', (100, 100, 1.5, 1.6), ['founder', [35.7143, 42.8571]]),
  ('regression: neutral tie', (100, 50, 1.0, 0.5), ['neutral', None]),
  ('control: no competition', (70, 40, 0.0, 0.0), ['coexist', [70.0, 40.0]]),
  ('control: coexist with one strong coefficient', (200, 60, 1.5, 0.2), ['coexist', [157.1429, 28.5714]]),
  ('control: invalid negative coefficient', (100, 100, -0.1, 0.5), None),
  ('control: invalid capacity', (0, 100, 0.5, 0.5), None),
  ('regression: near tie', (100, 99.5, 1.0, 1.0), ['species1', [100.0, 0.0]])],
 [('control: weak competition coexist', (100, 80, 0.5, 0.4), ['coexist', [75.0, 50.0]]),
  ('regression: neutral tie', (100, 50, 1.0, 0.5), ['neutral', None]),
  ('control: coexist with one strong coefficient', (200, 60, 1.5, 0.2), ['coexist', [157.1429, 28.5714]]),
  ('control: invalid negative coefficient', (100, 100, -0.1, 0.5), None),
  ('control: invalid capacity', (0, 100, 0.5, 0.5), None),
  ('regression: near tie', (100, 99.5, 1.0, 1.0), ['species1', [100.0, 0.0]]),
  ('control: founder asymmetric', (90, 150, 2.0, 2.5), ['founder', [52.5, 18.75]])],
 [('control: weak competition coexist', (100, 80, 0.5, 0.4), ['coexist', [75.0, 50.0]]),
  ('control: strong asymmetric species1', (100, 60, 0.5, 1.2), ['species1', [100.0, 0.0]]),
  ('control: species2 wins', (50, 120, 1.5, 0.3), ['species2', [0.0, 120.0]]),
  ('control: founder control', (100, 100, 1.5, 1.6), ['founder', [35.7143, 42.8571]]),
  ('regression: neutral tie', (100, 50, 1.0, 0.5), ['neutral', None]),
  ('regression: near tie', (100, 99.5, 1.0, 1.0), ['species1', [100.0, 0.0]]),
  ('control: founder asymmetric', (90, 150, 2.0, 2.5), ['founder', [52.5, 18.75]])],
 [('control: strong asymmetric species1', (100, 60, 0.5, 1.2), ['species1', [100.0, 0.0]]),
  ('control: species2 wins', (50, 120, 1.5, 0.3), ['species2', [0.0, 120.0]]),
  ('control: founder control', (100, 100, 1.5, 1.6), ['founder', [35.7143, 42.8571]]),
  ('regression: neutral tie', (100, 50, 1.0, 0.5), ['neutral', None]),
  ('control: no competition', (70, 40, 0.0, 0.0), ['coexist', [70.0, 40.0]]),
  ('control: coexist with one strong coefficient', (200, 60, 1.5, 0.2), ['coexist', [157.1429, 28.5714]]),
  ('regression: near tie', (100, 99.5, 1.0, 1.0), ['species1', [100.0, 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: weak competition coexist['coexist', [75.0, 50.0]]['coexist', [75.0, 50.0]]Passed
control: strong asymmetric species1['species1', [100.0, 0.0]]['species1', [100.0, 0.0]]Passed
control: species2 wins['species2', [0.0, 120.0]]['species2', [0.0, 120.0]]Passed
control: founder control['founder', [35.7143, 42.8571]]['founder', [35.7143, 42.8571]]Passed
regression: neutral tie['neutral', None]['neutral', None]Passed
control: no competition['coexist', [70.0, 40.0]]['coexist', [70.0, 40.0]]Passed
regression: near tie['species1', [100.0, 0.0]]['species1', [100.0, 0.0]]Passed

SHA-256 / 047bc5c50fab01f90acb6703c2cae5c919eb3284d2d3ca40588255c3fe9fe65c

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

Case digest / 130890de21424de2da8b2d0ed23d25176a3f5f6e395871abc3d800e5c5cd3ff6