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

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

Solving Problems by Searching (Blindly)

A4B36ZUI - Introduction ARTIFICIAL INTELLIGENCE

A4B36ZUI - Introduction to ARTIFICIAL INTELLIGENCE

Are We Smart Yet? (Where we try to choose smartly) R&N: Chap. 4, Sect

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

Heuristic (Informed) Search

Problem Solving as Search. CMPSCI 383 September 15, 2011

Heuristic (Informed) Search

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

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

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

Search EECS 395/495 Intro to Artificial Intelligence

Search EECS 348 Intro to Artificial Intelligence

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

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

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

Problem Solving and Search

Uninformed Search Strategies AIMA

Chapter 3: Solving Problems by Searching

Solving problems by searching. Chapter 3

DFS. Depth-limited Search

ARTIFICIAL INTELLIGENCE. Pathfinding and search

Uninformed Search Methods

Chapter 3 Solving problems by searching

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

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

Solving problems by searching

CS 771 Artificial Intelligence. Problem Solving by Searching Uninformed search

Artificial Intelligence

(Un)informed State Space Search A4B33ZUI, LS 2016

Artificial Intelligence

Artificial Intelligence

Solving problems by searching

Ar#ficial)Intelligence!!

CS 380: Artificial Intelligence Lecture #3

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

Solving Problems by Searching

4. Solving Problems by Searching

Chapter 2. Blind Search 8/19/2017

Problem solving and search

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

A2 Uninformed Search

CS 8520: Artificial Intelligence

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

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.

Solving Problem by Searching. Chapter 3

AI: problem solving and search

Uninformed Search Strategies AIMA 3.4

3 SOLVING PROBLEMS BY SEARCHING

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

CAP 4630 Artificial Intelligence

Motion Planning for a Point Robot (2/2) Point Robot on a Grid. Planning requires models. Point Robot on a Grid 1/18/2012.

Solving Problems by Searching

Problem solving and search

mywbut.com Informed Search Strategies-I

Solving problems by searching

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

Solving Problems by Searching

EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS

Solving problems by searching

Problem Solving. Russell and Norvig: Chapter 3

Search : Lecture 2. September 9, 2003

ITCS 6150 Intelligent Systems. Lecture 3 Uninformed Searches

2. State Space Search

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

Problem Solving & Heuristic Search

KI-Programmierung. Basic Search Algorithms

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

Artificial Intelligence Uninformed search

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

Informed (Heuristic) Search. Idea: be smart about what paths to try.

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

Lecture 3. Uninformed Search

Uninformed Search. Chapter 3

Search. CS 3793/5233 Artificial Intelligence Search 1

Uninformed search strategies (Section 3.4) Source: Fotolia

Solving Problems by Searching

Uninformed (also called blind) search algorithms

Chapter 4. Uninformed Search Strategies

Artificial Intelligence: Search Part 1: Uninformed graph search

Artificial Intelligence Problem Solving and Uninformed Search

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

Problem solving and search

AGENTS AND ENVIRONMENTS. What is AI in reality?

CS 151: Intelligent Agents, Problem Formulation and 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?

Problem solving and search

Multiagent Systems Problem Solving and Uninformed Search

Informed Search CS457 David Kauchak Fall 2011

Informed search strategies (Section ) Source: Fotolia

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

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

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

Problem solving and search

Solving Problems by Searching

Solving Problems by Searching

Uninformed Search Strategies

AGENTS AND ENVIRONMENTS. What is AI in reality?

Ar#ficial)Intelligence!!

Transcription:

Blind (Uninformed) Search (Where we systematically explore alternatives) R&N: Chap. 3, Sect. 3.3 5 Slides from Jean-Claude Latombe at Stanford University (used with permission) Simple Problem-Solving-Agent Agent Algorithm. 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) 2 Search Tree State graph Search tree Note that some states may be visited multiple times 3

Search Nodes and States 7 3 4 8 4 2 3 7 4 Search Nodes and States 7 3 4 If states are allowed to be revisited, the search tree may be infinite even when the state space is finite 8 4 2 3 7 5 Data Structure of a Node STATE CHILDREN... PARENT-NODE BOOKKEEPING Action Right Depth 5 Path-Cost 5 Expanded yes Depth of a node N = length of path from root to N (depth of the root = 0) 6 2

Node expansion The expansion of a node N of the search tree consists of: ) 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 4 2 3 7 7 Fringe of Search Tree The fringe is the set of all search nodes that haven t been expanded yet 7 3 4 8 4 2 3 7 8 Is it identical to the set of leaves? 9 3

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 0 Search Algorithm # SEARCH#. 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) Expansion of N 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) 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 2 4

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) 3 Example 5 6 7 8 6 STATE N STATE N 2 For a blind strategy, N and N 2 are just two nodes (at some position in the search tree) 6 7 8 Goal state 4 Example 5 6 7 8 6 STATE N STATE N 2 For a heuristic strategy counting the number of misplaced tiles, N 2 is more promising than N 6 7 8 Goal state 5 5

Remark Some search problems, such as the (n 2 -)- 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 6 Breadth-first Bidirectional Blind Strategies Depth-first Depth-limited Iterative deepening Uniform-Cost (variant of breadth-first) Arc cost = Arc cost = c(action) ε>0 7 Breadth-First Strategy New nodes are inserted at the end of FRINGE FRINGE = () 6 7 8 6

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

Important Parameters ) 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 22 Evaluation b: branching factor d: depth of shallowest goal node Breadth-first search is: Complete? Not complete? Optimal? Not optimal? 23 Evaluation b: branching factor d: depth of shallowest goal node Breadth-first search is: Complete Optimal if step cost is Number of nodes generated:??? 24 8

Evaluation b: branching factor d: depth of shallowest goal node Breadth-first search is: Complete Optimal if step cost is Number of nodes generated: + b + b 2 + + b d =??? 25 Evaluation b: branching factor d: depth of shallowest goal node Breadth-first search is: Complete Optimal if step cost is Number of nodes generated: + b + b 2 + + b d = O(b d ) Time and space complexity is O(b d ) 26 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) 27 9

Time and Memory Requirements d # Nodes Time Memory 2.0 msec Kbytes 4, msec Mbyte 6 ~0 6 sec 00 Mb 8 ~0 8 00 sec 0 Gbytes 0 ~0 0 2.8 hours Tbyte 2 ~0 2.6 days 00 Tbytes 4 ~0 4 3.2 years 0,000 Tbytes Assumptions: b = 0;,000,000 nodes/sec; 00bytes/node 28 Time and Memory Requirements d # Nodes Time Memory 2.0 msec Kbytes 4, msec Mbyte 6 ~0 6 sec 00 Mb 8 ~0 8 00 sec 0 Gbytes 0 ~0 0 2.8 hours Tbyte 2 ~0 2.6 days 00 Tbytes 4 ~0 4 3.2 years 0,000 Tbytes Assumptions: b = 0;,000,000 nodes/sec; 00bytes/node 29 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) 2 3 4 2 3 4 5 6 7 8? 5 6 7 8 9 0 2 9 0 2 3 4 5 3 5 4 30 0

Bidirectional Strategy 2 fringe queues: FRINGE and FRINGE2 s Time and space complexity is O(b d/2 ) << O(b d ) if both trees have the same branching factor b 3 Depth-First Strategy FRINGE = () 32 Depth-First Strategy FRINGE = (2, 3) 33

Depth-First Strategy FRINGE = (4, 5, 3) 34 Depth-First Strategy 35 Depth-First Strategy 36 2

Depth-First Strategy 37 Depth-First Strategy 38 Depth-First Strategy 39 3

Depth-First Strategy 40 Depth-First Strategy 4 Depth-First Strategy 42 4

Evaluation b: branching factor d: depth of shallowest goal node m: maximal depth of a leaf node Depth-first search is: Complete? Optimal? 43 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): + 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] 44 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) 45 5

Iterative Deepening Search Provides the best of both breadth-first and depth-first search IDS For k = 0,, 2, do: Perform depth-first search with depth cutoff k (i.e., only generate nodes with depth k) 46 Iterative Deepening 47 Iterative Deepening 48 6

Iterative Deepening 49 Performance Iterative deepening search is: Complete Optimal if step cost = Time complexity is: (d+)() + db + (d-)b 2 + + () b d = O(b d ) Space complexity is: O(bd) or O(d) 50 Calculation db + (d-)b 2 + + () b d =b d +2b d- +3b d-2 + + db = ( + 2b - + 3b -2 + + db -d ) b d ( ) (Σ i=,, ib (-i) ) b d = b d (b/(b-)) 2 5 7

Number of Generated Nodes (Breadth-First & Iterative Deepening) d = 5 and b = 2 BF ID x 6 = 6 2 2 x 5 = 0 4 4 x 4 = 6 8 8 x 3 = 24 6 6 x 2 = 32 32 x = 32 63 20 20/63 ~ 2 52 Number of Generated Nodes (Breadth-First & Iterative Deepening) d = 5 and b = 0 BF ID 6 0 50 00 400,000 3,000 0,000 20,000 00,000 00,000, 23,456 23,456/, ~. 53 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 54 8

Revisited States No Few Many search tree is finite search tree is infinite 7 8 6 8-queens assembly planning 8-puzzle and robot navigation 55 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 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 Implemented as hash-table or as explicit data structure with flags 57 9

Avoiding Revisited States Depth-first search: Solution : 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?? 58 Avoiding Revisited States Depth-first search: Solution : 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! 59 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 i g(n) A S 0 0 S 5 B 5 G A B C 5 5 5 5 C G Need to modify search algorithm G 0 60 20

Search Algorithm #2 SEARCH#2. INSERT(initial-node,FRINGE) 2. Repeat: The goal test is applied to a node when this node is expanded, not when it is generated. 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) 6 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 62 2