diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2022-02-27 17:31:42 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2022-02-27 17:31:42 +0100 |
| commit | 36fb1d0fa1b70ee62dc6073d56176e8c81ceddfd (patch) | |
| tree | 9229e367690099c83b2f5231ca1990d7fb7561df | |
| parent | 7de88d1bcd420447023b8e74b0aa4f5e8ba1df6b (diff) | |
| download | nissy-36fb1d0fa1b70ee62dc6073d56176e8c81ceddfd.tar.gz nissy-36fb1d0fa1b70ee62dc6073d56176e8c81ceddfd.zip | |
Removed some unused code (khuge). Improved optimal solver performance by about 10% using raw transition tables (same for dr step).
| -rwxr-xr-x | nissy | bin | 326824 -> 0 bytes | |||
| -rw-r--r-- | src/pruning.c | 10 | ||||
| -rw-r--r-- | src/pruning.h | 1 | ||||
| -rw-r--r-- | src/steps.c | 31 | ||||
| -rw-r--r-- | src/symcoord.c | 82 | ||||
| -rw-r--r-- | src/symcoord.h | 1 | ||||
| -rw-r--r-- | src/trans.c | 16 | ||||
| -rw-r--r-- | src/trans.h | 13 |
8 files changed, 28 insertions, 126 deletions
| Binary files differ | |||
diff --git a/src/pruning.c b/src/pruning.c index 51bea10..d484a12 100644 --- a/src/pruning.c +++ b/src/pruning.c | |||
| @@ -78,15 +78,6 @@ pd_htrfin_htr = { | |||
| 78 | .moveset = &moveset_htr, | 78 | .moveset = &moveset_htr, |
| 79 | }; | 79 | }; |
| 80 | 80 | ||
| 81 | /* | ||
| 82 | PruneData | ||
| 83 | pd_khuge_HTM = { | ||
| 84 | .filename = "pt_khuge_HTM", | ||
| 85 | .coord = &coord_khuge, | ||
| 86 | .moveset = &moveset_HTM, | ||
| 87 | }; | ||
| 88 | */ | ||
| 89 | |||
| 90 | PruneData | 81 | PruneData |
| 91 | pd_nxopt31_HTM = { | 82 | pd_nxopt31_HTM = { |
| 92 | .filename = "pt_nxopt31_HTM", | 83 | .filename = "pt_nxopt31_HTM", |
| @@ -108,7 +99,6 @@ PruneData * allpd[] = { | |||
| 108 | &pd_drudfin_noE_sym16_drud, | 99 | &pd_drudfin_noE_sym16_drud, |
| 109 | &pd_htr_drud, | 100 | &pd_htr_drud, |
| 110 | &pd_htrfin_htr, | 101 | &pd_htrfin_htr, |
| 111 | /* &pd_khuge_HTM,*/ | ||
| 112 | &pd_nxopt31_HTM, | 102 | &pd_nxopt31_HTM, |
| 113 | NULL | 103 | NULL |
| 114 | }; | 104 | }; |
diff --git a/src/pruning.h b/src/pruning.h index 7da1e3e..df95ea2 100644 --- a/src/pruning.h +++ b/src/pruning.h | |||
| @@ -12,7 +12,6 @@ extern PruneData pd_drud_eofb; | |||
| 12 | extern PruneData pd_drudfin_noE_sym16_drud; | 12 | extern PruneData pd_drudfin_noE_sym16_drud; |
| 13 | extern PruneData pd_htr_drud; | 13 | extern PruneData pd_htr_drud; |
| 14 | extern PruneData pd_htrfin_htr; | 14 | extern PruneData pd_htrfin_htr; |
| 15 | extern PruneData pd_khuge_HTM; | ||
| 16 | extern PruneData pd_nxopt31_HTM; | 15 | extern PruneData pd_nxopt31_HTM; |
| 17 | 16 | ||
| 18 | extern PruneData * allpd[]; | 17 | extern PruneData * allpd[]; |
diff --git a/src/steps.c b/src/steps.c index 83d105c..3189811 100644 --- a/src/steps.c +++ b/src/steps.c | |||
| @@ -27,7 +27,6 @@ static int estimate_dr_eofb(DfsArg *arg); | |||
| 27 | static int estimate_drudfin_drud(DfsArg *arg); | 27 | static int estimate_drudfin_drud(DfsArg *arg); |
| 28 | static int estimate_htr_drud(DfsArg *arg); | 28 | static int estimate_htr_drud(DfsArg *arg); |
| 29 | static int estimate_htrfin_htr(DfsArg *arg); | 29 | static int estimate_htrfin_htr(DfsArg *arg); |
| 30 | /*static int estimate_khuge_HTM(DfsArg *arg);*/ | ||
| 31 | static int estimate_nxopt31_HTM(DfsArg *arg); | 30 | static int estimate_nxopt31_HTM(DfsArg *arg); |
| 32 | static int estimate_light_HTM(DfsArg *arg); | 31 | static int estimate_light_HTM(DfsArg *arg); |
| 33 | 32 | ||
| @@ -54,28 +53,6 @@ static char check_drany_msg[100] = "DR must be solved on at least one axis"; | |||
| 54 | 53 | ||
| 55 | /* Optimal solvers *******************/ | 54 | /* Optimal solvers *******************/ |
| 56 | 55 | ||
| 57 | /* This is not used anymore, I'll keep it just in case */ | ||
| 58 | /* | ||
| 59 | Step | ||
| 60 | optimal_khuge_HTM = { | ||
| 61 | .shortname = "khuge", | ||
| 62 | .name = "Optimal solve (in HTM) using khuge table", | ||
| 63 | |||
| 64 | .final = true, | ||
| 65 | .is_done = is_solved, | ||
| 66 | .estimate = estimate_khuge_HTM, | ||
| 67 | .ready = check_centers, | ||
| 68 | .ready_msg = check_centers_msg, | ||
| 69 | .is_valid = always_valid, | ||
| 70 | .moveset = &moveset_HTM, | ||
| 71 | |||
| 72 | .pre_trans = uf, | ||
| 73 | |||
| 74 | .tables = {&pd_khuge_HTM, &pd_corners_HTM}, | ||
| 75 | .ntables = 2, | ||
| 76 | }; | ||
| 77 | */ | ||
| 78 | |||
| 79 | Step | 56 | Step |
| 80 | optimal_HTM = { | 57 | optimal_HTM = { |
| 81 | .shortname = "optimal", | 58 | .shortname = "optimal", |
| @@ -1196,14 +1173,6 @@ estimate_htrfin_htr(DfsArg *arg) | |||
| 1196 | return ptableval(&pd_htrfin_htr, arg->cube); | 1173 | return ptableval(&pd_htrfin_htr, arg->cube); |
| 1197 | } | 1174 | } |
| 1198 | 1175 | ||
| 1199 | /* | ||
| 1200 | static int | ||
| 1201 | estimate_khuge_HTM(DfsArg *arg) | ||
| 1202 | { | ||
| 1203 | return estimate_nxoptlike(arg, &pd_khuge_HTM); | ||
| 1204 | } | ||
| 1205 | */ | ||
| 1206 | |||
| 1207 | static int | 1176 | static int |
| 1208 | estimate_nxopt31_HTM(DfsArg *arg) | 1177 | estimate_nxopt31_HTM(DfsArg *arg) |
| 1209 | { | 1178 | { |
diff --git a/src/symcoord.c b/src/symcoord.c index cb105a9..b2099a7 100644 --- a/src/symcoord.c +++ b/src/symcoord.c | |||
| @@ -8,19 +8,16 @@ 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);*/ | ||
| 12 | static Cube antindex_nxopt31(uint64_t ind); | 11 | static Cube antindex_nxopt31(uint64_t ind); |
| 13 | 12 | ||
| 14 | static uint64_t index_cp_sym16(Cube cube); | 13 | static uint64_t index_cp_sym16(Cube cube); |
| 15 | static uint64_t index_eofbepos_sym16(Cube cube); | 14 | static uint64_t index_eofbepos_sym16(Cube cube); |
| 16 | static uint64_t index_drud_sym16(Cube cube); | 15 | static uint64_t index_drud_sym16(Cube cube); |
| 17 | static uint64_t index_drudfin_noE_sym16(Cube cube); | 16 | static uint64_t index_drudfin_noE_sym16(Cube cube); |
| 18 | /*static uint64_t index_khuge(Cube cube);*/ | ||
| 19 | static uint64_t index_nxopt31(Cube cube); | 17 | static uint64_t index_nxopt31(Cube cube); |
| 20 | 18 | ||
| 21 | static int transfinder_drud_sym16(uint64_t ind, Trans *ret); | 19 | static int transfinder_drud_sym16(uint64_t ind, Trans *ret); |
| 22 | static int transfinder_drudfin_noE_sym16(uint64_t ind, Trans *ret); | 20 | static int transfinder_drudfin_noE_sym16(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); | 21 | static int transfinder_nxopt31(uint64_t ind, Trans *ret); |
| 25 | 22 | ||
| 26 | static void gensym(SymData *sd); | 23 | static void gensym(SymData *sd); |
| @@ -93,16 +90,6 @@ coord_drudfin_noE_sym16 = { | |||
| 93 | .trans = transfinder_drudfin_noE_sym16, | 90 | .trans = transfinder_drudfin_noE_sym16, |
| 94 | }; | 91 | }; |
| 95 | 92 | ||
| 96 | /* | ||
| 97 | Coordinate | ||
| 98 | coord_khuge = { | ||
| 99 | .index = index_khuge, | ||
| 100 | .cube = antindex_khuge, | ||
| 101 | .max = POW3TO7 * FACTORIAL4 * CLASSES_EOFBEPOS_16, | ||
| 102 | .trans = transfinder_khuge, | ||
| 103 | }; | ||
| 104 | */ | ||
| 105 | |||
| 106 | Coordinate | 93 | Coordinate |
| 107 | coord_nxopt31 = { | 94 | coord_nxopt31 = { |
| 108 | .index = index_nxopt31, | 95 | .index = index_nxopt31, |
| @@ -150,20 +137,6 @@ antindex_drudfin_noE_sym16(uint64_t ind) | |||
| 150 | return c1; | 137 | return c1; |
| 151 | } | 138 | } |
| 152 | 139 | ||
| 153 | /* | ||
| 154 | static Cube | ||
| 155 | antindex_khuge(uint64_t ind) | ||
| 156 | { | ||
| 157 | Cube c; | ||
| 158 | |||
| 159 | c = antindex_eofbepos_sym16(ind/(FACTORIAL4*POW3TO7)); | ||
| 160 | c.epose = ((c.epose / 24) * 24) + ((ind/POW3TO7) % 24); | ||
| 161 | c.coud = ind % POW3TO7; | ||
| 162 | |||
| 163 | return c; | ||
| 164 | } | ||
| 165 | */ | ||
| 166 | |||
| 167 | static Cube | 140 | static Cube |
| 168 | antindex_nxopt31(uint64_t ind) | 141 | antindex_nxopt31(uint64_t ind) |
| 169 | { | 142 | { |
| @@ -186,12 +159,10 @@ static uint64_t | |||
| 186 | index_drud_sym16(Cube cube) | 159 | index_drud_sym16(Cube cube) |
| 187 | { | 160 | { |
| 188 | Trans t; | 161 | Trans t; |
| 189 | Cube c; | ||
| 190 | 162 | ||
| 191 | t = sd_eofbepos_16.transtorep[coord_eofbepos.index(cube)]; | 163 | t = sd_eofbepos_16.transtorep[coord_eofbepos.index(cube)]; |
| 192 | c = apply_trans(t, cube); | ||
| 193 | 164 | ||
| 194 | return index_eofbepos_sym16(c) * POW3TO7 + c.coud; | 165 | return index_eofbepos_sym16(cube) * POW3TO7 + co_ttable[t][cube.coud]; |
| 195 | } | 166 | } |
| 196 | 167 | ||
| 197 | static uint64_t | 168 | static uint64_t |
| @@ -212,34 +183,19 @@ index_eofbepos_sym16(Cube cube) | |||
| 212 | return sd_eofbepos_16.class[coord_eofbepos.index(cube)]; | 183 | return sd_eofbepos_16.class[coord_eofbepos.index(cube)]; |
| 213 | } | 184 | } |
| 214 | 185 | ||
| 215 | /* | ||
| 216 | static uint64_t | ||
| 217 | index_khuge(Cube cube) | ||
| 218 | { | ||
| 219 | Trans t; | ||
| 220 | Cube c; | ||
| 221 | uint64_t a; | ||
| 222 | |||
| 223 | t = sd_eofbepos_16.transtorep[coord_eofbepos.index(cube)]; | ||
| 224 | c = apply_trans(t, cube); | ||
| 225 | a = (index_eofbepos_sym16(c) * 24) + (c.epose % 24); | ||
| 226 | |||
| 227 | return a * POW3TO7 + c.coud; | ||
| 228 | } | ||
| 229 | */ | ||
| 230 | |||
| 231 | static uint64_t | 186 | static uint64_t |
| 232 | index_nxopt31(Cube cube) | 187 | index_nxopt31(Cube cube) |
| 233 | { | 188 | { |
| 234 | Trans t; | 189 | Trans t; |
| 235 | Cube c; | ||
| 236 | uint64_t a; | 190 | uint64_t a; |
| 237 | 191 | int coud, cp; | |
| 192 | |||
| 238 | t = sd_eofbepos_16.transtorep[coord_eofbepos.index(cube)]; | 193 | t = sd_eofbepos_16.transtorep[coord_eofbepos.index(cube)]; |
| 239 | c = apply_trans(t, cube); | 194 | coud = co_ttable[t][cube.coud]; |
| 240 | a = (index_eofbepos_sym16(c)*POW3TO7) + c.coud; | 195 | cp = cp_ttable[t][cube.cp]; |
| 196 | a = (index_eofbepos_sym16(cube)*POW3TO7) + coud; | ||
| 241 | 197 | ||
| 242 | return a * BINOM8ON4 + coord_cpud_separate.index(c); | 198 | return a * BINOM8ON4 + coord_cpud_separate.index((Cube){.cp = cp}); |
| 243 | } | 199 | } |
| 244 | 200 | ||
| 245 | static int | 201 | static int |
| @@ -286,30 +242,6 @@ transfinder_drudfin_noE_sym16(uint64_t ind, Trans *ret) | |||
| 286 | return naux[trueind]; | 242 | return naux[trueind]; |
| 287 | } | 243 | } |
| 288 | 244 | ||
| 289 | /* | ||
| 290 | static int | ||
| 291 | transfinder_khuge(uint64_t ind, Trans *ret) | ||
| 292 | { | ||
| 293 | uint64_t i, trueind; | ||
| 294 | int j; | ||
| 295 | static bool initialized = false; | ||
| 296 | static int naux[CLASSES_EOFBEPOS_16]; | ||
| 297 | static Trans retaux[CLASSES_EOFBEPOS_16][NTRANS]; | ||
| 298 | |||
| 299 | if (!initialized) { | ||
| 300 | for (i = 0; i < CLASSES_EOFBEPOS_16; i++) | ||
| 301 | naux[i] = selfsims(&sd_eofbepos_16, i, retaux[i]); | ||
| 302 | |||
| 303 | initialized = true; | ||
| 304 | } | ||
| 305 | |||
| 306 | trueind = ind/(FACTORIAL4*POW3TO7); | ||
| 307 | for (j = 0; j < naux[trueind]; j++) | ||
| 308 | ret[j] = retaux[trueind][j]; | ||
| 309 | return naux[trueind]; | ||
| 310 | } | ||
| 311 | */ | ||
| 312 | |||
| 313 | static int | 245 | static int |
| 314 | transfinder_nxopt31(uint64_t ind, Trans *ret) | 246 | transfinder_nxopt31(uint64_t ind, Trans *ret) |
| 315 | { | 247 | { |
diff --git a/src/symcoord.h b/src/symcoord.h index 4ba3815..a7b71ba 100644 --- a/src/symcoord.h +++ b/src/symcoord.h | |||
| @@ -7,7 +7,6 @@ extern Coordinate coord_cp_sym16; | |||
| 7 | extern Coordinate coord_eofbepos_sym16; | 7 | extern Coordinate coord_eofbepos_sym16; |
| 8 | extern Coordinate coord_drud_sym16; | 8 | extern Coordinate coord_drud_sym16; |
| 9 | extern Coordinate coord_drudfin_noE_sym16; | 9 | extern Coordinate coord_drudfin_noE_sym16; |
| 10 | extern Coordinate coord_khuge; | ||
| 11 | extern Coordinate coord_nxopt31; | 10 | extern Coordinate coord_nxopt31; |
| 12 | 11 | ||
| 13 | void init_symcoord(); | 12 | void init_symcoord(); |
diff --git a/src/trans.c b/src/trans.c index 72f8dd2..e267a17 100644 --- a/src/trans.c +++ b/src/trans.c | |||
| @@ -44,14 +44,14 @@ static int coud_source[NTRANS]; /* 0=coud, 1=corl, 2=cofb */ | |||
| 44 | static int cofb_source[NTRANS]; | 44 | static int cofb_source[NTRANS]; |
| 45 | static int corl_source[NTRANS]; | 45 | static int corl_source[NTRANS]; |
| 46 | 46 | ||
| 47 | static int epose_ttable[NTRANS][FACTORIAL12/FACTORIAL8]; | 47 | int epose_ttable[NTRANS][FACTORIAL12/FACTORIAL8]; |
| 48 | static int eposs_ttable[NTRANS][FACTORIAL12/FACTORIAL8]; | 48 | int eposs_ttable[NTRANS][FACTORIAL12/FACTORIAL8]; |
| 49 | static int eposm_ttable[NTRANS][FACTORIAL12/FACTORIAL8]; | 49 | int eposm_ttable[NTRANS][FACTORIAL12/FACTORIAL8]; |
| 50 | static int eo_ttable[NTRANS][POW2TO11]; | 50 | int eo_ttable[NTRANS][POW2TO11]; |
| 51 | static int cp_ttable[NTRANS][FACTORIAL8]; | 51 | int cp_ttable[NTRANS][FACTORIAL8]; |
| 52 | static int co_ttable[NTRANS][POW3TO7]; | 52 | int co_ttable[NTRANS][POW3TO7]; |
| 53 | static int cpos_ttable[NTRANS][FACTORIAL6]; | 53 | int cpos_ttable[NTRANS][FACTORIAL6]; |
| 54 | static Move moves_ttable[NTRANS][NMOVES]; | 54 | Move moves_ttable[NTRANS][NMOVES]; |
| 55 | 55 | ||
| 56 | /* Local functions implementation ********************************************/ | 56 | /* Local functions implementation ********************************************/ |
| 57 | 57 | ||
diff --git a/src/trans.h b/src/trans.h index 2eda568..13d17d8 100644 --- a/src/trans.h +++ b/src/trans.h | |||
| @@ -3,6 +3,19 @@ | |||
| 3 | 3 | ||
| 4 | #include "moves.h" | 4 | #include "moves.h" |
| 5 | 5 | ||
| 6 | /* | ||
| 7 | * Tables are exposed to allow faster partial transofrmations in some | ||
| 8 | * specific cases (in symcoord) | ||
| 9 | */ | ||
| 10 | extern int epose_ttable[NTRANS][FACTORIAL12/FACTORIAL8]; | ||
| 11 | extern int eposs_ttable[NTRANS][FACTORIAL12/FACTORIAL8]; | ||
| 12 | extern int eposm_ttable[NTRANS][FACTORIAL12/FACTORIAL8]; | ||
| 13 | extern int eo_ttable[NTRANS][POW2TO11]; | ||
| 14 | extern int cp_ttable[NTRANS][FACTORIAL8]; | ||
| 15 | extern int co_ttable[NTRANS][POW3TO7]; | ||
| 16 | extern int cpos_ttable[NTRANS][FACTORIAL6]; | ||
| 17 | extern Move moves_ttable[NTRANS][NMOVES]; | ||
| 18 | |||
| 6 | Cube apply_trans(Trans t, Cube cube); | 19 | Cube apply_trans(Trans t, Cube cube); |
| 7 | Trans inverse_trans(Trans t); | 20 | Trans inverse_trans(Trans t); |
| 8 | Alg * rotation_alg(Trans i); | 21 | Alg * rotation_alg(Trans i); |
