FAILURE MAP
← Case archive

FA-12026 / Optimization solver contracts / Open access

Constraint violation is traded away by objective weighting · case 01

Constraint violation is traded away by objective weighting.

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

ROOT CAUSE

Finite penalty weighting allows an infeasible candidate to beat a feasible one.

VERIFIED REPAIR

Order by violation first, objective second, then stable input position.

Unsuccessful approach: Prioritizing only the feasible flag fails to rank two infeasible candidates by violation.

Case contract

Given candidate (name,nonnegative violation,objective) triples, return name minimizing (violation,objective), stable on exact ties; None for empty.

Why this case matters

This deterministic solver-step model isolates an algorithmic invariant used by iterative optimization implementations.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(candidates):
    return min(candidates,key=lambda c:c[2]+10*c[1])[0] if candidates else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('feasibility dominates', solve([("a",0,100*N),("b",1,0)]), 'a')
check('infeasible ordering', solve([("a",N,100),("b",2*N,0)]), 'a')
check('objective tiebreak', solve([("a",0,4),("b",0,2)]), 'b')
check('stable ties', solve([("a",N,2),("b",N,2)]), 'a')
check('single candidate', solve([("a",N,-3)]), 'a')
check('no candidates', solve([]), None)
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
feasibility dominatesbaFailed
infeasible orderingbaFailed
objective tiebreakbbPassed
stable tiesaaPassed
single candidateaaPassed
no candidatesNoneNonePassed

SHA-256 / 1eb5de2779a48953dfc64cdf14aa9f6dde69a03c0c8081a569e1ab0746ce0c49

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(candidates):
    return min(candidates,key=lambda c:(c[1]>0,c[2]))[0] if candidates else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('feasibility dominates', solve([("a",0,100*N),("b",1,0)]), 'a')
check('infeasible ordering', solve([("a",N,100),("b",2*N,0)]), 'a')
check('objective tiebreak', solve([("a",0,4),("b",0,2)]), 'b')
check('stable ties', solve([("a",N,2),("b",N,2)]), 'a')
check('single candidate', solve([("a",N,-3)]), 'a')
check('no candidates', solve([]), None)
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
feasibility dominatesaaPassed
infeasible orderingbaFailed
objective tiebreakbbPassed
stable tiesaaPassed
single candidateaaPassed
no candidatesNoneNonePassed

SHA-256 / 8e989fbf83358cce7ba1f76b3213d074d4189136f77cb84cc66293408ff24d40

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(candidates):
    return min(candidates,key=lambda c:(c[1],c[2]))[0] if candidates else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('feasibility dominates', solve([("a",0,100*N),("b",1,0)]), 'a')
check('infeasible ordering', solve([("a",N,100),("b",2*N,0)]), 'a')
check('objective tiebreak', solve([("a",0,4),("b",0,2)]), 'b')
check('stable ties', solve([("a",N,2),("b",N,2)]), 'a')
check('single candidate', solve([("a",N,-3)]), 'a')
check('no candidates', solve([]), None)
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
feasibility dominatesaaPassed
infeasible orderingaaPassed
objective tiebreakbbPassed
stable tiesaaPassed
single candidateaaPassed
no candidatesNoneNonePassed

SHA-256 / 3cda5cc81a07fb6eac84054e27e94cb959de84abe0b8cbba3c68b1d357074c7e

Verification & scope

Controlled finite inputs and explicit one-step contracts; this is not a production solver or a numerical stability benchmark. 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:38:53.069521+00:00.

Case digest / 1afc9e829ff7ed3eaac8bceeb8483d736287d374ae66cb9bfbf12a173d19fc20