"""Job #4587: n1 (this job, census4587-all.json) against #1840's integer frontier (ifront959.out: n_int = n_cov + 1, MILP-infeasible) on the 40 supports ifront959 covers. Sanity: n_int <= n1 <= n* (a depth-1 certificate cannot exist below the true frontier).""" import json, re res = {r['a']: r for r in json.load(open('census4587-all.json'))} rows = [] for l in open('r1840-ifront959.out', encoding='utf-8'): m = re.match(r'^(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\S+)\s+(\d+)', l) if m: a, ns, Ls, ncov = int(m.group(1)), int(m.group(2)), int(m.group(3)), int(m.group(4)) rows.append((a, ns, ncov + 1, res[a]['n1'])) ok = all(ni <= n1 <= ns for a, ns, ni, n1 in rows) and all(res[a]['nstar'] == ns for a, ns, ni, n1 in rows) gap = sum(ns - ni for a, ns, ni, n1 in rows); closed = sum(ns - n1 for a, ns, ni, n1 in rows) full = sum(1 for a, ns, ni, n1 in rows if n1 == ni) print(f"{'PASS' if ok else 'FAIL'} sanity n_int <= n1 <= n* on all {len(rows)} supports, n* agreeing with census959w") print(f"weighted-to-integer gap n* - n_int summed over {len(rows)} supports: {gap} slots; closed by one-anchor n* - n1: {closed} ({closed / gap:.1%}); supports where n1 = n_int (one anchor reaches the integer frontier): {full}") print('a\tn*\tn1\tn_int') for r in rows: print('\t'.join(map(str, r)))