commit a37181b1c2ae6251bba75d5ed7a896d47a26f961
parent c14e780551c4e7aa88d99b226b12f7cdd7b92527
Author: Sebastiano Tronto <sebastiano@tronto.net>
Date: Sat, 30 Mar 2024 19:50:45 +0100
Improved testing, added more data to cocsep table
Diffstat:
3 files changed, 35 insertions(+), 13 deletions(-)
diff --git a/cube.c b/cube.c
@@ -1843,19 +1843,24 @@ Section: auxiliary procedures for H48 optimal solver (temporary)
******************************************************************************/
_static size_t gendata_cocsep(void *);
-_static uint16_t dfs_cocsep(cube_fast_t, uint8_t, uint8_t, uint16_t *, uint32_t *);
+_static uint32_t dfs_cocsep(cube_fast_t, uint8_t, uint8_t, uint16_t *, uint32_t *);
/*
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)
- 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
+ - A uint32_t representing the highest value of the pruning table
+ - One uint32_t for each "line" of the pruning table, representing the number
+ of positions having that pruning value.
*/
_static size_t
gendata_cocsep(void *buf)
{
- uint32_t *buf32;
- uint16_t n, cc;
+ uint32_t *buf32, cc;
+ uint16_t n;
uint8_t i, j;
size_t tablesize;
@@ -1868,20 +1873,22 @@ gendata_cocsep(void *buf)
for (i = 0, n = 0, cc = 0; cc != 0 || i == 0; i++) {
DBG_LOG("gendata_cocsep: generating depth %" PRIu8 "\n", i);
cc = dfs_cocsep(cubetofast(solvedcube()), 0, i, &n, buf32);
- buf32[tablesize+i+1] = (uint32_t)cc;
+ buf32[tablesize+i+2] = cc;
+ DBG_LOG("found %" PRIu32 "\n", cc);
}
buf32[tablesize] = (uint32_t)n;
- i--;
+ buf32[tablesize+1] = (uint32_t)(i-2);
- DBG_LOG("cocsep data computed, %" PRIu16 " symmetry classes\n", n);
+ DBG_LOG("cocsep data computed, %" PRIu32 " symmetry classes\n", n);
+ DBG_LOG("Maximum pruning value: %" PRIu32 "\n", buf32[tablesize+1]);
DBG_LOG("Pruning value distribution:\n");
- for (j = 0; j < i; j++)
- DBG_LOG("%" PRIu8 ":\t%" PRIu32 "\n", j, buf32[tablesize+j+1]);
+ for (j = 0; j < i-1; j++)
+ DBG_LOG("%" PRIu8 ":\t%" PRIu32 "\n", j, buf32[tablesize+j+2]);
return 4*(tablesize + i + 1);
}
-_static uint16_t
+_static uint32_t
dfs_cocsep(
cube_fast_t c,
uint8_t depth,
@@ -1891,8 +1898,7 @@ dfs_cocsep(
)
{
uint8_t m, t, tinv, olddepth;
- uint16_t cc;
- uint32_t oldvalue;
+ uint32_t cc, oldvalue;
uint64_t i;
cube_fast_t d;
diff --git a/test/100_gendata_cocsep/00_all.out b/test/100_gendata_cocsep/00_all.out
@@ -1 +1,13 @@
-1119788
+1119792
+Classes: 3393
+Max value: 9
+0: 1
+1: 6
+2: 63
+3: 468
+4: 3068
+5: 15438
+6: 53814
+7: 71352
+8: 8784
+9: 96
diff --git a/test/100_gendata_cocsep/gendata_cocsep_tests.c b/test/100_gendata_cocsep/gendata_cocsep_tests.c
@@ -3,12 +3,16 @@
size_t gendata_cocsep(void *);
int main(void) {
- uint32_t buf[300000];
+ uint32_t buf[300000], i;
size_t result;
result = gendata_cocsep(buf);
printf("%zu\n", result);
+ printf("Classes: %" PRIu32 "\n", buf[result/4-12]);
+ printf("Max value: %" PRIu32 "\n", buf[result/4-11]);
+ for (i = 0; i < 10; i++)
+ printf("%" PRIu32 ": %" PRIu32 "\n", i, buf[result/4-10+i]);
return 0;
}