h48

A prototype for an optimal Rubik's cube solver, work in progress.
git clone https://git.tronto.net/h48
Download | Log | Files | Refs | README | LICENSE

commit fc150adaf3bff133da0e59d842f13b7b21297fc0
parent 0de1530f4cea21f2bc0a0e0f1cbf9da016c7bda5
Author: Sebastiano Tronto <sebastiano@tronto.net>
Date:   Fri,  4 Oct 2024 12:21:17 +0200

Removed slow test

This test generated a pruning table and it was too slow (around a minute).
Now the whole test suite runs in 49s on my laptop, which is more reasonable.

Pruning table generation should be tested with tools. They run in release
mode and are much faster, but can be still run in debug mode optionally.

Diffstat:
Dtest/120_gendata_h48h0k4/00_h_0.in | 2--
Dtest/120_gendata_h48h0k4/00_h_0.out | 22----------------------
Dtest/120_gendata_h48h0k4/gendata_h48h0k4_tests.c | 84-------------------------------------------------------------------------------
3 files changed, 0 insertions(+), 108 deletions(-)

diff --git a/test/120_gendata_h48h0k4/00_h_0.in b/test/120_gendata_h48h0k4/00_h_0.in @@ -1,2 +0,0 @@ -4 -0 diff --git a/test/120_gendata_h48h0k4/00_h_0.out b/test/120_gendata_h48h0k4/00_h_0.out @@ -1,22 +0,0 @@ -59904493 - -cocsepdata: -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 - -h48: -0: 1 -1: 1 -2: 4 -3: 34 -4: 331 diff --git a/test/120_gendata_h48h0k4/gendata_h48h0k4_tests.c b/test/120_gendata_h48h0k4/gendata_h48h0k4_tests.c @@ -1,84 +0,0 @@ -#include "../test.h" - -#define COCSEP_CLASSES 3393 -#define INFOSIZE 512 -#define INFO_SOLVER_STRLEN 100 -#define INFO_DISTRIBUTION_LEN 21 - -typedef struct { - uint64_t distribution[INFO_DISTRIBUTION_LEN]; - uint64_t type; - uint64_t infosize; - uint64_t fullsize; - uint64_t hash; - uint64_t entries; - uint64_t classes; /* Used only by cocsepdata, for now */ - uint64_t next; - char solver[INFO_SOLVER_STRLEN]; - uint8_t h48h; - uint8_t bits; - uint8_t base; - uint8_t maxvalue; -} tableinfo_t; - -typedef struct { - uint8_t h; - uint8_t k; - uint8_t base; - uint8_t maxdepth; - tableinfo_t info; - void *buf; - void *h48buf; - uint32_t *cocsepdata; - uint64_t selfsim[COCSEP_CLASSES]; - cube_t crep[COCSEP_CLASSES]; -} gendata_h48_arg_t; - -int64_t gendata_h48(gendata_h48_arg_t *); -bool readtableinfo(const void *, tableinfo_t *); - -void run(void) { - char str[STRLENMAX]; - uint8_t i; - gendata_h48_arg_t arg; - size_t result, sz; - tableinfo_t cinfo, hinfo; - void *h48buf; - - fgets(str, STRLENMAX, stdin); - arg.maxdepth = atoi(str); - fgets(str, STRLENMAX, stdin); - arg.h = atoi(str); - arg.k = 4; - - sz = gendata_h48(&arg); /* With buf = NULL returns data size */ - arg.buf = malloc(sz); - - result = gendata_h48(&arg); - - if (!readtableinfo(arg.buf, &cinfo)) { - printf("Error reading cocsep info\n"); - goto end; - } - - h48buf = (char *)arg.buf + cinfo.next; - if (!readtableinfo(h48buf, &hinfo)) { - printf("Error reading h48 info\n"); - goto end; - } - - printf("%zu\n\n", result); - - printf("cocsepdata:\n"); - printf("Classes: %" PRIu64 "\n", cinfo.classes); - printf("Max value: %" PRIu8 "\n", cinfo.maxvalue); - for (i = 0; i <= cinfo.maxvalue; i++) - printf("%" PRIu32 ": %" PRIu64 "\n", i, cinfo.distribution[i]); - - printf("\nh48:\n"); - for (i = 0; i <= hinfo.maxvalue; i++) - printf("%" PRIu32 ": %" PRIu64 "\n", i, hinfo.distribution[i]); - -end: - free(arg.buf); -}