aboutsummaryrefslogtreecommitdiff
path: root/src/cubetypes.h
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano.tronto@gmail.com>2021-12-13 20:40:18 +0100
committerSebastiano Tronto <sebastiano.tronto@gmail.com>2021-12-13 20:40:18 +0100
commit1215648b1ba3c592bd9d97b871349673d1702e44 (patch)
tree7dc73a013c76b0cb0976e98d5e07902a0045363f /src/cubetypes.h
parent296f35b7ed4ea3177c520f28176f44d6ad47d76d (diff)
downloadnissy-1215648b1ba3c592bd9d97b871349673d1702e44.tar.gz
nissy-1215648b1ba3c592bd9d97b871349673d1702e44.zip
Faster optimal solver.
This is a pretty big one, but unfortunately performance only improved by about 5%. I implemented one of the main ideas of nxopt, that is switching to the inverse scramble on the fly if it gives a lower branching factor. On the one hand it makes sense that it does not have such a huge impact, since it only rarely happens that we do have a lower branching factor on inverse, but on the other hand I am quite sad that the improvement is barely noticeable :-( Maybe the problem is that I have introduced a lot of new overhead and I can improve that in the future. Or maybe I am just overlooking something stupid.
Diffstat (limited to '')
-rw-r--r--src/cubetypes.h32
1 files changed, 14 insertions, 18 deletions
diff --git a/src/cubetypes.h b/src/cubetypes.h
index 9ec8620..3ad960b 100644
--- a/src/cubetypes.h
+++ b/src/cubetypes.h
@@ -81,9 +81,8 @@ typedef struct commandargs CommandArgs;
81typedef struct coordinate Coordinate; 81typedef struct coordinate Coordinate;
82typedef struct cube Cube; 82typedef struct cube Cube;
83typedef struct cubearray CubeArray; 83typedef struct cubearray CubeArray;
84typedef struct dfsdata DfsData; 84typedef struct dfsarg DfsArg;
85typedef struct estimatedata EstimateData; 85typedef struct estimatedata EstimateData;
86typedef struct localinfo LocalInfo;
87typedef struct piecefilter PieceFilter; 86typedef struct piecefilter PieceFilter;
88typedef struct prunedata PruneData; 87typedef struct prunedata PruneData;
89typedef struct solveoptions SolveOptions; 88typedef struct solveoptions SolveOptions;
@@ -94,7 +93,7 @@ typedef struct threaddatagenpt ThreadDataGenpt;
94 93
95typedef Cube (*AntiIndexer) (uint64_t); 94typedef Cube (*AntiIndexer) (uint64_t);
96typedef bool (*Checker) (Cube); 95typedef bool (*Checker) (Cube);
97typedef int (*Estimator) (EstimateData *); 96typedef int (*Estimator) (DfsArg *);
98typedef bool (*Validator) (Alg *); 97typedef bool (*Validator) (Alg *);
99typedef void (*Exec) (CommandArgs *); 98typedef void (*Exec) (CommandArgs *);
100typedef uint64_t (*Indexer) (Cube); 99typedef uint64_t (*Indexer) (Cube);
@@ -198,36 +197,31 @@ cubearray
198}; 197};
199 198
200struct 199struct
201dfsdata 200dfsarg
202{ 201{
202 Step * step;
203 SolveOptions * opts;
204 Cube cube;
205 Cube inverse;
203 int d; 206 int d;
204 int m; 207 uint64_t badmoves;
205 int lb; 208 uint64_t badmovesinv;
206 bool niss; 209 bool niss;
207 Move last1; 210 Move last1;
208 Move last2; 211 Move last2;
212 Move last1inv;
213 Move last2inv;
209 EstimateData * ed; 214 EstimateData * ed;
210 AlgList * sols; 215 AlgList * sols;
211 pthread_mutex_t * sols_mutex; 216 pthread_mutex_t * sols_mutex;
212 Alg * current_alg; 217 Alg * current_alg;
213 Move * sorted_moves; 218 Move * sorted_moves;
214 int * move_position; 219 int * move_position;
215 uint8_t * visited;
216}; 220};
217 221
218struct 222struct
219estimatedata 223estimatedata
220{ 224{
221 Cube cube;
222 int target;
223 Move lastmove;
224 uint64_t movebitmask;
225 LocalInfo * li;
226};
227
228struct
229localinfo
230{
231 int corners; 225 int corners;
232 int normal_ud; 226 int normal_ud;
233 int normal_fb; 227 int normal_fb;
@@ -235,7 +229,7 @@ localinfo
235 int inverse_ud; 229 int inverse_ud;
236 int inverse_fb; 230 int inverse_fb;
237 int inverse_rl; 231 int inverse_rl;
238 int prev_ret; 232 int oldret;
239}; 233};
240 234
241struct 235struct
@@ -284,6 +278,8 @@ step
284{ 278{
285 char * shortname; 279 char * shortname;
286 char * name; 280 char * name;
281 bool final;
282 Checker is_done;
287 Estimator estimate; 283 Estimator estimate;
288 Checker ready; 284 Checker ready;
289 char * ready_msg; 285 char * ready_msg;

Generated with cgit - Back to sebastiano.tronto.net