490 likes | 504 Views
Explore various search methodologies in AI including DFS, BFS, Heuristics, and Hill Climbing. Learn to design and implement algorithms using JavaScript for games like n-puzzle. Understand when to use different search strategies effectively.
E N D
Search Methodologies Comp3710 Artificial Intelligence Computing Science Thompson Rivers University
Course Outline • Part I – Introduction to Artificial Intelligence • Part II – Classical Artificial Intelligence, and Searching • Knowledge Representation • Searching • Search Methodologies • Advanced Search • Knowledge Represenation and Automated Reasoning • Propositinoal and Predicate Logic • Inference and Resolution for Problem Solving • Rules and Expert Systems • Part III – Machine Learning • Part IV – Some Advanced Topics Search Methodologies
Chapter Learning Outcomes • Decide if DFS (Depth First Search) and/or BFS (Breadth First Search) is complete and/or admissible on a tree and/or a graph. • Define what an admissible heuristic is. • Write a pseudo A* algorithm. • Given two heuristics, decide which one is better. • Given expanded states within a running A* algorithm, decide the next state to visit. • Design and implement a JavaScript program for the n-puzzle game, using an A* algorithm. • Use of Hill Climbing for the 4-queens game. Search Methodologies
Chapter Outline • Introduction • Problem Solving as Search • Data-Driven and Goal-Driven Search • Generate and Test • Depth-First Search • Breadth-First Search • Properties of Search Methods • Why Humans Use Depth-First Search • Implementing Depth-First and Breadth-First Search • Example: Web Spidering • Depth-First Iterative Deepening • Using Heuristics for Search • Hill Climing • Best-First Search • Beam Search • Identifying Optimal Paths Search Methodologies
Two types of search problems • Type 1 • Goal is known. • A solution is to find a best path from the start node to a goal node. • Type 2 • Goal is not known. • A solution is to find a goal that satisfies certain conditions. Search Methodologies
Brute Force Search • Search methods that examine every node (i.e., state) in the search space – also called exhaustive. • It does not say the search order. • ‘Generate and Test’ is the simplest brute force search method: • Generate all the possible solutions to the problem. • Test each one in turn to see if it is a valid solution. • Stop when a valid solution is found. • The method used to generate possible solutions must be carefully chosen. • [Q] Can brute force search find any solution? • [Q] What if there are too many possible solutions, i.e., states in the search space? • [Q] There could be so many states. Any better ideas? • Not to create all the possible states in the beginning. • Generate states while the search is running. Search Methodologies
Depth-First Search (DFS) • Another exhaustive search method. • Follows each path to its deepest node, before backtracking to try the next path. • [Q] Does the algorithm always find an unique solution in a tree? • [Q] Does the algorithm always find an optimal solution in a graph? • [Q] A search traversal in the next example is ? • [Q] How to implement? A A C C B B G G E E F F D D Search Methodologies
Breadth-First Search (BFS) • Another exhaustive search method. • Follows each path to a given depth before moving on to the next depth. • [Q] Does the algorithm always find an unique solution in a tree? • [Q] How about a graph? Optimal solution? • [Q] A search traversal in the next example is ? • [Q] How to implement? A A C C B B G G E E F F D D Search Methodologies
When a graph includes negative edge values, search methods on the graph might go over a cycle infinitely. (Note that it depends on search algorithms.) • Let’s assume that any edge value on a search graph is positive in this course. Let’s assume also that there is maximum one edge between two nodes. • Let’s assume a graph has an uniform value, e.g., 1, on all the edges. (Note that DFS and BFS use the strategy that they do not revisit any node.) • [Q] Can DFS find a solution? Can DFS find an optimal solution? A solution is ??? Yes, and NOT always. [Q] Why not? • [Q] Can BFS find a solution? Can BFS find an optimal solution? Yes, and YES. • [Q] How about non-uniform graphs? S S, A, C, G is not optimal. A B C G Search Methodologies
Let’s assume a graph has non-uniform values on edges. (Note that DFS and BFS use the strategy that they do not revisit any node.) • [Q] Can DFS find a solution? Can DFS find an optimal solution? Yes, and NOT always. [Q] Can you give an example? • [Q] Can BFS find a solution? Can BFS find an optimal solution? Yes, and NOT always. [Q] Can you give an example? [Q] Why not? • We need search methods that traverse in the manner of acyclic directed graph over the given search space (graph). (Note that a solution is a path to a goal node and we need to construct the path.) S 1 1 A B 5 1 3 C D G 1 1 Search Methodologies
It is important to choose the correct search method for a given problem. • In some situations, for example, depth first search will never find a solution, even though one exists. • [Q] Can you give an example of this case? Search Methodologies
Properties of Search Methods • Complexity • How much time and memory the method uses. • Completeness • A complete method is the one that is guaranteed to find a goal if one exists. • Optimality & Admissibility • A method is called optimal(or admissible) if it is guaranteed to find a best path to a goal. • [Q] Is an admissible method complete? • [Q] Is a complete method admissible? • Irrevocability • A method is irrevocable if, like hill climbing, it does not ever back-track. • [Q] Assuming a tree with uniform edge values, • Is DFS complete? Is DFS admissible? Is BFS complete? Is BFS admissible? • [Q] Assuming a tree with non-uniform edge values, • [Q] Assuming a graph with uniform edge values, Search Methodologies
Implementations • Generic search algorithm: The start node; // expansion While Select a non-visited node; // using an evaluation function Visit the node; Test if the node is a goal, then stop; // using a goal test function Otherwise, expand the neighbors; // What if a neighbor was expanded before? • Implementation: Two lists of nodes are used. • Visited nodes • Expanded nodes that are not visited. • [Q] BTW, how to implement depth-first search? • Stack • [Q] How to implement breadth-first search? • Queue • [Q] Data structure for graphs? Search Methodologies
DFS – Expanded[] is a stack • Expanded: [S]; Visited: [] • Visiting S, and expanding A, B Expanded: [A, B]; Visited: [S] • Visiting B, and expanding S Expanded: [A]; Visited: [S, B] • Visiting A, and expanding D, G, C, S Expanded: [D, G, C]; Visited: [S, B, A] [Q] What about S? • Visiting C, and expanding A, D Expanded: [D, G, D]; Visited: [S, B, A, C] • Visiting D, and expanding A, C, G Expanded: [D, G, G]; Visited: [S, B, A, C, D] • Visiting G, and found the goal. • [Q] What is the solution? How to obtain the solution? • [Q] Can you trace BFS too? S 1 1 A B 5 1 3 C D G 1 1 Introduction
Can you try BFS instead? • DFS – Expanded[] is a stack • Expanded: [S]; Visited: [] • Visiting S, and expanding A, B Expanded: [(A,S), (B,S)]; Visited: [S] • Visiting (B,S) and expanding S Expanded: [(A,S)]; Visited: [S, (B,S)] • Visiting (A,S), and expanding D, G, C, S Expanded: [(D,A), (G,A), (C,A)]; Visited: [S, (B,S), (A,S)] • Visiting (C,A), and expanding A, D Expanded: [(D,A), (G,A), (D,C)]; Visited: [S, (B,S), (A,S), (C,A)] • Visiting (D,C), and expanding A, C, G Expanded: [(D,A), (G,A), (G,D)]; Visited: [S, (B,S), (A,S), (C,A), (D,C)] • Visiting (G,D), and found the goal. Visited: [S, (B,S), (A,S), (C,A), (D,C), (G,D)] • [Q] What is the solution? • (G,D), (D,C), (C,A), (A,S), S => S –> A –> C -> D -> G • What about the cost of the path? S 1 1 A B 5 1 3 C D G 1 1 Introduction
Depth-First Iterative Deepening • An exhaustive search method based on both depth-first and breadth-first search. • Carries out depth-first search to depth of 1, then to depth of 2, 3, and so on until a goal node is found. • Efficient in memory use, and can cope with infinitely long branches. • Not as inefficient in time as it might appear, particularly for very large trees, in which it only needs to examine the largest row (the last one) once. • [Q] The search path in the next example is ? S 1 1 A B 5 1 3 C D G 1 1 Search Methodologies
Best-First Search It’s like seeing tomorrow, not past, not future. • Picks the most likely path (based on heuristic value) from the partially expanded tree at each stage; No revisiting strategy. • Tends to find a shorter path than depth-first or breadth-first search, but does not guarantee to find the best path in a graph. • [Q] What is the search path in the next example? Is the result the best path? • [Q] What if the costs are all the same? • [Q] Complete? Admissible? A solution? • [Q] Is this idea useful or useless? S 1 1 A B 3 1 2 C D G 1 3 Search Methodologies
Best First Search • Expanded: [(S,0)]; Visited: [] • Visiting S, and expanding A, B Expanded: [(A,1,S), (B,1,S)]; Visited: [(S,0)] • Visiting (B,1,S), and expanding S Expanded: [(A,1,S)]; Visited: [(S,0), (B,1,S)] • Visiting (A,1,S), and expanding D, C, G, S Expanded: [(D,3,A), (C,1,A), (G,5,A)]; Visited: [(S,0), (B,1,S), (A,1,S)] • Visiting (C,1,A), and expanding A, D Expanded: [(D,3,A), (G,5,A), (D,1,C)]; Visited: [(S,0), (B,1,S), (A,1,S), (C,1,A)] • Visiting (D,1,C), and expanding A, C, G Expanded: [(D,3,A), (G,5,A), (G,1,D)]; Visited: [(S,0), (B,1,S), (A,1,S), (C,1,A), (D,1,C)] • Visiting (G,1,D), and found the goal. • [Q] What is the solution? • (G,1,D), (D,1,C), (C,1,A), (A,1,S), (S,0) => S –> A –> C -> D -> G • Length = 1 + 1 + 1 + 1 = 4 S 1 1 A B 5 1 3 C D G 1 1 Introduction
Beam Search • Breadth-first method. • Only expands the best few paths at each level. • Thus has the memory advantages of depth-first search. • Not exhaustive, and so may not find the best solution. • May not find a solution at all. • [Q] Complete? Admissible? • [Q] What’s the point of using Beam Search? • All the search methods so far have too large time complexity. • [Q] What do we have to do? • We need some better ideas. Search Methodologies
Dijkstra’s shortest path algorithm Past information • Selection strategy: The distances from the start node are used instead. • Minimum priority queue • Expanded: [(S,0)]; Visited: [] • Visiting S, and expanding A, B Expanded: [(A,1,S), (B,1,S)]; Visited: [(S,0)] • Visiting (B,1,S), and expanding S Expanded: [(A,1,S)]; Visited: [(S,0), (B,1,S)] • Visiting (A,1,S), and expanding C, D, G, S Expanded: [(D,4,A), (C,2,A), (G,6,A)]; Visited: [(S,0), (B,1,S), (A,1,S)] • Visiting (C,2,A), and expanding A, D; c(C,D) is 1. 2+1 = 3 Expanded: [(D,3,C), (G,6,A)]; Visited: [(S,0), (B,1,S), (A,1,S), (C,2,A)] • Visiting (D,3,C), and expanding A, C, G; c(D,G) is 1. 3+1 = 4 Expanded: [(G,4,D)]; Visited: [(S,0), (B,1,S), (A,1,S), (C,2,A), (D,3,C)] • Visiting (G,4,D), and found the goal. • [Q] What is the solution? • (G,4,D), (D,3,C), (C,2,A), (A,1,S), (S,0) => S –> A –> C -> D -> G • Length = 4 S 1 1 D is updated with (D,3,C) A B 5 1 3 C D G 1 1
Heuristics • Heuristic: a rule or other piece of information that is used to make methods, such as search, more efficient or effective. • In search, often use a heuristic evaluation function, h(n): • h(n) tells you the approximate distance (or cost) from a node, n, to a goal node. • h(n) may not be 100% accurate, but it should give better results than pure guesswork. Entire future information Search Methodologies
Heuristics – How Informed? • In general, the more informed a heuristic is, the better it will perform. • Heuristic h1 is called more informed than h2, if: • h1 (n) h2(n) for all nodes n. • In general, a search method using h1 will search more efficiently than one using h2. • A heuristic should reduce the number of nodes that need to be examined. • [Q] Can you solve the 8-puzzle game? • [Q] Can you find any good heuristic for the 8-puzzle game? • [Q] Can you decide which heuristic is better? • The more informed, the better. Goal [Q] Which one do you want to move first? h1: the sum of Manhatan distances h1(left) = 5 h2: the number of miss tiles h2(left) = 4 [Q] Which one is more informed? Search Methodologies
Optimal Paths • An optimal path is one that is the shortest possible path from start to goal. • In other words, an optimal path has the lowest cost (not necessarily at the shallowest depth, if edges have costs associated with them). • How to find an optimal path? Check all the possible paths? • There are more efficient ways. • We need to use some good heuristics. [Q] Which ones then? Search Methodologies
Heuristics – admissible • Definition: A heuristic h(n) is admissible if, for every node n, h(n)≤ h*(n), where h*(n) is the true cost to reach the goal state from n. • An admissible heuristic never overestimates the cost to reach the goal, i.e., it is optimistic. • Examples: • hSLD(n)(never overestimates the actual road distance) on a map • h(n) = 0 for all n. Dijkstra’s shortest path algorithm. • [Q] Can you give admissible heuristics for the 8-puzzle game? h1: the sum of Manhatan distances h1(left) = 5 h2: the number of miss tiles h2(left) = 4 h3: ZERO function h3(left) = 0 Search Methodologies
Optimal Path – A* Algorithms • Uses the cost function: • f(node) = g(node) + h(node), where • g(node) is the cost of the path so far leading to the node from the start node. • h(node) is an underestimate of how far the node is from a goal node. (This is the definition of an admissible heuristic.) • f is a path-based evaluation function. • An A* algorithm expands paths from nodes that have the lowest f valueuntil the algorithm visits, not expands, the goal node. • Theorem: If h(n)is admissible, A* using h is optimal. • [Q] Which admissible heuristic is better? • [Q] When two admissible heuristics satisfy h1(n) h2(n) for all nodes n, which one is better? Past info Future info Search Methodologies
Optimal Path – A* Algorithms • A* algorithms are optimal, i.e., they are guaranteed to find the shortest path to a goal node, provided h(node) is always an underestimate. (This is the definition of an admissible heuristic.) • A* methods are also optimally efficient – they expand the fewest possible paths to find the right one. • If h is not admissible, the method is called A, rather than A*. • Algorithm: expand the start node; while (the queue is not empty) select the next node to visit from the expanded node queue; // A non-visited node havingthe smallest f-value visit the node; test if the node is a goal; if so, break the loop; expand nodes; // Any visited nodes are excluded. // The g-values of some nodes that were already // expanded might be updated. Do you remember Dijkstra’s algorithm?
Extreme example • [Q] zero is an admissible heuristic? • [Q] How about Dijkstra’s shortest path algorithm? • Like A*, but uses: • f(node) = g(node). • g(node) is the cost of the path leading up to node. • I.e., h(node) = 0. • Even when a goal node is expanded (at the child node expansion; still not visited yet), the method needs to continue to run in case a preferable solution is found, till a goal node is visited. Search Methodologies
Let’s use the heuristic of Manhatan distances. • \ • Let’s expand the current node (283, 164, 705), then • 283, 104, 765 g = 0+1; h = 4; f = 5 • 283, 164, 075 g = 0+1; h = 6; f = 7 • 283, 164, 750 g = 0+1; h = 6; f = 7 • 283, 104, 765 (g=1) is selected and visited. Let’s expand this new node. • 283, 164, 075 g = 1; h = 6; f = 7 previous ones in the queue • 283, 164, 750 g = 1; h = 6; f = 7 • 203, 184, 765 g = 1+1; h = 3; f = 5 new ones • 283, 014, 765 g = 1+1; h = 5; f = 7 • 283, 140, 765 g = 1+1; h = 5; f = 7 • 283, 164, 705 visited already The cost to move to the next node is always 1.
283, 104, 765 (g=1) is selected and visited. Let’s expand this new node. • 283, 164, 075 g = 1; h = 6; f = 7 previous ones in the queue • 283, 164, 750 g = 1; h = 6; f = 7 • 203, 184, 765 g = 2; h = 3; f = 5 new ones • 283, 014, 765 g = 2; h = 5; f = 7 • 283, 140, 765 g = 2; h = 5; f = 7 • 203, 184, 765 (g=2) is selected and visited. Let’s expand this new node. • 283, 164, 075 g = 1; h = 6; f = 7 • 283, 164, 750 g = 1; h = 6; f = 7 • 283, 014, 765 g = 2; h = 5; f = 7 • 283, 140, 765 g = 2; h = 5; f = 7 • 023, 184, 765 g = 2+1; h = 2; f = 5 • 230, 184, 765 g = 2+1; h = 4; f = 7 • 283, 104, 765 visited already • 023, 184, 765 (g=3) is selected and visited. Let’s expand this new node.
023, 184, 765 (g=3) is selected and visited. Let’s expand this new node. • 283, 164, 075 g = 1; h = 6; f = 7 • 283, 164, 750 g = 1; h = 6; f = 7 • 283, 014, 765 g = 2; h = 5; f = 7 • 283, 140, 765 g = 2; h = 5; f = 7 • 230, 184, 765 g = 3; h = 4; f = 7 • 123, 084, 765 g = 3+1; h = 1; f = 5 • 283, 104, 765 visited already • 123, 084, 765 (g=4) is selected and visited. Let’s expand this new node. • 283, 164, 075 g = 1; h = 6; f = 7 • 283, 164, 750 g = 1; h = 6; f = 7 • 283, 014, 765 g = 2; h = 5; f = 7 • 283, 140, 765 g = 2; h = 5; f = 7 • 230, 184, 765 g = 3; h = 4; f = 7 • 023, 184, 765 visited already • 123, 804, 765 g = 4+1; h = 0; f = 5 • 123, 784, 065 g = 4+1; h = 2; f = 7 • 123, 804, 765 (g=5) is selected and visited. This is the goal node.
123, 804, 765 (g=5) is selected and visited. This is the goal node. • [Q] How to construct the path from the start node to the goal node? • Back tracking • We need to keep the track of the parent node at the expansion step. • When a node is newly expanded, or • When an expanded node is updated with a smaller g-value. • What data structure can be used? • Stack
[Q] Can you try the Dijkstra’s shortest path algorithm with the next graph? S 1 1 A B 5 1 3 C D G 1 1
Optimal Path – with no heuristic • From Arad to Bucharest • Using the heuristic hZERO Search Methodologies
Arad(0): Zerind(75:Ar); Sibiu (140:Ar); Timisoara(118:Ar) • Zerind(75:Ar): Oradea(75+71:Ze); Sibiu(140:Ar); Timisoara(118:Ar) • Timisoara(118:Ar): Lugoj(118+111:Ti); Oradea(146:Ze); Sibiu(140:Ar) • Sibiu(140:Ar): Oradea(140+151:Si); Rimnicu(140+80:Si); Fagaras(140+99:Si); Lugoj(229:Ti); Oradea(146:Ze) • Oradea(146): Rimnicu(220:Si); Fagaras(239:Si); Lugoj(229:Ti) • Rimnicu(220:Si): Craiova(220+146:Ri); Pitesti(220+97:Ri); Fagaras(239:Si); Lugoj(229:Ti) • Lugoj(229:Ti): Mehadia(229+70:Lu); Craiova(366:Ri); Pitesti(317:Ri); Fagaras(239:Si) • Fagaras(239:Si): Bucharest(239+211:Fa); Mehadia(299:Lu); Craiova(366:Ri); Pitesti(317:Ri) • Mehadia(299:Lu): Dobreta(299+75:Me); Bucharest(450:Fa); Craiova(366:Ri); Pitesti(317:Ri) • Pitesti(317:Ri): Bucharest(317+101:Pi); Bucharest(450:Fa);Dobreta(374:Me); Craiova(366:Ri) • Craiova(366:Ri): Dobreta(366+120:Cr); Dobreta(374:Me); Bucharest(418:Pi) • Dobreta(374:Me): Bucharest(418:Pi) • Bucharest(418:Pi) [Q] The solution? [Q] How many nodes are visited? Search Methodologies
Optimal Path – more informed heuristic Your project for BC? • From Arad to Bucharest • Using the heuristic hSLD Additional information Search Methodologies
Arad(0): Zerind(75+374:Ar); Sibiu (140+253:Ar); Timisoara(118+329:Ar) • Sibiu(140:Ar): Oradea((140+151)+380:Si); Fagaras((140+99)+176:Si); Rimnicu((140+80)+193:Si); Zerind(75+374:Ar); Timisoara(118+329:Ar) • Rimnicu(220:Si): Craiova(220+146+160:Ri); Pitesti(220+97+100:Ri); Oradea(291+380:Si); Fagaras(239+176:Si); Zerind(75+374:Ar); Timisoara(118+329:Ar) • Fagaras(239:Si): Bucharest(239+211+0:Fa); Craiova(366+160:Ri); Pitesti(317+100:Ri); Oradea(291+380:Si); Zerind(75+374:Ar); Timisoara(118+329:Ar) • Pitesti(317:Ri): Craiova(317+138+160:Pi); Bucharest(317+101+0:Pi);Bucharest(450+0:Fa); Craiova(366+160:Ri); Oradea(291+380:Si); Zerind(75+374:Ar); Timisoara(118+329:Ar) • Bucharest(418:Pi) [Q] How many nodes are visited? Search Methodologies
283164705(0+5): 283104765(1+4); 283164075(1+6); 283164750(1+6) • 283104765(1+4): 203184765(2+3); 283014765(2+5); 283140765(2+5); 283164075(1+6); 283164750(1+6) • 203184765(2+3): 023184765(3+2); 230184765(3+4); 283014765(2+5); 283140765(2+5); 283164075(1+6); 283164750(1+6) • 023184765(3+2): 123084765(4+1); 230184765(3+4); 283014765(2+5); 283140765(2+5); 283164075(1+6); 283164750(1+6) • 123084765(4+1); 123784065(5+2); 123804765(5+0); 230184765(3+4); 283014765(2+5); 283140765(2+5); 283164075(1+6); 283164750(1+6) • 123804765(5+0) [Q] How many times do you need to move? h1: the sum of Manhatan distances h1(left) = 5 Search Methodologies
[Q] How to implement the 8-puzzle game? • [Q] Is the n-puzzle game always solvable from any start node? • No, only half • Algorithm again? expand the start node; while (the queue is not empty) select the next node to visit from the expanded node queue; // A non-visited node havingthe smallest f-value visit the node; test if the node is a goal; if so, break the loop; expand nodes; // Any visited nodes are excluded. // The g-values of some nodes // that were already expanded might be updated. Search Methodologies
Project idea • A* algorithm with hSLD for BC map (not whole BC) • Rubik’s cube • n-Puzzle game is still slow even if A* algorithm is used. Can you develop better heuristics? Search Methodologies
Optimal Path – Greedy Search • Similar to A*, but uses: • f(node) = h(node). • Hence, always expands the node that appears to be closest to a goal, regardless of what has gone before. • We humans often use this approach. • Not optimal, and not guaranteed to find a solution. • Can easily be fooled into taking poor paths. • [Q] Can you give an example? • The previous example of map search problem. Search Methodologies
Two types of search problems • Type 1 • Goal is known. • A solution is to find a best path from the start node to a goal node. • Type 2 • Goal is not known. • A solution is to find a goal. Search Methodologies
Local Search Algorithms • In the previous problems, we know what a goal state is. However, in many optimization problems, the path to the goal is irrelevant; the goal state itself is the solution. • E.g., How to find the highest mountain in BC? • [Q] Can we make any good heuristic? • [Q] Can we use A* algorithms? Why? • State space = set of "complete" configurations • Find configuration satisfying constraints, e.g., n-queens. (We do not have to consider of the order of move.) • In such cases, we can use local search algorithms. • Keep a single "current" state, and try to improve it. • [Q] Isn’t it a greedy approach? Heuristic Search
Example: n-queens • Problem: Put n queens on an n ×n board with no two queens on the same row, column, or diagonal. • [Q] What is a goal state? How do we solve? • [Q] Can we use a local search algorithm with a start state that can be made randomly? Which one do you want to move first? Heuristic Search
Hill Climbing • A local search algorithm • An informed, irrevocable (i.e., no back-tracking) local search method. • Just a question. [Q] Why do you need irrevocable methods? • Easiest to understand when considered as a method for finding the highest point in a three dimensional search space: • Check the height one foot away from your current location in each direction; North, South, East and West. • As soon as you find a position whose height is higher than your current position, move to that location, and restart the algorithm. How to find the highest mountain in BC? As a term project? Cannot know if it is the highest. Search Methodologies
Hill Climbing – Foothills • Difficulties for hill-climbing methods. • A foothill is a local maximum. Search Methodologies
Hill Climbing – Plateaus • Difficulties for hill-climbing methods. • Flat areas that make it hard to find where to go next. Search Methodologies
Hill Climbing – Ridges • Difficulties for hill-climbing methods • B is higher than A. • At C, the hill-climber can’t find a higher point North, South, East or West, so it stops. Search Methodologies
Local search algorithms use • Cumulative improvement. • But they are prone to local maxima. • [Q] How to improve? • One idea is to use multiple initial starting points. It is called diversity. • We will discuss genetic algorithms later. They look like advanced hill climbing that uses some interesting ideas to solve the previous problems. Search Methodologies
Summary • A* algorithms with heuristics • Searching for a path to a goal • Greedy search [Q] When a goal is known? • Local search [Q] When a goal is known? [Q] How to improve? Search Methodologies