Uninformed search methods

Similar documents
Informed search methods

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

COMP219: Artificial Intelligence. Lecture 7: Search Strategies

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

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

Solving Problems by Searching

ARTIFICIAL INTELLIGENCE SOLVING PROBLEMS BY SEARCHING. Chapter 3

Informed (heuristic) search (cont). Constraint-satisfaction search.

CAP 4630 Artificial Intelligence

Artificial Intelligence: Search Part 1: Uninformed graph search

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

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

Problem solving and search

CS:4420 Artificial Intelligence

4. Solving Problems by Searching

PEAS: Medical diagnosis system

Informed Search and Exploration

Robot Programming with Lisp

CS-E4800 Artificial Intelligence

Artificial Intelligence

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

Problem solving and search

AGENTS AND ENVIRONMENTS. What is AI in reality?

Problem solving and search

AGENTS AND ENVIRONMENTS. What is AI in reality?

KI-Programmierung. Basic Search Algorithms

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

Route planning / Search Movement Group behavior Decision making

Informed Search and Exploration

Problem solving and search

CS 771 Artificial Intelligence. Problem Solving by Searching Uninformed search

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

COMP9414/ 9814/ 3411: Artificial Intelligence. 5. Informed Search. Russell & Norvig, Chapter 3. UNSW c Alan Blair,

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,

Solving Problems using Search

521495A: Artificial Intelligence

Solving Problems by Searching

Solving Problems by Searching

Search EECS 395/495 Intro to Artificial Intelligence

DFS. Depth-limited Search

Search EECS 348 Intro to Artificial Intelligence

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

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

CS 8520: Artificial Intelligence

Informed search algorithms. Chapter 4, Sections 1 2 1

Problem solving and search

Solving Problems by Searching

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

Overview. Path Cost Function. Real Life Problems. COMP219: Artificial Intelligence. Lecture 10: Heuristic Search

COMP219: Artificial Intelligence. Lecture 10: Heuristic Search

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

Today s s lecture. Lecture 2: Search - 1. Examples of toy problems. Searching for Solutions. Victor R. Lesser

Announcements. Project 0: Python Tutorial Due last night

COMP219: Artificial Intelligence. Lecture 10: Heuristic Search

Artificial Intelligence. Informed search methods

Informed search algorithms

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

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

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

Ar#ficial)Intelligence!!

Solving Problems: Blind Search

Artificial Intelligence

AI: problem solving and search

CS 380: Artificial Intelligence Lecture #3

Problem Solving and Search

Informed Search and Exploration

Chapter 3: Solving Problems by Searching

Artificial Intelligence

EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS

Computer Science and Software Engineering University of Wisconsin - Platteville. 3. Search (Part 1) CS 3030 Lecture Notes Yan Shi UW-Platteville

S A E RC R H C I H NG N G IN N S T S A T T A E E G R G A R PH P S

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

Informed search algorithms

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

Problem solving and search: Chapter 3, Sections 1 5

Problem solving and search: Chapter 3, Sections 1 5

Outline for today s lecture. Informed Search I. One issue: How to search backwards? Very briefly: Bidirectional search. Outline for today s lecture

ARTIFICIAL INTELLIGENCE. Pathfinding and search

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

Warm- up. IteraAve version, not recursive. class TreeNode TreeNode[] children() boolean isgoal() DFS(TreeNode start)

Uninformed Search Methods

Introduction to Artificial Intelligence. Informed Search

CSC 2114: Artificial Intelligence Search

Solving problems by searching

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

Additional Divide and Conquer Algorithms. Skipping from chapter 4: Quicksort Binary Search Binary Tree Traversal Matrix Multiplication

Solving Problem by Searching. Chapter 3

Lecture 3. Uninformed Search

CS 4100 // artificial intelligence

Princess Nora University Faculty of Computer & Information Systems ARTIFICIAL INTELLIGENCE (CS 370D) Computer Science Department

COSC343: Artificial Intelligence

Solving problems by searching. Chapter 3

Solving problems by searching

Artificial Intelligence Problem Solving and Uninformed Search

Introduction to Artificial Intelligence (G51IAI) Dr Rong Qu. Blind Searches

Informed Search and Exploration

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

Transcription:

CS 1571 Introuction to AI Lecture 4 Uninforme search methos Milos Hauskrecht milos@cs.pitt.eu 539 Sennott Square Announcements Homework assignment 1 is out Due on Thursay, September 11, 014 before the lecture Theoretical an programming part: Programming part involves Puzzle 8 problem. Course web page: http://www.cs.pitt.eu/~milos/courses/cs1571/ 1

Search Search: The process of exploration of the search space Design goal: We want the search to be as efficient as possible The efficiency of the search epens on: The search space an its size Metho use to explore (traverse) the search space Conition to test the satisfaction of the search objective Uninforme search methos rely only on the information available in the problem efinition Breath first search Depth first search Iterative eepening Bi-irectional search For the minimum cost path problem: Uniform cost search

Breath first search (BFS) The shallowest noe is expane first Breath-first search Expan the shallowest noe first Implementation: put successors to the en of the queue (FIFO) queue Zerin Sibiu Timisoara Oraea Oraea Fagaras Rimnicu Lugoj Vilcea 3

Breath-first search queue Zerin Sibiu Timisoara Zerin Sibiu Timisoara Oraea Oraea Fagaras Rimnicu Lugoj Vilcea Breath-first search queue Sibiu Timisoara Oraea Zerin Sibiu Timisoara Oraea Oraea Fagaras Rimnicu Lugoj Vilcea 4

Breath-first search Zerin Sibiu Timisoara queue Timisoara Oraea Oraea Fagaras Romnicu Vilcea Oraea Oraea Fagaras Rimnicu Vilcea Lugoj Breath-first search Zerin Sibiu Timisoara queue Oraea Oraea Fagaras Romnicu Vilcea Lugoj Oraea Oraea Fagaras Rimnicu Lugoj Vilcea 5

Properties of breath-first search Completeness:? Optimality:? Time complexity:? Memory (space) complexity:? For complexity use: b maximum branching factor epth of the optimal solution m maximum epth of the search tree Properties of breath-first search Completeness: Yes. The solution is reache if it exists. Optimality:? Time complexity:? Memory (space) complexity:? 6

Properties of breath-first search Completeness: Yes. The solution is reache if it exists. Optimality: Yes, for the shortest path. Time complexity:? Memory (space) complexity:? BFS time complexity epth number of noes b 0 1 1 1 = =4 3 3 =8 (b ) +1 +1 (b +1 ) Total noes:? 7

BFS time complexity epth number of noes b 0 1 1 1 = =4 3 3 =8 (b ) +1 +1 (b +1 ) Expane noes: O ( b ) 1 Total noes: O ( b ) Properties of breath-first search Completeness: Yes. The solution is reache if it exists. Optimality: Yes, for the shortest path. Time complexity: 1 b b b O( b ) exponential in the epth of the solution Memory (space) complexity:? 8

BFS memory complexity Count noes kept in the tree structure or in the queue b epth number of noes 0 1 1 1 = =4 3 3 =8 (b ) +1 +1 (b +1 ) Total noes:? BFS memory complexity Count noes kept in the tree structure or in the queue b epth number of noes 0 1 1 1 = =4 3 3 =8 (b ) +1 +1 (b +1 ) Expane noes: O ( b ) 1 Total noes: O ( b ) 9

Properties of breath-first search Completeness: Yes. The solution is reache if it exists. Optimality: Yes, for the shortest path. Time complexity: 1 b b b O( b ) exponential in the epth of the solution Memory (space) complexity: O( b ) noes are kept in the memory BFS time complexity epth number of noes b 0 1 1 1 = =4 3 3 =8 (b ) +1 +1 (b +1 ) Expane noes: O ( b ) 1 Total noes: O ( b ) 10

Depth-first search (DFS) The eepest noe is expane first Backtrack when the path cannot be further expane Depth-first search The eepest noe is expane first Implementation: put successors to the beginning of the queue queue Zerin Sibiu Timisoara Oraea Oraea Fagaras Rimnicu Lugoj Vilcea 11

Depth-first search Zerin Sibiu Timisoara queue Zerin Sibiu Timisoara Oraea Oraea Fagaras Rimnicu Lugoj Vilcea Depth-first search Zerin Sibiu Timisoara queue Oraea Sibiu Timisoara Oraea Oraea Fagaras Rimnicu Lugoj Vilcea 1

Depth-first search Zerin Sibiu Timisoara queue Zerin Sibiu Timisoara Oraea Sibiu Timisoara Oraea Oraea Fagaras Rimnicu Lugoj Vilcea Zerin Sibiu Timisoara Note: Zerin cycle Properties of epth-first search Completeness: Does it always fin the solution if it exists? Optimality:? Time complexity:? Memory (space) complexity:? 13

Properties of epth-first search Completeness: No. Infinite loops can occur. Optimality: oes it fin the minimum length path? Time complexity:? Memory (space) complexity:? Properties of epth-first search Completeness: No. Infinite loops can occur. Solution: prevent occurrence of infinite loops. Optimality: oes it fin the minimum length path? Time complexity:? Memory (space) complexity:? 14

Properties of epth-first search Completeness: No, if we permit infinite loops. Yes, if we prevent them. Optimality: oes it fin the minimum length path? Time complexity:? Memory (space) complexity:? Properties of epth-first search Completeness: No. If we permit infinite loops. Yes, if we prevent them. Optimality: No. Solution foun first may not be the shortest possible. Time complexity:? Memory (space) complexity:? 15

Properties of epth-first search Completeness: No. If we permit infinite loops. Yes, if we prevent them. Optimality: No. Solution foun first may not be the shortest possible. Time complexity: assume a finite maximum tree epth m Memory (space) complexity:? DFS time complexity epth number of noes b 0 1 m 1 1 = =4 3 3 =8 m m - m- Complexity: 16

DFS time complexity epth number of noes b 0 1 m 1 1 = =4 3 3 =8 m m - m- Complexity: O ( b m ) Properties of epth-first search Completeness: No. If we permit infinite loops. Yes, if we prevent them. Optimality: No. Solution foun first may not be the shortest possible. Time complexity: O( b m ) exponential in the maximum epth of the search tree m Memory (space) complexity:? 17

Properties of epth-first search Completeness: No. If we permit infinite loops. Yes, if we prevent them. Optimality: No. Solution foun first may not be the shortest possible. Time complexity: O( b m ) exponential in the maximum epth of the search tree m Memory (space) complexity:? DFS memory complexity epth number of noes kept b 0 1 18

DFS memory complexity epth number of noes kept b 0 0 1 = b DFS memory complexity epth number of noes kept b 0 0 1 1 = (b-1) = b 19

DFS memory complexity epth number of noes kept b 0 0 m 1 1 1 3 1 m =b Complexity: DFS memory complexity epth number of noes kept b 0 0 m 1 1=(b-1) 1= (b-1) 3 1 =(b-1) m =b Complexity: O(bm ) 0

DFS memory complexity Count noes kept in the tree structure or the queue epth number of noes b 0 1 m 1 = b 3 m Total noes: O(bm ) Properties of epth-first search Completeness: No. If we permit infinite loops. Yes, if we prevent them. Optimality: No. Solution foun first may not be the shortest possible. Time complexity: m O( b ) exponential in the maximum epth of the search tree m Memory (space) complexity: O(bm ) linear in the maximum epth of the search tree m 1

Properties of epth-first search Completeness: No. If we permit infinite loops Yes, if we prevent them. Optimality: No. Solution foun first may not be the shortest possible. Time complexity: m O( b ) exponential in the maximum epth of the search tree m Memory (space) complexity: O(bm ) the tree size we nee to keep is linear in the maximum epth of the search tree m Limite-epth epth first search How to eliminate infinite epth-first exploration? Put the limit (l) on the epth of the epth-first exploration Limit l= l Not explore Time complexity: Memory complexity: O( b l ) O (bl ) l - is the given limit

Limite epth epth-first search Avois pitfalls of epth first search Use cutoff on the maximum epth of the tree Problem: How to pick the maximum epth? Assume: we have a traveler problem with 0 cities How to pick the maximum tree epth? Limite epth epth-first search Avois pitfalls of epth first search Use cutoff on the maximum epth of the tree Problem: How to pick the maximum epth? Assume: we have a traveler problem with 0 cities How to pick the maximum tree epth? We nee to consier only paths of length < 0 Limite epth DFS Time complexity: O ( b l ) Memory complexity: O(bl ) l - is the limit 3

Elimination of state repeats While searching the state space for the solution we can encounter the same state many times. Question: Is it necessary to keep an expan all copies of states in the search tree? Two possible cases: (A) Cyclic state repeats Search tree (B) Non-cyclic state repeats A B A B Elimination of cycles A A Case A: Correspons to the path with a cycle Question: Can the branch (path) in which the same state is visite twice ever be a part of the optimal (shortest) path between the initial state an the goal???? 4

Elimination of cycles A A Case A: Correspons to the path with a cycle Question: Can the branch (path) in which the same state is visite twice ever be a part of the optimal (shortest) path between the initial state an the goal? No!! Branches representing cycles cannot be the part of the shortest solution an can be eliminate. Elimination of cycles A A How to check for cyclic state repeats: Check ancestors in the tree structure Caveat: we nee to keep the tree. Do not expan the noe with the state that is the same as the state in one of its ancestors. 5

Elimination of non-cyclic state repeats Root of the search tree B noeb-1 B noeb- Case B: noes with the same state are not on the same path from the initial state Question: Is one of the noes noeb-1, noeb- better or preferable? Elimination of non-cyclic state repeats Root of the search tree B noeb-1 B noeb- Case B: noes with the same state are not on the same path from the initial state Question: Is one of the noes noeb-1, noeb- better or preferable? Yes. noeb-1 represents a shorter path from the initial state to B 6

Elimination of non-cyclic state repeats Root of the search tree B noeb-1 B noeb- Conclusion: Since we are happy with the optimal solution noeb- can be eliminate. It oes not affect the optimality of the solution. Problem: Noes can be encountere in ifferent orer uring ifferent search strategies. Elimination of non-cyclic state repeats with BFS Root of the search tree B noeb-1 B noeb- Breath FS is well behave with regar to non-cyclic state repeats: noeb-1 is always expane before noeb- Orer of expansion etermines the correct elimination strategy we can safely eliminate the noe that is associate with the state that has been expane before 7

Elimination of state repeats for the BFS For the breath-first search (BFS) we can safely eliminate all secon, thir, fourth, etc. occurrences of the same state this rule covers both cyclic an non-cyclic repeats!!! Implementation of all state repeat elimination through marking: All expane states are marke All marke states are store in a hash table Checking if the noe has ever been expane correspons to the mark structure lookup Use hash table to implement marking Elimination of non-cyclic state repeats with DFS Root of the search tree B noeb-1 B noeb- Depth FS: noeb- is expane before noeb-1 The orer of noe expansion oes not imply correct elimination strategy we nee to remember the length of the path between noes to safely eliminate them 8

Elimination of all state reunancies General strategy: A noe is reunant if there is another noe with exactly the same state an a shorter path from the initial state Works for any search metho Uses aitional path length information Implementation: hash table with the minimum path value: The new noe is reunant an can be eliminate if it is in the hash table (it is marke), an its path is longer or equal to the value store. Otherwise the new noe cannot be eliminate an it is entere together with its value into the hash table. (if the state was in the hash table the new path value is better an nees to be overwritten.) 9