// ============================================================================ // job67-transport-parallel.js — worker-parallel port of // research/attack-frontier37-02-transport.js (engine and scoring kept as in // the served script; the stream is partitioned into blocks with pre/post-rolls // so that 9 worker threads can score one fold of the old tile in parallel). // // Old tile T_x is generated from a stored base T_b (b <= 23) by a list of // on-the-fly folds F = [f_1 .. f_m] (T_x = T_b folded by f_1, then f_2, ...). // Stream order is the served deep37 order: k_m outermost, ..., k_1, base slot i. // A block is one value of the outermost one or two copy indices; each block is // scored by an engine that is warmed by a PRE-ROLL of the R alive slots before // the block (indices -R..-1) and closed by a POST-ROLL of the R alive slots // after it (indices D_chunk..). Attribution: kill runs by their start index, // old gaps and L=0 new gaps by the gap index, windows by the first gap index, // all "ours" iff in [0, D_chunk). Histograms and maxima are merged in main. // // usage: node --max-old-space-size=8192 job67-transport-parallel.js calib|fold31|fold37|fold41|all // ============================================================================ 'use strict'; const { Worker, isMainThread, parentPort, workerData } = require('worker_threads'); const path = require('path'); const R = 256; // pre/post-roll length in slots const HB = 8192; // histogram buckets, index = value / 6 const PRING = 1024; // ring of recent slot positions, for the window sums const NWORKERS = 9; const pad = (v, n) => String(v).padStart(n); // --------------------------------------------------------------------------- // THE ENGINE (served makeEngine, generalised to a chunk with pre/post-rolls). // push(i, s, r): slot index i (negative in the pre-roll), absolute position s, // residue r = s mod q. D is set by setD(n) after the chunk, before the post-roll. // --------------------------------------------------------------------------- function makeEngine(q) { let D = Number.MAX_SAFE_INTEGER; // --- direct route state: at most two live alignments let aA = -1, sA = -1, pA = 0, aB = -1, sB = -1, pB = 0; let Lmax = 0, prevPos = -1, prevR = -1, prevIdx = 0, started = false; const bestByLen = new Float64Array(64); let nRuns = 0, maxRunGap = 0, unclosed = 0; // --- histograms const histOld = new Float64Array(HB); // old gaps, one period const histNew = new Float64Array(HB); // new gaps, one new period const histQloose = new Float64Array(HB); // window sums, loose interiors const histQalt = new Float64Array(HB); // window sums, alternation-legal interiors // --- word route state (for the certificates and Q_L) const pring = new Float64Array(PRING); let qrun = 0, maxQrun = 0; // consecutive qualifying gaps let bA = 1, bB = 1; // alternation walk, lengths in slots let Mloose = 0, Malt = 0; let nWinLoose = 0, nWinAlt = 0; let over = 0; function bump(h, v) { const b = v / 6; if (b < HB) h[b]++; else over++; } function closeRun(a, st, en, after, before) { const len = en - st + 1; if (st < 0 || st >= D) return; // started in a roll: not ours if (len > Lmax) Lmax = len; nRuns++; const g = after - before; if (g > maxRunGap) maxRunGap = g; if (len < 64 && g > bestByLen[len]) bestByLen[len] = g; bump(histNew, g); } function push(i, s, r) { const r2 = r + 2 >= q ? r + 2 - q : r + 2; // ---- direct route ---------------------------------------------------- let nA = -1, nsA = -1, npA = 0, nB = -1, nsB = -1, npB = 0; if (aA === r || aA === r2) { nA = aA; nsA = sA; npA = pA; } else if (aA >= 0) closeRun(aA, sA, i - 1, s, pA); if (aB === r || aB === r2) { if (nA < 0) { nA = aB; nsA = sB; npA = pB; } else { nB = aB; nsB = sB; npB = pB; } } else if (aB >= 0) closeRun(aB, sB, i - 1, s, pB); if (r !== nA && r !== nB) { if (nA < 0) { nA = r; nsA = i; npA = prevPos; } else { nB = r; nsB = i; npB = prevPos; } } if (r2 !== nA && r2 !== nB) { if (nA < 0) { nA = r2; nsA = i; npA = prevPos; } else { nB = r2; nsB = i; npB = prevPos; } } aA = nA; sA = nsA; pA = npA; aB = nB; sB = nsB; pB = npB; // ---- the gap that ends at this slot ---------------------------------- if (started) { const g = s - prevPos; if (prevIdx >= 0 && prevIdx < D) { bump(histOld, g); // L = 0 new gaps: alignments at which BOTH endpoints live let ov; if (prevR === r) ov = 2; else if (r === (prevR + 2) % q || prevR === (r + 2) % q) ov = 1; else ov = 0; const mult = q - 4 + ov; const b = g / 6; if (b < HB) histNew[b] += mult; else over++; } // THE WINDOWS WHOSE FREE RIGHT GAP IS THIS ONE, g_{prevIdx}. The first // gap index j runs from prevIdx-1 downward; the interiors are // g_{j+1}..g_{prevIdx-1}, so the state used here is the one carried by // gap prevIdx-1, i.e. the state BEFORE this gap is folded in. const altrun = (bA > bB ? bA : bB) - 1; // legal interior suffix, in gaps const hi = prevIdx - 1; // L = 1, no interior const loL = hi - qrun, loA = hi - altrun; const hiCap = D - 1; const top = hi < hiCap ? hi : hiCap; for (let j = top; j >= loL && j >= 0; j--) { const wsum = s - pring[j & (PRING - 1)]; bump(histQloose, wsum); nWinLoose++; if (wsum > Mloose) Mloose = wsum; if (j >= loA) { bump(histQalt, wsum); nWinAlt++; if (wsum > Malt) Malt = wsum; } } // now carry the state across gap prevIdx const c = g % q; const qual = (c === 0 || c === 2 || c === q - 2); qrun = qual ? qrun + 1 : 0; if (qrun > maxQrun) maxQrun = qrun; if (c === 0) { const x = bA + 1, y = bB + 1; bA = x; bB = y; } else if (c === 2) { const x = bB + 1; bA = x; bB = 1; } else if (c === q - 2) { const y = bA + 1; bA = 1; bB = y; } else { bA = 1; bB = 1; } } pring[i & (PRING - 1)] = s; prevPos = s; prevR = r; prevIdx = i; started = true; } function setD(n) { D = n; } function finish() { // a run of ours still live after R post-roll slots would be R long: report it if (aA >= 0 && sA >= 0 && sA < D) unclosed++; if (aB >= 0 && sB >= 0 && sB < D) unclosed++; return { L: Lmax, nRuns, maxRunGap, unclosed, bestByLen: Array.from(bestByLen), Mloose, Malt, nWinLoose, nWinAlt, maxQrun, over, histOld, histNew, histQloose, histQalt, dold: D }; } return { push, setD, finish }; } // --------------------------------------------------------------------------- // SCORING (served, plus the counted D(old) and the unclosed-run check) // --------------------------------------------------------------------------- function score(r, q, D, W, label, expect) { const tail = h => { let t = 0; const out = new Float64Array(HB); for (let b = HB - 1; b >= 0; b--) { t += h[b]; out[b] = t; } return out; }; const N = tail(r.histOld), Nn = tail(r.histNew), QL = tail(r.histQloose), QA = tail(r.histQalt); let top = 0; for (let b = HB - 1; b >= 0; b--) if (r.histNew[b] > 0 || r.histOld[b] > 0 || r.histQloose[b] > 0) { top = b; break; } let viol = 0, maxRatio = 0, argmax = 0, violAlt = 0; for (let b = 1; b <= top; b++) { const th = b * 6; const rhs = (q - 2) * N[b] + 2 * QL[b]; if (Nn[b] > rhs) viol++; const rhsA = (q - 2) * N[b] + 2 * QA[b]; if (Nn[b] > rhsA) violAlt++; if (rhs > 0) { const ra = Nn[b] / rhs; if (ra > maxRatio) { maxRatio = ra; argmax = th; } } } let dnew = 0; for (let b = 0; b < HB; b++) dnew += r.histNew[b]; const dexp = D * (q - 2); let g2new = 0; for (let b = HB - 1; b >= 0; b--) if (r.histNew[b] > 0) { g2new = b * 6; break; } let g2old = 0; for (let b = HB - 1; b >= 0; b--) if (r.histOld[b] > 0) { g2old = b * 6; break; } const gi = Math.min(HB - 1, g2new / 6); const o = { label, q, D, W, dold: r.dold, g2old, g2new, L: r.L, Mloose: r.Mloose, Malt: r.Malt, Mfull: g2new, dnew, dexp, dok: dnew === dexp, viol, violAlt, maxRatio, argmax, maxQrun: r.maxQrun, nRuns: r.nRuns, over: r.over, unclosed: r.unclosed, bestByLen: r.bestByLen.slice(0, 8), NnG2: Nn[gi], QLG2: QL[gi], QAG2: QA[gi], NG2: N[gi], thetaCount: top, nWinLoose: r.nWinLoose, nWinAlt: r.nWinAlt }; console.log(''); console.log('--- ' + label + ' fold q = ' + q + ' ---'); console.log(' D(old) = ' + D + ' counted ' + r.dold + ' ' + (r.dold === D ? 'EXACT' : 'MISMATCH') + ' W(old) = ' + W + ' G2(old) = ' + g2old); console.log(' D(new) counted = ' + dnew + ' expected D(q-2) = ' + dexp + ' ' + (o.dok ? 'EXACT' : 'MISMATCH')); console.log(' L(direct) = ' + r.L + ' maximal kill runs enumerated = ' + r.nRuns + ' unclosed runs = ' + r.unclosed); console.log(' best merged gap by run length 1..7: ' + o.bestByLen.slice(1).join(', ')); console.log(' G2(new) = M_full = ' + g2new + (expect && expect.g2 ? (' expected ' + expect.g2 + ' ' + (g2new === expect.g2 ? 'AGREE' : 'MISMATCH')) : '')); console.log(' M_loose = ' + r.Mloose + ' M_alt = ' + r.Malt + (expect && expect.cert ? (' recorded certificate ' + expect.cert + ' ' + (r.Mloose === expect.cert ? 'AGREE' : 'MISMATCH')) : '')); console.log(' M_alt vs truth: ' + (r.Malt === g2new ? 'EXACT' : 'LOSS ' + (r.Malt - g2new)) + ' M_loose vs truth: ' + (r.Mloose === g2new ? 'EXACT' : 'LOSS ' + (r.Mloose - g2new))); console.log(' transport inequality, untruncated L-sum, ' + top + ' theta values:'); console.log(' violations (loose Q_L) = ' + viol + ' violations (alt-refined Q_L) = ' + violAlt); console.log(' max N_new/RHS = ' + maxRatio.toFixed(4) + ' at theta = ' + argmax); console.log(' at theta = G2(new) = ' + g2new + ': N_new = ' + o.NnG2 + ' SUM Q_L = ' + o.QLG2 + ' (alt ' + o.QAG2 + ')' + ' N(theta) = ' + o.NG2); console.log(' windows scored: loose ' + r.nWinLoose + ', alternation-legal ' + r.nWinAlt + ' longest qualifying gap run = ' + r.maxQrun + ' histogram overflow = ' + r.over); if (expect) { const checks = []; const ck = (name, got, exp) => { if (exp === undefined || exp === null) return; checks.push(name + ' ' + got + (got === exp ? ' = ' : ' != ') + exp + (got === exp ? ' OK' : ' FAIL')); }; ck('G2', g2new, expect.g2); ck('M_loose', r.Mloose, expect.cert); ck('M_alt', r.Malt, expect.malt); ck('L', r.L, expect.L); ck('D_old', r.dold, D); ck('D_new', dnew, dexp); ck('viol', viol, 0); ck('violAlt', violAlt, 0); ck('ratio', maxRatio.toFixed(4), expect.ratio); ck('argmax', argmax, expect.argmax); ck('NnG2', o.NnG2, expect.NnG2); ck('QLG2', o.QLG2, expect.QLG2); ck('NG2', o.NG2, expect.NG2); ck('winLoose', r.nWinLoose, expect.winLoose); ck('winAlt', r.nWinAlt, expect.winAlt); ck('maxQrun', r.maxQrun, expect.maxQrun); ck('thetaCount', top, expect.thetaCount); ck('unclosed', r.unclosed, 0); if (expect.best) ck('bestByLen1..4', o.bestByLen.slice(1, 5).join(','), expect.best); console.log(' CHECKS: ' + checks.join(' | ')); o.allOk = checks.every(c => c.endsWith(' OK')); console.log(' ALL CHECKS ' + (o.allOk ? 'PASS' : 'FAIL')); } return o; } // --------------------------------------------------------------------------- // BASE TILES AND THE STREAM // --------------------------------------------------------------------------- function buildBase(x) { let P = 6, S = Float64Array.from([5]); for (const q of [5, 7, 11, 13, 17, 19, 23]) { if (q > x) break; const D = S.length, keep = new Float64Array(D * (q - 2)); let n = 0; for (let k = 0; k < q; k++) for (let i = 0; i < D; i++) { const r = S[i] + k * P; if (r % q !== 0 && (r + 2) % q !== 0) keep[n++] = r; } P *= q; S = keep; } return { x, W: P, S }; } function prepJob(job) { const F = job.F, m = F.length; const Ws = [job.baseW]; for (let j = 0; j < m; j++) Ws.push(Ws[j] * F[j]); job.Ws = Ws; job.Wold = Ws[m]; let Dold = job.baseD; for (const f of F) Dold *= (f - 2); job.Dold = Dold; if (m === 0) job.NB = Math.min(job.baseD, 9); else if (m === 1) job.NB = F[0]; else job.NB = F[m - 1] * F[m - 2]; return job; } // inner combos of a block, in stream order (outer indices fixed) function combosFor(job, b) { const F = job.F, m = F.length; const ks = new Array(m).fill(0); const inner = []; if (m === 1) ks[0] = b; else { const fm1 = F[m - 2]; ks[m - 1] = Math.floor(b / fm1); ks[m - 2] = b % fm1; for (let j = m - 3; j >= 0; j--) inner.push(j); } const out = []; const rec = d => { if (d === inner.length) { out.push(ks.slice()); return; } const j = inner[d]; for (let k = 0; k < F[j]; k++) { ks[j] = k; rec(d + 1); } }; rec(0); return out; } // generic (slow) iterator over the alive slots of block b; fn(pos, r) returns false to stop function iterBlock(job, base, RES, b, reverse, shiftPos, fn) { const S = base.S, D = S.length, F = job.F, m = F.length, q = job.q; const mod = (p, n) => { const v = p % n; return v < 0 ? v + n : v; }; if (m === 0) { const lo = Math.floor(b * D / job.NB), hi = Math.floor((b + 1) * D / job.NB); if (!reverse) { for (let i = lo; i < hi; i++) { const p = S[i] + shiftPos; if (!fn(p, mod(p, q))) return; } } else { for (let i = hi - 1; i >= lo; i--) { const p = S[i] + shiftPos; if (!fn(p, mod(p, q))) return; } } return; } const combos = combosFor(job, b); if (reverse) combos.reverse(); for (const ks of combos) { let off = 0; for (let j = 0; j < m; j++) off += ks[j] * job.Ws[j]; const ro = F.map(f => off % f); const i0 = reverse ? D - 1 : 0, i1 = reverse ? -1 : D, di = reverse ? -1 : 1; for (let i = i0; i !== i1; i += di) { let alive = true; for (let j = 0; j < m; j++) { let a = RES[j][i] + ro[j]; if (a >= F[j]) a -= F[j]; if (a === 0 || a === F[j] - 2) { alive = false; break; } } if (!alive) continue; const p = S[i] + off + shiftPos; if (!fn(p, mod(p, q))) return; } } } function collectRoll(job, base, RES, b, reverse, shiftPos) { const pos = [], res = []; if (job.F.length === 0) { // stored base: blocks may be shorter than R, so walk the cyclic slot index directly const S = base.S, D = S.length, q = job.q; const mod = (p, n) => { const v = p % n; return v < 0 ? v + n : v; }; // b here is the NEIGHBOUR block; recover the current block's boundary from it const cur = reverse ? (b + 1) % job.NB : (b + job.NB - 1) % job.NB; const lo = Math.floor(cur * D / job.NB), hi = Math.floor((cur + 1) * D / job.NB); const t0 = reverse ? lo - R : hi; for (let t = t0; t < t0 + R; t++) { const p = S[mod(t, D)] + Math.floor(t / D) * job.Wold; pos.push(p); res.push(mod(p, q)); } return { pos, res }; } iterBlock(job, base, RES, b, reverse, shiftPos, (p, r) => { pos.push(p); res.push(r); return pos.length < R; }); if (pos.length !== R) throw new Error('roll too short: block ' + b + ' gave ' + pos.length); if (reverse) { pos.reverse(); res.reverse(); } return { pos, res }; } // the main pass over block b: tight loops specialised by m function streamBlockMain(job, base, RES, RQ, b, eng) { const S = base.S, D = S.length, F = job.F, m = F.length, q = job.q; let n = 0; if (m === 0) { const lo = Math.floor(b * D / job.NB), hi = Math.floor((b + 1) * D / job.NB); for (let i = lo; i < hi; i++) { eng.push(n++, S[i], RQ[i]); } return n; } const combos = combosFor(job, b); for (const ks of combos) { let off = 0; for (let j = 0; j < m; j++) off += ks[j] * job.Ws[j]; const oq = off % q; if (m === 1) { const f1 = F[0], e1 = f1 - 2, R1 = RES[0], o1 = off % f1; for (let i = 0; i < D; i++) { let a = R1[i] + o1; if (a >= f1) a -= f1; if (a === 0 || a === e1) continue; let r = RQ[i] + oq; if (r >= q) r -= q; eng.push(n++, S[i] + off, r); } } else if (m === 2) { const f1 = F[0], e1 = f1 - 2, R1 = RES[0], o1 = off % f1; const f2 = F[1], e2 = f2 - 2, R2 = RES[1], o2 = off % f2; for (let i = 0; i < D; i++) { let a = R1[i] + o1; if (a >= f1) a -= f1; if (a === 0 || a === e1) continue; let bb = R2[i] + o2; if (bb >= f2) bb -= f2; if (bb === 0 || bb === e2) continue; let r = RQ[i] + oq; if (r >= q) r -= q; eng.push(n++, S[i] + off, r); } } else if (m === 3) { const f1 = F[0], e1 = f1 - 2, R1 = RES[0], o1 = off % f1; const f2 = F[1], e2 = f2 - 2, R2 = RES[1], o2 = off % f2; const f3 = F[2], e3 = f3 - 2, R3 = RES[2], o3 = off % f3; for (let i = 0; i < D; i++) { let a = R1[i] + o1; if (a >= f1) a -= f1; if (a === 0 || a === e1) continue; let bb = R2[i] + o2; if (bb >= f2) bb -= f2; if (bb === 0 || bb === e2) continue; let c = R3[i] + o3; if (c >= f3) c -= f3; if (c === 0 || c === e3) continue; let r = RQ[i] + oq; if (r >= q) r -= q; eng.push(n++, S[i] + off, r); } } else { const ro = F.map(f => off % f); for (let i = 0; i < D; i++) { let alive = true; for (let j = 0; j < m; j++) { let a = RES[j][i] + ro[j]; if (a >= F[j]) a -= F[j]; if (a === 0 || a === F[j] - 2) { alive = false; break; } } if (!alive) continue; let r = RQ[i] + oq; if (r >= q) r -= q; eng.push(n++, S[i] + off, r); } } } return n; } function doBlock(job, base, RES, RQ, b) { const q = job.q, NB = job.NB, Wold = job.Wold; const pre = collectRoll(job, base, RES, (b + NB - 1) % NB, true, b === 0 ? -Wold : 0); const post = collectRoll(job, base, RES, (b + 1) % NB, false, b === NB - 1 ? Wold : 0); const eng = makeEngine(q); for (let k = 0; k < R; k++) eng.push(k - R, pre.pos[k], pre.res[k]); const n = streamBlockMain(job, base, RES, RQ, b, eng); eng.setD(n); for (let k = 0; k < R; k++) eng.push(n + k, post.pos[k], post.res[k]); return eng.finish(); } // --------------------------------------------------------------------------- // WORKER // --------------------------------------------------------------------------- if (!isMainThread) { const job = prepJob(workerData.job); const base = buildBase(job.base); const D = base.S.length; const RES = job.F.map(f => { const a = new Uint8Array(D); for (let i = 0; i < D; i++) a[i] = base.S[i] % f; return a; }); const RQ = new Uint8Array(D); for (let i = 0; i < D; i++) RQ[i] = base.S[i] % job.q; parentPort.on('message', msg => { if (msg.type === 'task') { const t0 = Date.now(); const res = doBlock(job, base, RES, RQ, msg.b); res.secs = (Date.now() - t0) / 1000; parentPort.postMessage({ type: 'result', b: msg.b, res }); } else if (msg.type === 'done') process.exit(0); }); parentPort.postMessage({ type: 'ready' }); } // --------------------------------------------------------------------------- // MAIN // --------------------------------------------------------------------------- function mergeInto(M, r) { if (!M.histOld) { M.histOld = new Float64Array(HB); M.histNew = new Float64Array(HB); M.histQloose = new Float64Array(HB); M.histQalt = new Float64Array(HB); M.L = 0; M.nRuns = 0; M.maxRunGap = 0; M.unclosed = 0; M.bestByLen = new Array(64).fill(0); M.Mloose = 0; M.Malt = 0; M.nWinLoose = 0; M.nWinAlt = 0; M.maxQrun = 0; M.over = 0; M.dold = 0; } for (let b = 0; b < HB; b++) { M.histOld[b] += r.histOld[b]; M.histNew[b] += r.histNew[b]; M.histQloose[b] += r.histQloose[b]; M.histQalt[b] += r.histQalt[b]; } M.L = Math.max(M.L, r.L); M.nRuns += r.nRuns; M.maxRunGap = Math.max(M.maxRunGap, r.maxRunGap); M.unclosed += r.unclosed; for (let k = 0; k < 64; k++) M.bestByLen[k] = Math.max(M.bestByLen[k], r.bestByLen[k]); M.Mloose = Math.max(M.Mloose, r.Mloose); M.Malt = Math.max(M.Malt, r.Malt); M.nWinLoose += r.nWinLoose; M.nWinAlt += r.nWinAlt; M.maxQrun = Math.max(M.maxQrun, r.maxQrun); M.over += r.over; M.dold += r.dold; } function runJob(job) { return new Promise((resolve, reject) => { job = prepJob(job); const t0 = Date.now(), cpu0 = process.cpuUsage(); const el = () => ((Date.now() - t0) / 1000).toFixed(1) + 's'; console.log(''); console.log('=== ' + job.label + ': base T_' + job.base + ', folds [' + job.F.join(', ') + '], q = ' + job.q + ', blocks = ' + job.NB + ', workers = ' + Math.min(NWORKERS, job.NB) + ' ==='); const M = {}; let next = 0, finished = 0, live = 0; const nw = Math.min(NWORKERS, job.NB); const workers = []; const finishAll = () => { for (const w of workers) w.postMessage({ type: 'done' }); const cpu = process.cpuUsage(cpu0); const wall = (Date.now() - t0) / 1000; const o = score(M, job.q, job.Dold, job.Wold, job.label, job.expect); o.wall = wall; o.cpu = (cpu.user + cpu.system) / 1e6; console.log(' wall ' + wall.toFixed(1) + ' s cpu ' + o.cpu.toFixed(1) + ' s (all threads)'); resolve(o); }; for (let k = 0; k < nw; k++) { const w = new Worker(__filename, { workerData: { job } }); workers.push(w); w.on('error', reject); w.on('message', msg => { if (msg.type === 'ready') { if (next < job.NB) { w.postMessage({ type: 'task', b: next++ }); live++; } } else if (msg.type === 'result') { mergeInto(M, msg.res); finished++; live--; console.error(' [' + job.label + '] block ' + msg.b + ' done in ' + msg.res.secs.toFixed(1) + 's finished ' + finished + '/' + job.NB + ' ' + el()); if (next < job.NB) { w.postMessage({ type: 'task', b: next++ }); live++; } else if (finished === job.NB) finishAll(); } }); } }); } if (isMainThread) { const MODE = process.argv[2] || 'calib'; const BASE = { 5: { D: 3, W: 30 }, 7: { D: 15, W: 210 }, 11: { D: 135, W: 2310 }, 13: { D: 1485, W: 30030 }, 17: { D: 22275, W: 510510 }, 19: { D: 378675, W: 9699690 }, 23: { D: 7952175, W: 223092870 } }; const mk = (label, base, F, q, expect) => ({ label, base, baseD: BASE[base].D, baseW: BASE[base].W, F, q, expect }); const jobs = []; if (MODE === 'calib' || MODE === 'all') { jobs.push(mk('T_7 -> 11', 7, [], 11, { g2: 42, cert: 42, malt: 42, L: 1, ratio: '1.0000' })); jobs.push(mk('T_11 -> 13', 11, [], 13, { g2: 66, cert: 66, malt: 66, L: 2, ratio: '1.0000' })); jobs.push(mk('T_13 -> 17', 13, [], 17, { g2: 108, cert: 108, malt: 108, L: 2, ratio: '0.8881' })); jobs.push(mk('T_17 -> 19', 17, [], 19, { g2: 150, cert: 150, malt: 150, L: 2, ratio: '0.8975' })); jobs.push(mk('T_19 -> 23', 19, [], 23, { g2: 204, cert: 204, malt: 204, L: 3, ratio: '0.9180' })); jobs.push(mk('T_23 -> 29', 23, [], 29, { g2: 258, cert: 270, malt: 258, L: 2, ratio: '0.9324' })); } if (MODE === 'fold31' || MODE === 'all') jobs.push(mk('T_29 (streamed) -> 31', 23, [29], 31, { g2: 348, cert: 348, malt: 348, L: 4, ratio: '0.9348' })); if (MODE === 'fold37' || MODE === 'all') jobs.push(mk('T_31 (streamed) -> 37', 23, [29, 31], 37, { g2: 528, cert: 528, malt: 528, L: 4, ratio: '0.9477', argmax: 48, NnG2: 2, QLG2: 2, NG2: 0, winLoose: 6341904311, winAlt: 6341472275, maxQrun: 3, thetaCount: 88, best: '408,510,528,408' })); if (MODE === 'fold41' || MODE === 'all') jobs.push(mk('T_37 (streamed) -> 41', 23, [29, 31, 37], 41, { g2: 546 })); (async () => { const T0 = Date.now(); const out = []; for (const j of jobs) { const o = await runJob(j); out.push(o); } console.log(''); console.log('SUMMARY'); for (const o of out) console.log(' ' + o.label + ': G2 ' + o.g2new + ' M_loose ' + o.Mloose + ' M_alt ' + o.Malt + ' L ' + o.L + ' ratio ' + o.maxRatio.toFixed(4) + ' @ ' + o.argmax + ' viol ' + o.viol + '/' + o.violAlt + ' D_old ' + (o.dold === o.D ? 'ok' : 'BAD') + ' D_new ' + (o.dok ? 'ok' : 'BAD') + (o.allOk === undefined ? '' : (' checks ' + (o.allOk ? 'PASS' : 'FAIL'))) + ' wall ' + o.wall.toFixed(1) + 's'); console.log('total ' + ((Date.now() - T0) / 1000).toFixed(1) + ' s'); process.exit(0); })().catch(e => { console.error(e); process.exit(1); }); }