From 61e03f9f4eecf3d5811b11c44c9ef778f0a93bc7 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Sun, 14 Jul 2024 21:28:37 +0200 Subject: Found a sneaky bug (it's all a mess now) --- src/solve_h48.h | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) (limited to 'src/solve_h48.h') diff --git a/src/solve_h48.h b/src/solve_h48.h index 26cbc73..c3316e1 100644 --- a/src/solve_h48.h +++ b/src/solve_h48.h @@ -244,7 +244,7 @@ invcoord_h48(int64_t i, const cube_t *crep, uint8_t h) /* Each element of the cocsep table is a uint32_t used as follows: - Lowest 8-bit block: pruning value - - Second-lower 8-bit block: "ttrep" (transformation to representative) + - Second-lowest 8-bit block: "ttrep" (transformation to representative) - Top 16-bit block: symcoord value After the data as described above, more auxiliary information is appended: - A uint32_t representing the number of symmetry classes @@ -331,7 +331,7 @@ gendata_cocsep_dfs(dfsarg_cocsep_t *arg) if (arg->selfsim != NULL) arg->selfsim[*arg->n] |= is << t; set_visited(arg->visited, j); - tinv = inverse_trans(t); + tinv = inverse_trans(t) * (1-is); olddepth = (uint8_t)(arg->buf32[j] & 0xFF); cc += olddepth == 0xFF; @@ -425,13 +425,12 @@ gendata_h48h0k4_bfs(bfsarg_esep_t *arg) TODO: the new method gives a slightly different answer. If the new method is correct, then the old bfs method is wrong. Which one is it? Try also DFS and compare results (it could be faster). -/* +*/ if (2 * arg->done < (int64_t)ESEP_MAX(0)) return gendata_h48h0k4_bfs_fromdone(arg); else return gendata_h48h0k4_bfs_fromnew(arg); -*/ - return gendata_h48h0k4_bfs_fromdone(arg); +// return gendata_h48h0k4_bfs_fromnew(arg); } _static int64_t @@ -439,7 +438,8 @@ gendata_h48h0k4_bfs_fromdone(bfsarg_esep_t *arg) { uint8_t c, m, x; uint32_t cc; - int64_t i, j, k, t, cocsep_coord, sim; + int64_t i, j, k, t, cocsep_coord; + uint64_t sim; cube_t cube, moved, transd; for (i = 0, cc = 0; i < (int64_t)ESEP_MAX(0); i++) { @@ -461,10 +461,29 @@ gendata_h48h0k4_bfs_fromdone(bfsarg_esep_t *arg) set_esep_pval(arg->buf32, j, arg->depth); cc += x != arg->depth; cocsep_coord = j / H48_ESIZE(0); - sim = arg->selfsim[cocsep_coord] >> 1; - for (t = 1; t < 48 && sim; t++, sim >>= 1) { - if (!(sim & 1)) + sim = arg->selfsim[cocsep_coord] >> UINT64_C(1); + for (t = 1; t < 48 && sim; t++, sim >>= UINT64_C(1)) { + if (!(sim & UINT64_C(1))) { + transd = transform(moved, t); + k = coord_h48(transd, arg->cocsepdata, 0); + if (k != j) { +LOG("t=%" PRId64 ", tinv=%" PRIu8 "\n", t, inverse_trans(t)); +int64_t ccm = coord_cocsep(moved); +int64_t repm = coord_cocsep(arg->crep[j/H48_ESIZE(0)]); +LOG("moved: full %" PRId64 ", cocsep %" PRId64 ", rep %" PRId64 ", ttrep %" PRId32 "\n", j, ccm, repm, TTREP(arg->cocsepdata[ccm])); +int64_t cct = coord_cocsep(transd); +int64_t rept = coord_cocsep(arg->crep[k/H48_ESIZE(0)]); +LOG("moved: full %" PRId64 ", cocsep %" PRId64 ", rep %" PRId64 ", ttrep %" PRId32 "\n", j, cct, rept, TTREP(arg->cocsepdata[cct])); +/* + char q[150]; + writecube_H48(moved, q); + LOG("%s\n", q) + writecube_H48(transd, q); + LOG("%s\n", q) +*/ + } continue; + } transd = transform(moved, t); k = coord_h48(transd, arg->cocsepdata, 0); x = get_esep_pval(arg->buf32, k); @@ -497,7 +516,10 @@ gendata_h48h0k4_bfs_fromnew(bfsarg_esep_t *arg) j = coord_h48(moved, arg->cocsepdata, 0); x = get_esep_pval(arg->buf32, j); if (x < arg->depth) +{ +if (x < arg->depth -1) LOG("WAT %" PRIu8 " while scanning %" PRIu8 "\n",x, arg->depth); goto neighbor_found; +} } continue; neighbor_found: -- cgit v1.3