diff options
Diffstat (limited to 'src/solvers/h48/solve.h')
| -rw-r--r-- | src/solvers/h48/solve.h | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/solvers/h48/solve.h b/src/solvers/h48/solve.h index f076f11..78b4c97 100644 --- a/src/solvers/h48/solve.h +++ b/src/solvers/h48/solve.h | |||
| @@ -52,7 +52,7 @@ STATIC int64_t solve_h48_maketasks( | |||
| 52 | solve_h48_task_t [static STARTING_CUBES], int [static 1]); | 52 | solve_h48_task_t [static STARTING_CUBES], int [static 1]); |
| 53 | STATIC void *solve_h48_runthread(void *); | 53 | STATIC void *solve_h48_runthread(void *); |
| 54 | STATIC int64_t solve_h48_dfs(dfsarg_solve_h48_t [static 1]); | 54 | STATIC int64_t solve_h48_dfs(dfsarg_solve_h48_t [static 1]); |
| 55 | STATIC int64_t solve_h48(cube_t, int8_t, int8_t, uint64_t, int8_t, int8_t, | 55 | STATIC int64_t solve_h48(cube_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, |
| 56 | uint64_t, const void *, size_t n, char [n], | 56 | uint64_t, const void *, size_t n, char [n], |
| 57 | long long [static NISSY_SIZE_SOLVE_STATS]); | 57 | long long [static NISSY_SIZE_SOLVE_STATS]); |
| 58 | 58 | ||
| @@ -67,7 +67,9 @@ solve_h48_stop(dfsarg_solve_h48_t arg[static 1]) | |||
| 67 | n = arg->solution_moves->nmoves + arg->solution_moves->npremoves; | 67 | n = arg->solution_moves->nmoves + arg->solution_moves->npremoves; |
| 68 | target = arg->target_depth - n; | 68 | target = arg->target_depth - n; |
| 69 | if (target <= 0 || | 69 | if (target <= 0 || |
| 70 | arg->solution_list->nsols == arg->solution_settings->maxsolutions) | 70 | arg->solution_list->nsols >= arg->solution_settings->maxsolutions || |
| 71 | n > arg->solution_list->shortest_sol + | ||
| 72 | arg->solution_settings->optimal) | ||
| 71 | return true; | 73 | return true; |
| 72 | 74 | ||
| 73 | arg->movemask_normal = arg->movemask_inverse = MM_ALLMOVES; | 75 | arg->movemask_normal = arg->movemask_inverse = MM_ALLMOVES; |
| @@ -283,8 +285,8 @@ solve_h48_maketasks( | |||
| 283 | if (issolved(maketasks_arg->cube)) { | 285 | if (issolved(maketasks_arg->cube)) { |
| 284 | if (maketasks_arg->nmoves > maketasks_arg->maxmoves || | 286 | if (maketasks_arg->nmoves > maketasks_arg->maxmoves || |
| 285 | maketasks_arg->nmoves < maketasks_arg->minmoves || | 287 | maketasks_arg->nmoves < maketasks_arg->minmoves || |
| 286 | solve_arg->solution_list->nsols >= | 288 | solutions_done(solve_arg->solution_list, |
| 287 | solve_arg->solution_settings->maxsolutions) | 289 | solve_arg->solution_settings, maketasks_arg->nmoves)) |
| 288 | return NISSY_OK; | 290 | return NISSY_OK; |
| 289 | 291 | ||
| 290 | solution_moves_reset(&moves); | 292 | solution_moves_reset(&moves); |
| @@ -341,11 +343,11 @@ solve_h48_maketasks( | |||
| 341 | STATIC int64_t | 343 | STATIC int64_t |
| 342 | solve_h48( | 344 | solve_h48( |
| 343 | cube_t cube, | 345 | cube_t cube, |
| 344 | int8_t minmoves, | 346 | uint8_t minmoves, |
| 345 | int8_t maxmoves, | 347 | uint8_t maxmoves, |
| 346 | uint64_t maxsolutions, | 348 | uint8_t maxsolutions, |
| 347 | int8_t optimal, | 349 | uint8_t optimal, |
| 348 | int8_t threads, | 350 | uint8_t threads, |
| 349 | uint64_t data_size, | 351 | uint64_t data_size, |
| 350 | const void *data, | 352 | const void *data, |
| 351 | size_t solutions_size, | 353 | size_t solutions_size, |
| @@ -448,7 +450,7 @@ solve_h48( | |||
| 448 | solve_h48_maketasks(&arg[0], &maketasks_arg, tasks, &ntasks); | 450 | solve_h48_maketasks(&arg[0], &maketasks_arg, tasks, &ntasks); |
| 449 | if (ntasks < 0) | 451 | if (ntasks < 0) |
| 450 | goto solve_h48_error_solutions_buffer; | 452 | goto solve_h48_error_solutions_buffer; |
| 451 | if (sollist.nsols >= maxsolutions) | 453 | if (solutions_done(&sollist, &settings, MAX(minmoves, STARTING_MOVES))) |
| 452 | goto solve_h48_done; | 454 | goto solve_h48_done; |
| 453 | 455 | ||
| 454 | for (i = 0; i < threads; i++) { | 456 | for (i = 0; i < threads; i++) { |
