upcoming assignments cs 4100 artificial intelligence
play

Upcoming Assignments CS 4100: Artificial Intelligence Due Tue 10 - PowerPoint PPT Presentation

Upcoming Assignments CS 4100: Artificial Intelligence Due Tue 10 Sep at 11:59pm (today) Search Pr Project 0: Python Tutorial Homework k 0: Math Self-diagnostic 0 points in class, but important to check your preparedness Due Fri


  1. Upcoming Assignments CS 4100: Artificial Intelligence • Due Tue 10 Sep at 11:59pm (today) Search • Pr Project 0: Python Tutorial • Homework k 0: Math Self-diagnostic • 0 points in class, but important to check your preparedness • Due Fri 13 Sep at 11:59pm • Homework k 1: Search • Due Mon 23 Sep at 11:59pm • Pr Project 1: Search • Longer than most, and best way to test your programming preparedness • Reminder: We don’t use Blackboard (we use: class website, piazza, gradescope) Instructor: Jan-Willem van de Meent [Adapted from slides by Dan Klein and Pieter Abbeel for CS188 Intro to AI at UC Berkeley (ai.berkeley.edu).] Today Agents that Plan • Agents that Plan Ahead • Search Problems • Uninformed Search Methods • Depth-First Search • Breadth-First Search • Uniform-Cost Search

  2. Reflex Agents Example: Rational Reflex Agent • Reflex agents: • Choose action based on current percept (and maybe memory) • May have memory or a model of the world’s current state • Do not consider the future consequences of their actions • Consider how the world IS • Can a reflex agent be rational? [Demo: reflex optimal (L2D1)] [Demo: reflex optimal (L2D2)] Example: Sub-Optimal Reflex Agent Planning Agents • Planning agents: • Ask “what if” • Decisions based on (hypothesized) consequences of actions • Must have a model of how the world evolves in response to actions • Must formulate a goal (test) • Consider how the world WOULD BE • Optimal vs. complete planning • Planning vs. replanning [Demo: re-planning (L2D3)] [Demo: mastermind (L2D4)]

  3. Example: Planning Start to Finish Example: Step-wise Replanning Search Problems Search Problems • A search problem consists of: • A st state sp space • A su successo ssor function (with actions, costs) “N”, 0.0 “E”, 0.0 “S”, 1.0 “W”, 1.0 • A st start st state and a goal test st • A solution is a sequence of actions (a plan) which transforms the start state to a goal state

  4. Search Problems Are Models 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? What’s in a State Space? State Space Sizes? The world state includes every last detail of the environment • World state: • Agent positions: 120 • Food count: 30 • Ghost positions: 12 • Agent facing: NSEW A search state keeps only the details needed for planning (abstraction) • How many • Problem: Pathing • Problem: Eat-All-Dots • World states? • States: (x,y) location • States: {(x,y), dot booleans} 120x(2 30 )x(12 2 )x4 • Actions: NSEW • Actions: NSEW • States for pathing? • Successor: update location only • Successor: update location 120 and possibly a dot boolean • Goal test: is (x,y)=END • States for eat-all-dots? • Goal test: dots all false 120x(2 30 )

  5. Quiz: Safe Passage State Space Graphs and Search Trees • Problem: eat all dots while keeping the ghosts perma-scared • What does the state space have to specify? • (agent position, dot booleans, power pellet booleans, remaining scared time) State Space Graphs State Space Graphs • State space graph: A mathematical • State space graph: A mathematical G a representation of a search problem representation of a search problem c b • • Nodes are (abstracted) world configurations Nodes are (abstracted) world configurations • • Arcs represent successors (action results) Arcs represent successors (action results) e d • • f The goal test is a set of goal nodes (maybe only one) The goal test is a set of goal nodes (maybe only one) S h • In a state space graph, each state • In a state space graph, p r q occurs only once! each state occurs only once! Tiny state space graph for a tiny • We can rarely build this full graph in • We can rarely build this full graph in memory search problem memory (it’s too big), but it’s a useful idea (it’s too big), but it’s a useful idea

  6. State Space Graphs vs. Search Trees Search Trees This is now / start Each NODE in in State Space Graph “N”, 1.0 “E”, 1.0 Search Tree the search tree is an entire PATH in Possible futures the state space S graph. G e p a d c b q e h r b c e d f h r p q f a a • A search tree: We construct both S h q c on demand – and p q f G p r • A “what if” tree of plans and their outcomes q we construct as a q c G • The start state is the root node little as possible. a • Children correspond to successors • Nodes show states, but correspond to PLANS that achieve those states • For most problems, we can never actually build the whole tree Quiz: State Space Graphs vs. Search Trees Quiz: State Space Graphs vs. Search Trees Consider this 4-state graph: How big is its search tree (from S)? Consider this 4-state graph: How big is its search tree (from S)? s a a a b G G S S b G a G a G b G b b … … Important: Lots of repeated structure in the search tree!

  7. Tree Search Search Example: Romania Searching with a Search Tree General Tree Search • Important ideas: • Expand out potential plans (tree nodes) • Fringe • Maintain a fringe of partial plans under consideration • Expansion • Exploration strategy • Try to expand as few tree nodes as possible • Main question: which fringe nodes to explore?

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

  9. Search Algorithm Properties Search Algorithm Properties • Co Comple lete: Guaranteed to find a solution if one exists? • Opti Optimal: Guaranteed to find the least cost path? • Time complexi xity? y? 1 node • Space complexi xity? y? 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 ) Depth-First Search (DFS) Properties Breadth-First Search • What nodes DFS expand? 1 node b • Some left prefix of the tree. b nodes … b 2 nodes • Could process the whole tree! • 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 (more later) • Is it optimal? • No, it finds the “leftmost” solution, regardless of depth or cost

  10. Breadth-First Search Breadth-First Search (BFS) Properties G Strategy: expand a a • What nodes does BFS expand? shallowest node first c b • Processes all nodes above shallowest solution 1 node e b Implementation: Fringe d f b nodes • Let depth of shallowest solution be s … is a FIFO queue S h s tiers b 2 nodes • Search takes time O(b s ) p r q • How much space does the fringe take? b s nodes S • Has roughly the last tier, so O(b s ) e p d b m nodes • Is it complete? Search q b c e h r • s must be finite if a solution exists, so yes! Tiers h r p q f a a • Is it optimal? q c p q f G • Only if costs are all 1 (more on costs later) a q c G a Quiz: DFS vs BFS Quiz: DFS vs BFS • When will BFS outperform DFS? • When will DFS outperform BFS? [Demo: dfs/bfs maze water (L2D6)]

  11. Video of Demo Maze Water DFS/BFS (part 1) Video of Demo Maze Water DFS/BFS (part 2) Cost-Sensitive Search Iterative Deepening • Id Idea: get DFS’s space advantage with BFS’s GOAL a 2 2 time / shallow-solution advantages b c b 3 • Run a DFS with depth limit 1. If no solution… … 2 1 8 • Run a DFS with depth limit 2. If no solution… 2 e • Run a DFS with depth limit 3. ….. d 3 f 9 8 2 START h 4 2 • Isn’t that wastefully redundant? 1 4 p r 15 • Generally most work happens in the lowest level q searched, so not so bad! BFS finds the sh shortest st path in terms of num number er of of act actions ons . It does not find the least st-cost st path . We will now cover a similar algorithm which does find the least st-cost st path .

Recommend


More recommend