1 Blind (Uninformed) Search (Where we systematically explore alternatives) R&N: Chap. 3, Sect. 3.3–5.

Slides:



Advertisements
Similar presentations
Artificial Intelligence Problem Solving Eriq Muhammad Adams
Advertisements

Lecture 3: Uninformed Search
Problem Solving and Search Andrea Danyluk September 9, 2013.
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.
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,
Blind Search1 Solving problems by searching Chapter 3.
Search Strategies Reading: Russell’s Chapter 3 1.
May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.
1 Chapter 3 Solving Problems by Searching. 2 Outline Problem-solving agentsProblem-solving agents Problem typesProblem types Problem formulationProblem.
Solving Problem by Searching Chapter 3. Outline Problem-solving agents Problem formulation Example problems Basic search algorithms – blind search Heuristic.
Search Search plays a key role in many parts of AI. These algorithms provide the conceptual backbone of almost every approach to the systematic exploration.
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 for Games Uninformed search Patrick Olivier
14 Jan 2004CS Blind Search1 Solving problems by searching Chapter 3.
Artificial Intelligence (CS 461D)
Search Strategies CPS4801. Uninformed Search Strategies Uninformed search strategies use only the information available in the problem definition Breadth-first.
14 Jan 2004CS Blind Search1 Solving problems by searching Chapter 3.
CS 380: Artificial Intelligence Lecture #3 William Regli.
Review: Search problem formulation
Problem Solving by Searching Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 3 Spring 2004.
Searching the search space graph
Search I Tuomas Sandholm Carnegie Mellon University Computer Science Department [Read Russell & Norvig Chapter 3]
Artificial Intelligence Chapter 3: Solving Problems by Searching
1 Solving Problems by Searching. 2 Terminology State State Space Initial State Goal Test Action Step Cost Path Cost State Change Function State-Space.
1 Lecture 3 Uninformed Search. 2 Complexity Recap (app.A) We often want to characterize algorithms independent of their implementation. “This algorithm.
Heuristic (Informed) Search (Where we try to be smarter in how we choose among alternatives) R&N III: Chapter 3.5 R&N II: Chap. 4, Sect. 4.1–3.
1 Lecture 3 Uninformed Search
1 Midterm Review cmsc421 Fall Outline Review the material covered by the midterm Questions?
Solving Problems by Searching
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.
1 Problem Solving and Searching CS 171/271 (Chapter 3) Some text and images in these slides were drawn from Russel & Norvig’s published material.
Problem Solving and Search Andrea Danyluk September 11, 2013.
CS 440 / ECE 448 Introduction to Artificial Intelligence Spring 2010 Lecture #3 Instructor: Eyal Amir Grad TAs: Wen Pu, Yonatan Bisk Undergrad TAs: Sam.
Artificial Intelligence
1 Solving Problems by Searching (Blindly) R&N: Chap. 3 (many of these slides borrowed from Stanford’s AI Class)
AI in game (II) 권태경 Fall, outline Problem-solving agent Search.
Vilalta&Eick:Uninformed Search Problem Solving By Searching Introduction Solutions and Performance Uninformed Search Strategies Avoiding Repeated States/Looping.
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.
Lecture 3: Uninformed Search
An Introduction to Artificial Intelligence Lecture 3: Solving Problems by Sorting Ramin Halavati In which we look at how an agent.
SOLVING PROBLEMS BY SEARCHING Chapter 3 August 2008 Blind Search 1.
A General Introduction to Artificial Intelligence.
1 Heuristic (Informed) Search (Where we try to choose smartly) R&N: Chap. 4, Sect. 4.1–3.
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;
Uninformed Search ECE457 Applied Artificial Intelligence Spring 2007 Lecture #2.
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.
Problem Solving as Search. Problem Types Deterministic, fully observable  single-state problem Non-observable  conformant problem Nondeterministic and/or.
Uninformed Search Methods
Implementation: General Tree Search
Solving problems by searching A I C h a p t e r 3.
1 CS B551: Elements of Artificial Intelligence Instructor: Kris Hauser
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,
Chapter 3 Solving problems by searching. Search We will consider the problem of designing goal-based agents in observable, deterministic, discrete, known.
Artificial Intelligence Solving problems by searching.
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
Artificial Intelligence Solving problems by searching
Motion Planning for a Point Robot (2/2)
Russell and Norvig: Chapter 3, Sections 3.4 – 3.6
Searching for Solutions
CMSC 471 Fall 2011 Class #4 Tue 9/13/11 Uninformed Search
Presentation transcript:

1 Blind (Uninformed) Search (Where we systematically explore alternatives) R&N: Chap. 3, Sect. 3.3–5

2 Simple Problem-Solving-Agent Agent Algorithm 1.s 0  sense/read initial state 2.GOAL?  select/read goal test 3.Succ  read successor function 4.solution  search(s 0, GOAL?, Succ) 5.perform(solution)

3 Search Tree Search tree Note that some states may be visited multiple times State graph

4 Search Nodes and States

If states are allowed to be revisited, the search tree may be infinite even when the state space is finite If states are allowed to be revisited, the search tree may be infinite even when the state space is finite

6 Data Structure of a Node PARENT-NODE STATE Depth of a node N = length of path from root to N (depth of the root = 0) BOOKKEEPING 5Path-Cost 5Depth RightAction Expanded yes... CHILDREN

7 Node expansion The expansion of a node N of the search tree consists of: 1)Evaluating the successor function on STATE (N) 2)Generating a child of N for each state returned by the function node generation  node expansion N

8 Fringe of Search Tree  The fringe is the set of all search nodes that haven’t been expanded yet

9 Is it identical to the set of leaves?

10 Search Strategy  The fringe is the set of all search nodes that haven’t been expanded yet  The fringe is implemented as a priority queue FRINGE INSERT(node,FRINGE) REMOVE(FRINGE)  The ordering of the nodes in FRINGE defines the search strategy

11 Search Algorithm #1 SEARCH#1 1.If GOAL?(initial-state) then return initial-state 2.INSERT(initial-node,FRINGE) 3.Repeat: a.If empty(FRINGE) then return failure b.N  REMOVE(FRINGE) c.s  STATE(N) d.For every state s’ in SUCCESSORS(s) i.Create a new node N’ as a child of N ii.If GOAL?(s’) then return path or goal state iii.INSERT(N’,FRINGE) Expansion of N

12 Performance Measures  Completeness A search algorithm is complete if it finds a solution whenever one exists [What about the case when no solution exists?]  Optimality A search algorithm is optimal if it returns a minimum-cost path whenever a solution exists  Complexity It measures the time and amount of memory required by the algorithm

13 Blind vs. Heuristic Strategies  Blind (or un-informed) strategies do not exploit state descriptions to order FRINGE. They only exploit the positions of the nodes in the search tree  Heuristic (or informed) strategies exploit state descriptions to order FRINGE (the most “promising” nodes are placed at the beginning of FRINGE)

14 Example For a blind strategy, N 1 and N 2 are just two nodes (at some position in the search tree) Goal state N1N1 N2N2 STATE

15 Example For a heuristic strategy counting the number of misplaced tiles, N 2 is more promising than N 1 Goal state N1N1 N2N2 STATE

16 Remark  Some search problems, such as the (n 2 -1)- puzzle, are NP-hard  One can’t expect to solve all instances of such problems in less than exponential time (in n)  One may still strive to solve each instance as efficiently as possible  This is the purpose of the search strategy

17 Blind Strategies  Breadth-first Bidirectional  Depth-first Depth-limited Iterative deepening  Uniform-Cost (variant of breadth-first) Arc cost = 1 Arc cost = c(action)    0

18 Breadth-First Strategy New nodes are inserted at the end of FRINGE FRINGE = (1)

19 Breadth-First Strategy New nodes are inserted at the end of FRINGE FRINGE = (2, 3)

20 Breadth-First Strategy New nodes are inserted at the end of FRINGE FRINGE = (3, 4, 5)

21 Breadth-First Strategy New nodes are inserted at the end of FRINGE FRINGE = (4, 5, 6, 7)

22 Important Parameters 1)Maximum number of successors of any state  branching factor b of the search tree 2)Minimal length (≠ cost) of a path between the initial and a goal state  depth d of the shallowest goal node in the search tree

23 Evaluation  b: branching factor  d: depth of shallowest goal node  Breadth-first search is: Complete? Not complete? Optimal? Not optimal?

24 Evaluation  b: branching factor  d: depth of shallowest goal node  Breadth-first search is: Complete Optimal if step cost is 1  Number of nodes generated: ???

25 Evaluation  b: branching factor  d: depth of shallowest goal node  Breadth-first search is: Complete Optimal if step cost is 1  Number of nodes generated: 1 + b + b 2 + … + b d = ???

26 Evaluation  b: branching factor  d: depth of shallowest goal node  Breadth-first search is: Complete Optimal if step cost is 1  Number of nodes generated: 1 + b + b 2 + … + b d = (b d+1 -1)/(b-1) = O(b d )  Time and space complexity is O(b d )

27 Big O Notation g(n) = O(f(n)) if there exist two positive constants a and N such that: for all n > N: g(n)  a  f(n)

28 Time and Memory Requirements d# NodesTimeMemory msec11 Kbytes 411,1111 msec1 Mbyte 6~ sec100 Mb 8~ sec10 Gbytes 10~ hours1 Tbyte 12~ days100 Tbytes 14~ years10,000 Tbytes Assumptions: b = 10; 1,000,000 nodes/sec; 100bytes/node

29 Time and Memory Requirements d# NodesTimeMemory msec11 Kbytes 411,1111 msec1 Mbyte 6~ sec100 Mb 8~ sec10 Gbytes 10~ hours1 Tbyte 12~ days100 Tbytes 14~ years10,000 Tbytes Assumptions: b = 10; 1,000,000 nodes/sec; 100bytes/node

30 Remark If a problem has no solution, breadth-first may run for ever (if the state space is infinite or states can be revisited arbitrary many times) ?

31 Bidirectional Strategy 2 fringe queues: FRINGE1 and FRINGE2 s Time and space complexity is O(b d/2 )  O(b d ) if both trees have the same branching factor b Question: What happens if the branching factor is different in each direction?

32 Depth-First Strategy New nodes are inserted at the front of FRINGE FRINGE = (1)

33 Depth-First Strategy New nodes are inserted at the front of FRINGE FRINGE = (2, 3)

34 Depth-First Strategy New nodes are inserted at the front of FRINGE FRINGE = (4, 5, 3)

35 Depth-First Strategy New nodes are inserted at the front of FRINGE

36 Depth-First Strategy New nodes are inserted at the front of FRINGE

37 Depth-First Strategy New nodes are inserted at the front of FRINGE

38 Depth-First Strategy New nodes are inserted at the front of FRINGE

39 Depth-First Strategy New nodes are inserted at the front of FRINGE

40 Depth-First Strategy New nodes are inserted at the front of FRINGE

41 Depth-First Strategy New nodes are inserted at the front of FRINGE

42 Depth-First Strategy New nodes are inserted at the front of FRINGE

43 Evaluation  b: branching factor  d: depth of shallowest goal node  m: maximal depth of a leaf node  Depth-first search is:  Complete?  Optimal?

44 Evaluation  b: branching factor  d: depth of shallowest goal node  m: maximal depth of a leaf node  Depth-first search is:  Complete only for finite search tree  Not optimal  Number of nodes generated (worst case): 1 + b + b 2 + … + b m = O(b m )  Time complexity is O(b m )  Space complexity is O(bm) [or O(m)] [Reminder: Breadth-first requires O(b d ) time and space]

45 Depth-Limited Search  Depth-first with depth cutoff k (depth at which nodes are not expanded)  Three possible outcomes: Solution Failure (no solution) Cutoff (no solution within cutoff)

46 Iterative Deepening Search Provides the best of both breadth-first and depth-first search Main idea: IDS For k = 0, 1, 2, … do: Perform depth-first search with depth cutoff k (i.e., only generate nodes with depth  k) Totally horrifying !

47 Iterative Deepening

48 Iterative Deepening

49 Iterative Deepening

50 Performance  Iterative deepening search is: Complete Optimal if step cost =1  Time complexity is: (d+1)(1) + db + (d-1)b 2 + … + (1) b d = O(b d )  Space complexity is: O(bd) or O(d)

51 Calculation db + (d-1)b 2 + … + (1) b d = b d + 2b d-1 + 3b d-2 +… + db = (1 + 2b b -2 + … + db -d )  b d  (  i=1,…,  ib (1-i) )  b d = b d ( b/(b-1) ) 2

52 d = 5 and b = 2 BFID 11 x 6 = 6 22 x 5 = x 4 = x 3 = x 2 = x 1 = /63 ~ 2 Number of Generated Nodes (Breadth-First & Iterative Deepening)

53 Number of Generated Nodes (Breadth-First & Iterative Deepening) d = 5 and b = 10 BFID ,0003,000 10,00020, , ,111123, ,456/111,111 ~ 1.111

54 Comparison of Strategies  Breadth-first is complete and optimal, but has high space complexity  Depth-first is space efficient, but is neither complete, nor optimal  Iterative deepening is complete and optimal, with the same space complexity as depth-first and almost the same time complexity as breadth-first Quiz: Would IDS + bi-directional search be a good combination?

55 Revisited States 8-queens No assembly planning Few puzzle and robot navigation Many search tree is finitesearch tree is infinite

56 Avoiding Revisited States  Requires comparing state descriptions  Breadth-first search: Store all states associated with generated nodes in VISITED If the state of a new node is in VISITED, then discard the node

57 Avoiding Revisited States  Requires comparing state descriptions  Breadth-first search: Store all states associated with generated nodes in VISITED If the state of a new node is in VISITED, then discard the node Implemented as hash-table or as explicit data structure with flags

58 Avoiding Revisited States  Depth-first search: Solution 1: –Store all states associated with nodes in current path in VISITED –If the state of a new node is in VISITED, then discard the node  ??

59 Avoiding Revisited States  Depth-first search: Solution 1: –Store all states associated with nodes in current path in VISITED –If the state of a new node is in VISITED, then discard the node  Only avoids loops Solution 2: –Store all generated states in VISITED –If the state of a new node is in VISITED, then discard the node  Same space complexity as breadth-first !

60 Uniform-Cost Search  Each arc has some cost c   > 0  The cost of the path to each node N is g(N) =  costs of arcs  The goal is to generate a solution path of minimal cost  The nodes N in the queue FRINGE are sorted in increasing g(N)  Need to modify search algorithm S 0 1 A 5 B 15 C SG A B C G 11 G 10

61 Search Algorithm #2 SEARCH#2 1.INSERT(initial-node,FRINGE) 2.Repeat: a.If empty(FRINGE) then return failure b.N  REMOVE(FRINGE) c.s  STATE(N) d.If GOAL?(s) then return path or goal state e.For every state s’ in SUCCESSORS(s) i.Create a node N’ as a successor of N ii.INSERT(N’,FRINGE) The goal test is applied to a node when this node is expanded, not when it is generated.

62 Avoiding Revisited States in Uniform-Cost Search  For any state S, when the first node N such that STATE ( N )  S is expanded, the path to N is the best path from the initial state to S N N’ N” g(N)  g(N’) g(N)  g(N”)

63 Avoiding Revisited States in Uniform-Cost Search  For any state S, when the first node N such that STATE ( N )  S is expanded, the path to N is the best path from the initial state to S  So: When a node is expanded, store its state into CLOSED When a new node N is generated: –If STATE (N) is in CLOSED, discard N –If there exits a node N’ in the fringe such that STATE (N’)  STATE (N), discard the node  N or N’  with the highest-cost path