diff options
Diffstat (limited to 'src/solvers/h48/solve.h')
| -rw-r--r-- | src/solvers/h48/solve.h | 61 |
1 files changed, 13 insertions, 48 deletions
diff --git a/src/solvers/h48/solve.h b/src/solvers/h48/solve.h index 6fb359d..047d13e 100644 --- a/src/solvers/h48/solve.h +++ b/src/solvers/h48/solve.h | |||
| @@ -34,7 +34,6 @@ typedef struct { | |||
| 34 | uint8_t base; | 34 | uint8_t base; |
| 35 | const uint32_t *cocsepdata; | 35 | const uint32_t *cocsepdata; |
| 36 | const unsigned char *h48data; | 36 | const unsigned char *h48data; |
| 37 | const unsigned char *h48data_fallback_h0k4; | ||
| 38 | const unsigned char *h48data_fallback_eoesep; | 37 | const unsigned char *h48data_fallback_eoesep; |
| 39 | uint64_t movemask_normal; | 38 | uint64_t movemask_normal; |
| 40 | uint64_t movemask_inverse; | 39 | uint64_t movemask_inverse; |
| @@ -112,7 +111,7 @@ solve_h48_stop(dfsarg_solve_h48_t arg[static 1]) | |||
| 112 | uint32_t data, data_inv; | 111 | uint32_t data, data_inv; |
| 113 | int64_t coord, coordext, coordmin; | 112 | int64_t coord, coordext, coordmin; |
| 114 | int8_t target, nh, n; | 113 | int8_t target, nh, n; |
| 115 | uint8_t pval_cocsep, pval_eoesep; | 114 | uint8_t pval_min, pval_eoesep; |
| 116 | 115 | ||
| 117 | n = arg->solution_moves->nmoves + arg->solution_moves->npremoves; | 116 | n = arg->solution_moves->nmoves + arg->solution_moves->npremoves; |
| 118 | target = arg->target_depth - n; | 117 | target = arg->target_depth - n; |
| @@ -149,22 +148,12 @@ solve_h48_stop(dfsarg_solve_h48_t arg[static 1]) | |||
| 149 | if (arg->k == 2 && arg->lb_inverse == 0) { | 148 | if (arg->k == 2 && arg->lb_inverse == 0) { |
| 150 | arg->table_fallbacks++; | 149 | arg->table_fallbacks++; |
| 151 | 150 | ||
| 152 | /* | ||
| 153 | pval_cocsep = get_h48_pval( | ||
| 154 | arg->h48data_fallback_h0k4, coord >> arg->h, 4); | ||
| 155 | */ | ||
| 156 | #if 1 | ||
| 157 | coordmin = H48_LINE_MIN(coord); | 151 | coordmin = H48_LINE_MIN(coord); |
| 158 | pval_cocsep = get_h48_pvalmin( | 152 | pval_min = get_h48_pvalmin( |
| 159 | arg->h48data, coordmin, arg->k); | 153 | arg->h48data, coordmin, arg->k); |
| 160 | pval_eoesep = get_eoesep_pval_cube( | 154 | pval_eoesep = get_eoesep_pval_cube( |
| 161 | arg->h48data_fallback_eoesep, arg->inverse); | 155 | arg->h48data_fallback_eoesep, arg->inverse); |
| 162 | arg->lb_inverse = MAX(pval_cocsep, pval_eoesep); | 156 | arg->lb_inverse = MAX(pval_min, pval_eoesep); |
| 163 | #else | ||
| 164 | coordmin = H48_LINE_MIN(coord); | ||
| 165 | arg->lb_inverse = get_h48_pvalmin( | ||
| 166 | arg->h48data, coordmin, arg->k); | ||
| 167 | #endif | ||
| 168 | } else { | 157 | } else { |
| 169 | arg->lb_inverse += arg->base; | 158 | arg->lb_inverse += arg->base; |
| 170 | } | 159 | } |
| @@ -189,22 +178,12 @@ solve_h48_stop(dfsarg_solve_h48_t arg[static 1]) | |||
| 189 | if (arg->k == 2 && arg->lb_normal == 0) { | 178 | if (arg->k == 2 && arg->lb_normal == 0) { |
| 190 | arg->table_fallbacks++; | 179 | arg->table_fallbacks++; |
| 191 | 180 | ||
| 192 | /* | ||
| 193 | pval_cocsep = get_h48_pval( | ||
| 194 | arg->h48data_fallback_h0k4, coord >> arg->h, 4); | ||
| 195 | */ | ||
| 196 | #if 1 | ||
| 197 | coordmin = H48_LINE_MIN(coord); | 181 | coordmin = H48_LINE_MIN(coord); |
| 198 | pval_cocsep = get_h48_pval( | 182 | pval_min = get_h48_pval( |
| 199 | arg->h48data, coordmin, arg->k); | 183 | arg->h48data, coordmin, arg->k); |
| 200 | pval_eoesep = get_eoesep_pval_cube( | 184 | pval_eoesep = get_eoesep_pval_cube( |
| 201 | arg->h48data_fallback_eoesep, arg->cube); | 185 | arg->h48data_fallback_eoesep, arg->cube); |
| 202 | arg->lb_normal = MAX(pval_cocsep, pval_eoesep); | 186 | arg->lb_normal = MAX(pval_min, pval_eoesep); |
| 203 | #else | ||
| 204 | coordmin = H48_LINE_MIN(coord); | ||
| 205 | arg->lb_normal = get_h48_pval( | ||
| 206 | arg->h48data, coordmin, arg->k); | ||
| 207 | #endif | ||
| 208 | } else { | 187 | } else { |
| 209 | arg->lb_normal += arg->base; | 188 | arg->lb_normal += arg->base; |
| 210 | } | 189 | } |
| @@ -482,7 +461,7 @@ solve_h48( | |||
| 482 | void *poll_status_data | 461 | void *poll_status_data |
| 483 | ) | 462 | ) |
| 484 | { | 463 | { |
| 485 | int i, ntasks, eoesep_table_index; | 464 | int i, ntasks; |
| 486 | bool td; | 465 | bool td; |
| 487 | wrapthread_atomic int status, prev_status; | 466 | wrapthread_atomic int status, prev_status; |
| 488 | size_t lastused; | 467 | size_t lastused; |
| @@ -493,10 +472,10 @@ solve_h48( | |||
| 493 | long double fallback_rate, lookups_per_node; | 472 | long double fallback_rate, lookups_per_node; |
| 494 | uint64_t offset; | 473 | uint64_t offset; |
| 495 | uint64_t nodes_visited, table_lookups, table_fallbacks; | 474 | uint64_t nodes_visited, table_lookups, table_fallbacks; |
| 496 | tableinfo_t info, fbinfo, fbinfo2; | 475 | tableinfo_t info, fbinfo2; |
| 497 | const uint32_t *cocsepdata; | 476 | const uint32_t *cocsepdata; |
| 498 | const unsigned char *fallback, *h48data; | 477 | const unsigned char *h48data; |
| 499 | const unsigned char *fallback2; | 478 | const unsigned char *eoesep; |
| 500 | solution_moves_t solution_moves[THREADS]; | 479 | solution_moves_t solution_moves[THREADS]; |
| 501 | solution_settings_t settings; | 480 | solution_settings_t settings; |
| 502 | solution_list_t sollist; | 481 | solution_list_t sollist; |
| @@ -512,29 +491,16 @@ solve_h48( | |||
| 512 | cocsepdata = (uint32_t *)(data + INFOSIZE); | 491 | cocsepdata = (uint32_t *)(data + INFOSIZE); |
| 513 | h48data = data + COCSEP_FULLSIZE + INFOSIZE; | 492 | h48data = data + COCSEP_FULLSIZE + INFOSIZE; |
| 514 | 493 | ||
| 515 | /* Read fallback table(s) */ | 494 | /* Read additional eoesep table */ |
| 516 | fallback = NULL; | ||
| 517 | if (readtableinfo_n(data_size, data, 3, &fbinfo) != NISSY_OK) | ||
| 518 | goto solve_h48_error_data; | ||
| 519 | offset = info.next; | 495 | offset = info.next; |
| 520 | eoesep_table_index = 3; | 496 | if (readtableinfo_n(data_size, data, 3, &fbinfo2) |
| 521 | if (info.bits == 2) { | ||
| 522 | /* We only support h0k4 as fallback table */ | ||
| 523 | if (fbinfo.h48h != 0 || fbinfo.bits != 4) | ||
| 524 | goto solve_h48_error_data; | ||
| 525 | fallback = h48data + offset; | ||
| 526 | offset += fbinfo.next; | ||
| 527 | eoesep_table_index++; | ||
| 528 | } | ||
| 529 | |||
| 530 | if (readtableinfo_n(data_size, data, eoesep_table_index, &fbinfo2) | ||
| 531 | != NISSY_OK) | 497 | != NISSY_OK) |
| 532 | goto solve_h48_error_data; | 498 | goto solve_h48_error_data; |
| 533 | 499 | ||
| 534 | /* Some heuristic check to see that it is eoesep */ | 500 | /* Some heuristic check to see that it is eoesep */ |
| 535 | if (fbinfo2.bits != 4 || fbinfo2.type != TABLETYPE_SPECIAL) | 501 | if (fbinfo2.bits != 4 || fbinfo2.type != TABLETYPE_SPECIAL) |
| 536 | goto solve_h48_error_data; | 502 | goto solve_h48_error_data; |
| 537 | fallback2 = h48data + offset; | 503 | eoesep = h48data + offset; |
| 538 | 504 | ||
| 539 | settings = (solution_settings_t) { | 505 | settings = (solution_settings_t) { |
| 540 | .unniss = true, | 506 | .unniss = true, |
| @@ -553,8 +519,7 @@ solve_h48( | |||
| 553 | .base = info.base, | 519 | .base = info.base, |
| 554 | .cocsepdata = cocsepdata, | 520 | .cocsepdata = cocsepdata, |
| 555 | .h48data = h48data, | 521 | .h48data = h48data, |
| 556 | .h48data_fallback_h0k4 = fallback, | 522 | .h48data_fallback_eoesep = eoesep, |
| 557 | .h48data_fallback_eoesep = fallback2, | ||
| 558 | .solution_moves = &solution_moves[i], | 523 | .solution_moves = &solution_moves[i], |
| 559 | .solution_settings = &settings, | 524 | .solution_settings = &settings, |
| 560 | .solution_list = &sollist, | 525 | .solution_list = &sollist, |
