aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano.tronto@gmail.com>2022-03-15 15:54:39 +0100
committerSebastiano Tronto <sebastiano.tronto@gmail.com>2022-03-15 15:54:39 +0100
commite18f8e4eefadd733d985e99e2710111afa5a710a (patch)
tree196033c8f04e760b8b6f4d445c70ca17143e0179
parentdef25ea64b097d2a994eb33c91dc66248233afec (diff)
downloadnissy-e18f8e4eefadd733d985e99e2710111afa5a710a.tar.gz
nissy-e18f8e4eefadd733d985e99e2710111afa5a710a.zip
Prepare for big changes in coordinates
-rw-r--r--TODO.md31
-rwxr-xr-xnissybin327072 -> 327640 bytes
-rw-r--r--src/cubetypes.h6
-rw-r--r--src/moves.c22
-rw-r--r--src/moves.h15
-rw-r--r--src/pruning.c4
-rw-r--r--src/symcoord.c32
-rw-r--r--src/trans.h2
8 files changed, 65 insertions, 47 deletions
diff --git a/TODO.md b/TODO.md
index 1bc92e0..ae09a01 100644
--- a/TODO.md
+++ b/TODO.md
@@ -4,11 +4,19 @@ This is a list of things that I would like to add or change at some point.
4It's more of a personal reminder than anything else. 4It's more of a personal reminder than anything else.
5 5
6## For version 2.1 6## For version 2.1
7### Installation 7### Moving coordinates
8* Implement coord->move to apply moves directly on coordinates 8* Implement coord->move to apply moves directly on coordinates
9 (can this be used to improve solving speed? Applying moves on 9* add transformer to transform coordinate (optional, only for sym coordinates)
10 three coordinates is better than applying a move on a Cube and 10* For each coordinate, manually disallow "bad" moves, or just ignore the error
11 then transforming it, but I still need to work with inverses...) 11 (probably better to check: low performance cost, detect problems that I might
12 be overlooking)
13* remove selsims, do this directly inside transfinder
14* change genptable where needed
15* Remove coord->cube (and edit README.md accordingly)
16* Remove sym_data->rep (but keep transtorep)?
17* Use this to improve solver: add 2 or 3 helper coordinates to optimal solver,
18 to avoid transforming every time. We still need to transform when checking
19 inverse scramble, though.
12### Documentation 20### Documentation
13* Write an examples.md file 21* Write an examples.md file
14* More screenshots! 22* More screenshots!
@@ -44,14 +52,13 @@ including e.g. solutions that were not shown because -c)
44 (graphical: maybe there is a cubing.js function; command line: ???) 52 (graphical: maybe there is a cubing.js function; command line: ???)
45 53
46## Distribution 54## Distribution
47
48* Add EXAMPLES.md file
49* webapp (cgi) 55* webapp (cgi)
50* installation: get ptables with curl or similar (on Windows what?)
51 also, keep only one compressed format (+uncompressed?) on server
52 56
53## Technical stuff 57## Technical stuff
54 58
59### Testing
60* write some proper tests, move test_coord to the testing module(s)
61
55### Memory management 62### Memory management
56* free pruning table after solve is done? if I do this I need to deafault to a 63* free pruning table after solve is done? if I do this I need to deafault to a
57 small table for < 8 moves solutions or smth 64 small table for < 8 moves solutions or smth
@@ -65,14 +72,6 @@ including e.g. solutions that were not shown because -c)
65* Check if memory is enough for loading pruning tables; if not, abort 72* Check if memory is enough for loading pruning tables; if not, abort
66* For optimal solver: choose largest that fits in memory between nxopt and light 73* For optimal solver: choose largest that fits in memory between nxopt and light
67 74
68### Other optimal solvers
69* try htr corners + edges in slice but not oriented (300Mb table);
70 de Bondt's trick does not work, but I can use full symmetry and
71 take advantage of the fact that it is a subset invariant under half-turns
72 (like in light optimal solver)
73* Another idea: DR + cornershtr (5Gb table); same as above, de Bondt's trick
74 does not work but I can use half-turn trick
75
76### Structural changes 75### Structural changes
77* client/server architecture: run a server process in the background so that 76* client/server architecture: run a server process in the background so that
78 multiple client processess can send it queries and get results; this would 77 multiple client processess can send it queries and get results; this would
diff --git a/nissy b/nissy
index 8a20a5d..a92453e 100755
--- a/nissy
+++ b/nissy
Binary files differ
diff --git a/src/cubetypes.h b/src/cubetypes.h
index 14e490a..518c727 100644
--- a/src/cubetypes.h
+++ b/src/cubetypes.h
@@ -95,6 +95,8 @@ typedef struct threaddatagenpt ThreadDataGenpt;
95 95
96typedef Cube (*AntiIndexer) (uint64_t); 96typedef Cube (*AntiIndexer) (uint64_t);
97typedef bool (*Checker) (Cube); 97typedef bool (*Checker) (Cube);
98typedef uint64_t (*CoordMover) (Move, uint64_t);
99typedef uint64_t (*CoordTransformer) (Trans, uint64_t);
98typedef int (*Estimator) (DfsArg *); 100typedef int (*Estimator) (DfsArg *);
99typedef bool (*Validator) (Alg *); 101typedef bool (*Validator) (Alg *);
100typedef void (*Exec) (CommandArgs *); 102typedef void (*Exec) (CommandArgs *);
@@ -168,7 +170,9 @@ coordinate
168 Indexer index; 170 Indexer index;
169 AntiIndexer cube; 171 AntiIndexer cube;
170 uint64_t max; 172 uint64_t max;
171 TransFinder trans; 173 TransFinder transfind;
174 CoordMover move;
175 CoordTransformer transform;
172}; 176};
173 177
174struct 178struct
diff --git a/src/moves.c b/src/moves.c
index 7c33db4..02880ca 100644
--- a/src/moves.c
+++ b/src/moves.c
@@ -138,17 +138,17 @@ static char equiv_alg_string[100][NMOVES] = {
138}; 138};
139 139
140/* Transition tables, to be loaded up at the beginning */ 140/* Transition tables, to be loaded up at the beginning */
141static int epose_mtable[NMOVES][FACTORIAL12/FACTORIAL8]; 141int epose_mtable[NMOVES][FACTORIAL12/FACTORIAL8];
142static int eposs_mtable[NMOVES][FACTORIAL12/FACTORIAL8]; 142int eposs_mtable[NMOVES][FACTORIAL12/FACTORIAL8];
143static int eposm_mtable[NMOVES][FACTORIAL12/FACTORIAL8]; 143int eposm_mtable[NMOVES][FACTORIAL12/FACTORIAL8];
144static int eofb_mtable[NMOVES][POW2TO11]; 144int eofb_mtable[NMOVES][POW2TO11];
145static int eorl_mtable[NMOVES][POW2TO11]; 145int eorl_mtable[NMOVES][POW2TO11];
146static int eoud_mtable[NMOVES][POW2TO11]; 146int eoud_mtable[NMOVES][POW2TO11];
147static int cp_mtable[NMOVES][FACTORIAL8]; 147int cp_mtable[NMOVES][FACTORIAL8];
148static int coud_mtable[NMOVES][POW3TO7]; 148int coud_mtable[NMOVES][POW3TO7];
149static int cofb_mtable[NMOVES][POW3TO7]; 149int cofb_mtable[NMOVES][POW3TO7];
150static int corl_mtable[NMOVES][POW3TO7]; 150int corl_mtable[NMOVES][POW3TO7];
151static int cpos_mtable[NMOVES][FACTORIAL6]; 151int cpos_mtable[NMOVES][FACTORIAL6];
152 152
153 153
154/* Local functions implementation ********************************************/ 154/* Local functions implementation ********************************************/
diff --git a/src/moves.h b/src/moves.h
index e7881a4..14ae087 100644
--- a/src/moves.h
+++ b/src/moves.h
@@ -5,6 +5,21 @@
5#include "cube.h" 5#include "cube.h"
6#include "env.h" 6#include "env.h"
7 7
8/*
9 * Tables are exposed to allow for faster moves in some cases.
10 */
11extern int epose_mtable[NMOVES][FACTORIAL12/FACTORIAL8];
12extern int eposs_mtable[NMOVES][FACTORIAL12/FACTORIAL8];
13extern int eposm_mtable[NMOVES][FACTORIAL12/FACTORIAL8];
14extern int eofb_mtable[NMOVES][POW2TO11];
15extern int eorl_mtable[NMOVES][POW2TO11];
16extern int eoud_mtable[NMOVES][POW2TO11];
17extern int cp_mtable[NMOVES][FACTORIAL8];
18extern int coud_mtable[NMOVES][POW3TO7];
19extern int cofb_mtable[NMOVES][POW3TO7];
20extern int corl_mtable[NMOVES][POW3TO7];
21extern int cpos_mtable[NMOVES][FACTORIAL6];
22
8Cube apply_alg(Alg *alg, Cube cube); 23Cube apply_alg(Alg *alg, Cube cube);
9Cube apply_alg_generic(Alg *alg, Cube c, PieceFilter f, bool a); 24Cube apply_alg_generic(Alg *alg, Cube c, PieceFilter f, bool a);
10Cube apply_move(Move m, Cube cube); 25Cube apply_move(Move m, Cube cube);
diff --git a/src/pruning.c b/src/pruning.c
index c66f8d6..2dea797 100644
--- a/src/pruning.c
+++ b/src/pruning.c
@@ -263,12 +263,12 @@ genptable_fixnasty(PruneData *pd, int d)
263 Cube c, cc; 263 Cube c, cc;
264 Trans t[NTRANS]; 264 Trans t[NTRANS];
265 265
266 if (pd->coord->trans == NULL) 266 if (pd->coord->transfind == NULL)
267 return; 267 return;
268 268
269 for (i = 0; i < pd->coord->max; i++) { 269 for (i = 0; i < pd->coord->max; i++) {
270 if (ptableval_index(pd, i) == d) { 270 if (ptableval_index(pd, i) == d) {
271 n = pd->coord->trans(i, t); 271 n = pd->coord->transfind(i, t);
272 if (n == 1) 272 if (n == 1)
273 continue; 273 continue;
274 274
diff --git a/src/symcoord.c b/src/symcoord.c
index c4349f5..38e13c6 100644
--- a/src/symcoord.c
+++ b/src/symcoord.c
@@ -64,38 +64,38 @@ SymData * all_sd[] = {
64 64
65Coordinate 65Coordinate
66coord_eofbepos_sym16 = { 66coord_eofbepos_sym16 = {
67 .index = index_eofbepos_sym16, 67 .index = index_eofbepos_sym16,
68 .cube = antindex_eofbepos_sym16, 68 .cube = antindex_eofbepos_sym16,
69}; 69};
70 70
71Coordinate 71Coordinate
72coord_cp_sym16 = { 72coord_cp_sym16 = {
73 .index = index_cp_sym16, 73 .index = index_cp_sym16,
74 .cube = antindex_cp_sym16, 74 .cube = antindex_cp_sym16,
75}; 75};
76 76
77Coordinate 77Coordinate
78coord_drud_sym16 = { 78coord_drud_sym16 = {
79 .index = index_drud_sym16, 79 .index = index_drud_sym16,
80 .cube = antindex_drud_sym16, 80 .cube = antindex_drud_sym16,
81 .max = POW3TO7 * CLASSES_EOFBEPOS_16, 81 .max = POW3TO7 * CLASSES_EOFBEPOS_16,
82 .trans = transfinder_drud_sym16, 82 .transfind = transfinder_drud_sym16,
83}; 83};
84 84
85Coordinate 85Coordinate
86coord_drudfin_noE_sym16 = { 86coord_drudfin_noE_sym16 = {
87 .index = index_drudfin_noE_sym16, 87 .index = index_drudfin_noE_sym16,
88 .cube = antindex_drudfin_noE_sym16, 88 .cube = antindex_drudfin_noE_sym16,
89 .max = FACTORIAL8 * CLASSES_CP_16, 89 .max = FACTORIAL8 * CLASSES_CP_16,
90 .trans = transfinder_drudfin_noE_sym16, 90 .transfind = transfinder_drudfin_noE_sym16,
91}; 91};
92 92
93Coordinate 93Coordinate
94coord_nxopt31 = { 94coord_nxopt31 = {
95 .index = index_nxopt31, 95 .index = index_nxopt31,
96 .cube = antindex_nxopt31, 96 .cube = antindex_nxopt31,
97 .max = POW3TO7 * BINOM8ON4 * CLASSES_EOFBEPOS_16 , 97 .max = POW3TO7 * BINOM8ON4 * CLASSES_EOFBEPOS_16,
98 .trans = transfinder_nxopt31, 98 .transfind = transfinder_nxopt31,
99}; 99};
100 100
101/* Functions *****************************************************************/ 101/* Functions *****************************************************************/
diff --git a/src/trans.h b/src/trans.h
index 13d17d8..51df12f 100644
--- a/src/trans.h
+++ b/src/trans.h
@@ -4,7 +4,7 @@
4#include "moves.h" 4#include "moves.h"
5 5
6/* 6/*
7 * Tables are exposed to allow faster partial transofrmations in some 7 * Tables are exposed to allow faster partial transformations in some
8 * specific cases (in symcoord) 8 * specific cases (in symcoord)
9 */ 9 */
10extern int epose_ttable[NTRANS][FACTORIAL12/FACTORIAL8]; 10extern int epose_ttable[NTRANS][FACTORIAL12/FACTORIAL8];

Generated with cgit - Back to sebastiano.tronto.net