diff options
| author | Sebastiano Tronto <sebastiano.tronto@gmail.com> | 2021-12-24 00:07:29 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano.tronto@gmail.com> | 2021-12-24 00:07:29 +0100 |
| commit | 0aabc7d04f03311694557a045de2ad3d9caa4004 (patch) | |
| tree | fab8ab8e52574a3f1750e99d7e0a5b5bd1829129 | |
| parent | 4fb970ad4e7d0558f7bf32dbad2333dbf3cb3ab4 (diff) | |
| download | nissy-0aabc7d04f03311694557a045de2ad3d9caa4004.tar.gz nissy-0aabc7d04f03311694557a045de2ad3d9caa4004.zip | |
use nxopt31 (compressed) by default for optimal solving
Diffstat (limited to '')
| -rw-r--r-- | TODO.md | 6 | ||||
| -rwxr-xr-x | nissy | bin | 321808 -> 320968 bytes | |||
| -rw-r--r-- | src/pruning.c | 15 | ||||
| -rw-r--r-- | src/shell.c | 6 | ||||
| -rw-r--r-- | src/steps.c | 25 | ||||
| -rw-r--r-- | src/symcoord.c | 14 |
6 files changed, 43 insertions, 23 deletions
| @@ -73,3 +73,9 @@ It's more of a personal reminder than anything else. | |||
| 73 | * client/server architecture: run a server process in the background so that | 73 | * client/server architecture: run a server process in the background so that |
| 74 | multiple client processess can send it queries and get results; this would | 74 | multiple client processess can send it queries and get results; this would |
| 75 | open up the door for a web-based version or graphical clients | 75 | open up the door for a web-based version or graphical clients |
| 76 | |||
| 77 | ### Cleanup | ||
| 78 | * Remove khuge from everywhere | ||
| 79 | * sort again functions alphabetically in their files | ||
| 80 | * more stuff to load at start (or when suitable command is called) rather | ||
| 81 | than when called directly, to avoid nasty problems with threading | ||
| Binary files differ | |||
diff --git a/src/pruning.c b/src/pruning.c index 5c74e1e..e6fd791 100644 --- a/src/pruning.c +++ b/src/pruning.c | |||
| @@ -78,13 +78,14 @@ pd_htrfin_htr = { | |||
| 78 | .moveset = &moveset_htr, | 78 | .moveset = &moveset_htr, |
| 79 | }; | 79 | }; |
| 80 | 80 | ||
| 81 | /* TODO: remove */ | 81 | /* |
| 82 | PruneData | 82 | PruneData |
| 83 | pd_khuge_HTM = { | 83 | pd_khuge_HTM = { |
| 84 | .filename = "pt_khuge_HTM", | 84 | .filename = "pt_khuge_HTM", |
| 85 | .coord = &coord_khuge, | 85 | .coord = &coord_khuge, |
| 86 | .moveset = &moveset_HTM, | 86 | .moveset = &moveset_HTM, |
| 87 | }; | 87 | }; |
| 88 | */ | ||
| 88 | 89 | ||
| 89 | PruneData | 90 | PruneData |
| 90 | pd_nxopt31_HTM = { | 91 | pd_nxopt31_HTM = { |
| @@ -399,10 +400,16 @@ ptableval_index(PruneData *pd, uint64_t ind) | |||
| 399 | genptable(pd, 1); /* TODO: set default or remove this case */ | 400 | genptable(pd, 1); /* TODO: set default or remove this case */ |
| 400 | } | 401 | } |
| 401 | 402 | ||
| 402 | e = pd->compact ? ENTRIES_PER_GROUP_COMPACT : ENTRIES_PER_GROUP; | 403 | if (pd->compact) { |
| 403 | m = (entry_group_t)(pd->compact ? 3 : 15); | 404 | e = ENTRIES_PER_GROUP_COMPACT; |
| 405 | m = 3; | ||
| 406 | sh = (ind % e) * 2; | ||
| 407 | } else { | ||
| 408 | e = ENTRIES_PER_GROUP; | ||
| 409 | m = 15; | ||
| 410 | sh = (ind % e) * 4; | ||
| 411 | } | ||
| 404 | 412 | ||
| 405 | sh = (ind % e) * (pd->compact ? 2 : 4); | ||
| 406 | mask = m << sh; | 413 | mask = m << sh; |
| 407 | i = ind/e; | 414 | i = ind/e; |
| 408 | 415 | ||
diff --git a/src/shell.c b/src/shell.c index 6d2de94..5fb18bc 100644 --- a/src/shell.c +++ b/src/shell.c | |||
| @@ -97,12 +97,6 @@ launch(bool batchmode) | |||
| 97 | int | 97 | int |
| 98 | main(int argc, char *argv[]) | 98 | main(int argc, char *argv[]) |
| 99 | { | 99 | { |
| 100 | /* | ||
| 101 | init_movesets(); | ||
| 102 | init_symcoord(); | ||
| 103 | print_ptable(&pd_nxopt31_HTM); | ||
| 104 | */ | ||
| 105 | |||
| 106 | if (argc > 1) { | 100 | if (argc > 1) { |
| 107 | if (!strcmp(argv[1], "-b")) { | 101 | if (!strcmp(argv[1], "-b")) { |
| 108 | launch(true); | 102 | launch(true); |
diff --git a/src/steps.c b/src/steps.c index 2517d16..ae3f9fd 100644 --- a/src/steps.c +++ b/src/steps.c | |||
| @@ -35,7 +35,7 @@ static int estimate_dr_eofb(DfsArg *arg); | |||
| 35 | static int estimate_drudfin_drud(DfsArg *arg); | 35 | static int estimate_drudfin_drud(DfsArg *arg); |
| 36 | static int estimate_htr_drud(DfsArg *arg); | 36 | static int estimate_htr_drud(DfsArg *arg); |
| 37 | static int estimate_htrfin_htr(DfsArg *arg); | 37 | static int estimate_htrfin_htr(DfsArg *arg); |
| 38 | static int estimate_optimal_HTM(DfsArg *arg); | 38 | /*static int estimate_khuge_HTM(DfsArg *arg);*/ |
| 39 | static int estimate_nxopt31_HTM(DfsArg *arg); | 39 | static int estimate_nxopt31_HTM(DfsArg *arg); |
| 40 | static int estimate_light_HTM(DfsArg *arg); | 40 | static int estimate_light_HTM(DfsArg *arg); |
| 41 | 41 | ||
| @@ -60,14 +60,17 @@ static char check_drany_msg[100] = "DR must be solved on at least one axis"; | |||
| 60 | /* Steps *********************************************************************/ | 60 | /* Steps *********************************************************************/ |
| 61 | 61 | ||
| 62 | /* Optimal solvers *******************/ | 62 | /* Optimal solvers *******************/ |
| 63 | |||
| 64 | /* This is not used anymore, I'll keep it just in case */ | ||
| 65 | /* | ||
| 63 | Step | 66 | Step |
| 64 | optimal_HTM = { | 67 | optimal_khuge_HTM = { |
| 65 | .shortname = "optimal", | 68 | .shortname = "khuge", |
| 66 | .name = "Optimal solve (in HTM)", | 69 | .name = "Optimal solve (in HTM) using khuge table", |
| 67 | 70 | ||
| 68 | .final = true, | 71 | .final = true, |
| 69 | .is_done = is_solved, | 72 | .is_done = is_solved, |
| 70 | .estimate = estimate_optimal_HTM, | 73 | .estimate = estimate_khuge_HTM, |
| 71 | .ready = check_centers, | 74 | .ready = check_centers, |
| 72 | .ready_msg = check_centers_msg, | 75 | .ready_msg = check_centers_msg, |
| 73 | .is_valid = always_valid, | 76 | .is_valid = always_valid, |
| @@ -78,11 +81,12 @@ optimal_HTM = { | |||
| 78 | .tables = {&pd_khuge_HTM, &pd_corners_HTM}, | 81 | .tables = {&pd_khuge_HTM, &pd_corners_HTM}, |
| 79 | .ntables = 2, | 82 | .ntables = 2, |
| 80 | }; | 83 | }; |
| 84 | */ | ||
| 81 | 85 | ||
| 82 | Step | 86 | Step |
| 83 | optimal_nxopt31_HTM = { | 87 | optimal_HTM = { |
| 84 | .shortname = "nxopt31", | 88 | .shortname = "optimal", |
| 85 | .name = "Optimal solve (in HTM), nxopt31 table", | 89 | .name = "Optimal solve (in HTM)", |
| 86 | 90 | ||
| 87 | .final = true, | 91 | .final = true, |
| 88 | .is_done = is_solved, | 92 | .is_done = is_solved, |
| @@ -856,7 +860,6 @@ htrfin_htr = { | |||
| 856 | 860 | ||
| 857 | Step *steps[NSTEPS] = { | 861 | Step *steps[NSTEPS] = { |
| 858 | &optimal_HTM, /* first is default */ | 862 | &optimal_HTM, /* first is default */ |
| 859 | &optimal_nxopt31_HTM, | ||
| 860 | &optimal_light_HTM, | 863 | &optimal_light_HTM, |
| 861 | 864 | ||
| 862 | &eoany_HTM, | 865 | &eoany_HTM, |
| @@ -1203,11 +1206,13 @@ estimate_htrfin_htr(DfsArg *arg) | |||
| 1203 | return ptableval(&pd_htrfin_htr, arg->cube); | 1206 | return ptableval(&pd_htrfin_htr, arg->cube); |
| 1204 | } | 1207 | } |
| 1205 | 1208 | ||
| 1209 | /* | ||
| 1206 | static int | 1210 | static int |
| 1207 | estimate_optimal_HTM(DfsArg *arg) | 1211 | estimate_khuge_HTM(DfsArg *arg) |
| 1208 | { | 1212 | { |
| 1209 | return estimate_nxoptlike(arg, &pd_khuge_HTM); | 1213 | return estimate_nxoptlike(arg, &pd_khuge_HTM); |
| 1210 | } | 1214 | } |
| 1215 | */ | ||
| 1211 | 1216 | ||
| 1212 | static int | 1217 | static int |
| 1213 | estimate_nxopt31_HTM(DfsArg *arg) | 1218 | estimate_nxopt31_HTM(DfsArg *arg) |
diff --git a/src/symcoord.c b/src/symcoord.c index cb178b7..cb105a9 100644 --- a/src/symcoord.c +++ b/src/symcoord.c | |||
| @@ -8,19 +8,19 @@ static Cube antindex_cp_sym16(uint64_t ind); | |||
| 8 | static Cube antindex_eofbepos_sym16(uint64_t ind); | 8 | static Cube antindex_eofbepos_sym16(uint64_t ind); |
| 9 | static Cube antindex_drud_sym16(uint64_t ind); | 9 | static Cube antindex_drud_sym16(uint64_t ind); |
| 10 | static Cube antindex_drudfin_noE_sym16(uint64_t ind); | 10 | static Cube antindex_drudfin_noE_sym16(uint64_t ind); |
| 11 | static Cube antindex_khuge(uint64_t ind); | 11 | /*static Cube antindex_khuge(uint64_t ind);*/ |
| 12 | static Cube antindex_nxopt31(uint64_t ind); | 12 | static Cube antindex_nxopt31(uint64_t ind); |
| 13 | 13 | ||
| 14 | static uint64_t index_cp_sym16(Cube cube); | 14 | static uint64_t index_cp_sym16(Cube cube); |
| 15 | static uint64_t index_eofbepos_sym16(Cube cube); | 15 | static uint64_t index_eofbepos_sym16(Cube cube); |
| 16 | static uint64_t index_drud_sym16(Cube cube); | 16 | static uint64_t index_drud_sym16(Cube cube); |
| 17 | static uint64_t index_drudfin_noE_sym16(Cube cube); | 17 | static uint64_t index_drudfin_noE_sym16(Cube cube); |
| 18 | static uint64_t index_khuge(Cube cube); | 18 | /*static uint64_t index_khuge(Cube cube);*/ |
| 19 | static uint64_t index_nxopt31(Cube cube); | 19 | static uint64_t index_nxopt31(Cube cube); |
| 20 | 20 | ||
| 21 | static int transfinder_drud_sym16(uint64_t ind, Trans *ret); | 21 | static int transfinder_drud_sym16(uint64_t ind, Trans *ret); |
| 22 | static int transfinder_drudfin_noE_sym16(uint64_t ind, Trans *ret); | 22 | static int transfinder_drudfin_noE_sym16(uint64_t ind, Trans *ret); |
| 23 | static int transfinder_khuge(uint64_t ind, Trans *ret); | 23 | /*static int transfinder_khuge(uint64_t ind, Trans *ret);*/ |
| 24 | static int transfinder_nxopt31(uint64_t ind, Trans *ret); | 24 | static int transfinder_nxopt31(uint64_t ind, Trans *ret); |
| 25 | 25 | ||
| 26 | static void gensym(SymData *sd); | 26 | static void gensym(SymData *sd); |
| @@ -93,6 +93,7 @@ coord_drudfin_noE_sym16 = { | |||
| 93 | .trans = transfinder_drudfin_noE_sym16, | 93 | .trans = transfinder_drudfin_noE_sym16, |
| 94 | }; | 94 | }; |
| 95 | 95 | ||
| 96 | /* | ||
| 96 | Coordinate | 97 | Coordinate |
| 97 | coord_khuge = { | 98 | coord_khuge = { |
| 98 | .index = index_khuge, | 99 | .index = index_khuge, |
| @@ -100,6 +101,7 @@ coord_khuge = { | |||
| 100 | .max = POW3TO7 * FACTORIAL4 * CLASSES_EOFBEPOS_16, | 101 | .max = POW3TO7 * FACTORIAL4 * CLASSES_EOFBEPOS_16, |
| 101 | .trans = transfinder_khuge, | 102 | .trans = transfinder_khuge, |
| 102 | }; | 103 | }; |
| 104 | */ | ||
| 103 | 105 | ||
| 104 | Coordinate | 106 | Coordinate |
| 105 | coord_nxopt31 = { | 107 | coord_nxopt31 = { |
| @@ -148,6 +150,7 @@ antindex_drudfin_noE_sym16(uint64_t ind) | |||
| 148 | return c1; | 150 | return c1; |
| 149 | } | 151 | } |
| 150 | 152 | ||
| 153 | /* | ||
| 151 | static Cube | 154 | static Cube |
| 152 | antindex_khuge(uint64_t ind) | 155 | antindex_khuge(uint64_t ind) |
| 153 | { | 156 | { |
| @@ -159,6 +162,7 @@ antindex_khuge(uint64_t ind) | |||
| 159 | 162 | ||
| 160 | return c; | 163 | return c; |
| 161 | } | 164 | } |
| 165 | */ | ||
| 162 | 166 | ||
| 163 | static Cube | 167 | static Cube |
| 164 | antindex_nxopt31(uint64_t ind) | 168 | antindex_nxopt31(uint64_t ind) |
| @@ -208,6 +212,7 @@ index_eofbepos_sym16(Cube cube) | |||
| 208 | return sd_eofbepos_16.class[coord_eofbepos.index(cube)]; | 212 | return sd_eofbepos_16.class[coord_eofbepos.index(cube)]; |
| 209 | } | 213 | } |
| 210 | 214 | ||
| 215 | /* | ||
| 211 | static uint64_t | 216 | static uint64_t |
| 212 | index_khuge(Cube cube) | 217 | index_khuge(Cube cube) |
| 213 | { | 218 | { |
| @@ -221,6 +226,7 @@ index_khuge(Cube cube) | |||
| 221 | 226 | ||
| 222 | return a * POW3TO7 + c.coud; | 227 | return a * POW3TO7 + c.coud; |
| 223 | } | 228 | } |
| 229 | */ | ||
| 224 | 230 | ||
| 225 | static uint64_t | 231 | static uint64_t |
| 226 | index_nxopt31(Cube cube) | 232 | index_nxopt31(Cube cube) |
| @@ -280,6 +286,7 @@ transfinder_drudfin_noE_sym16(uint64_t ind, Trans *ret) | |||
| 280 | return naux[trueind]; | 286 | return naux[trueind]; |
| 281 | } | 287 | } |
| 282 | 288 | ||
| 289 | /* | ||
| 283 | static int | 290 | static int |
| 284 | transfinder_khuge(uint64_t ind, Trans *ret) | 291 | transfinder_khuge(uint64_t ind, Trans *ret) |
| 285 | { | 292 | { |
| @@ -301,6 +308,7 @@ transfinder_khuge(uint64_t ind, Trans *ret) | |||
| 301 | ret[j] = retaux[trueind][j]; | 308 | ret[j] = retaux[trueind][j]; |
| 302 | return naux[trueind]; | 309 | return naux[trueind]; |
| 303 | } | 310 | } |
| 311 | */ | ||
| 304 | 312 | ||
| 305 | static int | 313 | static int |
| 306 | transfinder_nxopt31(uint64_t ind, Trans *ret) | 314 | transfinder_nxopt31(uint64_t ind, Trans *ret) |
