FA-70596 / GIS polygon topology / Open access
Douglas-Peucker simplification of a topology arc: tolerance comparison · case 01
Vertices exactly at the tolerance are retained.
ROOT CAUSE
The split test uses >=, keeping vertices whose distance equals the tolerance.
VERIFIED REPAIR
At the tolerance comparison step restore `if idx != -1 and best > tol:`, leaving the rest of the model unchanged.
Unsuccessful approach: Rounding the distance before comparing drops vertices slightly beyond tolerance.
Case contract
Input [points, tol]: an arc as integer [x, y] positions (possibly closed, first == last). Keep both endpoints; recursively (explicit stack) find the interior vertex farthest from the SEGMENT between the current endpoints (projection clamped to the segment; distance to the point itself if the endpoints coincide), taking the first maximum; keep it and split when that distance is strictly greater than tol. Return kept positions in order.
Why this case matters
Shared arcs are simplified once so adjacent polygons stay gap-free; distance and split errors change which boundary vertices survive.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
pts, tol = x
def dist(p, a, b):
dx, dy = b[0] - a[0], b[1] - a[1]
if dx == 0 and dy == 0:
return math.hypot(p[0] - a[0], p[1] - a[1])
t = ((p[0] - a[0]) * dx + (p[1] - a[1]) * dy) / (dx * dx + dy * dy)
t = max(0.0, min(1.0, t))
return math.hypot(p[0] - a[0] - t * dx, p[1] - a[1] - t * dy)
keep = [False] * len(pts)
keep[0] = keep[-1] = True
stack = [(0, len(pts) - 1)]
while stack:
i, j = stack.pop()
best, idx = -1.0, -1
for k in range(i + 1, j):
d = dist(pts[k], pts[i], pts[j])
if d > best:
best, idx = d, k
if idx != -1 and best >= tol:
keep[idx] = True
stack.append((i, idx))
stack.append((idx, j))
return [p for p, f in zip(pts, keep) if f]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('control #0', [[[0, 0], [3, 1], [6, -1], [9, 1], [12, 1], [15, 4], [18, 1], [21, -2], [24, 1]], 2], [[0, 0], [6, -1], [15, 4], [21, -2], [24, 1]]), ('control #1', [[[0, 3], [3, -4], [6, 1], [9, 3], [12, -4], [15, 1], [18, -1]], 1], [[0, 3], [3, -4], [9, 3], [12, -4], [15, 1], [18, -1]]), ('control #2', [[[0, -4], [3, 3], [6, -2], [9, -1], [12, 2], [15, 1], [18, 1]], 0], [[0, -4], [3, 3], [6, -2], [9, -1], [12, 2], [15, 1], [18, 1]]), ('control #3', [[[0, -3], [3, -1], [6, -3], [9, -2]], 3], [[0, -3], [9, -2]]), ('control #4', [[[0, -2], [3, -4], [6, -1], [9, -4], [12, 1], [15, 2]], 3], [[0, -2], [9, -4], [15, 2]]), ('control #5', [[[0, -2], [3, 2], [6, 2], [9, -3], [12, 3], [15, 4], [18, 2], [21, -2]], 0], [[0, -2], [3, 2], [6, 2], [9, -3], [12, 3], [15, 4], [18, 2], [21, -2]]), ('control #6', [[[0, 4], [3, -1], [6, 2], [9, 2], [12, 2]], 3], [[0, 4], [3, -1], [12, 2]]), ('control #9', [[[0, -3], [3, 4], [6, 0], [9, -4], [12, 0], [15, -1], [18, 4]], 0], [[0, -3], [3, 4], [9, -4], [12, 0], [15, -1], [18, 4]])], [('control #3', [[[0, -3], [3, -1], [6, -3], [9, -2]], 3], [[0, -3], [9, -2]]), ('control #4', [[[0, -2], [3, -4], [6, -1], [9, -4], [12, 1], [15, 2]], 3], [[0, -2], [9, -4], [15, 2]]), ('control #5', [[[0, -2], [3, 2], [6, 2], [9, -3], [12, 3], [15, 4], [18, 2], [21, -2]], 0], [[0, -2], [3, 2], [6, 2], [9, -3], [12, 3], [15, 4], [18, 2], [21, -2]]), ('control #6', [[[0, 4], [3, -1], [6, 2], [9, 2], [12, 2]], 3], [[0, 4], [3, -1], [12, 2]]), ('control #7', [[[0, -4], [3, 0], [6, -3], [9, 1], [12, 1], [15, 3]], 2], [[0, -4], [3, 0], [6, -3], [15, 3]]), ('control #8', [[[0, -4], [3, -4], [6, 1], [9, 3], [12, 3], [15, -4]], 1], [[0, -4], [3, -4], [9, 3], [12, 3], [15, -4]]), ('control #9', [[[0, -3], [3, 4], [6, 0], [9, -4], [12, 0], [15, -1], [18, 4]], 0], [[0, -3], [3, 4], [9, -4], [12, 0], [15, -1], [18, 4]]), ('boundary #18', [[[0, 0], [5, 2], [10, 0]], 2], [[0, 0], [10, 0]])], [('control #6', [[[0, 4], [3, -1], [6, 2], [9, 2], [12, 2]], 3], [[0, 4], [3, -1], [12, 2]]), ('control #7', [[[0, -4], [3, 0], [6, -3], [9, 1], [12, 1], [15, 3]], 2], [[0, -4], [3, 0], [6, -3], [15, 3]]), ('control #8', [[[0, -4], [3, -4], [6, 1], [9, 3], [12, 3], [15, -4]], 1], [[0, -4], [3, -4], [9, 3], [12, 3], [15, -4]]), ('control #9', [[[0, -3], [3, 4], [6, 0], [9, -4], [12, 0], [15, -1], [18, 4]], 0], [[0, -3], [3, 4], [9, -4], [12, 0], [15, -1], [18, 4]]), ('control #10', [[[0, -4], [3, -2], [6, 1], [9, 1]], 2], [[0, -4], [9, 1]]), ('control #11', [[[0, 4], [3, -3], [6, -2], [9, -4], [12, 4], [15, 4], [18, -1]], 2], [[0, 4], [3, -3], [9, -4], [12, 4], [18, -1]]), ('regression #14', [[[0, 0], [10, 0], [14, 3], [20, 0]], 2], [[0, 0], [10, 0], [14, 3], [20, 0]]), ('boundary #28', [[[0, 0], [4, 3], [1, 4], [0, 0]], 5], [[0, 0], [0, 0]])], [('control #2', [[[0, -4], [3, 3], [6, -2], [9, -1], [12, 2], [15, 1], [18, 1]], 0], [[0, -4], [3, 3], [6, -2], [9, -1], [12, 2], [15, 1], [18, 1]]), ('control #9', [[[0, -3], [3, 4], [6, 0], [9, -4], [12, 0], [15, -1], [18, 4]], 0], [[0, -3], [3, 4], [9, -4], [12, 0], [15, -1], [18, 4]]), ('control #11', [[[0, 4], [3, -3], [6, -2], [9, -4], [12, 4], [15, 4], [18, -1]], 2], [[0, 4], [3, -3], [9, -4], [12, 4], [18, -1]]), ('control #12', [[[0, 2], [3, -3], [6, 3], [9, -1]], 1], [[0, 2], [3, -3], [6, 3], [9, -1]]), ('control #13', [[[0, 4], [3, -1], [6, -4], [9, -2], [12, 4], [15, -3], [18, -1], [21, 0]], 3], [[0, 4], [6, -4], [12, 4], [15, -3], [21, 0]]), ('regression #14', [[[0, 0], [10, 0], [14, 3], [20, 0]], 2], [[0, 0], [10, 0], [14, 3], [20, 0]]), ('regression #15', [[[0, 0], [5, 0], [-6, 1], [10, 0]], 2], [[0, 0], [5, 0], [-6, 1], [10, 0]]), ('regression #16', [[[0, 0], [4, 4], [8, 0], [4, -4], [0, 0]], 1], [[0, 0], [4, 4], [8, 0], [4, -4], [0, 0]])], [('control #7', [[[0, -4], [3, 0], [6, -3], [9, 1], [12, 1], [15, 3]], 2], [[0, -4], [3, 0], [6, -3], [15, 3]]), ('control #13', [[[0, 4], [3, -1], [6, -4], [9, -2], [12, 4], [15, -3], [18, -1], [21, 0]], 3], [[0, 4], [6, -4], [12, 4], [15, -3], [21, 0]]), ('regression #14', [[[0, 0], [10, 0], [14, 3], [20, 0]], 2], [[0, 0], [10, 0], [14, 3], [20, 0]]), ('regression #15', [[[0, 0], [5, 0], [-6, 1], [10, 0]], 2], [[0, 0], [5, 0], [-6, 1], [10, 0]]), ('regression #16', [[[0, 0], [4, 4], [8, 0], [4, -4], [0, 0]], 1], [[0, 0], [4, 4], [8, 0], [4, -4], [0, 0]]), ('regression #17', [[[0, 0], [6, 1], [6, 7], [0, 6], [0, 0]], 2], [[0, 0], [6, 1], [6, 7], [0, 6], [0, 0]]), ('boundary #18', [[[0, 0], [5, 2], [10, 0]], 2], [[0, 0], [10, 0]]), ('boundary #19', [[[0, 0], [5, 3], [10, 0]], 2], [[0, 0], [5, 3], [10, 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 |
|---|---|---|---|
| control #0 | [[0, 0], [6, -1], [15, 4], [21, -2], [24, 1]] | [[0, 0], [6, -1], [15, 4], [21, -2], [24, 1]] | Passed |
| control #1 | [[0, 3], [3, -4], [9, 3], [12, -4], [15, 1], [18, -1]] | [[0, 3], [3, -4], [9, 3], [12, -4], [15, 1], [18, -1]] | Passed |
| control #2 | [[0, -4], [3, 3], [6, -2], [9, -1], [12, 2], [15, 1], [18, 1]] | [[0, -4], [3, 3], [6, -2], [9, -1], [12, 2], [15, 1], [18, 1]] | Passed |
| control #3 | [[0, -3], [9, -2]] | [[0, -3], [9, -2]] | Passed |
| control #4 | [[0, -2], [9, -4], [15, 2]] | [[0, -2], [9, -4], [15, 2]] | Passed |
| control #5 | [[0, -2], [3, 2], [6, 2], [9, -3], [12, 3], [15, 4], [18, 2], [21, -2]] | [[0, -2], [3, 2], [6, 2], [9, -3], [12, 3], [15, 4], [18, 2], [21, -2]] | Passed |
| control #6 | [[0, 4], [3, -1], [12, 2]] | [[0, 4], [3, -1], [12, 2]] | Passed |
| control #9 | [[0, -3], [3, 4], [6, 0], [9, -4], [12, 0], [15, -1], [18, 4]] | [[0, -3], [3, 4], [9, -4], [12, 0], [15, -1], [18, 4]] | Failed |
SHA-256 / 8a12c74eba63e29845d265a2e4116c979805d34a13fcb0c0305fa2deb5d95e42
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
pts, tol = x
def dist(p, a, b):
dx, dy = b[0] - a[0], b[1] - a[1]
if dx == 0 and dy == 0:
return math.hypot(p[0] - a[0], p[1] - a[1])
t = ((p[0] - a[0]) * dx + (p[1] - a[1]) * dy) / (dx * dx + dy * dy)
t = max(0.0, min(1.0, t))
return math.hypot(p[0] - a[0] - t * dx, p[1] - a[1] - t * dy)
keep = [False] * len(pts)
keep[0] = keep[-1] = True
stack = [(0, len(pts) - 1)]
while stack:
i, j = stack.pop()
best, idx = -1.0, -1
for k in range(i + 1, j):
d = dist(pts[k], pts[i], pts[j])
if d > best:
best, idx = d, k
if idx != -1 and round(best) > tol:
keep[idx] = True
stack.append((i, idx))
stack.append((idx, j))
return [p for p, f in zip(pts, keep) if f]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('control #0', [[[0, 0], [3, 1], [6, -1], [9, 1], [12, 1], [15, 4], [18, 1], [21, -2], [24, 1]], 2], [[0, 0], [6, -1], [15, 4], [21, -2], [24, 1]]), ('control #1', [[[0, 3], [3, -4], [6, 1], [9, 3], [12, -4], [15, 1], [18, -1]], 1], [[0, 3], [3, -4], [9, 3], [12, -4], [15, 1], [18, -1]]), ('control #2', [[[0, -4], [3, 3], [6, -2], [9, -1], [12, 2], [15, 1], [18, 1]], 0], [[0, -4], [3, 3], [6, -2], [9, -1], [12, 2], [15, 1], [18, 1]]), ('control #3', [[[0, -3], [3, -1], [6, -3], [9, -2]], 3], [[0, -3], [9, -2]]), ('control #4', [[[0, -2], [3, -4], [6, -1], [9, -4], [12, 1], [15, 2]], 3], [[0, -2], [9, -4], [15, 2]]), ('control #5', [[[0, -2], [3, 2], [6, 2], [9, -3], [12, 3], [15, 4], [18, 2], [21, -2]], 0], [[0, -2], [3, 2], [6, 2], [9, -3], [12, 3], [15, 4], [18, 2], [21, -2]]), ('control #6', [[[0, 4], [3, -1], [6, 2], [9, 2], [12, 2]], 3], [[0, 4], [3, -1], [12, 2]]), ('control #9', [[[0, -3], [3, 4], [6, 0], [9, -4], [12, 0], [15, -1], [18, 4]], 0], [[0, -3], [3, 4], [9, -4], [12, 0], [15, -1], [18, 4]])], [('control #3', [[[0, -3], [3, -1], [6, -3], [9, -2]], 3], [[0, -3], [9, -2]]), ('control #4', [[[0, -2], [3, -4], [6, -1], [9, -4], [12, 1], [15, 2]], 3], [[0, -2], [9, -4], [15, 2]]), ('control #5', [[[0, -2], [3, 2], [6, 2], [9, -3], [12, 3], [15, 4], [18, 2], [21, -2]], 0], [[0, -2], [3, 2], [6, 2], [9, -3], [12, 3], [15, 4], [18, 2], [21, -2]]), ('control #6', [[[0, 4], [3, -1], [6, 2], [9, 2], [12, 2]], 3], [[0, 4], [3, -1], [12, 2]]), ('control #7', [[[0, -4], [3, 0], [6, -3], [9, 1], [12, 1], [15, 3]], 2], [[0, -4], [3, 0], [6, -3], [15, 3]]), ('control #8', [[[0, -4], [3, -4], [6, 1], [9, 3], [12, 3], [15, -4]], 1], [[0, -4], [3, -4], [9, 3], [12, 3], [15, -4]]), ('control #9', [[[0, -3], [3, 4], [6, 0], [9, -4], [12, 0], [15, -1], [18, 4]], 0], [[0, -3], [3, 4], [9, -4], [12, 0], [15, -1], [18, 4]]), ('boundary #18', [[[0, 0], [5, 2], [10, 0]], 2], [[0, 0], [10, 0]])], [('control #6', [[[0, 4], [3, -1], [6, 2], [9, 2], [12, 2]], 3], [[0, 4], [3, -1], [12, 2]]), ('control #7', [[[0, -4], [3, 0], [6, -3], [9, 1], [12, 1], [15, 3]], 2], [[0, -4], [3, 0], [6, -3], [15, 3]]), ('control #8', [[[0, -4], [3, -4], [6, 1], [9, 3], [12, 3], [15, -4]], 1], [[0, -4], [3, -4], [9, 3], [12, 3], [15, -4]]), ('control #9', [[[0, -3], [3, 4], [6, 0], [9, -4], [12, 0], [15, -1], [18, 4]], 0], [[0, -3], [3, 4], [9, -4], [12, 0], [15, -1], [18, 4]]), ('control #10', [[[0, -4], [3, -2], [6, 1], [9, 1]], 2], [[0, -4], [9, 1]]), ('control #11', [[[0, 4], [3, -3], [6, -2], [9, -4], [12, 4], [15, 4], [18, -1]], 2], [[0, 4], [3, -3], [9, -4], [12, 4], [18, -1]]), ('regression #14', [[[0, 0], [10, 0], [14, 3], [20, 0]], 2], [[0, 0], [10, 0], [14, 3], [20, 0]]), ('boundary #28', [[[0, 0], [4, 3], [1, 4], [0, 0]], 5], [[0, 0], [0, 0]])], [('control #2', [[[0, -4], [3, 3], [6, -2], [9, -1], [12, 2], [15, 1], [18, 1]], 0], [[0, -4], [3, 3], [6, -2], [9, -1], [12, 2], [15, 1], [18, 1]]), ('control #9', [[[0, -3], [3, 4], [6, 0], [9, -4], [12, 0], [15, -1], [18, 4]], 0], [[0, -3], [3, 4], [9, -4], [12, 0], [15, -1], [18, 4]]), ('control #11', [[[0, 4], [3, -3], [6, -2], [9, -4], [12, 4], [15, 4], [18, -1]], 2], [[0, 4], [3, -3], [9, -4], [12, 4], [18, -1]]), ('control #12', [[[0, 2], [3, -3], [6, 3], [9, -1]], 1], [[0, 2], [3, -3], [6, 3], [9, -1]]), ('control #13', [[[0, 4], [3, -1], [6, -4], [9, -2], [12, 4], [15, -3], [18, -1], [21, 0]], 3], [[0, 4], [6, -4], [12, 4], [15, -3], [21, 0]]), ('regression #14', [[[0, 0], [10, 0], [14, 3], [20, 0]], 2], [[0, 0], [10, 0], [14, 3], [20, 0]]), ('regression #15', [[[0, 0], [5, 0], [-6, 1], [10, 0]], 2], [[0, 0], [5, 0], [-6, 1], [10, 0]]), ('regression #16', [[[0, 0], [4, 4], [8, 0], [4, -4], [0, 0]], 1], [[0, 0], [4, 4], [8, 0], [4, -4], [0, 0]])], [('control #7', [[[0, -4], [3, 0], [6, -3], [9, 1], [12, 1], [15, 3]], 2], [[0, -4], [3, 0], [6, -3], [15, 3]]), ('control #13', [[[0, 4], [3, -1], [6, -4], [9, -2], [12, 4], [15, -3], [18, -1], [21, 0]], 3], [[0, 4], [6, -4], [12, 4], [15, -3], [21, 0]]), ('regression #14', [[[0, 0], [10, 0], [14, 3], [20, 0]], 2], [[0, 0], [10, 0], [14, 3], [20, 0]]), ('regression #15', [[[0, 0], [5, 0], [-6, 1], [10, 0]], 2], [[0, 0], [5, 0], [-6, 1], [10, 0]]), ('regression #16', [[[0, 0], [4, 4], [8, 0], [4, -4], [0, 0]], 1], [[0, 0], [4, 4], [8, 0], [4, -4], [0, 0]]), ('regression #17', [[[0, 0], [6, 1], [6, 7], [0, 6], [0, 0]], 2], [[0, 0], [6, 1], [6, 7], [0, 6], [0, 0]]), ('boundary #18', [[[0, 0], [5, 2], [10, 0]], 2], [[0, 0], [10, 0]]), ('boundary #19', [[[0, 0], [5, 3], [10, 0]], 2], [[0, 0], [5, 3], [10, 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 |
|---|---|---|---|
| control #0 | [[0, 0], [6, -1], [15, 4], [21, -2], [24, 1]] | [[0, 0], [6, -1], [15, 4], [21, -2], [24, 1]] | Passed |
| control #1 | [[0, 3], [3, -4], [9, 3], [12, -4], [15, 1], [18, -1]] | [[0, 3], [3, -4], [9, 3], [12, -4], [15, 1], [18, -1]] | Passed |
| control #2 | [[0, -4], [3, 3], [6, -2], [9, -1], [12, 2], [18, 1]] | [[0, -4], [3, 3], [6, -2], [9, -1], [12, 2], [15, 1], [18, 1]] | Failed |
| control #3 | [[0, -3], [9, -2]] | [[0, -3], [9, -2]] | Passed |
| control #4 | [[0, -2], [9, -4], [15, 2]] | [[0, -2], [9, -4], [15, 2]] | Passed |
| control #5 | [[0, -2], [3, 2], [6, 2], [9, -3], [12, 3], [15, 4], [18, 2], [21, -2]] | [[0, -2], [3, 2], [6, 2], [9, -3], [12, 3], [15, 4], [18, 2], [21, -2]] | Passed |
| control #6 | [[0, 4], [3, -1], [12, 2]] | [[0, 4], [3, -1], [12, 2]] | Passed |
| control #9 | [[0, -3], [3, 4], [9, -4], [12, 0], [15, -1], [18, 4]] | [[0, -3], [3, 4], [9, -4], [12, 0], [15, -1], [18, 4]] | Passed |
SHA-256 / 7b3e960484074ca0f47cff9eceaf90a11486f5db69919e5cac45e32cc9bf0e52
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
pts, tol = x
def dist(p, a, b):
dx, dy = b[0] - a[0], b[1] - a[1]
if dx == 0 and dy == 0:
return math.hypot(p[0] - a[0], p[1] - a[1])
t = ((p[0] - a[0]) * dx + (p[1] - a[1]) * dy) / (dx * dx + dy * dy)
t = max(0.0, min(1.0, t))
return math.hypot(p[0] - a[0] - t * dx, p[1] - a[1] - t * dy)
keep = [False] * len(pts)
keep[0] = keep[-1] = True
stack = [(0, len(pts) - 1)]
while stack:
i, j = stack.pop()
best, idx = -1.0, -1
for k in range(i + 1, j):
d = dist(pts[k], pts[i], pts[j])
if d > best:
best, idx = d, k
if idx != -1 and best > tol:
keep[idx] = True
stack.append((i, idx))
stack.append((idx, j))
return [p for p, f in zip(pts, keep) if f]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('control #0', [[[0, 0], [3, 1], [6, -1], [9, 1], [12, 1], [15, 4], [18, 1], [21, -2], [24, 1]], 2], [[0, 0], [6, -1], [15, 4], [21, -2], [24, 1]]), ('control #1', [[[0, 3], [3, -4], [6, 1], [9, 3], [12, -4], [15, 1], [18, -1]], 1], [[0, 3], [3, -4], [9, 3], [12, -4], [15, 1], [18, -1]]), ('control #2', [[[0, -4], [3, 3], [6, -2], [9, -1], [12, 2], [15, 1], [18, 1]], 0], [[0, -4], [3, 3], [6, -2], [9, -1], [12, 2], [15, 1], [18, 1]]), ('control #3', [[[0, -3], [3, -1], [6, -3], [9, -2]], 3], [[0, -3], [9, -2]]), ('control #4', [[[0, -2], [3, -4], [6, -1], [9, -4], [12, 1], [15, 2]], 3], [[0, -2], [9, -4], [15, 2]]), ('control #5', [[[0, -2], [3, 2], [6, 2], [9, -3], [12, 3], [15, 4], [18, 2], [21, -2]], 0], [[0, -2], [3, 2], [6, 2], [9, -3], [12, 3], [15, 4], [18, 2], [21, -2]]), ('control #6', [[[0, 4], [3, -1], [6, 2], [9, 2], [12, 2]], 3], [[0, 4], [3, -1], [12, 2]]), ('control #9', [[[0, -3], [3, 4], [6, 0], [9, -4], [12, 0], [15, -1], [18, 4]], 0], [[0, -3], [3, 4], [9, -4], [12, 0], [15, -1], [18, 4]])], [('control #3', [[[0, -3], [3, -1], [6, -3], [9, -2]], 3], [[0, -3], [9, -2]]), ('control #4', [[[0, -2], [3, -4], [6, -1], [9, -4], [12, 1], [15, 2]], 3], [[0, -2], [9, -4], [15, 2]]), ('control #5', [[[0, -2], [3, 2], [6, 2], [9, -3], [12, 3], [15, 4], [18, 2], [21, -2]], 0], [[0, -2], [3, 2], [6, 2], [9, -3], [12, 3], [15, 4], [18, 2], [21, -2]]), ('control #6', [[[0, 4], [3, -1], [6, 2], [9, 2], [12, 2]], 3], [[0, 4], [3, -1], [12, 2]]), ('control #7', [[[0, -4], [3, 0], [6, -3], [9, 1], [12, 1], [15, 3]], 2], [[0, -4], [3, 0], [6, -3], [15, 3]]), ('control #8', [[[0, -4], [3, -4], [6, 1], [9, 3], [12, 3], [15, -4]], 1], [[0, -4], [3, -4], [9, 3], [12, 3], [15, -4]]), ('control #9', [[[0, -3], [3, 4], [6, 0], [9, -4], [12, 0], [15, -1], [18, 4]], 0], [[0, -3], [3, 4], [9, -4], [12, 0], [15, -1], [18, 4]]), ('boundary #18', [[[0, 0], [5, 2], [10, 0]], 2], [[0, 0], [10, 0]])], [('control #6', [[[0, 4], [3, -1], [6, 2], [9, 2], [12, 2]], 3], [[0, 4], [3, -1], [12, 2]]), ('control #7', [[[0, -4], [3, 0], [6, -3], [9, 1], [12, 1], [15, 3]], 2], [[0, -4], [3, 0], [6, -3], [15, 3]]), ('control #8', [[[0, -4], [3, -4], [6, 1], [9, 3], [12, 3], [15, -4]], 1], [[0, -4], [3, -4], [9, 3], [12, 3], [15, -4]]), ('control #9', [[[0, -3], [3, 4], [6, 0], [9, -4], [12, 0], [15, -1], [18, 4]], 0], [[0, -3], [3, 4], [9, -4], [12, 0], [15, -1], [18, 4]]), ('control #10', [[[0, -4], [3, -2], [6, 1], [9, 1]], 2], [[0, -4], [9, 1]]), ('control #11', [[[0, 4], [3, -3], [6, -2], [9, -4], [12, 4], [15, 4], [18, -1]], 2], [[0, 4], [3, -3], [9, -4], [12, 4], [18, -1]]), ('regression #14', [[[0, 0], [10, 0], [14, 3], [20, 0]], 2], [[0, 0], [10, 0], [14, 3], [20, 0]]), ('boundary #28', [[[0, 0], [4, 3], [1, 4], [0, 0]], 5], [[0, 0], [0, 0]])], [('control #2', [[[0, -4], [3, 3], [6, -2], [9, -1], [12, 2], [15, 1], [18, 1]], 0], [[0, -4], [3, 3], [6, -2], [9, -1], [12, 2], [15, 1], [18, 1]]), ('control #9', [[[0, -3], [3, 4], [6, 0], [9, -4], [12, 0], [15, -1], [18, 4]], 0], [[0, -3], [3, 4], [9, -4], [12, 0], [15, -1], [18, 4]]), ('control #11', [[[0, 4], [3, -3], [6, -2], [9, -4], [12, 4], [15, 4], [18, -1]], 2], [[0, 4], [3, -3], [9, -4], [12, 4], [18, -1]]), ('control #12', [[[0, 2], [3, -3], [6, 3], [9, -1]], 1], [[0, 2], [3, -3], [6, 3], [9, -1]]), ('control #13', [[[0, 4], [3, -1], [6, -4], [9, -2], [12, 4], [15, -3], [18, -1], [21, 0]], 3], [[0, 4], [6, -4], [12, 4], [15, -3], [21, 0]]), ('regression #14', [[[0, 0], [10, 0], [14, 3], [20, 0]], 2], [[0, 0], [10, 0], [14, 3], [20, 0]]), ('regression #15', [[[0, 0], [5, 0], [-6, 1], [10, 0]], 2], [[0, 0], [5, 0], [-6, 1], [10, 0]]), ('regression #16', [[[0, 0], [4, 4], [8, 0], [4, -4], [0, 0]], 1], [[0, 0], [4, 4], [8, 0], [4, -4], [0, 0]])], [('control #7', [[[0, -4], [3, 0], [6, -3], [9, 1], [12, 1], [15, 3]], 2], [[0, -4], [3, 0], [6, -3], [15, 3]]), ('control #13', [[[0, 4], [3, -1], [6, -4], [9, -2], [12, 4], [15, -3], [18, -1], [21, 0]], 3], [[0, 4], [6, -4], [12, 4], [15, -3], [21, 0]]), ('regression #14', [[[0, 0], [10, 0], [14, 3], [20, 0]], 2], [[0, 0], [10, 0], [14, 3], [20, 0]]), ('regression #15', [[[0, 0], [5, 0], [-6, 1], [10, 0]], 2], [[0, 0], [5, 0], [-6, 1], [10, 0]]), ('regression #16', [[[0, 0], [4, 4], [8, 0], [4, -4], [0, 0]], 1], [[0, 0], [4, 4], [8, 0], [4, -4], [0, 0]]), ('regression #17', [[[0, 0], [6, 1], [6, 7], [0, 6], [0, 0]], 2], [[0, 0], [6, 1], [6, 7], [0, 6], [0, 0]]), ('boundary #18', [[[0, 0], [5, 2], [10, 0]], 2], [[0, 0], [10, 0]]), ('boundary #19', [[[0, 0], [5, 3], [10, 0]], 2], [[0, 0], [5, 3], [10, 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 |
|---|---|---|---|
| control #0 | [[0, 0], [6, -1], [15, 4], [21, -2], [24, 1]] | [[0, 0], [6, -1], [15, 4], [21, -2], [24, 1]] | Passed |
| control #1 | [[0, 3], [3, -4], [9, 3], [12, -4], [15, 1], [18, -1]] | [[0, 3], [3, -4], [9, 3], [12, -4], [15, 1], [18, -1]] | Passed |
| control #2 | [[0, -4], [3, 3], [6, -2], [9, -1], [12, 2], [15, 1], [18, 1]] | [[0, -4], [3, 3], [6, -2], [9, -1], [12, 2], [15, 1], [18, 1]] | Passed |
| control #3 | [[0, -3], [9, -2]] | [[0, -3], [9, -2]] | Passed |
| control #4 | [[0, -2], [9, -4], [15, 2]] | [[0, -2], [9, -4], [15, 2]] | Passed |
| control #5 | [[0, -2], [3, 2], [6, 2], [9, -3], [12, 3], [15, 4], [18, 2], [21, -2]] | [[0, -2], [3, 2], [6, 2], [9, -3], [12, 3], [15, 4], [18, 2], [21, -2]] | Passed |
| control #6 | [[0, 4], [3, -1], [12, 2]] | [[0, 4], [3, -1], [12, 2]] | Passed |
| control #9 | [[0, -3], [3, 4], [9, -4], [12, 0], [15, -1], [18, 4]] | [[0, -3], [3, 4], [9, -4], [12, 0], [15, -1], [18, 4]] | Passed |
SHA-256 / fba9003d69c2156ef02c1e388ceeca0dc91f16a86dd6207568af043e4464bed5
Verification & scope
Stipulated deterministic toy contract on a bounded input domain; results are rounded as stated and no conformance with any published standard or library is claimed. 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:48:22.232043+00:00.
Case digest / 9e1861855f25f8f7abf906756360a392577866bfc01aa1088214ab122f5c9887