1 / 37

CSE P573 Introduction to Artificial Intelligence Class 1 Planning & Search

This class introduces planning and search concepts in artificial intelligence. Topics include classical planning, route planning, and applications of AI techniques. Techniques covered include state-space search, constraint satisfaction, and planning algorithms.

migdaliar
Télécharger la présentation

CSE P573 Introduction to Artificial Intelligence Class 1 Planning & Search

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSE P573Introduction to Artificial Intelligence Class 1 Planning & Search Henry Kautz Autumn 2004

  2. Tonight • (6:40) What is artificial intelligence? • (7:00) Outline of course • (7:10) Planning • (7:20) State-space search • (7:40) Constraint satisfaction • (8:00) Exercise: creating & solving planning problems

  3. What is Artificial Intelligence?

  4. Outline of Course • Topics • search & planning • game playing • logic & knowledge representation • natural language processing • probabilistic reasoning • robotics • rule learning • neural networks • reinforcement learning • local search & genetic algorithms • Textbook • Russell & Norvig, Artificial Intelligence, A Modern Approach, 2nd Ed • Skim before class; re-read afterward • Coursework • weekly assignments (80%) • take home final (20%) • Information • http://www.cs.washington.edu/education/courses/csep573/04au/

  5. Planning • Input • Description of initial state of world • Description of goal state(s) • Description of available actions • Optional: Cost for each action • Output • Sequence of actions that converts the initial state into a goal state • May wish to minimizelength or cost of plan

  6. Classical Planning • Atomic time • Deterministic actions • Complete knowledge • No numeric reward (just goals) • Only planner changes world

  7. Route Planning • State = intersection • Operators = block between intersections • Operator cost = length of block

  8. Blocks World • Control a robot arm that can pick up and stack blocks. • Arm can hold exactly one block • Blocks can either be on the table, or on top of exactly one other block • State = configuration of blocks • { (on-table G), (on B G), (clear B), (holding R) } • Operator = pick up or put down a block • (put-down R) put on table • (stack R B) put on another block

  9. State Space • Planning = Finding (shortest) paths in state graph put-down(R) stack(R,B) pick-up(R) pick-up(G) stack(G,R)

  10. STRIPS Representation • (define (domain prodigy-bw) • (:requirements :strips) • (:predicates • (on ?x ?y) • (on-table ?x) • (clear ?x) • (arm-empty) • (holding ?x))

  11. Problem Instance • (define (problem bw-sussman) • (:domain prodigy-bw) • (:objects A B C) • (:init • (on-table a) (on-table b) (on c a) • (clear b) (clear c) (arm-empty)) • (:goal • (and (on a b) (on b c)))) goal may be a partial description

  12. Operator Schemas • (:action stack • :parameters (?obj ?under_obj) • :precondition • (and (holding ?obj) (clear ?under_obj)) • :effect • (and (not (holding ?obj)) • (not (clear ?under_obj)) • (clear ?obj) • (arm-empty) • (on ?obj ?under_obj))) add effects – make true delete effects – make false

  13. Blocks World Blackbox Planner Demo

  14. Planning Algorithms • Direct Space-State Search • Depth-First • Breadth-First • Best-First • A* • Constraint Satisfaction • Davis-Putnam Procedure

  15. A General Search Algorithm • Search( Start, Goal_test, Criteria ) • Open = { Start }; Closed = { }; • repeat • if (empty(Open)) return fail; • select Node from Open using Criteria; • if (Goal_test(Node)) return Node; • for each Child of node do • if (Child not in Closed) • Open = Open U { Child }; • Closed = Closed U { Node }; Closed list optional

  16. Breadth-First Search • Search( Start, Goal_test, Criteria ) • Open = { Start }; Closed = { }; • repeat • if (empty(Open)) return fail; • select Node from Open using Criteria; • if (Goal_test(Node)) return Node; • for each Child of node do • if (Child not in Closed) • Open = Open U { Child }; • Closed = Closed U { Node }; Criteria = shortest distance from Start

  17. Depth-First Search • Search( Start, Goal_test, Criteria ) • Open = { Start }; Closed = { }; • repeat • if (empty(Open)) return fail; • select Node from Open using Criteria; • if (Goal_test(Node)) return Node; • for each Child of node do • if (Child not in Closed) • Open = Open U { Child }; • Closed = Closed U { Node }; Criteria = most recently visited (implies: greatest distance from Start)

  18. Best-First Search • Search( Start, Goal_test, Criteria ) • Open = { Start }; Closed = { }; • repeat • if (empty(Open)) return fail; • select Node from Open using Criteria; • if (Goal_test(Node)) return Node; • for each Child of node do • if (Child not in Closed) • Open = Open U { Child }; • Closed = Closed U { Node }; Criteria = shortest estimated (heuristic) distance to goal

  19. Best-First with Manhattan Distance ( x+  y) Heuristic 53nd St 52nd St G 51st St S 50th St 10th Ave 9th Ave 8th Ave 7th Ave 6th Ave 5th Ave 4th Ave 2nd Ave 3rd Ave

  20. Non-Optimality of Best-First 53nd St 52nd St S G 51st St 50th St 10th Ave 9th Ave 8th Ave 7th Ave 6th Ave 5th Ave 4th Ave 2nd Ave 3rd Ave

  21. Properties • Depth First • Simple implementation (stack) • Might not terminate • Might find non-optimal solution • Breadth First • Always terminates if solution exists • Finds optimal solutions • Visits many nodes • Best First • Always terminates if heuristic is “reasonable” • Visits many fewer nodes • May find non-optimal solution

  22. A* • Criteria: minimize (distance from start) + (estimated distance to goal) • Implementation: priority queue • f(n) = g(n) + h(n) • f(n) = priority of a node • g(n) = true distance from start • h(n) = heuristic distance to goal

  23. Optimality of A* • Suppose the estimated distance is alwaysless than or equal to the true distance to the goal • heuristic is a lower bound • heuristic is admissible • Then: when the goal is removed from the priority queue, we are guaranteed to have found a shortest path!

  24. Maze Runner Demo

  25. Planning Heuristics • General idea: solve an easier “relaxed” problem • Blocks World • Number of blocks out of place • Ignores complication of “trapped” blocks • General STRIPS Planning • Number of false goal propositions(not admissible) • Delete all preconditions from actions;solve easier relaxed problem;use length of solution(admissible)

  26. Tonight • (6:40) What is artificial intelligence? • (7:00) Outline of course • (7:10) Planning • (7:20) State-space search • (7:40) Constraint satisfaction • (8:00) Exercise: creating & solving planning problems

  27. Constraint Propagation Problems(CSP)

  28. Constraint Satisfaction • Find assignment(s) to a set of variables that satisfies (makes true) a set of constraints on those variables • Example: variables = real numbers • constraints = linear equations • x + 2y + z = 3 x – y + z = 0 -x - y – 2z = 7 • Satisfied byx=10, y=1, z=-9

  29. Constraint Satisfaction • Find assignment(s) to a set of variables that satisfies (makes true) a set of constraints on those variables • Example: variable = true/false (Boolean) • constraints = propositional logic formulas • (x  y) (x  z) (y  z) • Satisfied by{x=False, y=True, z=True} • {x=True, y=False, z=True} • {x=True, y=True, z=True}

  30. Constraint Satisfaction • Find assignment(s) to a set of variables that satisfies (makes true) a set of constraints on those variables • Example: variable = true/false (Boolean) • constraints = propositional logic formulas • (x  y) (x  z) (y  z) • Satisfied by{x=0, y=1, z=1} • {x=1, y=0, z=1} • {x=1, y=1, z=1}

  31. Special Syntactic Forms • General propositional logic ((q r)  s))   (s  t) • Conjunction Normal Form (CNF) ( q  r  s )  ( s   t) • Binary clauses: 2 literals per clause ( q  r) ( s   t) • Unit clauses: 1 literal per clause ( q) (s)

  32. Planning as a Logical CSP • Choose a maximum time step K • Variables for each ground fact for each time step: (on R B 1) (on R B 2) (on R B 3) • Variables for each ground action for each time step: (pick-up R 1) (pick-up R 2) (pick-up R 3)

  33. Initial & Goal State Formulas • Assert initial state hold at time 1 • Variables for each ground fact for each time step: (on R B 1)  (on B G 1)  (on-table G 1)  (hand-empty)  (clear R 1) • Assert goals hold at time K (e.g. 5) (on R G 5)

  34. Action Formulas • For each time step: If an action occurs, its preconditions hold (pickup R 3)  (on-table R 3) (pickup R 3)  (hand-empty 3) • For each time step after the first:If a fact holds, it was either just added by an action or maintained from the previous state (on R G 3)  [ (stack R G 2)  (maintain (on R G) 2) ] • The precondition of maintain is that fact: (maintain (on R G) 3)  (on R G 2) (maintain (on-table R) 3)  (on-table R 2)

  35. Mutual Exclusion Formulas • Actions and maintains whose preconditions or effects conflict cannot happen at the same time (pickup R 3) (pickup G 3) (pickup R 3) (pickup B 3) (pickup R 3) (maintain (hand-empty) 3) (pickup R 3) (maintain (on-table R) 3) • That’s it! • The TRUE action variables in a satisfying solution are a plan! • SATPLAN – Winner of 2004 AI Planning System Competition

  36. Solving SAT: Davis-Putnam DPLL( wff ): for each unit clause (P) [resp. (P)] set P to true [resp. to false] simplify other clauses if empty clause thenreturn false if no clause left thenreturn solution choose a unassigned variable Q if DPLL( wff U {(Q)} ) return solution elsereturn DPLL( wff U {(Q)} ) • Backtrack search over partial variable assignments • Worst case O(2n)

  37. In-Class Exercise • Form groups of 3 • Open a browser on • http://www.cs.washington.edu/education/courses/csep573 • Follow: Lectures & Assignments, Shakey Domain • Launch x-windows and ssh • Login to attu • Launch: xterm& xterm& • In one xterm: cd /cse/courses/csep573/04au/planning/blocks blackbox -o domain.pddl –f bw-sussman.pddl • (8:30) SHARE representation • (8:50) SHARE solutions

More Related