CS 331: Artificial Intelligence Uninformed Search. Real World Search Problems

Similar documents
CS 331: Artificial Intelligence Uninformed Search. Real World Search Problems

CS 331: Artificial Intelligence Uninformed Search. Leftovers from last time

Outline. Solving Problems by Searching. Introduction. Problem-solving agents

Solving Problems by Searching

Artificial Intelligence

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

A2 Uninformed Search

Example: The 8-puzzle. A2 Uninformed Search. It can be generalized to 15-puzzle, 24-puzzle, or. (n 2 1)-puzzle for n 6. Department of Computer Science

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

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

Lecture 3. Uninformed Search

CS 771 Artificial Intelligence. Problem Solving by Searching Uninformed search

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?

Ar#ficial)Intelligence!!

Problem Solving as Search. CMPSCI 383 September 15, 2011

Solving Problems by Searching

CS:4420 Artificial Intelligence

Uninformed Search B. Navigating through a search tree. Navigating through a search tree. Navigating through a search tree

Basic Search. Fall Xin Yao. Artificial Intelligence: Basic Search

ARTIFICIAL INTELLIGENCE. Pathfinding and search

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

Uninformed Search B. Navigating through a search tree. Navigating through a search tree. Navigating through a search tree

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

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

Artificial Intelligence: Search Part 1: Uninformed graph search

Problem Solving. Russell and Norvig: Chapter 3

CS 8520: Artificial Intelligence

Solving Problem by Searching. Chapter 3

Solving problems by searching

Algorithms for Data Structures: Uninformed Search. Phillip Smith 19/11/2013

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.

Chapter 2. Blind Search 8/19/2017

KI-Programmierung. Basic Search Algorithms

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

Uninformed Search. CS171, Winter 2018 Introduction to Artificial Intelligence Prof. Richard Lathrop. Reading: R&N

Artificial Intelligence

Solving problems by searching

Uninformed (also called blind) search algorithms

Uninformed Search Methods

CAP 4630 Artificial Intelligence

Search. Intelligent agents. Problem-solving. Problem-solving agents. Road map of Romania. The components of a problem. that will take me to the goal!

Solving problems by searching. Chapter 3

Problem Solving and Search

Problem solving and search

CS 380: Artificial Intelligence Lecture #3

Uninformed search strategies (Section 3.4) Source: Fotolia

AI: problem solving and search

Artificial Intelligence, CS, Nanjing University Spring, 2018, Yang Yu. Lecture 2: Search 1.

Chapter 3: Solving Problems by Searching

Uninformed Search Strategies AIMA

EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS

Artificial Intelligence Uninformed search

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

Search I. slides from: Padhraic Smyth, Bryan Low, S. Russell and P. Norvig

Solving problems by searching

521495A: Artificial Intelligence

Chapter 3 Solving problems by searching

Informed Search CS457 David Kauchak Fall 2011

Uninformed Search. Problem-solving agents. Tree search algorithms. Single-State Problems

Search : Lecture 2. September 9, 2003

AGENTS AND ENVIRONMENTS. What is AI in reality?

Chapter 4. Uninformed Search Strategies

Uninformed Search strategies. AIMA sections 3.4,3.5

Problem solving and search

AGENTS AND ENVIRONMENTS. What is AI in reality?

Solving Problems: Blind Search

CSC 2114: Artificial Intelligence Search

Solving Problems by Searching

Solving Problems by Searching

Lecture 14: March 9, 2015

CS 331: Artificial Intelligence Informed Search. Informed Search

CS 331: Artificial Intelligence Informed Search. Informed Search

Seminar: Search and Optimization

CS510 \ Lecture Ariel Stolerman

CS 4100 // artificial intelligence

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

Lecture 4: Search 3. Victor R. Lesser. CMPSCI 683 Fall 2010

Set 2: State-spaces and Uninformed Search. ICS 271 Fall 2015 Kalev Kask

CS540 Uninformed Search

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

Artificial Intelligence

Problem Solving and Searching

Uninformed Search Strategies AIMA 3.4

Solving problems by searching

Uninformed search strategies

Problem solving and search

Announcements. Project 0: Python Tutorial Due last night

3 SOLVING PROBLEMS BY SEARCHING

Problem solving and search

Week 3: Path Search. COMP9414/ 9814/ 3411: Artificial Intelligence. Motivation. Example: Romania. Romania Street Map. Russell & Norvig, Chapter 3.

mywbut.com Uninformed Search

Pengju XJTU 2016

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

Planning and search. Lecture 1: Introduction and Revision of Search. Lecture 1: Introduction and Revision of Search 1

ARTIFICIAL INTELLIGENCE SOLVING PROBLEMS BY SEARCHING. Chapter 3

Goal-Based Agents Problem solving as search. Outline

Outline. Solving problems by searching. Prologue. Example: Romania. Uninformed search

Artificial Intelligence

4. Solving Problems by Searching

Solving problems by searching

Transcription:

S 331: rtificial Intelligence Uninformed Search 1 Real World Search Problems 2 1

Simpler Search Problems 3 ssumptions bout Our Environment Fully Observable Deterministic Sequential Static Discrete Single-agent 4 2

Search Problem Formulation search problem has 5 components: 1. finite set of states S 2. non-empty set of initial states I S 3. non-empty set of goal states G S 4. successor function succ(s) which takes a state s as input and returns as output the set of states you can reach from state s in one step. 5. cost function cost(s,s ) which returns the nonnegative one-step cost of travelling from state s to s. The cost function is only defined if s is a successor state of s. 5 Initial State Newport oos ay Goal State McMinnville orvallis Junction ity Example: Oregon Portland Salem lbany Eugene Medford Lebanon S = {oos ay, Newport, orvallis, Junction ity, Eugene, Medford, lbany, Lebanon, Salem, Portland, McMinnville} I = {orvallis} G={Medford} Succ(orvallis)={lbany, Newport, McMinnville, Junction ity} ost(s,s ) = 1 for all transitions 6 3

Results of a Search Problem Solution Path from initial state to goal state Junction orvallis Eugene Medford ity Solution quality Path cost (3 in this case) Optimal solution Lowest path cost among all solutions (In this case, we found the optimal solution) 7 Search Tree orvallis Start with Initial State 8 4

Search Tree orvallis Is initial state the goal? Yes, return solution McMinnville lbany Junction ity Newport No, apply Successor() function 9 Search Tree orvallis pply Successor() function McMinnville lbany Junction ity Newport These nodes have not been expanded yet. all them the fringe. We ll put them in a queue. Queue McMinnville lbany Junction ity Newport 10 5

Search Tree orvallis Queue lbany McMinnville lbany Junction ity Newport Junction ity Newport Portland Portland Now remove a node from the queue. If it s a goal state, return the solution. Otherwise, call Successor() on it, and put the results in the queue. Repeat. 11 Search Tree orvallis Queue lbany McMinnville lbany Junction ity Newport Junction ity Newport Portland Portland Things to note: Order in which you expand nodes (in this example, we took the first node in the queue) void repeated states 6

Tree-Search Pseudocode 13 Tree-Search Pseudocode Note: Goal test happens after we grab a node off the queue. 14 7

Tree-Search Pseudocode Why are these parent node backpointers are important? 15 Uninformed Search No info about states other than generating successors and recognizing goal states Later on we ll talk about informed search can tell if a non-goal state is more promising than another 16 8

Evaluating Uninformed Search ompleteness Is the algorithm guaranteed to find a solution when there is one? Optimality Does it find the optimal solution? Time complexity How long does it take to find a solution? Space complexity How much memory is needed to perform the search 17 omplexity 1. ranching factor (b) maximum number of successors of any node 2. Depth (d) of the shallowest goal node 3. Maximum length (m) of any path in the search space Time omplexity: number of nodes generated during search Space omplexity: maximum number of nodes stored in memory 18 9

Uninformed Search lgorithms readth-first search Uniform-cost search Depth-first search Depth-limited search Iterative Deepening Depth-first Search idirectional search 19 readth-first Search Expand all nodes at a given depth before any nodes at the next level are expanded Implement with a FIFO queue 20 10

readth First Search Example D E F G D E F G Not yet reached Open nodes (on the fringe) losed (expanded) nodes urrent node to be expanded 21 readth First Search Example D E F G D E F G Not yet reached Open nodes (on the fringe) losed (expanded) nodes urrent node to be expanded 22 11

Evaluating FS omplete? Time omplexity Space omplexity 23 Evaluating FS omplete? Yes provided branching factor is finite Time omplexity Space omplexity 24 12

Evaluating FS omplete? Yes provided branching factor is finite Yes if step costs are identical Time omplexity Space omplexity 25 Evaluating FS omplete? Time omplexity Space omplexity Yes provided branching factor is finite Yes if step costs are identical b+b 2 +b 3 + +b d +(b d+1 -b)= O(b d+1 ) 26 13

Evaluating FS omplete? Yes provided branching factor is finite Yes if step costs are identical Time omplexity b+b 2 +b 3 + +b d +(b d+1 -b)= O(b d+1 ) Space omplexity O(b d+1 ) Exponential time and space complexity make FS impractical for all but the smallest problems 27 Uniform-cost Search What if step costs are not equal? Recall that FS expands the shallowest node Now we expand the node with the lowest path cost Uses priority queues Note: Gets stuck if there is a zero-cost action leading back to the same state. For completeness and optimality, we require the cost of every step to be 28 14

Evaluating Uniform-cost Search omplete? Time omplexity Space omplexity 29 Evaluating Uniform-cost Search omplete? Yes provided branching factor is finite and step costs for small positive Time omplexity Space omplexity 30 15

Evaluating Uniform-cost Search omplete? Yes provided branching factor is finite and step costs for small positive Yes Time omplexity Space omplexity 31 Evaluating Uniform-cost Search omplete? Time omplexity Space omplexity Yes provided branching factor is finite and step costs for small positive Yes O(b 1+floor(*/ ) ) where * is the cost of the optimal solution 32 16

Evaluating Uniform-cost Search omplete? Time omplexity Space omplexity Yes provided branching factor is finite and step costs for small positive Yes O(b 1+floor(*/ ) ) where * is the cost of the optimal solution O(b 1+floor(*/ ) ) where * is the cost of the optimal solution 33 Depth-first Search Expands the deepest node in the current fringe of the search tree Implemented with a LIFO queue 34 17

Depth-first Search Example Not yet reached On fringe but unexpanded Expanded nodes on current path Expanded nodes with no descendants in the fringe (can be removed from memory) M urrent node to be expanded Goal state Depth-first Search Example Not yet reached On fringe but unexpanded Expanded nodes on current path Expanded nodes with no descendants in the fringe (can be removed from memory) M urrent node to be expanded Goal state 18

Evaluating Depth-first Search omplete? Time omplexity Space omplexity 37 Evaluating Depth-first Search omplete? Yes on finite graphs. No if there is an infinitely long path with no solutions. Time omplexity Space omplexity 38 19

Evaluating Depth-first Search omplete? Yes on finite graphs. No if there is an infinitely long path with no solutions. Time omplexity No (ould expand a much longer path than the optimal one first) Space omplexity 39 Evaluating Depth-first Search omplete? Yes on finite graphs. No if there is an infinitely long path with no solutions. Time omplexity O(b m ) Space omplexity No (ould expand a much longer path than the optimal one first) 40 20

Evaluating Depth-first Search omplete? Yes on finite graphs. No if there is an infinitely long path with no solutions. Time omplexity O(b m ) No (ould expand a much longer path than the optimal one first) Space omplexity O(bm) 41 Depth-limited Search Solves infinite path problem by using predetermined depth limit l Nodes at depth l are treated as if they have no successors an use knowledge of the problem to determine l (but in general you don t know this in advance) 42 21

Evaluating Depth-limited Search omplete? Time omplexity Space omplexity 43 Evaluating Depth-limited Search omplete? No (If shallowest goal node beyond depth limit) Time omplexity Space omplexity 44 22

Evaluating Depth-limited Search omplete? Time omplexity No (If shallowest goal node beyond depth limit) No (If depth limit > depth of shallowest goal node and we expand a much longer path than the optimal one first) Space omplexity 45 Evaluating Depth-limited Search omplete? Time omplexity O(b l ) Space omplexity No (If shallowest goal node beyond depth limit) No (If depth limit > depth of shallowest goal node and we expand a much longer path than the optimal one first) 46 23

Evaluating Depth-limited Search omplete? Time omplexity O(b l ) No (If shallowest goal node beyond depth limit) No (If depth limit > depth of shallowest goal node and we expand a much longer path than the optimal one first) Space omplexity O(bl) 47 Iterative Deepening Depth-first Search Do DFS with depth limit 0, 1, 2, until a goal is found ombines benefits of both DFS and FS 48 24

Iterative Deepening Depth-first Search Example Limit = 0 Limit = 1 Limit = 2 49 IDDFS Example Limit = 3 50 25

IDDFS Example Limit = 3 (ontinued) 51 omplete? Evaluating Iterative Deepening Depth-first Search Time omplexity Space omplexity 52 26

Evaluating Iterative Deepening Depth-first Search omplete? Yes provided branching factor is finite Time omplexity Space omplexity 53 Evaluating Iterative Deepening Depth-first Search omplete? Time omplexity Yes provided branching factor is finite Yes if the path cost is a nondecreasing function of the depth of the node Space omplexity 54 27

omplete? Evaluating Iterative Deepening Depth-first Search Time omplexity O(b d ) Space omplexity Yes provided branching factor is finite Yes if the path cost is a nondecreasing function of the depth of the node 55 omplete? Evaluating Iterative Deepening Depth-first Search Time omplexity O(b d ) Yes provided branching factor is finite Yes if the path cost is a nondecreasing function of the depth of the node Space omplexity O(bd) 56 28

Isn t Iterative Deepening Wasteful? ctually, no! Most of the nodes are at the bottom level, doesn t matter that upper levels are generated multiple times. To see this, add up the 4th column below: Depth # of nodes # of times generated 1 b d (d)b 2 b 2 d-1 (d-1)b 2 : : : : d b d 1 (1)b d Total # of nodes generated at depth d 57 Is Iterative Deepening Wasteful? Total # of nodes generated by iterative deepening: (d)b + (d-1)b 2 + + (1)b d = O(b d+1 ) Total # of nodes generated by FS: b + b 2 + + b d + b d+1 - b = O(b d+1 ) In general, iterative deepening is the preferred uninformed search method when there is a large search space and the depth of the solution is not known 58 29

idirectional Search Run one search forward from the initial state Run another search backward from the goal Stop when the two searches meet in the middle 59 idirectional Search Needs an efficiently computable Predecessor() function What if there are several goal states? reate a new dummy goal state whose predecessors are the actual goal states Difficult when the goal is an abstract description like no queen attacks another queen 60 30

Evaluating idirectional Search omplete? Time omplexity Space omplexity 61 Evaluating idirectional Search omplete? Yes provided branching factor is finite and both directions use FS Time omplexity Space omplexity 62 31

Evaluating idirectional Search omplete? Yes provided branching factor is finite and both directions use FS Time omplexity Yes if the step costs are all identical and both directions use FS Space omplexity 63 Evaluating idirectional Search omplete? Yes provided branching factor is finite and both directions use FS Time omplexity O(b d/2 ) Space omplexity Yes if the step costs are all identical and both directions use FS 64 32

Evaluating idirectional Search omplete? Yes provided branching factor is finite and both directions use FS Time omplexity O(b d/2 ) Yes if the step costs are all identical and both directions use FS Space omplexity O(b d/2 ) (t least one search tree must be kept in memory for the membership check) 65 voiding Repeated States Tradeoff between space and time! Need a closed list which stores every expanded node (memory requirements could make search infeasible) If the current node matches a node on the closed list, discard it (ie. discard the newly discovered path) We ll refer to this algorithm as GRPH-SERH Is this optimal? Only for uniform-cost search or breadth-first search with constant step costs. 66 33

GRPH-SERH 67 Things You Should Know How to formalize a search problem How FS, US, DFS, DLS, IDS and idirectional search work Whether the above searches are complete and optimal plus their time and space complexity The pros and cons of the above searches 68 34