upcoming assignments cs 4100 artificial intelligence
play

Upcoming Assignments CS 4100: Artificial Intelligence Due Tue 10 - PDF document

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 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)]

  2. 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 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 • Goal test: is (x,y)=END and possibly a dot boolean • States for eat-all-dots? • Goal test: dots all false 120x(2 30 )

  3. 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 • • The goal test is a set of goal nodes (maybe only one) The goal test is a set of goal nodes (maybe only one) f 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 Search Trees State Space Graphs vs. 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 S the state space graph. G e p a d b c q b c e h r e d f a a h r p q f • 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 S G S G b G a G a G b G b b … … Important: Lots of repeated structure in the search tree!

  4. 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? Example: Tree Search Example: Tree Search G G a a b c c 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 e h r b c s à d à 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 Implementation: e e 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 a a h r p q f q c p q f G a q c G a

  5. 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? • Space complexi 1 node 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 Breadth-First Search Breadth-First Search (BFS) Properties Strategy: expand a G a • What nodes does BFS expand? c shallowest node first 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 b s nodes • How much space does the fringe take? 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 a a h r p q f • 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)]

Recommend


More recommend