Lecture 3: Uninformed Search

Slides:



Advertisements
Similar presentations
Review: Search problem formulation
Advertisements

Greedy best-first search Use the heuristic function to rank the nodes Search strategy –Expand node with lowest h-value Greedily trying to find the least-cost.
Solving Problem by Searching
Artificial Intelligence Problem Solving Eriq Muhammad Adams
Lecture 3: Uninformed Search
ICS-171:Notes 4: 1 Notes 4: Optimal Search ICS 171 Summer 1999.
Problem Solving Agents A problem solving agent is one which decides what actions and states to consider in completing a goal Examples: Finding the shortest.
1 Lecture 3 Uninformed Search. 2 Uninformed search strategies Uninformed: While searching you have no clue whether one non-goal state is better than any.
Solving Problems by Searching Currently at Chapter 3 in the book Will finish today/Monday, Chapter 4 next.
Blind Search by Prof. Jean-Claude Latombe
Uninformed (also called blind) search algorithms) This Lecture Chapter Next Lecture Chapter (Please read lecture topic material before.
CS 480 Lec 3 Sept 11, 09 Goals: Chapter 3 (uninformed search) project # 1 and # 2 Chapter 4 (heuristic search)
CMSC 471 Spring 2014 Class #4 Thu 2/6/14 Uninformed Search Professor Marie desJardins,
G5BAIM Artificial Intelligence Methods Graham Kendall Blind Searches.
Blind Search1 Solving problems by searching Chapter 3.
Search Strategies Reading: Russell’s Chapter 3 1.
1 Blind (Uninformed) Search (Where we systematically explore alternatives) R&N: Chap. 3, Sect. 3.3–5.
Solving Problem by Searching Chapter 3. Outline Problem-solving agents Problem formulation Example problems Basic search algorithms – blind search Heuristic.
1 Lecture 3 Uninformed Search. 2 Uninformed search strategies Uninformed: While searching you have no clue whether one non-goal state is better than any.
Touring problems Start from Arad, visit each city at least once. What is the state-space formulation? Start from Arad, visit each city exactly once. What.
Artificial Intelligence (CS 461D)
Search Strategies CPS4801. Uninformed Search Strategies Uninformed search strategies use only the information available in the problem definition Breadth-first.
UNINFORMED SEARCH Problem - solving agents Example : Romania  On holiday in Romania ; currently in Arad.  Flight leaves tomorrow from Bucharest.
Artificial Intelligence Lecture No. 7 Dr. Asad Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
14 Jan 2004CS Blind Search1 Solving problems by searching Chapter 3.
CS 380: Artificial Intelligence Lecture #3 William Regli.
CPSC 322, Lecture 9Slide 1 Search: Advanced Topics Computer Science cpsc322, Lecture 9 (Textbook Chpt 3.6) January, 23, 2009.
Review: Search problem formulation
Searching the search space graph
Artificial Intelligence Chapter 3: Solving Problems by Searching
Introduction to Artificial Intelligence Blind Search Ruth Bergman Fall 2004.
1 Lecture 3 Uninformed Search. 2 Complexity Recap (app.A) We often want to characterize algorithms independent of their implementation. “This algorithm.
Blind Search-Part 2 Ref: Chapter 2. Search Trees The search for a solution can be described by a tree - each node represents one state. The path from.
Using Search in Problem Solving
Introduction to Artificial Intelligence Blind Search Ruth Bergman Fall 2002.
CS 188: Artificial Intelligence Spring 2006 Lecture 2: Queue-Based Search 8/31/2006 Dan Klein – UC Berkeley Many slides over the course adapted from either.
1 Lecture 3 Uninformed Search
Lecture 3 Uninformed Search.
Review: Search problem formulation Initial state Actions Transition model Goal state (or goal test) Path cost What is the optimal solution? What is the.
CS 440 / ECE 448 Introduction to Artificial Intelligence Spring 2010 Lecture #3 Instructor: Eyal Amir Grad TAs: Wen Pu, Yonatan Bisk Undergrad TAs: Sam.
Search Tamara Berg CS 560 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore, Svetlana Lazebnik,
Artificial Intelligence
For Friday Finish reading chapter 4 Homework: –Lisp handout 4.
For Monday Read chapter 4, section 1 No homework..
Review: Tree search Initialize the frontier using the starting state While the frontier is not empty – Choose a frontier node to expand according to search.
Search CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
1 Solving problems by searching Chapter 3. Depth First Search Expand deepest unexpanded node The root is examined first; then the left child of the root;
Basic Problem Solving Search strategy  Problem can be solved by searching for a solution. An attempt is to transform initial state of a problem into some.
Search (continued) CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
1 search CS 331/531 Dr M M Awais REPRESENTATION METHODS Represent the information: Animals are generally divided into birds and mammals. Birds are further.
Uninformed search strategies A search strategy is defined by picking the order of node expansion Uninformed search strategies use only the information.
Uninformed Search Methods
CPSC 322, Lecture 6Slide 1 Uniformed Search (cont.) Computer Science cpsc322, Lecture 6 (Textbook finish 3.5) Sept, 17, 2012.
Solving problems by searching A I C h a p t e r 3.
CPSC 322, Lecture 5Slide 1 Uninformed Search Computer Science cpsc322, Lecture 5 (Textbook Chpt 3.5) Sept, 13, 2013.
Blind Search Russell and Norvig: Chapter 3, Sections 3.4 – 3.6 CS121 – Winter 2003.
Search Part I Introduction Solutions and Performance Uninformed Search Strategies Avoiding Repeated States Partial Information Summary.
Brian Williams, Fall 041 Analysis of Uninformed Search Methods Brian C. Williams Sep 21 st, 2004 Slides adapted from: Tomas Lozano Perez,
For Monday Read chapter 4 exercise 1 No homework.
Chapter 3 Solving problems by searching. Search We will consider the problem of designing goal-based agents in observable, deterministic, discrete, known.
Chapter 3 (Part-II) Section 3.4, 3.5, 3.6 Uninformed Search.
Lecture 3 Problem Solving through search Uninformed Search
Lecture 3: Uninformed Search
Uninformed Search Chapter 3.4.
Prof. Dechter ICS 270A Winter 2003
Russell and Norvig: Chapter 3, Sections 3.4 – 3.6
EA C461 – Artificial Intelligence
UNINFORMED SEARCH -BFS -DFS -DFIS - Bidirectional
CMSC 471 Fall 2011 Class #4 Tue 9/13/11 Uninformed Search
Presentation transcript:

Lecture 3: Uninformed Search ICS 270a Winter 2003

Summary Uninformed Blind search Breadth-first uniform first depth-first Iterative deepening depth-first Bidirectional Branch and Bound Informed Heuristic search (next class) Greedy search, hill climbing, Heuristics Important concepts: Completeness Time complexity Space complexity Quality of solution

Graph and Tree notations

Search Tree Notation d = Depth S b=2 1 2 G Branching degree, b b is the number of children of a node Depth of a node, d number of branches from root to a node Arc weight, Cost of a path n  n’ , n parent node of n’, a child node Node generation Node expansion Search policy: determines the order of nodes expansion Two kinds of nodes in the tree Open Nodes (Fringe) nodes which are not expanded (i.e., the leaves of the tree) Closed Nodes nodes which have already been expanded (internal nodes) d = Depth 1 2 S b=2 G

Example: Map Navigation S G A B D E C F S = start, G = goal, other nodes = intermediate states, links = legal transitions

Example of a Search Tree D B D E C E Note: this is the search tree at some particular point in in the search.

Search Method 1: Breadth First Search (Use the simple heuristic of not generating a child node if that node is a parent to avoid “obvious” loops: this clearly does not avoid all loops and there are other ways to do this)

Breadth-First Search

Breadth-First-Search (*) 1. Put the start node s on OPEN 2. If OPEN is empty exit with failure. 3. Remove the first node n from OPEN and place it on CLOSED. 4. If n is a goal node, exit successfully with the solution obtained by tracing back pointers from n to s. 5. Otherwise, expand n, generating all its successors attach to them pointers back to n, and put them at the end of OPEN in some order. Go to step 2. For Shortest path or uniform cost: 5’ Otherwise, expand n, generating all its successors attach to them pointers back to n, and put them in OPEN in order of shortest cost path. * This simplified version does not check for loops

What is the Complexity of Breadth-First Search? Time Complexity assume (worst case) that there is 1 goal leaf at the RHS so BFS will expand all nodes = 1 + b + b2+ ......... + bd = O (bd) Space Complexity how many nodes can be in the queue (worst-case)? at depth d-1 there are bd unexpanded nodes in the Q = O (bd) d=0 d=1 d=2 G d=0 d=1 d=2 G

Examples of Time and Memory Requirements for Breadth-First Search Depth of Nodes Solution Expanded Time Memory 0 1 1 millisecond 100 bytes 2 111 0.1 seconds 11 kbytes 4 11,111 11 seconds 1 megabyte 8 108 31 hours 11 giabytes 12 1012 35 years 111 terabytes Assuming b=10, 1000 nodes/sec, 100 bytes/node

Properties of BFS Finds shortest length solution Generates every node just once Exponential time Exponential space

Breadth-First Search (BFS) Properties Solution Length: optimal Generates every node just once Search Time: O(Bd) Memory Required: O(Bd) Drawback: require exponential space 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Search Method 2: Depth First Search (DFS) B D C E Here, to avoid repeated states assume we don’t expand any child node which appears already in the path from the root S to the parent. (Again, one could use other strategies) F D G

Depth-First Search

Depth-First-Search (*) 1. Put the start node s on OPEN 2. If OPEN is empty exit with failure. 3. Remove the first node n from OPEN and place it on CLOSED. 4. If n is a goal node, exit successfully with the solution obtained by tracing back pointers from n to s. 5. Otherwise, expand n, generating all its successors attach to them pointers back to n, and put them at the top of OPEN in some order. 6. Go to step 2.

What is the Complexity of Depth-First Search? Time Complexity assume (worst case) that there is 1 goal leaf at the RHS so DFS will expand all nodes =1 + b + b2+ ......... + bd = O (bd) Space Complexity how many nodes can be in the queue (worst-case)? at depth l < d we have b-1 nodes at depth d we have b nodes total = (d-1)*(b-1) + b = O(bd) d=0 d=1 d=2 G d=0 d=1 d=2 d=3 d=4

Techniques for Avoiding Repeated States B S B C C C S B S State Space Example of a Search Tree Method 1 do not create paths containing cycles (loops) Method 2 never generate a state generated before must keep track of all possible states (uses a lot of memory) e.g., 8-puzzle problem, we have 9! = 362,880 states Method 1 is most practical, work well on most problems

Example, diamond networks

Depth-First Search (DFS) Properties Non-optimal solution path Incomplete unless there is a depth bound Reexpansion of nodes, Exponential time Linear space

Comparing DFS and BFS Same worst-case time Complexity, but In the worst-case BFS is always better than DFS Sometime, on the average DFS is better if: many goals, no loops and no infinite paths BFS is much worse memory-wise DFS is linear space BFS may store the whole search space. In general BFS is better if goal is not deep, if infinite paths, if many loops, if small search space DFS is better if many goals, not many loops, DFS is much better in terms of memory

Search Method 3: Iterative Deepening Search Basic Idea: every iteration is a DFS with a depth cutoff i Increment i this avoids the problem of infinite paths It avoid space problems Procedure Iterative deepening DFS for i = 1 to infinity while no solution do DFS from initial state S0 with cutoff I If found goal state, return solution. end

Iterative Deepening (DFS) Every iteration is a DFS with a depth cutoff. Iterative deepening (ID) i = 1 While no solution, do DFS from initial state S0 with cutoff i If found goal, stop and return solution, else, increment cutoff Comments: ID implements BFS with DFS Only one path in memory BFS at step i may need to keep 2i nodes in OPEN

Iterative deepening search

Comments on Iterative Deepening Search Complexity Space complexity = O(bd) (since its like depth first search run different times) Time Complexity 1 + (1+b) + (1 +b+b2) + .......(1 +b+....bd) = O(bd) (i.e., asymptotically the same as BFS or DFS in the the worst case) The overhead in repeated searching of the same subtrees is small relative to the overall time e.g., for b=10, only takes about 11% more time than DFS A useful practical method combines guarantee of finding an optimal solution if one exists (as in BFS) space efficiency, O(bd) of DFS But still has problems with loops like DFS

Iterative Deepening (DFS) Time: BFS time is O(bn) B is the branching degree ID is asymptotically like BFS For b=10 d=5 d=cut-off DFS = 1+10+100,…,=111,111 IDS = 123,456 Ratio is

Bidirectional Search Idea simultaneously search forward from S and backwards from G stop when both “meet in the middle” need to keep track of the intersection of 2 open sets of nodes What does searching backwards from G mean need a way to specify the predecessors of G this can be difficult, e.g., predecessors of checkmate in chess? what if there are multiple goal states? what if there is only a goal test, no explicit list? Complexity time complexity is best: O(2 b(d/2)) = O(b (d/2)), worst: O(bd+1) memory complexity is the same

Bi-Directional Search

Bi-Directional Search (continued)

Uniform Cost Search Requirement g(successor)(n))  g(n) Expand lowest-cost OPEN node (g(n)) In BFS g(n) = depth(n) Requirement g(successor)(n))  g(n)

Uniform cost search DFS Branch and Bound 1. Put the start node s on OPEN 2. If OPEN is empty exit with failure. 3. Remove the first node n from OPEN and place it on CLOSED. 4. If n is a goal node, exit successfully with the solution obtained by tracing back pointers from n to s. 5. Otherwise, expand n, generating all its successors attach to them pointers back to n, and put them at the end of OPEN in order of shortest cost Go to step 2. DFS Branch and Bound hjhjh At step 4: compute the cost of the solution found and update the upper bound U. at step 5: expand n, generating all its successors attach to them pointers back to n, and put in OPEN in order of shortest cost. Compute cost of paretial path to node and prune if larger than U. .

Comparison of Algorithms

Summary A review of search a search space consists of states and operators: it is a graph a search tree represents a particular exploration of search space There are various strategies for “uninformed search” breadth-first depth-first iterative deepening bidirectional search Uniform cost search Depth-first branch and bound Repeated states can lead to infinitely large search trees we looked at methods for for detecting repeated states All of the search techniques so far are “blind” in that they do not look at how far away the goal may be: next we will look at informed or heuristic search, which directly tries to minimize the distance to the goal. Example we saw: greedy search