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

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

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

An Appropriate Search Algorithm for Finding Grid Resources

Uninformed Search Methods

CS:4420 Artificial Intelligence

Topic 1 Uninformed Search

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

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

Chapter 4. Uninformed Search Strategies

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

Search & Planning. Jeremy L Wyatt

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

What is Search? Intro to Search. Search problems. Finding goals in trees. Why is goal search not trivial? Blind Search Methods

Efficient memory-bounded search methods

CAP 4630 Artificial Intelligence

Artificial Intelligence: Search Part 1: Uninformed graph search

The wolf sheep cabbage problem. Search. Terminology. Solution. Finite state acceptor / state space

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

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

mywbut.com Uninformed Search

Lecture 14: March 9, 2015

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

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

Last time: Problem-Solving

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

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

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

Chapter 3: Solving Problems by Searching

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

Search EECS 395/495 Intro to Artificial Intelligence

Search EECS 348 Intro to Artificial Intelligence

ARTIFICIAL INTELLIGENCE. Pathfinding and search

Solving Problems by Searching

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

A4B36ZUI - Introduction ARTIFICIAL INTELLIGENCE

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

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

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

Uninformed Search Strategies AIMA

Problem Solving as Search. CMPSCI 383 September 15, 2011

521495A: Artificial Intelligence

KI-Programmierung. Basic Search Algorithms

Search : Lecture 2. September 9, 2003

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

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Department of Electrical Engineering and Computer Science Artificial Intelligence Fall, 2010

LECTURE 11 TREE TRAVERSALS

Problem solving and search

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

Artificial Intelligence

Solving Problems by Searching

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

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

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

Solving Problems by Searching

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

Uninformed (also called blind) search algorithms

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.

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

CS540 Uninformed Search

Goal-Based Agents Problem solving as search. Outline

ARTIFICIAL INTELLIGENCE SOLVING PROBLEMS BY SEARCHING. Chapter 3

COMP219: Artificial Intelligence. Lecture 7: Search Strategies

Artificial Intelligence

Problem Solving and Search

UNINFORMED SEARCH. Announcements Reading Section 3.4, especially 3.4.1, 3.4.2, 3.4.3, 3.4.5

Solving Problems by Searching

ME/CS 132: Advanced Robotics: Navigation and Vision

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

Problem solving and search

Artificial Intelligence

Artificial Intelligence Problem Solving and Uninformed Search

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

CPS 170: Artificial Intelligence Search

Uninformed search strategies (Section 3.4) Source: Fotolia

AI: problem solving and search

Informed Search. CS 486/686: Introduction to Artificial Intelligence Fall 2013

Ar#ficial)Intelligence!!

Artificial Intelligence Uninformed search

Problem solving and search

Multiagent Systems Problem Solving and Uninformed Search

Uninformed Search strategies. AIMA sections 3.4,3.5

mywbut.com Informed Search Strategies-I

CS 4100 // artificial intelligence

ITCS 6150 Intelligent Systems. Lecture 3 Uninformed Searches

Uninformed Search. Chapter 3

CS 771 Artificial Intelligence. Problem Solving by Searching Uninformed search

Uninformed Search. Models To Be Studied in CS 540. Chapter Search Example: Route Finding

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

CS 8520: Artificial Intelligence

CogSysI Lecture 2: Basic Aspects of Action Planning p. 35

A4B36ZUI - Introduction to ARTIFICIAL INTELLIGENCE

Mustafa Jarrar: Lecture Notes on Artificial Intelligence Birzeit University, Chapter 3 Informed Searching. Mustafa Jarrar. University of Birzeit

CSC 2114: Artificial Intelligence Search

Solving problems by searching. Chapter 3

Announcements. Project 0: Python Tutorial Due last night

Graph Search. Chris Amato Northeastern University. Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA

3 SOLVING PROBLEMS BY SEARCHING

Lecture 3. Uninformed Search

Problem solving as Search (summary)

Transcription:

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

Representations for Reasoning We know (at least) two models of a world: model of the static states of the world model of the effects of actions on the first model

Static World 1 2 3

Effects of ctions stack(, ) stack(, ) stack(, ) stack(, ) stack(, ) stack(, )

Decision Making It is easy to choose among options when one appears better than all of the rest. ut when you find things hard to compare, then you may have to deliberate. - Minsky (2006) We need to know about goals and sub-goals

Search pplications Simple social networking Searching the internet Playing games against an I opponent: hess Route finding: Robot navigation

Using a State-space Graph to Find Plans 1. Select a goal state 2. Identify the current state Finding a solution is simply a case of finding a path between these two in the state-space graph

Using a State-space Graph to Find Plans The solution or plan is the sequence of labels on the arcs Usually graphs are so large that we can t hold all of them explicitly in memory There may be many possible paths to a goal state We may wish to find the path of least cost or optimal path

State-space Graphs Typically we need to predict the effects of sequences of actions If the number of states of the world is small enough we can draw a complete state-space graph

Search Trees We represent only the explored portion (or less) of the graph as a search tree: root node = initial state D goal state E F G H I J leaf nodes = unexpanded states

Search Trees locks world example: = node state representation: ( ( 1 2 ) ( 3 ) ) parent node: ( ( 1 ) ( 2 ) ( 3 ) ) operator ( action ): stack( 1, 2 ) depth: 1 path cost: 1

Search Trees: General Rules Each node has only one parent If a node can be reached by two paths, we only remember the parent on the path with the lowest cost

Generating Search Trees We generate the search tree by expanding nodes Expanding a node generating its children!! D Different search techniques essentially correspond to different ways of selecting the next node

readth-first Search Expand the leaf node with the lowest cost path so far dd 1 to the path cost for a node to obtain the path cost of each of its children

readth-first Search Level 0 Level 1 D Level 2 E F G H I J Sequence of nodes we expand is: D E F G H I J Stop when you expand a node which is a goal node

readth-first Search: lgorithm When doing breadth-first search, a queue is an ideal data structure: dd root node to the queue Dequeue ( remove and inspect ) first element from queue If it is the goal state: finish! If it isn t expand node to show it s children, and add to queue Dequeue first element in queue Repeat

readth-first Search: Pseudocode breadth-first-search(tree): get root node r create a queue Q add r to Q while Q is not empty: t = Q.dequeue() if t is goal: return t // goal has been reached else: for all edges e Tree.adjacentEdges(t) V = Tree.adjacentVertices(t, e) //list of child nodes from t enqueue V onto Q

readth-first Search: Example with Queue E F G Queue

readth-first Search: Example with Queue Queue E F G

readth-first Search: Example with Queue E F G E F G Queue

readth-first Search: Example with Queue E F G E F G Queue

readth-first Search: Example with Queue F G Queue E F G

readth-first Search: Example with Queue G E F G Queue G

readth-first Search: Properties Guaranteed to find the shortest path Memory intensive if the space is large Space complexity O( b d ) Time complexity O( b d ) b = branching factor The number of children at each node When not uniform, this can be averaged d = depth of shallowest goal state

Table from Russell & Norvig (1995), rtificial Intelligence: Modern pproach

Depth-First Search Generate the successors of the leaf-node with the highest cost path so far dd 1 to a node s path cost to obtain the path cost of its children

Depth-First Search D E F G H I J Sequence of nodes we expand is: E F G D H I J Stop when you expand a node which is a goal node

Depth-First Search: lgorithm n ideal data structure for depth-first search is a stack This adapts the breadth-first search algorithm we saw previously The nature of a stack changes the behaviour of the search Instead of adding items to examine to the end of a queue we add them to the top of a stack We pop the top item on the stack for each iteration of the algorithm

Depth-First Search: Pseudocode depth-first-search(tree): get root node r create a stack S push r to S while S is not empty: t = S.pop() if t is goal: return t // goal has been reached else: for all edges e Tree.adjacentEdges(t) V = Tree.adjacentVertices(t, e) //list of child nodes from t push V onto S

Depth-First Search: Example with Stack E F G Stack

Depth-First Search: Example with Stack E F G Stack

Depth-First Search: Example with Stack E F E F G Stack

Depth-First Search: Example with Stack G E F G G Stack

Depth-First Search: Properties Not guaranteed to find any path to a goal state Memory efficient Space complexity O( bm ) Time complexity O( b m ) m = maximum depth of search tree (can t be )

Depth-Limited Search To guarantee that search will terminate (either in failure or success) we can put a limit on how deep DFS searches Depth-limited search does DFS to a depth limit h If goal s depth h then DLS is complete (guaranteed to find the solution Still not guaranteed to find the shortest path Space complexity O( bd ) Time complexity O( b d )

Depth-First Iterative Deepening Extends the idea of depth-limited search Start by doing DLS with h = 1 Then we reset: OPEN = [initial-state] LOSED = [] Increase h by 1 Repeat DLS with new limit Iterate, increasing h by 1 each time

Depth-First Iterative Search Looks wasteful However, is better than either FS or DFS lthough it always expands many nodes more than once, it still spends most of its time at the bottom level

Depth-First Iterative Deepening: Explanation t depth d there are b d nodes Total nodes to depth d in DLS is: 1 + b + b 2 + b 3 + + b d-1 + b d The total number of expansions after d iterations will be: ( d+1 ) 1 + ( d ) b + ( d - 1 ) b 2 + (2) b d-1 + (1) b d The sum of the first d expansions will be insignificant compared to b d e.g b =10 d = 5 6 + 50 + 400 + 3000 + 20000 + 100000 = 123,456 So time complexity is O ( b d ) Same as FS, better than DFS

Depth-First Iterative Deepening: Explanation s it s doing depth-first search only one path is maintained. Therefore the space complexity is the same as for DFS: O( bd ) Finally, because all the nodes are expanded at each level DFID is complete (like DLS) s the limit is increased by 1 each iteration the algorithm is guaranteed to find the shortest path to the GOL first, so it is optimal. uriously, DFID is the best uninformed search algorithm in all respects

nalysing Search lgorithms learly the performance of any algorithm on a particular problem depends on properties of the problem domain, and of the representation you choose ut, we can place some general bounds on the performance of algorithms too

nalysing Search lgorithms ompleteness - search algorithm is complete if it is guaranteed to find a solution when at least one solution exists! Optimality - search algorithm is optimal if it is guaranteed to find the best solution when there is more than one! Space omplexity - The order of storage space required at any point during the search process, in order to find a solution in the worst case (number of nodes we must store)! Time omplexity - The order of computation required during the search process to find a solution in the worst case (number of expansions)

omparing Uninformed Search lgorithms Strategy omplete? Optimal? Time omplexity Space omplexity FS Yes Yes O( b d ) O( b d ) DFS No No O( b m ) O( bm ) DLS Yes if h d No O( b h ) O( bh ) DFID Yes Yes O( b d ) O( bd ) d = depth of shallowest goal state m = maximum depth of search tree (could be ) h = user defined limit on search

Summary of Uninformed Search lgorithms Uninformed Search - sometimes called blind search Systematic search with no information about the current distance (cost) to the goal So far we have seen readth-first: guaranteed to find the shallowest goal state in the search tree, but very expensive w.r.t space and time Depth-first: Less storage space required than FS, but no guarantees, and worst case time complexity is poorer Depth-limited: Weak guarantee of completeness. Known bound on time complexity and good space complexity DFID: The best of a bad bunch. Low storage space, complete and optimal, however exponential time complexity