diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-07-15 11:15:35 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-07-15 11:15:35 +0200 |
| commit | 3d060c348fdfff074a9b902d56f539664789d831 (patch) | |
| tree | 12705ad2896be47961fab55735ec68e13abad4bc | |
| parent | 67c35b638c04ab7a860aac0c166936e9481633c9 (diff) | |
| download | nissy-core-3d060c348fdfff074a9b902d56f539664789d831.tar.gz nissy-core-3d060c348fdfff074a9b902d56f539664789d831.zip | |
Solved bug in cocsep generation
| -rw-r--r-- | TODO.txt | 30 | ||||
| -rw-r--r-- | src/solve_h48.h | 29 | ||||
| -rw-r--r-- | test/103_cocsep_selfsim_distribution/00_all.out | 22 | ||||
| -rw-r--r-- | test/111_gendata_h48_h0/00_h_0.out | 4 |
4 files changed, 24 insertions, 61 deletions
| @@ -1,30 +1,14 @@ | |||
| 1 | Bug in cocsepdata | 1 | Bug in esep table generation |
| 2 | - Add tests for ttrep | ||
| 3 | - check that ttrep indeed brings to representative | ||
| 4 | - Fix? | ||
| 5 | - Once fixed, fix other tests | ||
| 6 | - maybe add longtest, e.g. as a tool? | ||
| 7 | - Clean up mixed bfs fromdone / fromnew, use as new for h0k4 | ||
| 8 | - Re-do stats | 2 | - Re-do stats |
| 9 | 3 | - Add long-running test for h0k4 (maybe as a tool?) | |
| 10 | Check stats for all tables using H48stats solver | ||
| 11 | - try DFS for h0 solver | 4 | - try DFS for h0 solver |
| 12 | - compare results, the bfs method could be wrong | 5 | - use dfs for computing big table, save distance %3 until the last two steps, |
| 13 | - if faster: remove bfs | 6 | then clean the table and double loop over moves to fill the value |
| 14 | - if slower: why do I get different results with the new bfs? | 7 | - dfs for tables with h=1 to 10? |
| 15 | 8 | ||
| 16 | Bug in esep table generation | ||
| 17 | - Fails for UFRUFU, try command | 9 | - Fails for UFRUFU, try command |
| 18 | ./run solve -solver H48 -options "2;20" -n 1 -M 10 -cube \ | 10 | ./run solve -solver H48 -options "2;20" -n 1 -M 10 -cube \ |
| 19 | "$(./run frommoves -moves "UFRUFU")" | 11 | "$(./run frommoves -moves "UFRUFU")" |
| 20 | - Fundamental error in how tables are generated, each coordinate has too | ||
| 21 | many representative. I need to use the big table with the full coordinate | ||
| 22 | first (h=11, ~241 billion positions, 60Gb with k=2). From this the smaller | ||
| 23 | tables can be easily deduced. | ||
| 24 | - Investigate the possibility of computing smaller tables directly in some | ||
| 25 | other way, even if slow. | ||
| 26 | - use dfs for computing big table, save distance %3 until the last two steps, | ||
| 27 | then clean the table and double loop over moves to fill the value | ||
| 28 | 12 | ||
| 29 | Solver | 13 | Solver |
| 30 | - cleanup h48 solver | 14 | - cleanup h48 solver |
| @@ -118,6 +102,10 @@ switch. Here NISS may be useful. | |||
| 118 | * see if vcube's method to flip all corners is better | 102 | * see if vcube's method to flip all corners is better |
| 119 | * find a better way for computing the inverse? | 103 | * find a better way for computing the inverse? |
| 120 | * Transform with big table: make static cube actually static (how?) | 104 | * Transform with big table: make static cube actually static (how?) |
| 105 | * Use selfsim: in generating some tables, it is in thery possible to only check | ||
| 106 | the few transformations that give self-similarity instead of all 48. | ||
| 107 | The performance drop is almost insignificant, but I would like to figure out | ||
| 108 | the mistake I made previously. | ||
| 121 | 109 | ||
| 122 | ## Improvements and other things | 110 | ## Improvements and other things |
| 123 | 111 | ||
diff --git a/src/solve_h48.h b/src/solve_h48.h index 5054605..ed63209 100644 --- a/src/solve_h48.h +++ b/src/solve_h48.h | |||
| @@ -422,16 +422,10 @@ gendata_h48h0k4_return_size: | |||
| 422 | _static int64_t | 422 | _static int64_t |
| 423 | gendata_h48h0k4_bfs(bfsarg_esep_t *arg) | 423 | gendata_h48h0k4_bfs(bfsarg_esep_t *arg) |
| 424 | { | 424 | { |
| 425 | /* | ||
| 426 | TODO: the new method gives a slightly different answer. If the new | ||
| 427 | method is correct, then the old bfs method is wrong. Which one is it? | ||
| 428 | Try also DFS and compare results (it could be faster). | ||
| 429 | */ | ||
| 430 | if (2 * arg->done < (int64_t)ESEP_MAX(0)) | 425 | if (2 * arg->done < (int64_t)ESEP_MAX(0)) |
| 431 | return gendata_h48h0k4_bfs_fromdone(arg); | 426 | return gendata_h48h0k4_bfs_fromdone(arg); |
| 432 | else | 427 | else |
| 433 | return gendata_h48h0k4_bfs_fromnew(arg); | 428 | return gendata_h48h0k4_bfs_fromnew(arg); |
| 434 | // return gendata_h48h0k4_bfs_fromnew(arg); | ||
| 435 | } | 429 | } |
| 436 | 430 | ||
| 437 | _static int64_t | 431 | _static int64_t |
| @@ -464,22 +458,7 @@ gendata_h48h0k4_bfs_fromdone(bfsarg_esep_t *arg) | |||
| 464 | cocsep_coord = j / H48_ESIZE(0); | 458 | cocsep_coord = j / H48_ESIZE(0); |
| 465 | sim = arg->selfsim[cocsep_coord] >> UINT64_C(1); | 459 | sim = arg->selfsim[cocsep_coord] >> UINT64_C(1); |
| 466 | for (t = 1; t < 48 && sim; t++, sim >>= UINT64_C(1)) { | 460 | for (t = 1; t < 48 && sim; t++, sim >>= UINT64_C(1)) { |
| 467 | if (!(sim & UINT64_C(1))) { | 461 | /* TODO: use only selfsim */ |
| 468 | transd = transform(moved, t); | ||
| 469 | k = coord_h48(transd, arg->cocsepdata, 0); | ||
| 470 | if (k != j) { | ||
| 471 | /* | ||
| 472 | LOG("t=%" PRId64 ", tinv=%" PRIu8 "\n", t, inverse_trans(t)); | ||
| 473 | int64_t ccm = coord_cocsep(moved); | ||
| 474 | int64_t repm = coord_cocsep(arg->crep[j/H48_ESIZE(0)]); | ||
| 475 | LOG("moved: full %" PRId64 ", cocsep %" PRId64 ", rep %" PRId64 ", ttrep %" PRId32 "\n", j, ccm, repm, TTREP(arg->cocsepdata[ccm])); | ||
| 476 | int64_t cct = coord_cocsep(transd); | ||
| 477 | int64_t rept = coord_cocsep(arg->crep[k/H48_ESIZE(0)]); | ||
| 478 | LOG("moved: full %" PRId64 ", cocsep %" PRId64 ", rep %" PRId64 ", ttrep %" PRId32 "\n", j, cct, rept, TTREP(arg->cocsepdata[cct])); | ||
| 479 | */ | ||
| 480 | } | ||
| 481 | continue; | ||
| 482 | } | ||
| 483 | transd = transform(moved, t); | 462 | transd = transform(moved, t); |
| 484 | k = coord_h48(transd, arg->cocsepdata, 0); | 463 | k = coord_h48(transd, arg->cocsepdata, 0); |
| 485 | x = get_esep_pval(arg->buf32, k); | 464 | x = get_esep_pval(arg->buf32, k); |
| @@ -512,10 +491,7 @@ gendata_h48h0k4_bfs_fromnew(bfsarg_esep_t *arg) | |||
| 512 | j = coord_h48(moved, arg->cocsepdata, 0); | 491 | j = coord_h48(moved, arg->cocsepdata, 0); |
| 513 | x = get_esep_pval(arg->buf32, j); | 492 | x = get_esep_pval(arg->buf32, j); |
| 514 | if (x < arg->depth) | 493 | if (x < arg->depth) |
| 515 | { | ||
| 516 | if (x < arg->depth -1) LOG("WAT %" PRIu8 " while scanning %" PRIu8 "\n",x, arg->depth); | ||
| 517 | goto neighbor_found; | 494 | goto neighbor_found; |
| 518 | } | ||
| 519 | } | 495 | } |
| 520 | continue; | 496 | continue; |
| 521 | neighbor_found: | 497 | neighbor_found: |
| @@ -524,8 +500,7 @@ neighbor_found: | |||
| 524 | cocsep_coord = i / H48_ESIZE(0); | 500 | cocsep_coord = i / H48_ESIZE(0); |
| 525 | sim = arg->selfsim[cocsep_coord] >> 1; | 501 | sim = arg->selfsim[cocsep_coord] >> 1; |
| 526 | for (t = 1; t < 48 && sim; t++, sim >>= 1) { | 502 | for (t = 1; t < 48 && sim; t++, sim >>= 1) { |
| 527 | if (!(sim & 1)) | 503 | /* TODO: use only selfsim */ |
| 528 | continue; | ||
| 529 | transd = transform(cube, t); | 504 | transd = transform(cube, t); |
| 530 | j = coord_h48(transd, arg->cocsepdata, 0); | 505 | j = coord_h48(transd, arg->cocsepdata, 0); |
| 531 | x = get_esep_pval(arg->buf32, j); | 506 | x = get_esep_pval(arg->buf32, j); |
diff --git a/test/103_cocsep_selfsim_distribution/00_all.out b/test/103_cocsep_selfsim_distribution/00_all.out index 94e17a5..e58bfe1 100644 --- a/test/103_cocsep_selfsim_distribution/00_all.out +++ b/test/103_cocsep_selfsim_distribution/00_all.out | |||
| @@ -1,12 +1,12 @@ | |||
| 1 | 373 self-similar positions out of 3393 | 1 | 373 self-similar positions out of 3393 |
| 2 | Size number of groups | 2 | Size number of groups |
| 3 | 1 3020 | 3 | 1 3020 |
| 4 | 2 311 | 4 | 2 311 |
| 5 | 3 8 | 5 | 3 8 |
| 6 | 4 35 | 6 | 4 35 |
| 7 | 6 9 | 7 | 6 9 |
| 8 | 8 6 | 8 | 8 6 |
| 9 | 12 1 | 9 | 12 1 |
| 10 | 16 1 | 10 | 16 1 |
| 11 | 24 1 | 11 | 24 1 |
| 12 | 48 1 | 12 | 48 1 |
diff --git a/test/111_gendata_h48_h0/00_h_0.out b/test/111_gendata_h48_h0/00_h_0.out index cc5cf9b..04e8bf6 100644 --- a/test/111_gendata_h48_h0/00_h_0.out +++ b/test/111_gendata_h48_h0/00_h_0.out | |||
| @@ -19,5 +19,5 @@ h48: | |||
| 19 | 1: 1 | 19 | 1: 1 |
| 20 | 2: 4 | 20 | 2: 4 |
| 21 | 3: 34 | 21 | 3: 34 |
| 22 | 4: 329 | 22 | 4: 331 |
| 23 | 5: 3587 | 23 | 5: 3612 |
