diff options
| -rw-r--r-- | cube.c | 28 | ||||
| -rw-r--r-- | test/100_gendata_cocsep/00_all.out | 14 | ||||
| -rw-r--r-- | test/100_gendata_cocsep/gendata_cocsep_tests.c | 6 |
3 files changed, 35 insertions, 13 deletions
| @@ -1843,19 +1843,24 @@ Section: auxiliary procedures for H48 optimal solver (temporary) | |||
| 1843 | ******************************************************************************/ | 1843 | ******************************************************************************/ |
| 1844 | 1844 | ||
| 1845 | _static size_t gendata_cocsep(void *); | 1845 | _static size_t gendata_cocsep(void *); |
| 1846 | _static uint16_t dfs_cocsep(cube_fast_t, uint8_t, uint8_t, uint16_t *, uint32_t *); | 1846 | _static uint32_t dfs_cocsep(cube_fast_t, uint8_t, uint8_t, uint16_t *, uint32_t *); |
| 1847 | 1847 | ||
| 1848 | /* | 1848 | /* |
| 1849 | Each element of the cocsep table is a uint32_t used as follows: | 1849 | Each element of the cocsep table is a uint32_t used as follows: |
| 1850 | - Lowest 8-bit block: pruning value | 1850 | - Lowest 8-bit block: pruning value |
| 1851 | - Second-lower 8-bit block: "ttrep" (transformation to representative) | 1851 | - Second-lower 8-bit block: "ttrep" (transformation to representative) |
| 1852 | - Top 16-bit block: symcoord value | 1852 | - Top 16-bit block: symcoord value |
| 1853 | After the data as described above, more auxiliary information is appended: | ||
| 1854 | - A uint32_t representing the number of symmetry classes | ||
| 1855 | - A uint32_t representing the highest value of the pruning table | ||
| 1856 | - One uint32_t for each "line" of the pruning table, representing the number | ||
| 1857 | of positions having that pruning value. | ||
| 1853 | */ | 1858 | */ |
| 1854 | _static size_t | 1859 | _static size_t |
| 1855 | gendata_cocsep(void *buf) | 1860 | gendata_cocsep(void *buf) |
| 1856 | { | 1861 | { |
| 1857 | uint32_t *buf32; | 1862 | uint32_t *buf32, cc; |
| 1858 | uint16_t n, cc; | 1863 | uint16_t n; |
| 1859 | uint8_t i, j; | 1864 | uint8_t i, j; |
| 1860 | size_t tablesize; | 1865 | size_t tablesize; |
| 1861 | 1866 | ||
| @@ -1868,20 +1873,22 @@ gendata_cocsep(void *buf) | |||
| 1868 | for (i = 0, n = 0, cc = 0; cc != 0 || i == 0; i++) { | 1873 | for (i = 0, n = 0, cc = 0; cc != 0 || i == 0; i++) { |
| 1869 | DBG_LOG("gendata_cocsep: generating depth %" PRIu8 "\n", i); | 1874 | DBG_LOG("gendata_cocsep: generating depth %" PRIu8 "\n", i); |
| 1870 | cc = dfs_cocsep(cubetofast(solvedcube()), 0, i, &n, buf32); | 1875 | cc = dfs_cocsep(cubetofast(solvedcube()), 0, i, &n, buf32); |
| 1871 | buf32[tablesize+i+1] = (uint32_t)cc; | 1876 | buf32[tablesize+i+2] = cc; |
| 1877 | DBG_LOG("found %" PRIu32 "\n", cc); | ||
| 1872 | } | 1878 | } |
| 1873 | buf32[tablesize] = (uint32_t)n; | 1879 | buf32[tablesize] = (uint32_t)n; |
| 1874 | i--; | 1880 | buf32[tablesize+1] = (uint32_t)(i-2); |
| 1875 | 1881 | ||
| 1876 | DBG_LOG("cocsep data computed, %" PRIu16 " symmetry classes\n", n); | 1882 | DBG_LOG("cocsep data computed, %" PRIu32 " symmetry classes\n", n); |
| 1883 | DBG_LOG("Maximum pruning value: %" PRIu32 "\n", buf32[tablesize+1]); | ||
| 1877 | DBG_LOG("Pruning value distribution:\n"); | 1884 | DBG_LOG("Pruning value distribution:\n"); |
| 1878 | for (j = 0; j < i; j++) | 1885 | for (j = 0; j < i-1; j++) |
| 1879 | DBG_LOG("%" PRIu8 ":\t%" PRIu32 "\n", j, buf32[tablesize+j+1]); | 1886 | DBG_LOG("%" PRIu8 ":\t%" PRIu32 "\n", j, buf32[tablesize+j+2]); |
| 1880 | 1887 | ||
| 1881 | return 4*(tablesize + i + 1); | 1888 | return 4*(tablesize + i + 1); |
| 1882 | } | 1889 | } |
| 1883 | 1890 | ||
| 1884 | _static uint16_t | 1891 | _static uint32_t |
| 1885 | dfs_cocsep( | 1892 | dfs_cocsep( |
| 1886 | cube_fast_t c, | 1893 | cube_fast_t c, |
| 1887 | uint8_t depth, | 1894 | uint8_t depth, |
| @@ -1891,8 +1898,7 @@ dfs_cocsep( | |||
| 1891 | ) | 1898 | ) |
| 1892 | { | 1899 | { |
| 1893 | uint8_t m, t, tinv, olddepth; | 1900 | uint8_t m, t, tinv, olddepth; |
| 1894 | uint16_t cc; | 1901 | uint32_t cc, oldvalue; |
| 1895 | uint32_t oldvalue; | ||
| 1896 | uint64_t i; | 1902 | uint64_t i; |
| 1897 | cube_fast_t d; | 1903 | cube_fast_t d; |
| 1898 | 1904 | ||
diff --git a/test/100_gendata_cocsep/00_all.out b/test/100_gendata_cocsep/00_all.out index 37b8c1d..e14b938 100644 --- a/test/100_gendata_cocsep/00_all.out +++ b/test/100_gendata_cocsep/00_all.out | |||
| @@ -1 +1,13 @@ | |||
| 1 | 1119788 | 1 | 1119792 |
| 2 | Classes: 3393 | ||
| 3 | Max value: 9 | ||
| 4 | 0: 1 | ||
| 5 | 1: 6 | ||
| 6 | 2: 63 | ||
| 7 | 3: 468 | ||
| 8 | 4: 3068 | ||
| 9 | 5: 15438 | ||
| 10 | 6: 53814 | ||
| 11 | 7: 71352 | ||
| 12 | 8: 8784 | ||
| 13 | 9: 96 | ||
diff --git a/test/100_gendata_cocsep/gendata_cocsep_tests.c b/test/100_gendata_cocsep/gendata_cocsep_tests.c index 19dfa9f..36dd5ce 100644 --- a/test/100_gendata_cocsep/gendata_cocsep_tests.c +++ b/test/100_gendata_cocsep/gendata_cocsep_tests.c | |||
| @@ -3,12 +3,16 @@ | |||
| 3 | size_t gendata_cocsep(void *); | 3 | size_t gendata_cocsep(void *); |
| 4 | 4 | ||
| 5 | int main(void) { | 5 | int main(void) { |
| 6 | uint32_t buf[300000]; | 6 | uint32_t buf[300000], i; |
| 7 | size_t result; | 7 | size_t result; |
| 8 | 8 | ||
| 9 | result = gendata_cocsep(buf); | 9 | result = gendata_cocsep(buf); |
| 10 | 10 | ||
| 11 | printf("%zu\n", result); | 11 | printf("%zu\n", result); |
| 12 | printf("Classes: %" PRIu32 "\n", buf[result/4-12]); | ||
| 13 | printf("Max value: %" PRIu32 "\n", buf[result/4-11]); | ||
| 14 | for (i = 0; i < 10; i++) | ||
| 15 | printf("%" PRIu32 ": %" PRIu32 "\n", i, buf[result/4-10+i]); | ||
| 12 | 16 | ||
| 13 | return 0; | 17 | return 0; |
| 14 | } | 18 | } |
