CSE 473 Artificial Intelligence Oren Etzioni Search CSE 473 Artificial Intelligence Oren Etzioni What are the fundamental Scientific Questions? How did the Universe start? Genome AI Theory for each, except AI.. GO OVER SYLLABUS HAND OUT SEATING CHART
What is Search? Search is a class of techniques for systematically finding or constructing solutions to problems. Example technique: generate-and-test. Example problem: Combination lock. Generate a possible solution. Test the solution. If solution found THEN done ELSE return to step 1. © Daniel S. Weld
Why is search interesting? Many (all?) AI problems can be formulated as search problems! Examples: Path planning Games Natural Language Processing Machine learning Genetic algorithms © Daniel S. Weld
Weak Methods “In the knowledge lies the power…” [Feigenbaum] But what if no knowledge???? © Daniel S. Weld
Search Tree Example: Fragment of 8-Puzzle Problem Space © Daniel S. Weld
Problem Space / State Space Search thru a Problem Space / State Space Input: Set of states Operators [and costs] Start state Goal state [test] Output: Path: start a state satisfying goal test [May require shortest path] State Space Search is basically a GRAPH SEARCH PROBLEM STATES are whatever you like! OPERATORS are a compact DESCRIPTION of possible STATE TRANSITIONS – the EDGES of the GRAPH May have different COSTS or all be UNIT cost OUTPUT may be specified either as ANY PATH (REACHABILITY), or a SHORTEST PATH © Daniel S. Weld
Example: Route Planning Input: Set of states Operators [and costs] Start state Goal state (test) Output: States = cities Start state = starting city Goal state test = is state the destination city? Operators = move to an adjacent city; cost = distance Output: a shortest path from start state to goal state SUPPOSE WE REVERSE START AND GOAL STATES? © Daniel S. Weld
Example: N Queens Q Input: Set of states Operators [and costs] Start state Goal state (test) Output © Daniel S. Weld
Classifying Search GUESSING (“Tree Search”) SIMPLIFYING (“Inference”) Guess how to extend a partial solution to a problem. Generates a tree of (partial) solutions. The leafs of the tree are either “failures” or represent complete solutions SIMPLIFYING (“Inference”) Infer new, stronger constraints by combining one or more constraints (without any “guessing”) Example: X+2Y = 3 X+Y =1 therefore Y = 2 WANDERING (“Markov chain”) Perform a (biased) random walk through the space of (partial or total) solutions HERE ARE THE THREE BASIC PRINCIPLES Guessing – guess how to EXTEND A PARTIAL SOLUTION one step at a time Simplifying – make inferences about how the PROBLEM CONSTRAINTS interact X + 2Y = 3 X + Y = 1 ------------ Y = 2 3. Wandering – RANDOMLY step through the space of POSSIBILITIES © Daniel S. Weld
Constraint Satisfaction Roadmap Guessing – State Space Search BFS DFS Iterative Deepening Bidirectional Best-first search A* Game tree Davis-Putnam (logic) Cutset conditioning (probability) Simplification – Constraint Propagation Forward Checking Path Consistency (Waltz labeling, temporal algebra) Resolution “Bucket Algorithm” Wandering – Randomized Search Hillclimbing Simulated annealing Walksat Monte-Carlo Methods Constraint Satisfaction © Daniel S. Weld
Search Strategies v2 Blind Search Informed Search Constraint Satisfaction Adversary Search Depth first search Breadth first search Iterative deepening search Iterative broadening search © Daniel S. Weld
Depth First Search Maintain stack of nodes to visit Evaluation Complete? Time Complexity? Space Complexity? Not for infinite spaces a O(b^d) b e O(d) g h c d f © Daniel S. Weld
Breadth First Search Maintain queue of nodes to visit Evaluation Complete? Time Complexity? Space Complexity? Yes a O(b^d) b c O(b^d) g h d e f © Daniel S. Weld
Memory a Limitation? Suppose: 2 GHz CPU 1 GB main memory 100 instructions / expansion 5 bytes / node 200,000 expansions / sec Memory filled in 100 sec … < 2 minutes © Daniel S. Weld
Iterative Deepening Search DFS with limit; incrementally grow limit Evaluation Complete? Time Complexity? Space Complexity? Yes a b e O(b^d) c f d i O(d) g h j k L © Daniel S. Weld
Cost of Iterative Deepening b ratio ID to DFS 2 3 5 1.5 10 1.2 25 1.08 100 1.02 © Daniel S. Weld
Forwards vs. Backwards start end © Daniel S. Weld
vs. Bidirectional © Daniel S. Weld
Problem All these methods are slow (blind) Solution add guidance (“heurstic estimate”) “informed search” © Daniel S. Weld