|
PBeFS
Parallel Best-First Search
|
the sliding-tile puzzle with the sequence score heuristic of Nilsson More...
#include <PBeFS/astar/SequenceScore.h>
Public Types | |
| using | Base = SlidingTile< W , H > |
| the puzzle | |
| using | state_type = typename Base::state_type |
| a packed board | |
| using | cost_type = typename Base::cost_type |
| the cost type | |
| using | board_type = typename Base::board_type |
| a board | |
Public Member Functions | |
| SequenceScore (const board_type &start, const board_type &goal=Base::korf_goal()) | |
| constructor, taking the start and the goal boards | |
| state_type | initial_state (void) const noexcept |
| bool | is_goal (state_type s) const noexcept |
| std::uint64_t | hash (state_type s) const noexcept |
| cost_type | heuristic (state_type s) const noexcept |
| M + W S. | |
| template<class F> | |
| void | for_each_successor (state_type s, cost_type, F &&f) const |
| const Base & | base (void) const noexcept |
| the underlying puzzle | |
Static Public Attributes | |
| static constexpr int | cells = Base::cells |
| the cells | |
the sliding-tile puzzle with the sequence score heuristic of Nilsson
The heuristic is h = M + W S, M being the Manhattan distance and S the sequence score: on the 3 x 3 board S counts 1 if the centre does not hold its goal tile and 2 for each tile of the border not followed, clockwise, by the tile that follows it in the goal; on the other boards S counts 1 if the first cell does not hold its goal tile and 2 for each tile not followed, in row-major order, by the tile that follows it in the goal (Nilsson, "Problem-solving methods in artificial intelligence", 1971). The heuristic is not admissible: A* finds a solution expanding fewer nodes, but not necessarily an optimal one.
| using Base = SlidingTile< W , H > |
the puzzle
| using board_type = typename Base::board_type |
a board
| using cost_type = typename Base::cost_type |
the cost type
| using state_type = typename Base::state_type |
a packed board
|
inlineexplicit |
constructor, taking the start and the goal boards
|
inlinenodiscardnoexcept |
the underlying puzzle
|
inline |
|
inlinenodiscardnoexcept |
|
inlinenodiscardnoexcept |
M + W S.
|
inlinenodiscardnoexcept |
|
inlinenodiscardnoexcept |
|
staticconstexpr |
the cells