cse 473 artificial intelligence
play

CSE 473: Artificial Intelligence Autumn 2018 Problem Spaces & - PowerPoint PPT Presentation

CSE 473: Artificial Intelligence Autumn 2018 Problem Spaces & Search Steve Tanimoto With slides from : Dieter Fox, Dan Weld, Dan Klein, Stuart Russell, Andrew Moore, Luke Zettlemoyer Outline Search Problems Uninformed Search


  1. CSE 473: Artificial Intelligence Autumn 2018 Problem Spaces & Search Steve Tanimoto With slides from : Dieter Fox, Dan Weld, Dan Klein, Stuart Russell, Andrew Moore, Luke Zettlemoyer

  2. Outline  Search Problems  Uninformed Search Methods  Depth-First Search  Breadth-First Search  Uniform-Cost Search  Heuristic Search Methods  Best-First, Greedy Search  A*

  3. Agent vs. Environment  An agent is an entity that Agent perceives and acts . Sensors Percepts  A rational agent selects Environment actions that maximize its ? utility function .  Characteristics of the Actuators Actions percepts, environment, and action space dictate techniques for selecting rational actions.

  4. Types of Agents  Reflex  Goal oriented  Utility-based 4

  5. Goal Based Agents  Plan ahead  Ask “what if”  Decisions based on (hypothesized) consequences of actions  Must have a model of how the world evolves in response to actions  Act on how the world WOULD BE

  6. Types of Environments  Fully observable vs. partially observable  Single agent vs. multiagent  Deterministic vs. stochastic  Episodic vs. sequential  Discrete vs. continuous

  7. Search thru a Problem Space (aka State Space) Problem Space (aka State Space) • Input:  Set of states  Operators [and costs]  Start state  Goal state [test] • Output: • Path: start a state satisfying goal test [May require shortest path] [Sometimes just need a state that passes test]

  8. Example: Traveling in Romania  State space:  Cities  Successor function:  Roads: Go to adjacent city with cost = distance  Start state:  Arad  Goal test:  Is state == Bucharest?  Solution?

  9. Example: Simplified Pac-Man  Input:  A state space  A successor function “N”, 1.0 “E”, 1.0  A start state  A goal test  Output:

  10. State Space Sizes?  Search Problem: Eat all of the food  Pacman positions: 10 x 12 = 120 10 x 12 = 120  Pacman facing: up, down, left, right up, down, left, right  Food configurations: 2 30 2 30  Ghost1 positions: 12 12  Ghost 2 positions: 11 11 120 x 4 x 2 30 x 12 x 11 = 6.8 x 10 13

  11. State Space Graphs  State space graph:  Each node is a state G a  The successor function is c b represented by arcs e  Edges may be labeled with d f costs S h  In a search graph, each state p r occurs only once! q  We can rarely build this graph Ridiculously tiny search graph for a tiny search problem in memory (so we don’t)

  12. Search Trees This is now / start “N”, 1.0 “E”, 1.0 Possible futures  A search tree:  Start state at the root node  Children correspond to successors  Nodes contain states, correspond to PLANS to those states  Edges are labeled with actions and costs  For most problems, we can never actually build the whole tree

  13. State Space Graphs vs. Search Trees Each NODE in State Space Search Tree in the search Graph tree is an S entire PATH in the state G e p a d space graph. c b q e h r b c e d f a a h r p q f S We construct h q c p q f G both on p r q demand – and a q c G we construct a as little as possible.

  14. State Space Graphs vs. Search Trees Consider this 4-state How big is its search tree graph: (from S)? a G S b Important: Lots of repeated structure in the search tree!

  15. Tree Search

  16. Search Example: Romania

  17. Searching with a Search Tree  Search:  Expand out potential plans (tree nodes)  Maintain a fringe of partial plans under consideration  Try to expand as few tree nodes as possible

  18. General Tree Search  Important ideas:  Fringe  Expansion  Exploration strategy  Main question: which fringe nodes to explore?

  19. Tree Search Example G a c b e d f S h p r q

  20. Depth-First Search

  21. Depth-First Search G a Strategy: expand a c b deepest node first e Implementation: Fringe is d f a LIFO stack S h p r q

  22. Depth-First Search G Strategy: expand a a a c c deepest node first b b e e Implementation: Fringe is d d f f a LIFO stack S h h p p r r q q S e p d q e h r b c h r p q f a a q c p q f G a q c G a

  23. Search Algorithm Properties

  24. Search Algorithm Properties  Complete: Guaranteed to find a solution if one exists?  Optimal: Guaranteed to find the least cost path?  Time complexity? 1 node  Space complexity? b b nodes … b 2 nodes  Cartoon of search tree: m tiers  b is the branching factor  m is the maximum depth  solutions at various depths b m nodes  Number of nodes in entire tree?  1 + b + b 2 + …. b m = O(b m )

  25. Depth-First Search (DFS) Properties  What nodes does DFS expand? 1 node  Some left prefix of the tree. b b nodes …  Could process the whole tree! b 2 nodes  If m is finite, takes time O(b m ) m tiers  How much space does the fringe take?  Only has siblings on path to root, so O(bm) b m nodes  Is it complete?  m could be infinite, so only if we prevent cycles  Is it optimal?  No, it finds the “leftmost” solution, regardless of depth or cost

  26. Breadth-First Search

  27. Breadth-First Search G a Strategy: expand a c b shallowest node first e Implementation: Fringe d f is a FIFO queue S h p r q S e p d Search q e h r b c Tiers h r p q f a a q c p q f G a q c G a

  28. Breadth-First Search (BFS) Properties  What nodes does BFS expand?  Processes all nodes above shallowest solution 1 node b  Let depth of shallowest solution be d b nodes … d tiers  Search takes time O(b d ) b 2 nodes  How much space does the fringe take? b d nodes  Has roughly the last tier, so O(b d )  Is it complete? b m nodes  d must be finite if a solution exists, so yes!  Is it optimal?  Only if costs are all 1 (more on costs later)

  29. DFS vs BFS Algorithm Complete Optimal Time Space N unless DFS w/ Path N O( b m ) O( bm ) Checking finite BFS Y Y O( b d ) O( b d )

  30. Memory a Limitation?  Suppose: • 4 GHz CPU • 32 GB main memory • 100 instructions / expansion • 5 bytes / node • 40 M expansions / sec • Memory filled in 160 sec … 3 min

  31. Iterative Deepening Iterative deepening uses DFS as a subroutine: b … 1. Do a DFS which only searches for paths of length 1 or less. 2. If “1” failed, do a DFS which only searches paths of length 2 or less. 3. If “2” failed, do a DFS which only searches paths of length 3 or less. ….and so on. Algorithm Complete Optimal Time Space w/ Path DFS Y N O( b m ) O( bm ) Checking BFS Y Y O( b d ) O( b d ) ID Y Y O( b d ) O( bd )

  32. BFS vs. Iterative Deepening  For b = 10, d = 5:  BFS = 1 + 10 + 100 + 1,000 + 10,000 + 100,000 = 111,111  IDS = 6 + 50 + 400 + 3,000 + 20,000 + 100,000 = 123,456  Overhead = (123,456 - 111,111) / 111,111 = 11%  Memory BFS: 100,000; IDS: 50 32

  33. Costs on Actions GOAL a 2 2 c b 3 2 1 8 2 e 3 d f 9 8 2 START h 4 1 1 4 p r 15 q Notice that BFS finds the shortest path in terms of number of transitions. It does not find the least-cost path.

  34. Uniform Cost Search Expand cheapest node first: GOAL a 2 2 Fringe is a c b 3 2 priority 1 8 queue 2 e 3 d f 9 8 2 START h 4 1 1 4 p r 15 q

  35. Uniform Cost Search 2 G a Strategy: expand a c b 8 1 cheapest node first: 2 2 e 3 d f Fringe is a priority 9 8 2 S h 1 queue (priority: 1 p r cumulative cost) q 15 0 S 9 1 e p 3 d q 16 11 5 17 4 e h r b c 11 Cost 7 6 13 h r p q f a a contours q c 8 p q f G a q c 11 10 G a

  36. Uniform Cost Search (UCS) Properties  What nodes does UCS expand?  Processes all nodes with cost less than cheapest solution! b C ≤ 1  If that solution costs C* and arcs cost at least ε , then the “effective … depth” is roughly C*/ε C ≤ 2 C*/ε  Takes time O(b C*/ε ) (exponential in effective depth) “tiers” C ≤ 3  How much space does the fringe take?  Has roughly the last tier, so O(b C*/ε )  Is it complete?  Assuming best solution has a finite cost and minimum arc cost is positive, yes!  Is it optimal?  Yes!

  37. Uniform Cost Search  Strategy: expand lowest … c  1 path cost c  2 c  3  The good: UCS is complete and optimal!  The bad:  Explores options in every “direction”  No information about goal location Start Goal

  38. Uniform Cost Search Algorithm Complete Optimal Time Space DFS w/ Path Y N O( b m ) O( bm ) Checking BFS Y Y O( b d ) O( b d ) UCS Y* Y O( b C*/ε ) O( b C*/ε ) b … C*/ ε tiers

  39. Uniform Cost: Pac-Man  Cost of 1 for each action  Explores all of the states, but one

  40. The One Queue  All these search algorithms are the same except for fringe strategies  Conceptually, all fringes are priority queues (i.e. collections of nodes with attached priorities)  Practically, for DFS and BFS, you can avoid the log(n) overhead from an actual priority queue, by using stacks and queues  Can even code one implementation that takes a variable queuing object

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