introduction to artificial intelligence problem solving
play

Introduction to Artificial Intelligence Problem Solving through - PowerPoint PPT Presentation

Introduction to Artificial Intelligence Problem Solving through Search (Goal-based agents) BFS, DFS, Greedy Search Janyl Jumadinova September 12-16, 2016 Example: Romania On holiday in Romania; currently in Arad. Flight leaves tomorrow from


  1. Introduction to Artificial Intelligence Problem Solving through Search (Goal-based agents) BFS, DFS, Greedy Search Janyl Jumadinova September 12-16, 2016

  2. Example: Romania On holiday in Romania; currently in Arad. Flight leaves tomorrow from Bucharest Formulate goal : be in Bucharest Formulate problem : states : various cities actions : drive between cities Find solution : sequence of cities, e.g., Arad, Sibiu, Fagaras, Bucharest 2/38

  3. Example: Romania 3/38

  4. Tree search algorithms Basic idea: offline, simulated exploration of state space by generating successors of already-explored states (a.k.a. expanding states) 4/38

  5. Tree search example 5/38

  6. Tree search example 6/38

  7. Tree search example 7/38

  8. Implementation: states vs. nodes A state is a (representation of) a physical configuration A node is a data structure constituting part of a search tree includes parent, children, depth, path cost g ( x ) States do not have parents, children, depth, or path cost! 8/38

  9. Breadth-first search Expand shallowest unexpanded node ◮ FIFO queue, i.e., new successors go at end A B C D E F G 9/38

  10. Breadth-first search Expand shallowest unexpanded node ◮ FIFO queue, i.e., new successors go at end A B C D E F G 10/38

  11. Breadth-first search Expand shallowest unexpanded node ◮ FIFO queue, i.e., new successors go at end A B C D E F G 11/38

  12. Breadth-first search Expand shallowest unexpanded node ◮ FIFO queue, i.e., new successors go at end A B C D E F G 12/38

  13. Breadth-first search Arad 13/38

  14. Breadth-first search Arad Zerind Sibiu Timisoara 14/38

  15. Breadth-first search Arad Zerind Sibiu Timisoara Arad Oradea 15/38

  16. Breadth-first search Arad Zerind Sibiu Timisoara Rimnicu Arad Oradea Arad Oradea Fagaras Arad Lugoj Vilcea 16/38

  17. Breadth-first search 17/38

  18. Depth-first search Expand deepest unexpanded node ◮ LIFO queue, i.e., put successors at front Arad 18/38

  19. Depth-first search Expand deepest unexpanded node ◮ LIFO queue, i.e., put successors at front Arad Zerind Sibiu Timisoara 19/38

  20. Depth-first search Expand deepest unexpanded node ◮ LIFO queue, i.e., put successors at front Arad Zerind Sibiu Timisoara Arad Oradea 20/38

  21. Depth-first search Expand deepest unexpanded node ◮ LIFO queue, i.e., put successors at front Arad Zerind Sibiu Timisoara Arad Oradea Zerind Sibiu Timisoara 21/38

  22. Best-first search Idea : use an evaluation function for each node – estimate of “desirability” 22/38

  23. Best-first search Idea : use an evaluation function for each node – estimate of “desirability” ⇒ Expand most desirable unexpanded node 22/38

  24. Best-first search Idea : use an evaluation function for each node – estimate of “desirability” ⇒ Expand most desirable unexpanded node Implementation : a queue sorted in decreasing order of desirability 22/38

  25. Best-first search Idea : use an evaluation function for each node – estimate of “desirability” ⇒ Expand most desirable unexpanded node Implementation : a queue sorted in decreasing order of desirability Special cases: greedy search, A ∗ search 22/38

  26. Romania with step costs in km Straight − line distance Oradea to Bucharest 71 Neamt Arad 366 Bucharest 0 87 Zerind 151 Craiova 75 160 Iasi Dobreta 242 Arad Eforie 140 161 92 Fagaras 178 Sibiu 99 Fagaras Giurgiu 77 118 Hirsova 151 Vaslui 80 Iasi 226 Rimnicu Vilcea Lugoj 244 Timisoara Mehadia 241 142 211 111 Neamt 234 Pitesti 97 Lugoj Oradea 380 70 98 Pitesti 98 146 85 Hirsova 101 Rimnicu Vilcea 193 Mehadia Urziceni 86 Sibiu 253 75 138 Bucharest Timisoara 329 120 Dobreta Urziceni 80 90 Vaslui 199 Craiova Eforie Giurgiu Zerind 374 A* slide 23/38

  27. Greedy search Evaluation function h ( n ) (heuristic) = estimate of cost from n to the closest goal Example: h ( n ) = straight-line distance from n to Bucharest 24/38

  28. Greedy search Evaluation function h ( n ) (heuristic) = estimate of cost from n to the closest goal Example: h ( n ) = straight-line distance from n to Bucharest ◮ Greedy search expands the node that appears to be closest to goal 24/38

  29. Greedy Search Arad 366 25/38

  30. Greedy Search Arad Sibiu Timisoara Zerind 253 329 374 26/38

  31. Greedy Search Arad Sibiu Timisoara Zerind 329 374 Arad Fagaras Oradea Rimnicu Vilcea 366 176 380 193 27/38

  32. Greedy Search Arad Sibiu Timisoara Zerind 329 374 Arad Fagaras Oradea Rimnicu Vilcea 366 380 193 Sibiu Bucharest 253 0 28/38

  33. Greedy search ◮ Can get stuck in loops, e.g., Iasi → Neamt → Iasi → Neamt → Complete in finite space with repeated-state checking ◮ A good heuristic can give dramatic improvement in search cost 29/38

  34. http://aispace.org/search/ Explore Best first search (explanation from AIspace: http://www.aispace.org/deduction/help/tut3.shtml ) 30/38

  35. A* search Idea: avoid expanding paths that are already expensive 31/38

  36. A* search Idea: avoid expanding paths that are already expensive ◮ Evaluation function f ( n ) = g ( n ) + h ( n ) ◮ g ( n ) = cost so far to reach n ◮ h ( n ) = estimated cost to goal from n ◮ f ( n ) = estimated total cost of path through n to goal Romania with step costs 31/38

  37. Example: Romania 32/38

  38. A* Search Arad 366=0+366 33/38

  39. A* Search Arad Sibiu Timisoara Zerind 393=140+253 447=118+329 449=75+374 34/38

  40. A* Search Arad Sibiu Timisoara Zerind 447=118+329 449=75+374 Arad Fagaras Oradea Rimnicu Vilcea 646=280+366 415=239+176 671=291+380 413=220+193 35/38

  41. A* Search Arad Sibiu Timisoara Zerind 447=118+329 449=75+374 Arad Fagaras Oradea Rimnicu Vilcea 646=280+366 415=239+176 671=291+380 Craiova Pitesti Sibiu 526=366+160 417=317+100 553=300+253 36/38

  42. A* Search Arad Sibiu Timisoara Zerind 447=118+329 449=75+374 Arad Fagaras Oradea Rimnicu Vilcea 646=280+366 671=291+380 Sibiu Bucharest Craiova Pitesti Sibiu 591=338+253 450=450+0 526=366+160 417=317+100 553=300+253 37/38

  43. A* Search Arad Sibiu Timisoara Zerind 447=118+329 449=75+374 Arad Fagaras Oradea Rimnicu Vilcea 646=280+366 671=291+380 Sibiu Bucharest Craiova Pitesti Sibiu 591=338+253 450=450+0 526=366+160 553=300+253 Bucharest Craiova Rimnicu Vilcea 418=418+0 615=455+160 607=414+193 38/38

Recommend


More recommend