Contents Foundations of Artificial Intelligence Best-First Search 1 4. Informed Search Methods A ∗ and IDA ∗ Heuristics, Local Search Methods, Genetic Algorithms 2 Local Search Methods 3 Wolfram Burgard, Bernhard Nebel, and Martin Riedmiller Genetic Algorithms 4 Albert-Ludwigs-Universit¨ at Freiburg Mai 17, 2011 (University of Freiburg) Foundations of AI Mai 17, 2011 2 / 32 Best-First Search General Algorithm Search procedures differ in the way they determine the next node to expand. function T REE -S EARCH ( problem ) returns a solution, or failure Uninformed Search: Rigid procedure with no knowledge of the cost of a initialize the frontier using the initial state of problem given node to the goal. loop do if the frontier is empty then return failure Informed Search: Knowledge of the worth of expanding a node n is choose a leaf node and remove it from the frontier given in the form of an evaluation function f ( n ) , if the node contains a goal state then return the corresponding solution which assigns a real number to each node. Mostly, expand the chosen node, adding the resulting nodes to the frontier f ( n ) includes as a component a heuristic function h ( n ) , which estimates the costs of the cheapest Best-first search is an instance of the general Tree-Search algorithm in path from n to the goal. which frontier is a priority queue ordered by an evaluation function f . Best-First Search: Informed search procedure that expands the node When f is always correct, we do not need to search! with the “best” f -value first. (University of Freiburg) Foundations of AI Mai 17, 2011 3 / 32 (University of Freiburg) Foundations of AI Mai 17, 2011 4 / 32
Greedy Search Heuristics The evaluation function h in greedy searches is also called a heuristic A possible way to judge the “worth” of a node is to estimate its path-costs function or simply a heuristic . to the goal. The word heuristic is derived from the Greek word ευρισκειν (note also: ευρηκα !) h ( n ) = estimated path-costs from n to the goal The mathematician Polya introduced the word in the context of problem The only real restriction is that h ( n ) = 0 if n is a goal. solving techniques. A best-first search using h ( n ) as the evaluation function, i.e. f ( n ) = g ( n ) In AI it has two meanings: is called a greedy search . Heuristics are fast but in certain situations incomplete methods for problem-solving [Newell, Shaw, Simon 1963] (The greedy search is actually Example: Route-finding problem: generally incomplete). h ( n ) = straight-line distance from n to the goal Heuristics are methods that improve the search in the average-case. → In all cases, the heuristic is problem-specific and focuses the search! (University of Freiburg) Foundations of AI Mai 17, 2011 5 / 32 (University of Freiburg) Foundations of AI Mai 17, 2011 6 / 32 Greedy Search Example Greedy Search from Arad to Bucharest (a) The initial state Arad 366 (b) After expanding Arad Arad Oradea Arad 366 71 Neamt Bucharest 0 Sibiu Timisoara Zerind Craiova 160 253 329 374 Zerind 87 Drobeta 242 151 75 (c) After expanding Sibiu Eforie 161 Iasi Arad Arad Fagaras 176 140 Giurgiu 77 92 Sibiu Fagaras Hirsova 151 99 Sibiu Timisoara Zerind Iasi 226 118 Vaslui 329 374 Lugoj 244 80 Rimnicu Vilcea Mehadia 241 Timisoara Arad Fagaras Oradea Rimnicu Vilcea 234 Neamt 366 176 380 193 380 142 Oradea Pitesti 211 111 Lugoj 100 Pitesti 97 (d) After expanding Fagaras Arad 193 Rimnicu Vilcea 70 98 Hirsova Sibiu 253 146 85 Mehadia Urziceni 101 Timisoara 329 86 Urziceni 80 Sibiu Timisoara Zerind 75 138 Bucharest Vaslui 199 329 374 Dobreta 120 Zerind 374 90 Craiova Eforie Giurgiu Arad Fagaras Oradea Rimnicu Vilcea 366 380 193 Sibiu Bucharest 253 0 (University of Freiburg) Foundations of AI Mai 17, 2011 7 / 32 (University of Freiburg) Foundations of AI Mai 17, 2011 8 / 32
A ∗ : Minimization of the Estimated Path Costs Greedy Search - Properties A ∗ combines the greedy search with the uniform-search strategy: Always expand node with lowest f ( n ) first, where g ( n ) = actual cost from the initial state to n . h ( n ) = estimated cost from n to the next goal. a good heuristic might reduce search time drastically f ( n ) = g ( n ) + h ( n ) , non-optimal the estimated cost of the cheapest solution through n . incomplete Let h ∗ ( n ) be the actual cost of the optimal path from n to the next goal. graph-search version is complete only in finite spaces h is admissible if the following holds for all n : Can we do better? h ( n ) ≤ h ∗ ( n ) We require that for A ∗ , h is admissible (example: straight-line distance is admissible). In other words, h is an optimistic estimate of the costs that actually occur. (University of Freiburg) Foundations of AI Mai 17, 2011 9 / 32 (University of Freiburg) Foundations of AI Mai 17, 2011 10 / 32 A ∗ Search Example A ∗ Search from Arad to Bucharest (a) The initial state Arad 366=0+366 (b) After expanding Arad Arad Oradea Arad 366 71 Neamt Bucharest 0 Sibiu Timisoara Zerind Craiova 160 Zerind 87 Drobeta 242 393=140+253 447=118+329 449=75+374 151 75 Eforie 161 Iasi Arad Fagaras 176 (c) After expanding Sibiu Arad 140 Giurgiu 77 92 Sibiu Fagaras Hirsova 151 99 Iasi 226 118 Vaslui Sibiu Timisoara Zerind Lugoj 244 80 447=118+329 449=75+374 Rimnicu Vilcea Mehadia 241 Timisoara 234 Neamt Arad Fagaras Oradea Rimnicu Vilcea 380 142 Oradea 646=280+366 415=239+176 671=291+380 413=220+193 Pitesti 211 111 Lugoj 100 Pitesti 97 (d) After expanding Rimnicu Vilcea 193 Rimnicu Vilcea 70 Arad 98 Hirsova Sibiu 253 146 85 Mehadia Urziceni 101 Timisoara 329 86 Urziceni 80 75 138 Sibiu Timisoara Zerind Bucharest Vaslui 199 Dobreta 120 447=118+329 449=75+374 Zerind 374 90 Craiova Eforie Arad Fagaras Oradea Rimnicu Vilcea Giurgiu 646=280+366 415=239+176 671=291+380 Craiova Pitesti Sibiu 526=366+160 417=317+100 553=300+253 (University of Freiburg) Foundations of AI Mai 17, 2011 11 / 32 (University of Freiburg) Foundations of AI Mai 17, 2011 12 / 32
A ∗ Search from Arad to Bucharest Example: Path Planning for Robots in a Grid-World (e) After expanding Fagaras 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 (f) After expanding Pitesti 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 (University of Freiburg) Foundations of AI Mai 17, 2011 12 / 32 (University of Freiburg) Foundations of AI Mai 17, 2011 13 / 32 Optimality of A ∗ Optimality of A ∗ Let n be a node on the path from the start to G that has not yet been Claim: The first solution found has the minimum path cost. expanded. Since h is admissible, we have Proof: Suppose there exists a goal node G with optimal path cost f ∗ , but A ∗ has found another node G 2 with g ( G 2 ) > f ∗ . f ( n ) ≤ f ∗ . Since n was not expanded before G 2 , the following must hold: Start f ( G 2 ) ≤ f ( n ) and n f ( G 2 ) ≤ f ∗ . It follows from h ( G 2 ) = 0 that G G 2 g ( G 2 ) ≤ f ∗ . → Contradicts the assumption! (University of Freiburg) Foundations of AI Mai 17, 2011 14 / 32 (University of Freiburg) Foundations of AI Mai 17, 2011 15 / 32
Recommend
More recommend