Uninformed Search Strategies

Similar documents
Uninformed Search. (Textbook Chpt 3.5) Computer Science cpsc322, Lecture 5. May 18, CPSC 322, Lecture 5 Slide 1

Search. (Textbook Chpt ) Computer Science cpsc322, Lecture 2. May, 10, CPSC 322, Lecture 2 Slide 1

Uninformed Search. CPSC 322 Lecture 5. September 14, 2007 Textbook 2.4. Graph Search Searching Depth-First Search

Uninformed Search. CPSC 322 Lecture 5. January 17, 2007 Textbook 2.4. Uninformed Search CPSC 322 Lecture 5, Slide 1

Search with Costs and Heuristic Search

Uniformed Search (cont.)

Branch & Bound (B&B) and Constraint Satisfaction Problems (CSPs)

Uninformed Search. Reading: Chapter 4 (Tuesday, 2/5) HW#1 due next Tuesday

Search: Advanced Topics and Conclusion

Search: Advanced Topics and Conclusion

CS 4700: Foundations of Artificial Intelligence. Bart Selman. Search Techniques R&N: Chapter 3

Search. CS 3793/5233 Artificial Intelligence Search 1

Learning Objectives. c D. Poole and A. Mackworth 2010 Artificial Intelligence, Lecture 3.2, Page 1

Heuristic Search: A* CPSC 322 Search 4 January 19, Textbook 3.6 Taught by: Vasanth

Search EECS 395/495 Intro to Artificial Intelligence

Search EECS 348 Intro to Artificial Intelligence

Heuristic Search and Advanced Methods

CSC 2114: Artificial Intelligence Search

Announcements. Project 0: Python Tutorial Due last night

Solving Problem by Searching. Chapter 3

Problem Solving and Searching

CS 520: Introduction to Artificial Intelligence. Review

A* optimality proof, cycle checking

AGENTS AND ENVIRONMENTS. What is AI in reality?

ITCS 6150 Intelligent Systems. Lecture 3 Uninformed Searches

CS 5522: Artificial Intelligence II

UNINFORMED SEARCH. What to do if teammates drop? Still have 3 or more? No problem keep going. Have two or fewer and want to be merged?

Chapter 3. A problem-solving agent is a kind of goal-based agent. It decide what to do by finding sequences of actions that lead to desirable states.

CS 4100 // artificial intelligence

521495A: Artificial Intelligence

Uninformed Search Methods

Artificial Intelligence

AGENTS AND ENVIRONMENTS. What is AI in reality?

Lecture 3 - States and Searching

Recap A Search Optimality of A. Search: A. CPSC 322 Search 5. Textbook 3.6. Search: A CPSC 322 Search 5, Slide 1

ARTIFICIAL INTELLIGENCE (CSC9YE ) LECTURES 2 AND 3: PROBLEM SOLVING

Problem Solving and Search

CS540 Uninformed Search

Class Overview. Introduction to Artificial Intelligence COMP 3501 / COMP Lecture 2: Search. Problem Solving Agents

COMP3702/7702 Artificial Intelligence Week2: Search (Russell & Norvig ch. 3)" Hanna Kurniawati"

CS 151: Intelligent Agents, Problem Formulation and Search

Problem solving and search

Announcements. Solution to Assignment 1 is posted Assignment 2 is available Video automatically uploaded (see web page)

CMU-Q Lecture 2: Search problems Uninformed search. Teacher: Gianni A. Di Caro

Chapter3. Problem-Solving Agents. Problem Solving Agents (cont.) Well-defined Problems and Solutions. Example Problems.

Intelligent Agents. Foundations of Artificial Intelligence. Problem-Solving as Search. A Simple Reflex Agent. Agent with Model and Internal State

CS 188: Ar)ficial Intelligence

Informed search strategies (Section ) Source: Fotolia

ARTIFICIAL INTELLIGENCE SOLVING PROBLEMS BY SEARCHING. Chapter 3

Uninformed Search. Chapter 3

CSE 473: Ar+ficial Intelligence

Chapter 4. Uninformed Search Strategies

CS486/686 Lecture Slides (c) 2014 P.Poupart

Uninformed Search. Day 1 & 2 of Search. Russel & Norvig Chap. 3. Material in part from

CS 771 Artificial Intelligence. Problem Solving by Searching Uninformed search

Uninformed search strategies (Section 3.4) Source: Fotolia

Artificial Intelligence

DIT411/TIN175, Artificial Intelligence. Peter Ljunglöf. 19 January, 2018

Blind (Uninformed) Search (Where we systematically explore alternatives)

CS 380: Artificial Intelligence Lecture #3

CS242 Uninformed Search

Why Search. Things to consider. Example, a holiday in Jamaica. CSE 3401: Intro to Artificial Intelligence Uninformed Search

Solving Problems by Searching

CS 8520: Artificial Intelligence

A and Branch-and-Bound Search

CAP 4630 Artificial Intelligence

Artificial Intelligence Uninformed search

Solving problems by searching

An Appropriate Search Algorithm for Finding Grid Resources

Chapter 3: Solving Problems by Searching

Lecture 6 Analysis of A*, B&B Search Refinements

CS486/686 Lecture Slides (c) 2015 P.Poupart

Chapter 3: Search. c D. Poole, A. Mackworth 2010, W. Menzel 2015 Artificial Intelligence, Chapter 3, Page 1

CS 188: Artificial Intelligence. Recap Search I

HW#1 due today. HW#2 due Monday, 9/09/13, in class Continue reading Chapter 3

Ar#ficial)Intelligence!!

Outline. Solving problems by searching. Problem-solving agents. Example: Romania

COMP219: Artificial Intelligence. Lecture 7: Search Strategies

Solving problems by searching

A4B36ZUI - Introduction ARTIFICIAL INTELLIGENCE

Solving problems by searching

EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS

CS Algorithms and Complexity

PEAS: Medical diagnosis system

Artificial Intelligence

Solving Problems by Searching

ARTIFICIAL INTELLIGENCE. Pathfinding and search

Graphs vs trees up front; use grid too; discuss for BFS, DFS, IDS, UCS Cut back on A* optimality detail; a bit more on importance of heuristics,

DFS. Depth-limited Search

Uninformed search strategies

Artificial Intelligence Problem Solving and Uninformed Search

AI: problem solving and search

Pengju XJTU 2016

Search Algorithms. Uninformed Blind search. Informed Heuristic search. Important concepts:

CMPSCI 250: Introduction to Computation. Lecture #24: General Search, DFS, and BFS David Mix Barrington 24 March 2014

Artificial Intelligence

Uninformed Search Strategies AIMA

Problem Solving as Search. CMPSCI 383 September 15, 2011

Class Overview. Introduction to Artificial Intelligence COMP 3501 / COMP Lecture 2. Problem Solving Agents. Problem Solving Agents: Assumptions

Solving problems by searching

Transcription:

Uninformed Search Strategies Alan Mackworth UBC CS 322 Search 2 January 11, 2013 Textbook 3.5 1

Today s Lecture Lecture 4 (2-Search1) Recap Uninformed search + criteria to compare search algorithms - Depth first - Breadth first 2

Recap 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 3

Search Space: 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 4

Problem Solving by Graph Searching 5

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

Bogus version of Generic Search Algorithm Input: a graph a set of start nodes Boolean procedure goal(n) that tests if n is a goal node frontier:= [<g>: g is a goal node]; While frontier is not empty: select and remove path <n o,.,n k > from frontier; If goal(n k ) return <n o,.,n k >; Find a neighbor n of n k add <n> to frontier; end 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) 7

Generic Search Algorithm Input: a graph a set of start nodes Boolean procedure goal(n) testing if n is a goal node frontier:= [<s>: s is a start node]; While frontier is not empty: select and remove path <n o,.,n k > from frontier; If goal(n k ) Then return <n o,.,n k >; Else end For every neighbor n of n k, add <n o,.,n k, n> to frontier; 8

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

Depth-first search (DFS) Frontier: shaded nodes 10

Depth-first search (DFS) Frontier: shaded nodes Which node will be expanded next? (expand = remove path ending at node from frontier & put its successors on ) 11

Depth-first search (DFS) Say, node in red box is a goal How many more nodes will be expanded? 1 2 3 4 12

Depth-first search (DFS) 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 when a goal is put onto the frontier! 13

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

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

Analysis of DFS 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? Yes No 16

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

Analysis of DFS 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. What is DFS s time complexity, in terms of m and b? O(b m ) O(m b ) O(bm) O(b+m) E.g., single goal node: red box 18

Analysis of DFS 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. What is DFS s time complexity, in terms of m and b? O(b m ) E.g., single goal node: red box 19

Analysis of DFS Def.: The space complexity of a search algorithm is the worst-case amount of memory that the algorithm will use (i.e., the maximal number of nodes on the frontier), expressed in terms of - maximum path length m - maximum forward branching factor b. What is DFS s space complexity, in terms of m and b? O(b m ) O(m b ) O(bm) O(b+m) 20

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

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

Breadth-first search (BFS) 23

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

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

Analysis of BFS 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? Yes No 26

Analysis of BFS 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? Yes Proof sketch? 27

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

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

Analysis of BFS 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. What is BFS s time complexity, in terms of m and b? O(b m ) O(m b ) O(bm) O(b+m) E.g., single goal node: red box 30

Analysis of BFS 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. What is BFS s time complexity, in terms of m and b? O(b m ) E.g., single goal node: red box 31

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

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

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

Real Example: Solving Sudoku 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? BFS DFS 35

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

Learning Goals for today s class 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 37

Coming up Read Section 3.6, Heuristic Search 38