aboutsummaryrefslogtreecommitdiff
path: root/src/solvers/h48
diff options
context:
space:
mode:
Diffstat (limited to 'src/solvers/h48')
-rw-r--r--src/solvers/h48/gendata_h48.h34
1 files changed, 13 insertions, 21 deletions
diff --git a/src/solvers/h48/gendata_h48.h b/src/solvers/h48/gendata_h48.h
index 2fd76ee..fb9a191 100644
--- a/src/solvers/h48/gendata_h48.h
+++ b/src/solvers/h48/gendata_h48.h
@@ -60,7 +60,7 @@ typedef struct {
60 60
61typedef struct { 61typedef struct {
62 cube_t cube; 62 cube_t cube;
63 uint8_t moves[4]; 63 uint8_t moves[MAXLEN];
64 uint8_t h; 64 uint8_t h;
65 uint8_t k; 65 uint8_t k;
66 uint8_t base; 66 uint8_t base;
@@ -310,8 +310,6 @@ gendata_h48k2(gendata_h48_arg_t *arg)
310 gendata_h48short_arg_t shortarg; 310 gendata_h48short_arg_t shortarg;
311 h48k2_dfs_arg_t dfsarg; 311 h48k2_dfs_arg_t dfsarg;
312 312
313 DBG_ASSERT(base[arg->h] == 8, 0, "Only implemented for h <= 3 (base 8)\n");
314
315 if (arg->buf == NULL) 313 if (arg->buf == NULL)
316 goto gendata_h48k2_return_size; 314 goto gendata_h48k2_return_size;
317 315
@@ -342,23 +340,12 @@ gendata_h48k2(gendata_h48_arg_t *arg)
342 }; 340 };
343 341
344 i = 0; 342 i = 0;
345int jj = 0;
346 for (kv = h48map_nextkvpair(&shortcubes, &i); 343 for (kv = h48map_nextkvpair(&shortcubes, &i);
347 i != shortcubes.capacity; 344 i != shortcubes.capacity;
348 kv = h48map_nextkvpair(&shortcubes, &i) 345 kv = h48map_nextkvpair(&shortcubes, &i)
349 ) { 346 ) {
350 dfsarg.cube = invcoord_h48(kv.key, arg->crep, 11); 347 dfsarg.cube = invcoord_h48(kv.key, arg->crep, 11);
351
352#if 1
353 gendata_h48k2_dfs(&dfsarg); 348 gendata_h48k2_dfs(&dfsarg);
354#else
355 /* It looks like this is not necessary, we get the same result */
356 _foreach_h48sim(
357 dfsarg.cube, arg->cocsepdata, arg->selfsim, arg->h,
358 gendata_h48k2_dfs(&dfsarg);
359 )
360#endif
361if ((++jj) % 100000 == 0) LOG("Done %d distance 8 cubes\n", jj);
362 } 349 }
363 350
364 h48map_destroy(&shortcubes); 351 h48map_destroy(&shortcubes);
@@ -377,6 +364,7 @@ gendata_h48k2_return_size:
377_static void 364_static void
378gendata_h48k2_dfs(h48k2_dfs_arg_t *arg) 365gendata_h48k2_dfs(h48k2_dfs_arg_t *arg)
379{ 366{
367 cube_t ccc;
380 bool toodeep, backtracked; 368 bool toodeep, backtracked;
381 uint8_t nmoves, oldval, newval; 369 uint8_t nmoves, oldval, newval;
382 uint64_t mval; 370 uint64_t mval;
@@ -384,14 +372,18 @@ gendata_h48k2_dfs(h48k2_dfs_arg_t *arg)
384 h48k2_dfs_arg_t nextarg; 372 h48k2_dfs_arg_t nextarg;
385 uint8_t m; 373 uint8_t m;
386 374
387 fullcoord = coord_h48(arg->cube, arg->cocsepdata, 11); 375 ccc = arg->cube;
388 coord = fullcoord >> (int64_t)(11 - arg->h); 376 _foreach_h48sim(ccc, arg->cocsepdata, arg->selfsim, 11,
389 mval = h48map_value(arg->shortcubes, fullcoord); 377 fullcoord = coord_h48(ccc, arg->cocsepdata, 11);
390 378 coord = fullcoord >> (int64_t)(11 - arg->h);
391 oldval = get_esep_pval(arg->h48data, coord, arg->k); 379 oldval = get_esep_pval(arg->h48data, coord, arg->k);
392 newval = arg->depth >= arg->base ? arg->depth - arg->base : 0; 380 newval = arg->depth >= arg->base ? arg->depth - arg->base : 0;
393 set_esep_pval(arg->h48data, coord, arg->k, _min(oldval, newval)); 381 set_esep_pval(
382 arg->h48data, coord, arg->k, _min(oldval, newval));
383 )
394 384
385 fullcoord = coord_h48(arg->cube, arg->cocsepdata, 11); /* Necessary? */
386 mval = h48map_value(arg->shortcubes, fullcoord);
395 backtracked = mval <= arg->shortdepth && arg->depth != arg->shortdepth; 387 backtracked = mval <= arg->shortdepth && arg->depth != arg->shortdepth;
396 toodeep = arg->depth >= arg->maxdepth; 388 toodeep = arg->depth >= arg->maxdepth;
397 if (backtracked || toodeep) 389 if (backtracked || toodeep)

Generated with cgit - Back to sebastiano.tronto.net