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.

Slides:



Advertisements
Similar presentations
Jecho and Donatus Depth First and Breadth First Search.
Advertisements

Artificial Intelligence By Mr. Ejaz CIIT Sahiwal.
Graphs COP Graphs  Train Lines Gainesville OcalaDeltona Daytona Melbourne Lakeland Tampa Orlando.
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
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,
CPSC 322, Lecture 5Slide 1 Uninformed Search Computer Science cpsc322, Lecture 5 (Textbook Chpt 3.4) January, 14, 2009.
Search Strategies Reading: Russell’s Chapter 3 1.
Breadth-First and Depth-First Search
Implementation and Evaluation of Search Methods. Use a stack data structure. 1. Push root node of tree on the stack. 2. Pop the top node off the stack.
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.
CS 206 Introduction to Computer Science II 11 / 07 / 2008 Instructor: Michael Eckmann.
Artificial Intelligence (CS 461D)
Uninformed Search Jim Little UBC CS 322 – Search 2 September 12, 2014
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.
CPSC 322, Lecture 9Slide 1 Search: Advanced Topics Computer Science cpsc322, Lecture 9 (Textbook Chpt 3.6) January, 23, 2009.
CSE332: Data Abstractions Lecture 16: Topological Sort / Graph Traversals Tyler Robison Summer
CSE332: Data Abstractions Lecture 16: Topological Sort / Graph Traversals Dan Grossman Spring 2010.
UnInformed Search What to do when you don’t know anything.
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved Graphs.
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.
COMP171 Depth-First Search.
Using Search in Problem Solving
Introduction to Artificial Intelligence Blind Search Ruth Bergman Fall 2002.
Graphs & Graph Algorithms Nelson Padua-Perez Bill Pugh Department of Computer Science University of Maryland, College Park.
Uninformed Search (cont.)
1 Structures and Strategies for State Space Search 3 3.0Introduction 3.1Graph Theory 3.2Strategies for State Space Search 3.3Using the State Space to Represent.
1 Lecture 3 Uninformed Search
Depth-First Search Lecture 24 COMP171 Fall Graph / Slide 2 Depth-First Search (DFS) * DFS is another popular graph search strategy n Idea is similar.
State-Space Searches. 2 State spaces A state space consists of –A (possibly infinite) set of states The start state represents the initial problem Each.
CS261 Data Structures DFS and BFS – Edge List Representation.
Review: Search problem formulation Initial state Actions Transition model Goal state (or goal test) Path cost What is the optimal solution? What is the.
Busby, Dodge, Fleming, and Negrusa. Backtracking Algorithm Is used to solve problems for which a sequence of objects is to be selected from a set such.
Problem Solving and Search Andrea Danyluk September 11, 2013.
Tree Searching Breadth First Search Dept First Search.
Introduction to search Chapter 3. Why study search? §Search is a basis for all AI l search proposed as the basis of intelligence l inference l all learning.
Introduction to search Chapter 3. Why study search? §Search is a basis for all AI l search proposed as the basis of intelligence l all learning algorithms,
CS 415 – A.I. Slide Set 5. Chapter 3 Structures and Strategies for State Space Search – Predicate Calculus: provides a means of describing objects and.
State-Space Searches. 2 State spaces A state space consists of A (possibly infinite) set of states The start state represents the initial problem Each.
CS.462 Artificial Intelligence SOMCHAI THANGSATHITYANGKUL Lecture 02 : Search.
For Monday Read chapter 4, section 1 No homework..
COMP261 Lecture 6 Dijkstra’s Algorithm. Connectedness Is this graph connected or not? A Z FF C M N B Y BB S P DDGG AA R F G J L EE CC Q O V D T H W E.
Lecture 3: Uninformed Search
Search CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Trees : Part 1 Section 4.1 (1) Theory and Terminology (2) Preorder, Postorder and Levelorder Traversals.
Basic Search Procedure 1. Start with the start node (root of the search tree) and place in on the queue 2. Remove the front node in the queue and If the.
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.
Goal-based Problem Solving Goal formation Based upon the current situation and performance measures. Result is moving into a desirable state (goal state).
COSC 2007 Data Structures II
CPSC 322, Lecture 6Slide 1 Uniformed Search (cont.) Computer Science cpsc322, Lecture 6 (Textbook finish 3.5) Sept, 17, 2012.
Breadth First Search and Depth First Search. Greatest problem in Computer Science Has lead to a lot of new ideas and data structures Search engines before.
Graph Search II GAM 376 Robin Burke. Outline Homework #3 Graph search review DFS, BFS A* search Iterative beam search IA* search Search in turn-based.
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,
Artificial Intelligence Solving problems by searching.
Searching for Solutions
Tree Searching.
COMP171 Depth-First Search.
UNINFORMED SEARCH -BFS -DFS -DFIS - Bidirectional
CMSC 471 Fall 2011 Class #4 Tue 9/13/11 Uninformed Search
Basic Search Methods How to solve the control problem in production-rule systems? Basic techniques to find paths through state- nets. For the moment: -
Presentation transcript:

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 a parent node to a child node represents an operation. Search Trees provide a convenient description of the search space, they are not a data structure stored in memory!!!

Search Trees Each node is a search tree has child nodes that represent each of the states reachable by the parent state. Another way of looking at it: child nodes represent all available options once the search procedure reaches the parent node. There are a number of strategies for traversing a search tree.

Breadth-First-Search Breadth-First Search visits all nodes at depth n before visiting any nodes at depth n+1. General Algorithm for BFS: create nodelist (a queue) and initialize to the start state. repeat until a goal state is found or nodelist = {} remove the first element from nodelist: apply all possible rules and add resulting states to nodelist.

Breadth-First Search Characteristics If there is a solution, BFS will find it. BFS will find the minimal solution (shortest path length to the solution). BFS will not get caught in state space cycles. Requires space available to store the nodelist queue. This can be very large!!!

BFS Time and Space Analysis Assumptions: –There is a single solution (goal state) in the tree. –The search tree is “regular” and has branching factor b. –The goal state is at depth d in the tree. –The goal state is in the middle of the tree (average case analysis).

BFS Space Requirements The queue initially has 1 state. After the first step - the queue will contain b states. Processing each of the b states at level 1 results in adding b more states to the queue. After processing all states at depth n, the queue will hold b n-1 states.

BFS Space Requirements Since we assume the goal state is in the middle of level d: –the queue will hold b d-1 /2 states. Goal State depth d depth d-1

BFS Time Analysis Measure time in terms of the number of states visited. –Assume that we spend the same time processing each node (state). Time = # level 1 nodes + #level 2 nodes + … + # level d-1 nodes + (# level d nodes/2). = 1 + b + b 2 + b 3 + … + b d-1 + b d /2 O(b d )

Depth-First Search Depth-First processes all children (choices) of a node before considering any siblings (at the same depth). Depth-First Search is similar to BFS, but instead of a queue we use a stack. Depth-First Search can easily be described recursively.

DFS recursive definition While applicable rules exist: apply the next rule and generate a new state. If new state is the goal - all done, Otherwise - do a depth-first search on the new state.

DFS General Algorithm for DFS: create nodelist (a stack) and initialize to the start state. repeat until a goal state is found or nodelist = {} pop the first element from nodelist: apply all possible rules and add (push) resulting states to nodelist.

DFS Space Analysis After the first step the stack will contain b nodes. After the second step the stack will contain (b - 1) + b nodes. After the 3rd step the stack will contain (b- 1) + (b-1) + b nodes. After the first d steps the stack will hold (b- 1)*d + 1 nodes (this is the maximum).

DFS Time Analysis In the best case - the goal state will be the first state examined at depth d - this will require looking at d+1 nodes. In the worst case - the goal state will be the last state examined at depth d - this will require looking at all the nodes: 1+b+b 2 +b 3 +…+b d = (b d+1 -1) / (b-1)

DFS average time Not as obvious how to calculate the average time as it was with BFS. Book goes through a derivation, the point is that DFS is also O(b d ) in the average case.

Depth-First Search Characteristics Don’t need to keep track of a large list of states. May find a solution very fast (and might not). “Pruning” is possible –example: branch-and-bound Can easily get caught in loops.

Iterated Deepening Attempt to combine BFS and DFS to get a search with the following desirable characteristics: –Find the minimal solution (shortest path length to the solution). –Minimal (reasonable) space requirements –Similar time requirements.

Iterated Deepening Iterated Deepening uses a depth cutoff that starts at depth 1. For each depth cutoff 1..d do: –apply DFS stopping at the cutoff depth. –If goal state is not found increase the depth cutoff.

Iterated Deepening Steps...

Iterated Deepening Analysis Maximum space requirements is the same as DFS: O(bd) Worst case/Average case time analysis: O(1 + b + b 2 + b 3 + … + b d ) O(b d )

Iterated Broadening Limit on the breadth of a search at each node (number of child nodes processed). Gradually increase the breadth limit until a goal is found. Iterated broadening is most useful when there are many goals in the search tree.

Iterated Broadening Time Analysis At most we must run b searches (each with different breadth cutoff). First search includes 1 node. Second search looks at 2 d Third looks at 3 d … 1+2 d +3 d +…+b d => O(b d )

Loops DFS (and iterated deepening) can suffer if there are loops in the state space. In problems that can generate loops we need to treat the search space as a graph. There are a number of modifications that are possible

Searching Graphs The general idea is to keep track of all nodes that have already been searched. Each time a new node is put on the stack/queue we first make sure it has not already been processed. The list of nodes already processed is called the “closed list” and the stack/queue is called the “open list”.

Problems with using Closed List The closed list can (and will) become too large. It takes time O(|Closed List|) to make sure each new node has not already been processed. Possible solutions: –Use hash tables –Limit the size of the Closed List?