1 / 16

Search Techniques

Search Techniques. CS480/580 Fall 2009. Introduction. Trees: Root, parent, child, sibling, leaf node, node, edge Single path from root to any node Graphs: Nodes, edges, directed/undirected graph, acyclic graph. Search techniques for Trees. Exhaustive search

Download Presentation

Search Techniques

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Search Techniques CS480/580 Fall 2009

  2. Introduction • Trees: • Root, parent, child, sibling, leaf node, node, edge • Single path from root to any node • Graphs: • Nodes, edges, directed/undirected graph, acyclic graph

  3. Search techniques for Trees • Exhaustive search • Breadth-first search: Use a queue to implement • Search nodes each level at a time • Depth-first search: Use a stack to implement • Search nodes path at a time

  4. Searching Graph • Apply the same two techniques • But to eliminate infinite looping, mark a node when it is already visited. This way it won’t be explored repeatedly.

  5. Heuristic Search • When the search space is very large (millions of nodes), it is not feasible to search the entire space; • Instead we use a heuristic search that directs the search based on some heuristics • Evaluation function to rank the nodes to determine the order of search---which is most likely to succeed

  6. Heuristic 1: Hill Climbing • http://www.devarticles.com/c/a/Java/AIBased-Problem-Solving/4/ • First decide on an evaluation function for each node---this depends on the specific application • E.g., In airline routing, if the task is to find a route that can take a passenger from airport X to airport Y, there could be several possible sequence of hops that need to be considered. • Suppose there is no direct path from X-Y, but there are 4 hubs H1, H2, H3, H4, that X has flights to, then we need to determine which is the next hub we want to explore. We need a basis for the decision. • Suppose we consider the distance between X and a hub as the evaluation function so the further a hub takes a passenger away from X, then the closer it is to the destination Y. So evaluation criteria is: choose an alternate that is farthest from X. • This may or may not always result in optimal solution. • Local maxima, local minima---problems • Look at the airline routing in the above reference

  7. Best First Search • Similar to BFS and DFS, it is exhaustive. • The difference is that the next node to search is based on an evaluation function---in other words whenever we need to choose the next node to search pick the one with the best node value • Calls for a priority queue instead of a stack or a FCFS queue • Refer to Fig. 4.8 – Discussion in class

  8. Least-cost search • Always choose the one that costs less in the next step---that is we always choose the node that can be reached with minimal cost from the current location. • For example http://www.devarticles.com/c/a/Java/AIBased-Problem-Solving/4/

  9. A* Algorithm • Variant of best first search • Assumes: Estimated cost < Actual cost • Admissible heuristic function: h(n) ≤ h*(n) where h*(n) is the true cost to the nearest goal.---never overestimate costs • Guarantees optimal solution provided admissible heuristics is used ---minimum cost solution --- distance is a cost, travel time is a cost, etc. • Here, evaluation function has two parts: cost of getting from start to the Current node; cost of going from current node to goal node or target node. f(Node) = g(Node) + h(Node) • Refer to the following slides

  10. Using Search Techniques in problem Solving • Puzzle solving, planning, routing, etc. • Main steps: (i) Representation of problem state (ii) Representation of available actions (iii) Systematically traversing through all possible sequences of actions to find one that will get from the initial state to the target state. • In the case of a board puzzle, each node represents current state of the puzzle; goal node represents the desired board position • State space search techniques: E.g., water jug problem • Complexity of the algorithm: branching factor; DFS and BFS are brute force techniques---computationally very demanding (complex)

  11. Planning techniques • Problem of finding a sequence of primitive actions to achieve some goal • This sequence of actions is the plan • Means-ends analysis (MEA) • Focuses on actions that reduce the difference between the current state and the target state • If an action can take a state S’ to target state T (using some sequence of steps), then that will be considered so that the new target state becomes S’. S----S’---A1--T • See algorithm in page 89 (textbook) • http://www.rci.rutgers.edu/~cfs/472_html/Planning/PlanningToc.html

  12. STRIPS • Applied to simple robot planning tasks. • Searching for a path (of actions) from some initial state to some desired final or target state • MEA controls the search • Each state may be represented as a list of facts that are true • [at(robot, living_room), at(coffee, kitchen), at(fred, living_room), door_closed(kitchen, living_room))] • Target state: [at(robot, living_room), at(coffee, living_room), at(fred, living_room), door_closed(kitchen, living_room))]

  13. Available operators: • Open(R1,R2) • Close(r1,R2) • Move(R1,R2) • Carry(R1,R2,O) • Over all algorithm find_plan: (page 89)

  14. Game Playing Systems • Two-person adversarial games where both know the state of the game • Different than the previous since each player needs to consider several possible of the opponents in successive steps • Min-max procedure (Next class) • Alpha-beta pruning (Next class)

  15. Min-max procedure • Maximize your chance of winning and minimize the opponent’s chance of winning • Starting from the bottom nodes, assign the maximum of leaf weights to their parent nodes. • When a node represents opponent’s move, assign it the minimum of weights of its child nodes. • When a node represents the player’s move, assign it the maximum of weights of its child nodes.

  16. Alpha-beta pruning • To improve the efficiency of the minmax procedure---- keeps track of the at most and at least values • The score at a minimizing node is going to be at most the worst score of the successor examined so far (denoted by β) • The score at a maximizing node is going to be at least the best score of the successor nodes examined so far (denoted by α) • If the β value of a minimizing node is less than the α value of its parent node then all remaining calculations on that node can be abandoned. Thus, the rest of the tree is pruned. • If the α value of a maximizing node is greater than the β value of its parent node then all remaining calculations on that node can be abandoned. Thus, the rest of the tree is pruned. • http://www.cs.cornell.edu/Courses/cs312/2002sp/lectures/rec21.htm • http://www.ocf.berkeley.edu/~yosenl/extras/alphabeta/alphabeta.html

More Related