{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

ch10 - Search vs planning Consider the task get milk...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Search vs. planning Consider the task get milk, bananas, and a cordless drill Standard search algorithms seem to fail miserably: Talk to Parrot Planning Go To Pet Store Go To School Go To Supermarket Go To Sleep Read A Book Sit in Chair Etc. Etc. ... Buy a Dog Go To Class Buy Tuna Fish Buy Arugula Buy Milk Sit Some More Read A Book Chapter 10 Start ... Finish ... After-the-fact heuristic/goal test inadequate Chapter 10 1 Chapter 10 3 Outline Search vs. planning STRIPS operators Partial-order planning Search vs. planning contd. Planning systems do the following: 1) open up action and goal representation to allow selection 2) divide-and-conquer by subgoaling 3) relax requirement for sequential construction of solutions States Actions Goal f Plan Search Lisp data structures Lisp code Lisp code Sequence from S0 Planning Logical sentences Preconditions/outcomes Logical sentence (conjunction) Constraints on actions Chapter 10 2 Chapter 10 4 STRIPS operators Tidily arranged actions descriptions, restricted language Action: Buy(x) Precondition: At(p), Sells(p, x) Effect: Have(x) [Note: this abstracts away many important details!] Restricted language efficient algorithm Precondition: conjunction of positive literals Effect: conjunction of literals postive effect: add literals negative effect: remove literals (negated literals) At(p) Sells(p,x) Buy(x) Backward State-space Search aka Regression Planning similar to Backward Chaining Difficult if the goal is described as constraints (e.g. 4 gallons in the large jug)--potentially many goal states. A goal can be divided into sub-goals (children). State-space formulation Initial State: goal state Actions: operations that can acheive the goal/sub-goal not undo any super-goals [parent goals/preconditions] succesors: sub-goals (unsatisfied precoditions) Goal test: no sub-goals (no unsatisfied preconditions) Chapter 10 5 Chapter 10 7 Have(x) Forward State-space Search aka Progression Planning similar to Forward Chaining State-space formulation Initial State: initial KB Actions: operators whose preconditions are satisfied successors: postive effect: add literals negative effect: remove literals Goal test: goal state Step cost: typically 1 Relaxed problem Admissible Heuristics remove all precoditions--every action is applicable remove all negative effects--no action removes a literal (note that the goal is a conjuction of literals) subgoal independence--achieving one subgoal does not affect achieving another subgoal Chapter 10 6 Chapter 10 8 Keeping track of changeSituation Calculus Facts hold in situations, rather than eternally E.g., Holding(Gold, N ow) rather than just Holding(Gold) Situation calculus is one way to represent change in FOL: Adds a situation argument to each non-eternal predicate E.g., N ow in Holding(Gold, N ow) denotes a situation Situations are connected by the Result function Result(a, s) is the situation that results from doing a in s PIT Gold Describing actions II Successor-state axioms solve the representational frame problem Each axiom is "about" a predicate (not an action per se): P true afterwards [an action made P true P true already and no action made P false] PIT For holding the gold: a, s Holding(Gold, Result(a, s)) [(a = Grab AtGold(s)) (Holding(Gold, s) a = Release)] PIT PIT Gold PIT S1 PIT S0 Forward Chapter 10 9 Chapter 10 11 Describing actions I "Effect" axiom--describe changes due to action s AtGold(s) Holding(Gold, Result(Grab, s)) "Frame" axiom--describe non-changes due to action s HaveArrow(s) HaveArrow(Result(Grab, s)) Frame problem: find an elegant way to handle non-change (a) representation--avoid frame axioms (b) inference--avoid repeated "copy-overs" to keep track of state Qualification problem: true descriptions of real actions require endless caveats-- what if gold is slippery or nailed down or . . . Ramification problem: real actions have many secondary consequences-- what about the dust on the gold, wear and tear on gloves, . . . Making Plans Initial condition in KB: At(Agent, [1, 1], S0) At(Gold, [1, 2], S0) Query: Ask(KB, s Holding(Gold, s)) i.e., in what situation will I be holding the gold? Answer: {s/Result(Grab, Result(F orward, S0))} i.e., go forward and then grab the gold This assumes that the agent is interested in plans starting at S0 and that S0 is the only situation described in the KB Chapter 10 10 Chapter 10 12 Making plans: A better way Represent plans as action sequences [a1, a2, . . . , an] P lanResult(p, s) is the result of executing p in s Then the query Ask(KB, p Holding(Gold, P lanResult(p, S0))) has the solution {p/[F orward, Grab]} Definition of P lanResult in terms of Result: s P lanResult([ ], s) = s a, p, s P lanResult([a|p], s) = P lanResult(p, Result(a, s)) Planning systems are special-purpose reasoners designed to do this type of inference more efficiently than a general-purpose reasoner Partial Order Planning Start Start Left Sock Right Sock LeftShoeOn, RightShoeOn LeftSockOn RightSockOn Finish Left Shoe Right Shoe LeftShoeOn, RightShoeOn Finish Chapter 10 13 Chapter 10 15 Partial Order Planning sequential planning: forward (or backward) step-by-step search Consider planning a trip to New York by flying 1. start with finding how to get from home to the Melboune airport 2. start with finding how to get from the New York airport to hotel 3. start with finding a plane ticket from Melbourne to New York least commitment strategy--delay making committments to steps that are less important/constrained Components of Partial Order Planning Actions "Start" action: no preconditions, effects = initial state "Finish" action: preconditions = goal state, no effects (regular) actions with precondtions and effects Ordering contraints between actions A B: A is before B (partial order) Lef tSock Lef tShoe Causal links from effect of one action to the precondition of another c A - B: A acheives precondition c for B tSockOn Lef tSock Lef- Lef tShoe other actions cannot conflict with the causal link: Lef tSockOn Open preconditions not acheived by any action yet planner: add actions until there are no open preconditions Chapter 10 14 Chapter 10 16 Example Start At(Home) Sells(HWS,Drill) Sells(SM,Milk) Sells(SM,Ban.) Example Start At(Home) Go(HWS) At(HWS) Sells(HWS,Drill) Buy(Drill) At(HWS) Go(SM) At(SM) Sells(SM,Milk) Buy(Milk) At(SM) Sells(SM,Ban.) Buy(Ban.) At(SM) Go(Home) Have(Milk) At(Home) Have(Ban.) Have(Drill) Finish Chapter 10 17 Have(Milk) At(Home) Have(Ban.) Have(Drill) Finish Chapter 10 19 Example Start At(Home) Sells(HWS,Drill) Sells(SM,Milk) Sells(SM,Ban.) Planning process Operators on partial plans: add a link from an existing action to an open condition add a step to fulfill an open condition order one step wrt another to remove possible conflicts Gradually move from incomplete/vague plans to complete, correct plans Backtrack if an open condition is unachievable or if a conflict is unresolvable Topological Sorting in graphs At(HWS) Sells(HWS,Drill) Buy(Drill) At(x) Go(SM) At(SM) Sells(SM,Milk) Buy(Milk) Have(Milk) At(Home) Have(Ban.) Have(Drill) Finish Chapter 10 18 Chapter 10 20 POP algorithm sketch function POP(initial, goal, operators) returns plan plan Make-Minimal-Plan(initial, goal) loop do if Solution?( plan) then return plan Sneed , c Select-Subgoal( plan) Choose-Operator( plan, operators, Sneed, c) Resolve-Threats( plan) end function Select-Subgoal( plan) returns Sneed , c pick a plan step Sneed from Steps( plan) with a precondition c that has not been achieved return Sneed , c Clobbering and promotion/demotion A clobberer is a potentially intervening step that destroys the condition achieved by a causal link. E.g., Go(Home) clobbers At(Supermarket): DEMOTION Go(Supermarket) Demotion: put before Go(Supermarket) Go(Home) At(Home) At(Supermarket) Buy(Milk) Promotion: put after Buy(M ilk) At(Home) PROMOTION Finish Chapter 10 21 Chapter 10 23 POP algorithm contd. procedure Choose-Operator(plan, operators, Sneed, c) choose a step Sadd from operators or Steps( plan) that has c as an effect if there is no such step then fail c add the causal link Sadd - Sneed to Links( plan) add the ordering constraint Sadd Sneed to Orderings( plan) if Sadd is a newly added step from operators then add Sadd to Steps( plan) add Start Sadd F inish to Orderings( plan) procedure Resolve-Threats(plan) c for each Sthreat that threatens a link Si - Sj in Links( plan) do choose either Demotion: Add Sthreat Si to Orderings( plan) Promotion: Add Sj Sthreat to Orderings( plan) if not Consistent( plan) then fail end Properties of POP Nondeterministic algorithm: backtracks at choice points on failure: choice of Sadd to achieve Sneed choice of demotion or promotion for clobberer selection of Sneed is irrevocable POP is sound, complete, and systematic (no repetition) Extensions for disjunction, universals, negation, conditionals Can be made efficient with good heuristics derived from problem description Particularly good for problems with many loosely related subgoals Chapter 10 22 Chapter 10 24 Example: Blocks world "Sussman anomaly" problem Example contd. C A B C START On(C,A) On(A,Table) Cl(B) On(B,Table) Cl(C) B A C B A Start State Goal State Clear(x) On(x,z) Clear(y) Clear(x) On(x,z) PutOn(x,y) ~On(x,z) ~Clear(y) Clear(z) On(x,y) PutOnTable(x) ~On(x,z) Clear(z) On(x,Table) Cl(B) On(B,z) Cl(C) PutOn(B,C) + several inequality constraints [Linear planners (find a plan for each subgoal and concatenate the plans) can't find a solution] On(A,B) On(B,C) A B C FINISH Chapter 10 25 Chapter 10 27 Example contd. C Example contd. C B A START On(C,A) On(A,Table) Cl(B) On(B,Table) Cl(C) START On(C,A) On(A,Table) Cl(B) On(B,Table) Cl(C) B A PutOn(A,B) clobbers Cl(B) => order after PutOn(B,C) Cl(B) On(B,z) Cl(C) Cl(A) On(A,z) Cl(B) PutOn(B,C) PutOn(A,B) On(A,B) On(B,C) A B C On(A,B) On(B,C) A B C FINISH FINISH Chapter 10 26 Chapter 10 28 Example contd. C START On(C,A) On(A,Table) Cl(B) On(B,Table) Cl(C) B A On(C,z) Cl(C) PutOn(A,B) clobbers Cl(B) => order after PutOn(B,C) PutOn(B,C) clobbers Cl(C) => order after PutOnTable(C) PutOnTable(C) Cl(B) On(B,z) Cl(C) Cl(A) On(A,z) Cl(B) PutOn(B,C) PutOn(A,B) On(A,B) On(B,C) A B C FINISH Chapter 10 29 Heuristics Which open precondition to choose? most constrained open precondition can be satisfied in the fewest number of ways can provide substantial speedups if it can't be satisfied, stop early and return fail if it can be satisfied by only one way, no choice anyhow and can reduce the number of possibilities later on Chapter 10 30 ...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online