aboutsummaryrefslogtreecommitdiff
path: root/src/solvers/h48/gendata_cocsep.h
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-09-10 19:43:05 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2024-09-10 19:43:05 +0200
commit70d3a3de3a2fdef7e47b2bd510261d69390a3a9c (patch)
tree2c545953d0b61b37c4f281cd47981e9350b5c09b /src/solvers/h48/gendata_cocsep.h
parent1f4900a3cc6ca74f94b73e224d14a09d52c4549c (diff)
downloadnissy-core-70d3a3de3a2fdef7e47b2bd510261d69390a3a9c.tar.gz
nissy-core-70d3a3de3a2fdef7e47b2bd510261d69390a3a9c.zip
New tableinfo for gendata_h48, still work to do
Diffstat (limited to 'src/solvers/h48/gendata_cocsep.h')
-rw-r--r--src/solvers/h48/gendata_cocsep.h36
1 files changed, 24 insertions, 12 deletions
diff --git a/src/solvers/h48/gendata_cocsep.h b/src/solvers/h48/gendata_cocsep.h
index 4a9b67e..2189145 100644
--- a/src/solvers/h48/gendata_cocsep.h
+++ b/src/solvers/h48/gendata_cocsep.h
@@ -1,7 +1,7 @@
1#define COCSEP_CLASSES ((size_t)3393) 1#define COCSEP_CLASSES ((size_t)3393)
2#define COCSEP_TABLESIZE ((size_t)POW_3_7 << (size_t)7) 2#define COCSEP_TABLESIZE ((size_t)POW_3_7 << (size_t)7)
3#define COCSEP_VISITEDSIZE ((COCSEP_TABLESIZE + (size_t)7) / (size_t)8) 3#define COCSEP_VISITEDSIZE DIV_ROUND_UP(COCSEP_TABLESIZE, (size_t)8)
4#define COCSEP_FULLSIZE ((size_t)4 * (COCSEP_TABLESIZE + (size_t)12)) 4#define COCSEP_FULLSIZE (INFOSIZE + (size_t)4 * COCSEP_TABLESIZE)
5 5
6#define VISITED_IND(i) ((uint32_t)(i) / UINT32_C(8)) 6#define VISITED_IND(i) ((uint32_t)(i) / UINT32_C(8))
7#define VISITED_MASK(i) (UINT32_C(1) << ((uint32_t)(i) % UINT32_C(8))) 7#define VISITED_MASK(i) (UINT32_C(1) << ((uint32_t)(i) % UINT32_C(8)))
@@ -42,20 +42,33 @@ After the data as described above, more auxiliary information is appended:
42STATIC size_t 42STATIC size_t
43gendata_cocsep(void *buf, uint64_t *selfsim, cube_t *rep) 43gendata_cocsep(void *buf, uint64_t *selfsim, cube_t *rep)
44{ 44{
45 uint32_t *buf32, *info, cc; 45 uint32_t *buf32, cc;
46 uint16_t n; 46 uint16_t n;
47 uint8_t i, j, visited[COCSEP_VISITEDSIZE]; 47 uint8_t i, j, visited[COCSEP_VISITEDSIZE];
48 tableinfo_t info;
48 cocsep_dfs_arg_t arg; 49 cocsep_dfs_arg_t arg;
49 50
50 if (buf == NULL) 51 if (buf == NULL)
51 goto gendata_cocsep_return_size; 52 goto gendata_cocsep_return_size;
52 53
53 buf32 = (uint32_t *)buf; 54 memset(buf, 0xFF, COCSEP_FULLSIZE);
54 info = buf32 + COCSEP_TABLESIZE; 55 buf32 = (uint32_t *)((char *)buf + INFOSIZE);
55 memset(buf32, 0xFF, sizeof(uint32_t) * COCSEP_TABLESIZE);
56 if (selfsim != NULL) 56 if (selfsim != NULL)
57 memset(selfsim, 0, sizeof(uint64_t) * COCSEP_CLASSES); 57 memset(selfsim, 0, sizeof(uint64_t) * COCSEP_CLASSES);
58 58
59 info = (tableinfo_t) {
60 .solver = "cocsep data for h48",
61 .type = TABLETYPE_SPECIAL,
62 .infosize = INFOSIZE,
63 .fullsize = COCSEP_FULLSIZE,
64 .hash = 0, /* TODO */
65 .entries = COCSEP_TABLESIZE,
66 .classes = COCSEP_CLASSES,
67 .bits = 32,
68 .base = 0,
69 .maxvalue = 9,
70 .next = 0
71 };
59 arg = (cocsep_dfs_arg_t) { 72 arg = (cocsep_dfs_arg_t) {
60 .cube = SOLVED_CUBE, 73 .cube = SOLVED_CUBE,
61 .n = &n, 74 .n = &n,
@@ -70,22 +83,21 @@ gendata_cocsep(void *buf, uint64_t *selfsim, cube_t *rep)
70 arg.depth = 0; 83 arg.depth = 0;
71 arg.maxdepth = i; 84 arg.maxdepth = i;
72 cc = gendata_cocsep_dfs(&arg); 85 cc = gendata_cocsep_dfs(&arg);
73 info[i+2] = cc; 86 info.distribution[i] = cc;
74 LOG("found %" PRIu32 "\n", cc); 87 LOG("found %" PRIu32 "\n", cc);
75 } 88 }
76 89
77 info[0] = (uint32_t)n; 90 writetableinfo(&info, buf);
78 info[1] = 9; /* Known max pruning value */ 91
79 DBG_ASSERT(n == COCSEP_CLASSES, 0, 92 DBG_ASSERT(n == COCSEP_CLASSES, 0,
80 "cocsep: computed %" PRIu16 " symmetry classes, " 93 "cocsep: computed %" PRIu16 " symmetry classes, "
81 "expected %zu\n", n, COCSEP_CLASSES); 94 "expected %zu\n", n, COCSEP_CLASSES);
82 95
83 LOG("cocsep data computed\n"); 96 LOG("cocsep data computed\n");
84 LOG("Symmetry classes: %" PRIu32 "\n", info[0]); 97 LOG("Symmetry classes: %" PRIu32 "\n", COCSEP_CLASSES);
85 LOG("Maximum pruning value: %" PRIu32 "\n", info[1]);
86 LOG("Pruning value distribution:\n"); 98 LOG("Pruning value distribution:\n");
87 for (j = 0; j < 10; j++) 99 for (j = 0; j < 10; j++)
88 LOG("%" PRIu8 ":\t%" PRIu32 "\n", j, info[j+2]); 100 LOG("%" PRIu8 ":\t%" PRIu32 "\n", j, info.distribution[j]);
89 101
90gendata_cocsep_return_size: 102gendata_cocsep_return_size:
91 return COCSEP_FULLSIZE; 103 return COCSEP_FULLSIZE;

Generated with cgit - Back to sebastiano.tronto.net