diff options
Diffstat (limited to 'src/solvers')
| -rw-r--r-- | src/solvers/h48/solve.h | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/solvers/h48/solve.h b/src/solvers/h48/solve.h index 8ac596d..5fd3dd9 100644 --- a/src/solvers/h48/solve.h +++ b/src/solvers/h48/solve.h | |||
| @@ -112,19 +112,13 @@ solve_h48_stop(dfsarg_solve_h48_t arg[static 1]) | |||
| 112 | int8_t target, nh, n; | 112 | int8_t target, nh, n; |
| 113 | uint8_t pval_min, pval_eoesep; | 113 | uint8_t pval_min, pval_eoesep; |
| 114 | 114 | ||
| 115 | n = arg->solution_moves->nmoves + arg->solution_moves->npremoves; | ||
| 116 | target = arg->target_depth - n; | ||
| 117 | if (target <= 0 || | ||
| 118 | arg->solution_list->nsols >= arg->solution_settings->maxsolutions || | ||
| 119 | n > arg->solution_list->shortest_sol + | ||
| 120 | arg->solution_settings->optimal) | ||
| 121 | return true; | ||
| 122 | |||
| 123 | arg->movemask_normal = arg->movemask_inverse = MM18_ALLMOVES; | 115 | arg->movemask_normal = arg->movemask_inverse = MM18_ALLMOVES; |
| 124 | arg->nodes_visited++; | 116 | arg->nodes_visited++; |
| 125 | 117 | ||
| 126 | /* Preliminary probing using last computed bound, if possible */ | 118 | /* Preliminary probing using last computed bound, if possible */ |
| 127 | 119 | ||
| 120 | n = arg->solution_moves->nmoves + arg->solution_moves->npremoves; | ||
| 121 | target = arg->target_depth - n; | ||
| 128 | if ((arg->use_lb_normal && arg->lb_normal > target) || | 122 | if ((arg->use_lb_normal && arg->lb_normal > target) || |
| 129 | (arg->use_lb_inverse && arg->lb_inverse > target)) | 123 | (arg->use_lb_inverse && arg->lb_inverse > target)) |
| 130 | return true; | 124 | return true; |
| @@ -200,14 +194,13 @@ STATIC int64_t | |||
| 200 | solve_h48_dfs(dfsarg_solve_h48_t arg[static 1]) | 194 | solve_h48_dfs(dfsarg_solve_h48_t arg[static 1]) |
| 201 | { | 195 | { |
| 202 | int64_t ret, n; | 196 | int64_t ret, n; |
| 203 | uint8_t m, nm, lbn, lbi; | 197 | uint8_t m, nm, lbn, lbi, t; |
| 204 | uint64_t mm_normal, mm_inverse; | 198 | uint64_t mm_normal, mm_inverse; |
| 205 | bool ulbi, ulbn; | 199 | bool ulbi, ulbn; |
| 206 | cube_t backup_cube, backup_inverse; | 200 | cube_t backup_cube, backup_inverse; |
| 207 | 201 | ||
| 202 | nm = arg->solution_moves->nmoves + arg->solution_moves->npremoves; | ||
| 208 | if (equal(arg->cube, SOLVED_CUBE)) { | 203 | if (equal(arg->cube, SOLVED_CUBE)) { |
| 209 | nm = arg->solution_moves->nmoves | ||
| 210 | + arg->solution_moves->npremoves; | ||
| 211 | if (arg->target_depth != nm) | 204 | if (arg->target_depth != nm) |
| 212 | return 0; | 205 | return 0; |
| 213 | wrapthread_mutex_lock(arg->solutions_mutex); | 206 | wrapthread_mutex_lock(arg->solutions_mutex); |
| @@ -220,6 +213,11 @@ solve_h48_dfs(dfsarg_solve_h48_t arg[static 1]) | |||
| 220 | if (solve_h48_stop(arg)) | 213 | if (solve_h48_stop(arg)) |
| 221 | return 0; | 214 | return 0; |
| 222 | 215 | ||
| 216 | t = arg->solution_list->shortest_sol + arg->solution_settings->optimal; | ||
| 217 | if (nm + 1 > MIN(t, arg->target_depth) || | ||
| 218 | arg->solution_list->nsols >= arg->solution_settings->maxsolutions) | ||
| 219 | return 0; | ||
| 220 | |||
| 223 | backup_cube = arg->cube; | 221 | backup_cube = arg->cube; |
| 224 | backup_inverse = arg->inverse; | 222 | backup_inverse = arg->inverse; |
| 225 | lbn = arg->lb_normal; | 223 | lbn = arg->lb_normal; |
