FAILURE MAP
← Case archive

FA-26181 / Filter interfaces / Open access

Replacing a set tests the resulting distinct operands against quota · case 01

Replacing a set tests the resulting distinct operands against quota is violated by the widget projection.

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

ROOT CAUSE

The replace-capacity decision uses `len(set(d['values']+d['replacement']))<=d['value_limit']` instead of the stipulated criterion-quota projection.

VERIFIED REPAIR

Implement the declared replace-capacity projection: `len(set(d['replacement']))<=d['value_limit']`.

Unsuccessful approach: The attempted correction `len(d['replacement'])<d['value_limit']` still violates the explicit contract fixtures.

Case contract

Filter-builder quotas separately bound user rows, nested groups and set operands; disabled user rows still consume edit capacity but enforced rows are exempt. This example checks: Replacing a set tests the resulting distinct operands against quota.

Why this case matters

Filter-widget state and serialization must preserve user constraints while the view changes.

1 / The failure

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

N = 1
observations = []
def solve(d):
    return {'operand-cost':(sum(len(x['operands']) for x in d['rows'] if not x['system'])), 'row-add-gate':(sum(not x['system'] for x in d['rows'])<d['row_limit']), 'group-cost':(sum(x['kind']=='group' for x in d['nodes'])), 'set-cost':(len(set(d['values']))), 'replace-capacity':(len(set(d['values']+d['replacement']))<=d['value_limit']), 'remaining-rows':(max(0,d['row_limit']-sum(not x['system'] for x in d['rows'])))}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'rows': [], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': False, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 3, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [], 'values': [], 'replacement': [], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': [], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0})], 2: [({'rows': [], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': False, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 3, 'nodes': [], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [], 'row_limit': 3, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': False, 'remaining-rows': 0})], 3: [({'rows': [], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': False, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 3, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': [], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [], 'values': [], 'replacement': [], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': False, 'remaining-rows': 0})], 4: [({'rows': [], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': False, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 3, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [], 'row_limit': 3, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': False, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 0})], 5: [({'rows': [], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 3, 'nodes': [], 'values': [], 'replacement': [], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [], 'row_limit': 3, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': [], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': False, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 3, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1})]}
for index, (data, expected) in enumerate(fixtures[N]):
    check("contract fixture " + str(index), solve(data), 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
contract fixture 0{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': False, 'row-add-gate': True, 'set-cost': 2}{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}Failed
contract fixture 1{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': False, 'row-add-gate': True, 'set-cost': 2}{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}Failed
contract fixture 2{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}Passed
contract fixture 3{'group-cost': 1, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': False, 'row-add-gate': True, 'set-cost': 2}{'group-cost': 1, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}Failed
contract fixture 4{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 2, 'replace-capacity': False, 'row-add-gate': True, 'set-cost': 2}{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 2, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}Failed
contract fixture 5{'group-cost': 1, 'operand-cost': 0, 'remaining-rows': 2, 'replace-capacity': False, 'row-add-gate': True, 'set-cost': 2}{'group-cost': 1, 'operand-cost': 0, 'remaining-rows': 2, 'replace-capacity': False, 'row-add-gate': True, 'set-cost': 2}Passed
contract fixture 6{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 3, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 3, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}Passed
contract fixture 7{'group-cost': 0, 'operand-cost': 3, 'remaining-rows': 0, 'replace-capacity': True, 'row-add-gate': False, 'set-cost': 0}{'group-cost': 0, 'operand-cost': 3, 'remaining-rows': 0, 'replace-capacity': True, 'row-add-gate': False, 'set-cost': 0}Passed
contract fixture 8{'group-cost': 1, 'operand-cost': 3, 'remaining-rows': 0, 'replace-capacity': True, 'row-add-gate': False, 'set-cost': 0}{'group-cost': 1, 'operand-cost': 3, 'remaining-rows': 0, 'replace-capacity': True, 'row-add-gate': False, 'set-cost': 0}Passed
contract fixture 9{'group-cost': 0, 'operand-cost': 3, 'remaining-rows': 0, 'replace-capacity': True, 'row-add-gate': False, 'set-cost': 0}{'group-cost': 0, 'operand-cost': 3, 'remaining-rows': 0, 'replace-capacity': True, 'row-add-gate': False, 'set-cost': 0}Passed

SHA-256 / ce6d3e20002d62bb89b0c7f85983799aa6e46536954c8db93ace99315c2c4eb3

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(d):
    return {'operand-cost':(sum(len(x['operands']) for x in d['rows'] if not x['system'])), 'row-add-gate':(sum(not x['system'] for x in d['rows'])<d['row_limit']), 'group-cost':(sum(x['kind']=='group' for x in d['nodes'])), 'set-cost':(len(set(d['values']))), 'replace-capacity':(len(d['replacement'])<d['value_limit']), 'remaining-rows':(max(0,d['row_limit']-sum(not x['system'] for x in d['rows'])))}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'rows': [], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': False, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 3, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [], 'values': [], 'replacement': [], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': [], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0})], 2: [({'rows': [], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': False, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 3, 'nodes': [], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [], 'row_limit': 3, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': False, 'remaining-rows': 0})], 3: [({'rows': [], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': False, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 3, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': [], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [], 'values': [], 'replacement': [], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': False, 'remaining-rows': 0})], 4: [({'rows': [], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': False, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 3, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [], 'row_limit': 3, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': False, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 0})], 5: [({'rows': [], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 3, 'nodes': [], 'values': [], 'replacement': [], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [], 'row_limit': 3, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': [], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': False, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 3, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1})]}
for index, (data, expected) in enumerate(fixtures[N]):
    check("contract fixture " + str(index), solve(data), 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
contract fixture 0{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}Passed
contract fixture 1{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': False, 'row-add-gate': True, 'set-cost': 2}{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}Failed
contract fixture 2{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}Passed
contract fixture 3{'group-cost': 1, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': False, 'row-add-gate': True, 'set-cost': 2}{'group-cost': 1, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}Failed
contract fixture 4{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 2, 'replace-capacity': False, 'row-add-gate': True, 'set-cost': 2}{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 2, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}Failed
contract fixture 5{'group-cost': 1, 'operand-cost': 0, 'remaining-rows': 2, 'replace-capacity': False, 'row-add-gate': True, 'set-cost': 2}{'group-cost': 1, 'operand-cost': 0, 'remaining-rows': 2, 'replace-capacity': False, 'row-add-gate': True, 'set-cost': 2}Passed
contract fixture 6{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 3, 'replace-capacity': False, 'row-add-gate': True, 'set-cost': 2}{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 3, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}Failed
contract fixture 7{'group-cost': 0, 'operand-cost': 3, 'remaining-rows': 0, 'replace-capacity': True, 'row-add-gate': False, 'set-cost': 0}{'group-cost': 0, 'operand-cost': 3, 'remaining-rows': 0, 'replace-capacity': True, 'row-add-gate': False, 'set-cost': 0}Passed
contract fixture 8{'group-cost': 1, 'operand-cost': 3, 'remaining-rows': 0, 'replace-capacity': True, 'row-add-gate': False, 'set-cost': 0}{'group-cost': 1, 'operand-cost': 3, 'remaining-rows': 0, 'replace-capacity': True, 'row-add-gate': False, 'set-cost': 0}Passed
contract fixture 9{'group-cost': 0, 'operand-cost': 3, 'remaining-rows': 0, 'replace-capacity': False, 'row-add-gate': False, 'set-cost': 0}{'group-cost': 0, 'operand-cost': 3, 'remaining-rows': 0, 'replace-capacity': True, 'row-add-gate': False, 'set-cost': 0}Failed

SHA-256 / 9dbe2c56a56b5c4dc927980fcf375b7f670cb9c4db85243c6d1af437761e2310

3 / The verified repair

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

N = 1
observations = []
def solve(d):
    return {'operand-cost':(sum(len(x['operands']) for x in d['rows'] if not x['system'])), 'row-add-gate':(sum(not x['system'] for x in d['rows'])<d['row_limit']), 'group-cost':(sum(x['kind']=='group' for x in d['nodes'])), 'set-cost':(len(set(d['values']))), 'replace-capacity':(len(set(d['replacement']))<=d['value_limit']), 'remaining-rows':(max(0,d['row_limit']-sum(not x['system'] for x in d['rows'])))}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'rows': [], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': False, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 3, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [], 'values': [], 'replacement': [], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': [], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0})], 2: [({'rows': [], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': False, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 3, 'nodes': [], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [], 'row_limit': 3, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': False, 'remaining-rows': 0})], 3: [({'rows': [], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': False, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 3, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': [], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [], 'values': [], 'replacement': [], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': False, 'remaining-rows': 0})], 4: [({'rows': [], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': False, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 3, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [], 'row_limit': 3, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': False, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 0})], 5: [({'rows': [], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 3, 'nodes': [], 'values': [], 'replacement': [], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [], 'row_limit': 3, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': [], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': False, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 3, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1})]}
for index, (data, expected) in enumerate(fixtures[N]):
    check("contract fixture " + str(index), solve(data), 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
contract fixture 0{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}Passed
contract fixture 1{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}Passed
contract fixture 2{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}Passed
contract fixture 3{'group-cost': 1, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}{'group-cost': 1, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}Passed
contract fixture 4{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 2, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 2, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}Passed
contract fixture 5{'group-cost': 1, 'operand-cost': 0, 'remaining-rows': 2, 'replace-capacity': False, 'row-add-gate': True, 'set-cost': 2}{'group-cost': 1, 'operand-cost': 0, 'remaining-rows': 2, 'replace-capacity': False, 'row-add-gate': True, 'set-cost': 2}Passed
contract fixture 6{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 3, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 3, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}Passed
contract fixture 7{'group-cost': 0, 'operand-cost': 3, 'remaining-rows': 0, 'replace-capacity': True, 'row-add-gate': False, 'set-cost': 0}{'group-cost': 0, 'operand-cost': 3, 'remaining-rows': 0, 'replace-capacity': True, 'row-add-gate': False, 'set-cost': 0}Passed
contract fixture 8{'group-cost': 1, 'operand-cost': 3, 'remaining-rows': 0, 'replace-capacity': True, 'row-add-gate': False, 'set-cost': 0}{'group-cost': 1, 'operand-cost': 3, 'remaining-rows': 0, 'replace-capacity': True, 'row-add-gate': False, 'set-cost': 0}Passed
contract fixture 9{'group-cost': 0, 'operand-cost': 3, 'remaining-rows': 0, 'replace-capacity': True, 'row-add-gate': False, 'set-cost': 0}{'group-cost': 0, 'operand-cost': 3, 'remaining-rows': 0, 'replace-capacity': True, 'row-add-gate': False, 'set-cost': 0}Passed

SHA-256 / 03e64afdf83612b6dfb2c29ad7a0dc2ce7c7e05a37668eccf431a1335acd79cb

Verification & scope

Deterministic bounded UI-state model only; no browser, query engine, network, or production-standard conformance 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:41:13.621739+00:00.

Case digest / d4f45d7841921ac6c93c090ccbbb763fd77520a4c21d8f4c7ce4e9f69ed3cb16