diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-03-30 19:50:45 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-03-30 19:50:45 +0100 |
| commit | a37181b1c2ae6251bba75d5ed7a896d47a26f961 (patch) | |
| tree | 51079aea6135d69340393aaab346827fe056b444 /cube.c | |
| parent | c14e780551c4e7aa88d99b226b12f7cdd7b92527 (diff) | |
| download | nissy-core-a37181b1c2ae6251bba75d5ed7a896d47a26f961.tar.gz nissy-core-a37181b1c2ae6251bba75d5ed7a896d47a26f961.zip | |
Improved testing, added more data to cocsep table
Diffstat (limited to 'cube.c')
| -rw-r--r-- | cube.c | 28 |
1 files changed, 17 insertions, 11 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 | ||
