1 8puzzle
2 A* search algorithm A* is a best-first, graph search algorithm that finds the least-cost path from a given initial node to one goal node f(x) = g(x) + h(x) f(x) = distance-plus-cost heuristic function g(x) = the path-cost function = the cost from the starting node to the current node h(x) = an admissible "heuristic estimate" of the distance to the goal
3 Taxicab geometry The taxicab distance between two points in a Euclidean space with fixed Cartesian coordinate system is the sum of the lengths of the projections of the line segment between the points onto the coordinate axes. In the plane the taxicab distance between the point P1 with coordinates (x 1, y 1 ) and the point P2 at (x 2, y 2 ) is |x 1 - x 2 | + |y 1 - y 2 |
4 Our algorithm Different Distance = RouteCount + distToGoal – distToInitial RouteCount = Cost to current state distToGoal = Estimated cost between possible state with coordinates (x 1, y 1 ) and goal state at (x 2, y 2 ) = |x 1 - x 2 | + |y 1 - y 2 | distToInitial = Estimated cost between possible state with coordinates (x 1, y 1 ) and initial state at (x 2, y 2 ) = |x 1 - x 2 | + |y 1 - y 2 |
Example Initial State Current StateGoal State
Move Up Cost = = 4 Move Down Move Right Cost = = Move Left Cost = = 6
Initial State Current StateGoal State
Cost = = Cost = = Cost = = Move UpMove Down Move RightMove Left
Initial State Current StateGoal State
Cost = = Cost = = Cost = = 2 Move UpMove Down Move RightMove Left
Initial State Current StateGoal State
Cost = = Cost = = 5 Move UpMove Down Move RightMove Left
Initial State Current StateGoal State
Cost = = Cost = = Cost = = 0 Move UpMove Down Move RightMove Left
Initial State Current StateGoal State
16
17 Our interface
18 Our options Auto run Run step by step Initial State is fixed Initial State is random