# dpcheck2473.py -- independent completeness check of route 94's tie counts: for each level, take one attaining position # per T19 seed (from the DFS output), run route 86's seed-completion DP (complete2028.py, unchanged, imported) and compare # completions(seed) + completions(mirror seed) with the DFS's nmax. import sys, json, time sys.path.insert(0, '../job2028'); from complete2028 import analyse, P19 c47 = json.load(open('../job2040/crt47.json')); c = json.load(open('../job2040/crt53-61.json')) levels = [(47, c47['G'], c47['nmax'], c47['positions'], c47['seeds19'])] + [(int(k), v['G'], v['nmax'], v['positions'], v['seeds19']) for k, v in c.items()] out = [] for x, G, nmax, positions, seeds in levels: if len(sys.argv) > 1 and str(x) not in sys.argv[1:]: continue t0 = time.time(); tot = 0; per = [] for s in seeds: p = next(pp for pp in positions if pp % P19 == s) r = analyse(x, G, p, enumerate_j=False) per.append(dict(seed=s, position=p, n_inner=r['n_inner'], completions=r['completions'], tuples=len(r['completing_residue_tuples']))) tot += r['completions'] ok = tot == nmax print(f"x={x} G={G} nmax_DFS={nmax} DP completions per seed={[(d['seed'], d['completions']) for d in per]} sum={tot} n_inner={[d['n_inner'] for d in per]} MATCH={ok} ({time.time()-t0:.1f}s)", flush=True) out.append(dict(x=x, G=G, nmax_DFS=nmax, per_seed=per, sum_completions=tot, match=ok)) json.dump(out, open('dpcheck2473.json', 'w'), indent=1)