Download presentation
Presentation is loading. Please wait.
Published byMaurice Allison Modified over 8 years ago
1
1 8puzzle
2
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
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
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 |
5
5 283 164 7-5 123 8-4 765 Example Initial State 283 164 7-5 Current StateGoal State
6
6 283 1-4 765 Move Up Cost = 1+4-1 = 4 Move Down 283 164 75- Move Right Cost = 1+6-1 = 6 283 164 -75 Move Left Cost = 1+6-1 = 6
7
7 283 164 7-5 123 8-4 765 Initial State 283 1-4 765 Current StateGoal State
8
8 2-3 184 765 Cost = 2+3-2 = 3 283 164 7-5 Cost = 2+5-0 = 7 283 14- 765 Cost = 2+5-2 = 5 283 -14 765 Move UpMove Down Move RightMove Left
9
9 283 164 7-5 123 8-4 765 Initial State 2-3 184 765 Current StateGoal State
10
10 283 1-4 765 Cost = 3+4-1 = 6 23- 184 765 Cost = 3+4-3 = 4 -23 184 765 Cost = 3+2-3 = 2 Move UpMove Down Move RightMove Left
11
11 283 164 7-5 123 8-4 765 Initial State -23 184 765 Current StateGoal State
12
12 123 -84 765 Cost = 4+1-4 = 1 2-3 184 765 Cost = 4+3-2 = 5 Move UpMove Down Move RightMove Left
13
13 283 164 7-5 123 8-4 765 Initial State 123 -84 765 Current StateGoal State
14
14 -23 184 765 Cost = 5+2-3 = 4 123 784 -65 Cost = 5+2-5 = 2 123 8-4 765 Cost = 5+0-5 = 0 Move UpMove Down Move RightMove Left
15
15 283 164 7-5 123 8-4 765 Initial State 123 8-4 765 Current StateGoal State
16
16
17
17 Our interface
18
18 Our options Auto run Run step by step Initial State is fixed Initial State is random
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.