uninformed search
play

Uninformed Search Russell and Norvig chap. 3 Following this, the - PowerPoint PPT Presentation

Uninformed Search Russell and Norvig chap. 3 Following this, the pong paddle went on a mission to destroy Atari headquarters and, due to a mixup, found himself inside the game The Matrix Reloaded. Boy, was THAT ever hard to explain to him.


  1. Uninformed Search Russell and Norvig chap. 3 Following this, the pong paddle went on a mission to destroy Atari headquarters and, due to a mixup, found himself inside the game The Matrix Reloaded. Boy, was THAT ever hard to explain to him.

  2. Navigating through a search tree A C B D G E F J I H K L

  3. Navigating through a search tree A

  4. Navigating through a search tree A C B

  5. Navigating through a search tree A C B D E

  6. Navigating through a search tree A C B D G E F

  7. Navigating through a search tree A C B D G E F I H

  8. Navigating through a search tree A C B D G E F F I H

  9. Navigating through a search tree A C B D G E F J I H

  10. Navigating through a search tree A C B D G E F J I I H H

  11. Navigating through a search tree A C B D G E F J I H K L

  12. Navigating through a search tree A C B D G E F J I H K K L L

  13. Navigating through a search tree A C B D G E F J I H K L

  14. Unexpanded nodes: the frontier A C B D G E F I H At every point in the search process we keep track of a list of nodes that haven’t been expanded yet: the frontier

  15. Tree search Initial state A function TREE-SEARCH( problem ) return a solution or failure Initialize frontier using the initial state of problem do if the frontier is empty then return failure choose leaf node from the frontier if node is a goal state then return solution else expand the node and add resulting nodes to the frontier

  16. Tree search A C B D E function TREE-SEARCH( problem ) return a solution or failure Initialize frontier using the initial state of problem do if the frontier is empty then return failure choose leaf node from the frontier if node is a goal state then return solution else expand the node and add resulting nodes to the frontier

  17. What’s in a node n State n Parent Why do we need the parent and n Action (the action that got us from the parent) action information? n Depth n Path-cost (total cost to get to the node)

  18. When the search graph is not a tree n Need to avoid repeated states! n Happens in problems with reversible operators Examples: missionaries and cannibals problem, sliding blocks puzzles, route finding problems. n Detection: compare a node to be expanded to those already expanded. n Increases memory requirements (especially for DFS): bounded by the size of the state space.

  19. Graph Search function GRAPH-SEARCH( problem ) return a solution or failure initialize the frontier using the initial state of problem initialize the explored set to be empty loop do if the frontier is empty then return failure choose a node from the frontier if node is a goal state then return the corresponding solution add the node to the explored set expand the node, adding the resulting nodes to the frontier ( only if not in the frontier or explored set ) Algorithms that forget their history are doomed to repeat it

  20. Search strategies function GRAPH-SEARCH( problem ) return a solution or failure initialize the frontier using the initial state of problem initialize the explored set to be empty loop do if the frontier is empty then return failure choose a node from the frontier if node is a goal state then return the corresponding solution add the node to the explored set expand the node, adding the resulting nodes to the frontier (only if not in the frontier or explored set) Search strategies differ in how a node is chosen from the frontier

  21. Show code for DFS/BFS tree/ graph search

  22. Uninformed search strategies n a.k.a. blind search = use only information available in problem definition. q When strategies can determine whether one non-goal state is better than another → informed search. n Search algorithms are defined by the node expansion method: q Breadth-first search q Uniform-cost search q Depth-first search q Depth-limited search q Iterative deepening search. q Bidirectional search

  23. Metrics for comparing search strategies n A strategy is defined by the order of node expansion. n Problem-solving performance is measured in four ways: Completeness: Does it always find a solution if one exists? q Optimality: Does it always find the least-cost solution? q Time Complexity: Number of nodes generated/expanded. q Space Complexity: Number of nodes stored in memory during search. q Time and space complexity are measured in terms of: n b - maximum branching factor of the search tree q d - depth of the least-cost solution q m - maximum depth of the state space (may be ∞ ) q

  24. Breadth-First Search (BFS) n Expand all nodes at depth d before proceeding to depth d+1. Return the first goal node found n Implementation: queue (FIFO). A C B D G E F

  25. Evaluation of BFS n Completeness: q Does it always find a solution if one exists?

  26. Evaluation of BFS n Completeness: q Does it always find a solution if one exists? YES (if shallowest goal node is at some finite depth d)

  27. Evaluation of BFS Completeness: n YES q Time complexity: n Assume a state space where every state has b successors. q Assume solution is at depth d n Worst case: generate all but the last node at depth d n Total number of nodes generated: n b + b 2 + b 3 + ... + b d = O ( b d )

  28. Evaluation of BFS Completeness: n YES q Time complexity: n Total number of nodes generated: q b + b 2 + b 3 + ... + b d = O ( b d ) Space complexity: n Same, if each node is retained in memory q

  29. Evaluation of BFS Completeness: n YES q Time complexity: n Total number of nodes generated: q b + b 2 + b 3 + ... + b d = O ( b d ) Space complexity: n Same, if each node is retained in memory q n Optimality: Does it always find the least-cost solution? q YES (if all actions have the same cost)

  30. BFS evaluation n Memory requirements are a bigger problem than its execution time. n Exponential complexity search problems cannot be solved by uninformed search methods for any but the smallest instances. DEPTH NODES TIME MEMORY 2 1100 0.11 seconds 1 megabyte 4 111100 11 seconds 106 megabytes 10 7 6 19 minutes 10 gigabytes 10 9 8 31 hours 1 terabyte 10 10 11 129 days 101 terabytes 10 13 12 35 years 10 petabytes 10 15 14 3523 years 1 exabyte Time and memory requirements for BFS for b=10, 10,000 nodes/sec; 1000 bytes/node

  31. Uniform cost search n Extension of BFS: q Expand node with lowest path cost n Implementation: fringe = priority queue ordered by path cost. n Same as BFS when all step-costs are equal. n What’s the relationship to Dijkstra’s algorithm?

  32. Uniform cost search n Completeness: q YES n Time complexity: q Assume C* the cost of the optimal solution. q Assume that every action costs at least ε q Worst-case: O ( b C */ ε ) n Space complexity: q Same as time complexity n Optimality: q YES (nodes expanded in order of increasing path cost)

  33. Uniform cost search function U NIFORM -C OST -S EARCH ( problem ) returns a solution, or failure node ← a node with S TATE = problem .I NITIAL -S TATE , P ATH -C OST = 0 frontier ← a priority queue ordered by P ATH -C OST , with node as the only element explored ← an empty set loop do if E MPTY ?( frontier ) then return failure node ← P OP ( frontier ) /* chooses the lowest-cost node in frontier */ if problem .G OAL -T EST ( node .S TATE ) then return S OLUTION ( node ) for each action in problem .A CTIONS ( node .S TATE ) do child ← C HILD -N ODE ( problem , node , action ) if child .S TATE is not in explored or frontier then add child .S TATE to explored frontier ← I NSERT ( child , frontier ) else if child .S TATE is in frontier with higher P ATH -C OST then replace that frontier node with child Note the use of a priority queue and the extra check in case a shorter path to a frontier state is discovered

  34. Depth First Search (DFS) Expand A deepest C B unexpanded node

  35. Depth First Search (DFS) Expand A deepest C B unexpanded node D E

  36. Depth First Search (DFS) Expand A deepest B C unexpanded node D E I H

  37. Depth First Search (DFS) Expand A deepest C B unexpanded node D E I H K L

  38. Depth First Search (DFS) Expand A deepest C B unexpanded node D E I H K L

  39. Depth First Search (DFS) Expand A deepest C B unexpanded node D G E F I H K L

  40. Depth First Search (DFS) Expand A deepest C B unexpanded node D G E F J I H K L

  41. Depth First Search (DFS) Expand A deepest C B unexpanded node D G E F J I H K L

  42. Depth First Search (DFS) Expand A deepest C B unexpanded node D G E F J I H K L Implementation: frontier is a stack (LIFO)

  43. DFS evaluation n Completeness: q Does it always find a solution if one exists?

  44. DFS evaluation n Completeness: q Does it always find a solution if one exists? NO unless search space is finite (also beware of loops if using n tree search)

  45. DFS evaluation n Completeness: q NO (unless search space is finite). n Time complexity: q Terrible if m (depth of search space) is much larger than d (depth of optimal solution) q But if many solutions, then might be faster than BFS

  46. DFS evaluation n Completeness: q NO (unless search space is finite). n Time complexity: O(b m ) – m is maximum depth of graph n Space complexity: O(bm) q Assumes we are not keeping track of explored nodes

  47. DFS evaluation n Completeness: q NO (unless search space is finite). n Time complexity: O(b m ) n Space complexity: O(bm) n Optimality: No

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend