SequenceScore
Declared in astar/SequenceScore.h; the same class on the site of Doxygen.
-
template<int W, int H>
class SequenceScore 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.
Public Types
-
using Base = SlidingTile<W, H>
the puzzle
Public Functions
-
inline explicit SequenceScore(const board_type &start, const board_type &goal = Base::korf_goal())
constructor, taking the start and the goal boards
-
inline state_type initial_state(void) const noexcept
-
inline bool is_goal(state_type s) const noexcept
-
inline std::uint64_t hash(state_type s) const noexcept
-
inline cost_type heuristic(state_type s) const noexcept
M + W S.
-
template<class F>
inline void for_each_successor(state_type s, cost_type, F &&f) const
-
using Base = SlidingTile<W, H>