Search Strategies CMPT 420 / CMPG 720.

Slides:



Advertisements
Similar presentations
Artificial Intelligent
Advertisements

Solving problems by searching Chapter 3. Outline Problem-solving agents Problem types Problem formulation Example problems Basic search algorithms.
Additional Topics ARTIFICIAL INTELLIGENCE
Review: Search problem formulation
Uninformed search strategies
Problem Solving Agents A problem solving agent is one which decides what actions and states to consider in completing a goal Examples: Finding the shortest.
1 Lecture 3 Uninformed Search. 2 Uninformed search strategies Uninformed: While searching you have no clue whether one non-goal state is better than any.
Solving Problems by Searching Currently at Chapter 3 in the book Will finish today/Monday, Chapter 4 next.
Uninformed (also called blind) search algorithms) This Lecture Chapter Next Lecture Chapter (Please read lecture topic material before.
CS 480 Lec 3 Sept 11, 09 Goals: Chapter 3 (uninformed search) project # 1 and # 2 Chapter 4 (heuristic search)
Blind Search1 Solving problems by searching Chapter 3.
Search Strategies Reading: Russell’s Chapter 3 1.
May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.
Solving Problem by Searching Chapter 3. Outline Problem-solving agents Problem formulation Example problems Basic search algorithms – blind search Heuristic.
1 Lecture 3 Uninformed Search. 2 Uninformed search strategies Uninformed: While searching you have no clue whether one non-goal state is better than any.
1 Lecture 3: 18/4/1435 Uninformed search strategies Lecturer/ Kawther Abas 363CS – Artificial Intelligence.
Implementation and Evaluation of Search Methods. Use a stack data structure. 1. Push root node of tree on the stack. 2. Pop the top node off the stack.
Touring problems Start from Arad, visit each city at least once. What is the state-space formulation? Start from Arad, visit each city exactly once. What.
Search Strategies CPS4801. Uninformed Search Strategies Uninformed search strategies use only the information available in the problem definition Breadth-first.
UNINFORMED SEARCH Problem - solving agents Example : Romania  On holiday in Romania ; currently in Arad.  Flight leaves tomorrow from Bucharest.
Artificial Intelligence Lecture No. 7 Dr. Asad Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
14 Jan 2004CS Blind Search1 Solving problems by searching Chapter 3.
CS 380: Artificial Intelligence Lecture #3 William Regli.
Review: Search problem formulation
1 Lecture 3 Uninformed Search. 2 Complexity Recap (app.A) We often want to characterize algorithms independent of their implementation. “This algorithm.
1 Lecture 3 Uninformed Search
Lecture 3 Uninformed Search.
Review: Search problem formulation Initial state Actions Transition model Goal state (or goal test) Path cost What is the optimal solution? What is the.
Artificial Intelligence
AI in game (II) 권태경 Fall, outline Problem-solving agent Search.
SOLVING PROBLEMS BY SEARCHING Chapter 3 August 2008 Blind Search 1.
A General Introduction to Artificial Intelligence.
1 Solving problems by searching Chapter 3. Depth First Search Expand deepest unexpanded node The root is examined first; then the left child of the root;
1 search CS 331/531 Dr M M Awais REPRESENTATION METHODS Represent the information: Animals are generally divided into birds and mammals. Birds are further.
Uninformed search strategies A search strategy is defined by picking the order of node expansion Uninformed search strategies use only the information.
Problem Solving as Search. Problem Types Deterministic, fully observable  single-state problem Non-observable  conformant problem Nondeterministic and/or.
Solving problems by searching A I C h a p t e r 3.
WEEK 5 LECTURE -A- 23/02/2012 lec 5a CSC 102 by Asma Tabouk Introduction 1 CSC AI Basic Search Strategies.
Chapter 3 Solving problems by searching. Search We will consider the problem of designing goal-based agents in observable, deterministic, discrete, known.
Artificial Intelligence Search Instructors: David Suter and Qince Li Course Harbin Institute of Technology [Many slides adapted from those.
Artificial Intelligence Solving problems by searching.
Lecture 3 Problem Solving through search Uninformed Search
Lecture 3: Uninformed Search
Uniformed Search (cont.) Computer Science cpsc322, Lecture 6
Uninformed (also called blind) search algorithms)
Problem Solving Agents
Announcements Homework 1 will be posted this afternoon. After today, you should be able to do Questions 1-3. Python 2.7 only for the homework; turns.
EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS
Uninformed Search Chapter 3.4.
Uninformed Search Strategies
Problem Solving as Search
Artificial Intelligence (CS 370D)
Uninformed Search CS171, Winter 2017
Uniformed Search (cont.) Computer Science cpsc322, Lecture 6
Uninformed Search Introduction to Artificial Intelligence
Artificial Intelligence
Solving problems by searching
Problem Solving and Searching
What to do when you don’t know anything know nothing
EA C461 – Artificial Intelligence
Artificial Intelligence
Searching for Solutions
Problem Solving and Searching
Principles of Computing – UFCFA3-30-1
Problem Spaces & Search
CMSC 471 Fall 2011 Class #4 Tue 9/13/11 Uninformed Search
Solving Problems by Searching
CS440/ECE 448 Lecture 4: Search Intro
Presentation transcript:

Search Strategies CMPT 420 / CMPG 720

Uninformed Search Strategies Uninformed search strategies use only the information available in the problem definition Depth-first search Iterative deepening search

Breadth-first search Expand shallowest unexpanded node

Breadth-first search Expand shallowest unexpanded node

Breadth-first search Expand shallowest unexpanded node

Breadth-first search Examine siblings before children

Breadth-first search Implementation: Frontier is a FIFO queue, i.e., new successors go at end

Example: Romania

Graph Representation Adjacency list representation of G = (V, E) An array of V lists, one for each vertex in V Each list Adj[u] contains all the vertices v such that there is an edge between u and v Adj[u] contains the vertices adjacent to u (in arbitrary order) Can be used for both directed and undirected graphs 1 2 5 / 1 2 5 4 3 2 1 5 3 4 / 3 2 4 4 2 5 3 / 5 Undirected graph 4 1 2

Graph Representation Adjacency matrix representation of G = (V, E) Assume vertices are numbered 1, 2, … V  The representation consists of a matrix A V x V : aij = 1 if (i, j)  E 0 otherwise 1 2 3 4 5 For undirected graphs matrix A is symmetric: aij = aji A = AT 1 1 1 2 5 4 3 2 1 3 1 4 1 Undirected graph 5 1

Breadth-first search Is BFS guaranteed to find a solution if one exists?

Breadth-first search Is BFS guaranteed to find a solution if one exists? Problem?

Breadth-first search Guaranteed to find a solution if one exists Problem: it might take a very long time to find a solution! note how much of tree is expanded that doesn't contribute towards goal

Properties of breadth-first search Complete? Yes Optimal? Time? Space?

Properties of breadth-first search Complete? Yes Optimal? Yes (if cost = 1 per step) Time? Space?

Properties of breadth-first search Complete? Yes Optimal? Yes (if cost = 1 per step) Time? 1+b+b2+b3+… +bd = O(bd) exponential in d Space?

Properties of breadth-first search Complete? Yes Optimal? Yes (if cost = 1 per step) Time? 1+b+b2+b3+… +bd = O(bd) exponential in d Space? O(bd) (O(bd-1) nodes in the explored set and O(bd) nodes in the frontier)

Uniform-cost search Expand the node with the lowest path cost g(n) Implementation:

Uniform-cost search Expand the node with the lowest path cost g(n) Implementation: Frontier = priority queue ordered by path cost g(n)

Example: Romania

Properties of uniform-cost search Equivalent to breadth-first if step costs all equal Complete? Yes Optimal? Yes – nodes expanded in increasing order of path cost Time? O(bd) Space?

Depth-first search Expand deepest unexpanded node

Depth-first search Expand deepest unexpanded node

Depth-first search Examine children before siblings

Depth-first search Examine children before siblings

Depth-first search Examine children before siblings

Depth-first search Examine children before siblings

Depth-first search Examine children before siblings

Depth-first search Examine children before siblings

Depth-first search Examine children before siblings

Depth-first search Examine children before siblings

Depth-first search Examine children before siblings

Depth-first search Implementation: Frontier = LIFO queue

Depth-first search Example

More efficient (in some cases) than breadth-first search Problem: what if some branch is very long: can spend a lot of time searching useless cases

Properties of depth-first search Complete? Yes (if every branch has finite number of states) Optimal? No

Properties of depth-first search Complete? Yes (if every branch has finite number of states) Optimal? No Time? O(bm): terrible if m is much larger than d but if solutions are dense, may be much faster than breadth-first

Comparing Uninformed Search Strategies Time and space complexity are measured in b – maximum branching factor of the search tree m – maximum depth of the state space d – depth of the least cost solution

Properties of depth-first search Complete? Yes (if every branch has finite number of states) Optimal? No Time? O(bm): terrible if m is much larger than d but if solutions are dense, may be much faster than breadth-first Space? O(bm), i.e., linear space!

Depth-limited search Depth-first search with depth limit l, i.e., nodes at depth l have no successors 20 cities in map of Romania l =19 Any city can be reached from any other city in at most 9 steps. Diameter gives a better depth limit.

Properties of Depth-limited search Complete? Yes (if the goal is within the limit) Optimal? No Time? O(bl) Space?

Properties of Depth-limited search Depth-first search can be viewed as a special case with l = infinity Main advantage that the search process can't descend forever (in a branch without solution). However, it will not find a solution if all solutions require a depth greater than the limit. (This is likely when l is unknown.)

How to overcome this and maintain the advantages of depth limited search?

Iterative deepening search Gradually increases the limit – 0, 1, 2, … If don't find solution, increase depth and try again Combines the benefits of depth-first and breadth-first search.

Iterative deepening search l =0

Iterative deepening search l =1

Iterative deepening search l =2

Iterative deepening search l =3

Properties of iterative deepening search Complete? Yes Optimal? Yes, if step cost = 1 Space? O(bd), linear space Time? d b1 + (d-1)b2 + … + (1)bd = O(bd)

Time consuming?? Can show this doesn't really increase the number of examined nodes by much over depth-first search: For large graphs, "most" of the nodes are at the outermost edge

If branching factor is b, then there are b2 nodes in the 2nd layer, b3 in the 3rd, bn in the nth Thus number of nodes at depth d is 1 + b + b2 + b3 + ... + bd If d =4, b =10, get 1 + 10 + 102 + 103 + 104 = 11,111 nodes For iterative deepening, need to consider some nodes more than once: b(d) + b2(d - 1) + b3(d - 2) + ... + bd d = 4, b = 10 gives 1*(4 + 1) + 10 * 4 + 102 * 3 + 103 * 2 + 104 = 12,345 visitations: a 10% increase in general, if branching factor is 10, visit nodes 11% more often by iterative deepening

Properties of iterative deepening search Combines the benefits of depth-first search Memory space O(bd) linear! breadth-first search Always complete and optimal

Bi-Directional Search Start the process simultaneously from the initial start and backwards from the goal state whether the frontiers of the two intersect To reduce the complexity bd/2 + bd/2 < bd