Uninformed Search Strategies CPSC 322 – Search 2 January 14, 2011 Textbook §3.5 1.

Slides:



Advertisements
Similar presentations
Announcements Course TA: Danny Kumar
Advertisements

Artificial Intelligence By Mr. Ejaz CIIT Sahiwal.
CPSC 322, Lecture 5Slide 1 Uninformed Search Computer Science cpsc322, Lecture 5 (Textbook Chpt 3.5) Sept, 14, 2012.
CPSC 322, Lecture 4Slide 1 Search: Intro Computer Science cpsc322, Lecture 4 (Textbook Chpt ) Sept, 11, 2013.
Problem Solving and Search Andrea Danyluk September 9, 2013.
Part2 AI as Representation and Search
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.
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.
Artificial Intelligence (CS 461D)
Uninformed Search Jim Little UBC CS 322 – Search 2 September 12, 2014
Artificial Intelligence Lecture No. 7 Dr. Asad Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
Search: Representation and General Search Procedure Jim Little UBC CS 322 – Search 1 September 10, 2014 Textbook § 3.0 –
Slide 1 Search: Advanced Topics Jim Little UBC CS 322 – Search 5 September 22, 2014 Textbook § 3.6.
CPSC 322, Lecture 4Slide 1 Search: Intro Computer Science cpsc322, Lecture 4 (Textbook Chpt ) January, 12, 2009.
Search: Representation and General Search Procedure CPSC 322 – Search 1 January 12, 2011 Textbook § 3.0 –
CPSC 322, Lecture 9Slide 1 Search: Advanced Topics Computer Science cpsc322, Lecture 9 (Textbook Chpt 3.6) January, 22, 2010.
Artificial Intelligence
UnInformed Search What to do when you don’t know anything.
CPSC 322, Lecture 12Slide 1 CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12 (Textbook Chpt ) January, 29, 2010.
Artificial Intelligence Chapter 3: Solving Problems by Searching
1 Lecture 3 Uninformed Search. 2 Complexity Recap (app.A) We often want to characterize algorithms independent of their implementation. “This algorithm.
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.
Announcements Project 0: Python Tutorial
Uninformed Search (cont.)
Solving problems by searching
Problem-solving agents
Solving Problems by Searching
Multiple Path Pruning, Iterative Deepening CPSC 322 – Search 7 Textbook § January 26, 2011.
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.
Computer Science CPSC 322 Lecture 4 Search: Intro (textbook Ch: ) 1.
Computer Science CPSC 322 Lecture Heuristic Search (Ch: 3.6, 3.6.1) Slide 1.
Computer Science CPSC 322 Lecture A* and Search Refinements (Ch 3.6.1, 3.7.1, 3.7.2) Slide 1.
Computer Science CPSC 322 Lecture 9 (Ch , 3.7.6) Slide 1.
For Monday Read chapter 4, section 1 No homework..
Search with Costs and Heuristic Search 1 CPSC 322 – Search 3 January 17, 2011 Textbook §3.5.3, Taught by: Mike Chiang.
Lecture 3: Uninformed Search
Heuristic Search: A* 1 CPSC 322 – Search 4 January 19, 2011 Textbook §3.6 Taught by: Vasanth.
Search CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Computer Science CPSC 322 Lecture 6 Iterative Deepening and Search with Costs (Ch: 3.7.3, 3.5.3)
For Friday Read chapter 4, sections 1 and 2 Homework –Chapter 3, exercise 7 –May be done in groups.
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).
CSCI 4310 Lecture 2: Search. Search Techniques Search is Fundamental to Many AI Techniques.
Uninformed search strategies A search strategy is defined by picking the order of node expansion Uninformed search strategies use only the information.
Arc Consistency CPSC 322 – CSP 3 Textbook § 4.5 February 2, 2011.
Introduction to Artificial Intelligence (G51IAI) Dr Rong Qu Blind Searches - Introduction.
CPSC 322, Lecture 6Slide 1 Uniformed Search (cont.) Computer Science cpsc322, Lecture 6 (Textbook finish 3.5) Sept, 17, 2012.
CPSC 322, Lecture 4Slide 1 Search: Intro Computer Science cpsc322, Lecture 4 (Textbook Chpt ) Sept, 12, 2012.
A* optimality proof, cycle checking CPSC 322 – Search 5 Textbook § 3.6 and January 21, 2011 Taught by Mike Chiang.
Domain Splitting, Local Search CPSC 322 – CSP 4 Textbook §4.6, §4.8 February 4, 2011.
CPSC 322, Lecture 5Slide 1 Uninformed Search Computer Science cpsc322, Lecture 5 (Textbook Chpt 3.5) Sept, 13, 2013.
Brian Williams, Fall 041 Analysis of Uninformed Search Methods Brian C. Williams Sep 21 st, 2004 Slides adapted from: Tomas Lozano Perez,
Uniformed Search (cont.) Computer Science cpsc322, Lecture 6
Computer Science cpsc322, Lecture 4
Uniformed Search (cont.) Computer Science cpsc322, Lecture 6
Computer Science cpsc322, Lecture 2
CS 188: Artificial Intelligence Fall 2008
Problem Solving and Searching
Searching for Solutions
Problem Solving and Searching
Principles of Computing – UFCFA3-30-1
Iterative Deepening CPSC 322 – Search 6 Textbook § 3.7.3
CPSC 322 Introduction to Artificial Intelligence
Iterative Deepening and Branch & Bound
Domain Splitting CPSC 322 – CSP 4 Textbook §4.6 February 4, 2011.
Presentation transcript:

Uninformed Search Strategies CPSC 322 – Search 2 January 14, 2011 Textbook §3.5 1

Discussion of feedback Printed lecture slides 30+, 2- (“waste of paper”) –Example for decision theory: Utility = - (#sheets of paper used), want to maximize utility Action A = “I print lecture notes” Action B = “Student prints lecture notes at home” Variable D = “Student has double-sided printer at home”, P(D)  0.4 U(A) = -3 U(B) = -3*P(D) + (-6)*P(not D)  -0.4*(-3) + 0.6*(-6) = -4.8 –Conclusion: A is much better than B Only counting students who would o/w print themselves But most others would otherwise print when studying for midterm/exam … 2

Discussion of feedback Examples: unanimous good 25+, 10- “more examples”, 3- “more real-world examples” Videos: unanimous good Please send me any cool videos you find during the course Coloured cards: unanimous helpful 23+, 3- “even more, please” 2- “most of us have clickers”, 3+ “thanks for NOT using clickers” 3

Discussion of feedback Most negative point: definitions sometimes unclear (6-) –In the intro I was sometimes vague Some concepts weren’t too clear-cut Trying to categorize AI research is not math –Starting with the search module, I hope definitions get more crisp First crisp definitions, then examples … Similarly: “missing math and algorithmic parts” (3-) –Those should be coming up Pace: –5: “too slow”, 8: “good”, 0: “too fast” –I’ll speed up a tiny bit (should naturally happen after intro is over) Speaking: 1 “too slow”, 1 “too fast”, I’ll keep it as is 4

Discussion of feedback Which concepts are the important ones? –First 3 lectures only to frame & organize rest of course –Last lecture was important (all search algos depend on it) –Learning goals cover the most important parts Extra slide with answer to m/c question: –Sorry, defies the purpose a bit Expectations & hints how the midterm will look like –I put a sample midterm in WebCT (just to see the type of questions) –Again, see learning goals “Watch for hands more” (1-) –Help me out if I’m blind, I really encourage questions! < Powerpoint slides incompatible “.pptx”: now.ppt 5

Today’s Lecture Lecture 4 Recap Uninformed search + criteria to compare search algorithms -Depth first -Breadth first 6

Recap 7 Search is a key computational mechanism in many AI agents We will study the basic principles of search on the simple deterministic goal-driven search agent model Generic search approach: - Define a search space graph - Initialize the frontier with an empty path - incrementally expand frontier until goal state is reached Frontier: - The set of paths which could be explored next The way in which the frontier is expanded defines the search strategy

Search Space Graph: example Operators –left, right, suck Successor states in the graph describe the effect of each action applied to a given state Possible Goal – no dirt 8

Problem Solving by Graph Searching 9

Input: a graph a set of start nodes Boolean procedure goal(n) that tests if n is a goal node frontier:= [ : g is a goal node]; While frontier is not empty: select and remove path from frontier; If goal(n k ) return ; Find a neighbor n of n k add to frontier; end Bogus version of Generic Search Algorithm There are a couple of bugs in this version here: help me find them! 10

Input: a graph a set of start nodes Boolean procedure goal(n) that tests if n is a goal node frontier:= [ : g is a goal node]; While frontier is not empty: select and remove path from frontier; If goal(n k ) return ; Find a neighbor n of n k add to frontier; end Bogus version of Generic Search Algorithm Start at the start node(s) Add all neighbours of n k to the frontier Add path(s) to frontier, NOT just the node(s) 11

Today’s Lecture Lecture 4 Recap Uninformed search + criteria to compare search algorithms -Depth first -Breadth first 12

Depth first search (DFS) 13 Frontier: shaded nodes

Depth first search (DFS) 14 Frontier: shaded nodes Which node will be expanded next? (expand = “remove node from frontier & put its successors on”)

Depth first search (DFS) 15 Say, node in red box is a goal How many more nodes will be expanded?

Depth first search (DFS) 16 Say, node in red box is a goal How many more nodes will be expanded? 3: you only return once the goal is being expanded! Not once a goal is put onto the frontier!

Input: a graph a set of start nodes Boolean procedure goal(n) testing if n is a goal node frontier:= [ : s is a start node]; While frontier is not empty: select and remove path from frontier; If goal(n k ) return ; Else For every neighbor n of n k, add to frontier; end DFS as an instantiation of the Generic Search Algorithm 17

Input: a graph a set of start nodes Boolean procedure goal(n) testing if n is a goal node frontier:= [ : s is a start node]; While frontier is not empty: select and remove path from frontier; If goal(n k ) return ; Else For every neighbor n of n k, add to frontier; end DFS as an instantiation of the Generic Search Algorithm 18 In DFS, the frontier is a last-in-first-out stack

Analysis of DFS 19 Def. : A search algorithm is complete if whenever there is at least one solution, the algorithm is guaranteed to find it within a finite amount of time. Is DFS complete? YesNo

Analysis of DFS 20 Is DFS optimal? YesNo Def.: A search algorithm is optimal if when it finds a solution, it is the best one E.g., goal nodes: red boxes

Analysis of DFS 21 What is DFS’s time complexity, in terms of m and b ? E.g., single goal node: red box Def.: The time complexity of a search algorithm is the worst-case amount of time it will take to run, expressed in terms of -maximum path length m -maximum forward branching factor b. O(b+m) O(b m ) O(m b )

Analysis of DFS 22 Def.: The space complexity of a search algorithm is the worst-case amount of memory that the algorithm will use (i.e., the maxmial number of nodes on the frontier), expressed in terms of - maximum path length m - maximum forward branching factor b. O(b+m) O(b m ) O(m b ) What is DFS’s space complexity, in terms of m and b ? -O(bm) -The longest possible path is m, and for every node in that path must maintain a fringe of size b

Today’s Lecture Lecture 4 Recap Uninformed search + criteria to compare search algorithms -Depth first -Breadth first 23

Breadth-first search (BFS) 24

Input: a graph a set of start nodes Boolean procedure goal(n) testing if n is a goal node frontier:= [ : s is a start node]; While frontier is not empty: select and remove path from frontier; If goal(n k ) return ; Else For every neighbor n of n k, add to frontier; end BFS as an instantiation of the Generic Search Algorithm 25

Input: a graph a set of start nodes Boolean procedure goal(n) testing if n is a goal node frontier:= [ : s is a start node]; While frontier is not empty: select and remove path from frontier; If goal(n k ) return ; Else For every neighbor n of n k, add to frontier; end BFS as an instantiation of the Generic Search Algorithm 26 In BFS, the frontier is a first-in-first-out queue

Analysis of BFS 27 Def. : A search algorithm is complete if whenever there is at least one solution, the algorithm is guaranteed to find it within a finite amount of time. Is BFS complete? YesNo Proof sketch?

Analysis of BFS 28 Is BFS optimal? YesNo Def.: A search algorithm is optimal if when it finds a solution, it is the best one Proof sketch ?

Analysis of BFS 29 What is BFS’s time complexity, in terms of m and b ? E.g., single goal node: red box Def.: The time complexity of a search algorithm is the worst-case amount of time it will take to run, expressed in terms of -maximum path length m -maximum forward branching factor b. O(b+m) O(b m ) O(m b )

Analysis of BFS 30 Def.: The space complexity of a search algorithm is the worst-case amount of memory that the algorithm will use (i.e., the maxmial number of nodes on the frontier), expressed in terms of - maximum path length m - maximum forward branching factor b. O(b+m) O(b m ) O(m b ) What is BFS’s space complexity, in terms of m and b ? -How many nodes at depth m?

When to use BFS vs. DFS? 31 The search graph has cycles or is infinite We need the shortest path to a solution There are only solutions at great depth There are some solutions at shallow depth: the other one No way the search graph will fit into memory BFSDFS BFSDFS BFSDFS BFSDFS

Real Example: Solving Sudoku 32 E.g. start state on the left Operators: fill in an allowed number Solution: all numbers filled in, with constraints satisfied Which method would you rather use? BFSDFS

Real Example: Eight Puzzle. DFS or BFS? 33 Which method would you rather use? BFSDFS

Apply basic properties of search algorithms:  completeness  optimality  time and space complexity of search algorithms Select the most appropriate search algorithms for specific problems. –Depth-First Search vs. Breadth-First Search Learning Goals for today’s class 34

Coming up … I am away all next week –AI conference in Rome: Learning and Intelligent Optimization –I will check regularly All classes will happen. TAs will teach: –Monday: Mike (including demo of AIspace search applet) –Wednesday: Vasanth (including lots more Infinite Mario) –Friday: Mike (including a proof of the optimal search algorithm) First practice exercise online – see assessments from WebCT Vista –Covers paths, frontier, BFS and DFS –Tracing algorithms as in there is the first question in assignment 1 Read section