Automated Planning 7 AI Slides (6e) c � Lin Zuoquan@PKU 1998-2020 7 1
7 Automated Planning 7.1 The planning problem 7.2 STRIPS operators 7.3 PDDL (Planning Domain Definition Language) 7.4 Situation calculus 7.5 Partial-order planning 7.6 Conditional planning ∗ 7.7 Replanning ∗ AI Slides (6e) c � Lin Zuoquan@PKU 1998-2020 7 2
The planning problem function Simple-Planning-Agent ( percept ) returns an action persistent : KB , a knowledge base (includes action descriptions) p , a plan, initially NoPlan t , a counter, initially 0, indicating time local variables : G , a goal current , a current state description Tell ( KB , Make-Percept-Sentence ( percept, t )) current ← State-Description ( KB, t ) if p = NoPlan then G ← Ask ( KB , Make-Goal-Query ( t )) p ← Ideal-Planner ( current , G , KB ) if p = NoPlan or p is empty then action ← NoOp else action ← First ( p ) p ← Rest ( p ) Tell ( KB , Make-Action-Sentence ( action, t )) t ← t + 1 return action AI Slides (6e) c � Lin Zuoquan@PKU 1998-2020 7 3
Search vs. planning Consider the task get milk, bananas, and a cordless drill Standard search algorithms seem to fail miserably: Talk to Parrot Go To Pet Store Buy a Dog Go To School Go To Class Go To Supermarket Buy Tuna Fish Start Go To Sleep Buy Arugula Read A Book Buy Milk ... Finish Sit in Chair Sit Some More Etc. Etc. ... Read A Book . . . After-the-fact heuristic/goal test inadequate AI Slides (6e) c � Lin Zuoquan@PKU 1998-2020 7 4
State space vs. plan space Standard search: node = concrete world state Planning search: node = partial plan Open condition is a precondition of a step not yet fulfilled Operators (actions) 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 Gradually move from incomplete/vague plans to complete, correct plans AI Slides (6e) c � Lin Zuoquan@PKU 1998-2020 7 5
Search vs. planning 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 Search Planning Lisp data structures Logical sentences States Actions Lisp code Preconditions/outcomes Lisp code Logical sentence (conjunction) Goal Sequence from S 0 Constraints on actions Plan AI Slides (6e) c � Lin Zuoquan@PKU 1998-2020 7 6
Planning as state space search Planning as a search problem: search from the initial state through the space of states, looking for a goal Algorithms for planning: – Progression : forward state-space search – Regression : backward relevant-space search Heuristics for planning: need to find good domain-specific heuristics for planning problems AI Slides (6e) c � Lin Zuoquan@PKU 1998-2020 7 7
STRIPS operators Restricted planning language, tidily arranged actions descriptions Action : Buy ( x ) Precondition : At ( p ) , Sells ( p, x ) Effect : Have ( x ) At(p) Sells(p,x) Buy(x) Note: this abstracts away many important details Have(x) Restricted language ⇒ efficient algorithm Precondition: conjunction of positive literals Effect: conjunction of literals Hint: A complete set of STRIPS operators can be translated into a set of successor-state axioms (see later) AI Slides (6e) c � Lin Zuoquan@PKU 1998-2020 7 8
PDDL PDDL (Planning Domain Definition Language) extends STRIPS by allowing preconditions and goals in negative literals State: a conjunction of fluents that are ground, functionless atoms Actions: a set of action schema that is a set of ground actions E.g., Action : Fly ( p, from, to ) , Precond : At ( p, from ) ∧ Plane ( p ) ∧ Airport ( from ) ∧ Airport ( to ) Effect : ¬ At ( p, from ) ∧ At ( p, to ) The preconditon and effect are conjunctions of literals that may con- tain variables The action schema lifts the level of reasoning from propositional logic to a restriced subset of first-order logic AI Slides (6e) c � Lin Zuoquan@PKU 1998-2020 7 9
PDDL The result of executing action a in state s is a state s ′ Del( a ) : deleting fluents that appear as negative literals in the action’s effects Add( a ) : adding the fluents that are positive literals in the ac- tion’s effects Result ( s, a ) = ( s − Del ( a )) ∪ Add ( a ) A planning domain is defined by a set of action schemas – A planning problem within the domain: initial state and a goal (conjunctions of literals) By propositionalization of the action schema we can use a proposi- tional solver (say SATPlan) to find a solution The complexity of planning decision problems are in class of PSPACE AI Slides (6e) c � Lin Zuoquan@PKU 1998-2020 7 10
Situation Calculus Situation calculus is a dialect of FOL to represent change by actions – situations: add a situation argument to non-eternal predicates E.g., now in Holding ( gold, now ) denotes a situation – actions: e.g., pickup ( r, x ) robot r picks up object x PIT PIT Gold PIT PIT PIT Gold S 1 PIT Forward S 0 AI Slides (6e) c � Lin Zuoquan@PKU 1998-2020 7 11
The language: situations Let L be a first-order language with especially – constant: an initial situation S 0 – terms: situations s 1 , s 2 , · · · – function symbol: do – predicate symbol: Poss Facts hold in situations, rather than eternally e.g., Holding ( gold, now ) rather than just Holding ( gold ) Situations, denoting possible world histories a distinguished constant S 0 and function symbol do are used – S 0 : the initial situation, before any actions have been performed – do ( a, s ) (or result ( a, s ) ): the situation that results from doing action a in situation s E.g., do ( put ( A, B ) , do ( put ( B, C ) , S 0 )) the situation that results from putting A on B after putting B on C in the initial situation AI Slides (6e) c � Lin Zuoquan@PKU 1998-2020 7 12
The language: fluents A function or predicate (relations) that can vary from one situation to the next is a fluent – written function/predicate whose last argument is a situation E.g., Holding ( r, x, s ) : robot r is holding object x in situation s A distinguished predicate symbol Poss ( a, s ) is used to state that a may be performed in s E.g., Poss ( pickup ( r, x ) , S 0 ) it is possible for the robot r to pickup object x in the initial situation AI Slides (6e) c � Lin Zuoquan@PKU 1998-2020 7 13
Actions It is necessary to include in a KB not only facts about the initial situation, but also about world dynamics Actions typically have preconditions: what needs to be true for the action to be performed E.g., Poss ( pickup ( r, x ) , s ) ⇔ ∀ z. ¬ Holding ( r, z, s ) ∧¬ Heavy ( x ) ∧ NextTo ( r, x, s ) a robot can pickup an object iff it is not holding anything, the object is not too heavy, and the robot is next to the object Actions typically have effects: the fluents that change as the result of performing the action E.g., Fragile ( x ) ⇒ Broken ( x, do ( drop ( r, x ) , s )) dropping a fragile object causes it to break ∀ s AtGold ( s ) ⇒ Holding ( Gold, do ( grab, s )) called effect axioms AI Slides (6e) c � Lin Zuoquan@PKU 1998-2020 7 14
The frame problem What fluents are unaffected (non-changes) by performing an action ∀ s HaveArrow ( s ) ⇒ HaveArrow ( do ( grab,s )) called frame axioms Frame problem: find an elegant way to handle non-change (a) representation – avoid frame axioms a vast number of such axioms ; most leave then invariant (b) reasoning – 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, . . . AI Slides (6e) c � Lin Zuoquan@PKU 1998-2020 7 15
The frame problem Solutions – Building a KB to write down all the effect axioms for each fluent F and action A that can cause the truth value of F to change, an axiom of the form R ( s ) ⇒ F ( do ( A, s )) (and R ( s ) ⇒ ¬ F ( do ( A, s )) ), where R ( s ) is some condition on s – Want a systematic procedure for generating all the frame axioms from these effect axioms – If possible, also want a parsimonious representation for them (since in their simplest form, there are too many) Frame axioms are necessary to reason about actions and are not en- tailed by the other axioms AI Slides (6e) c � Lin Zuoquan@PKU 1998-2020 7 16
Normal form for effect axioms Suppose there are two positive effect axioms for the fluent Broken Fragile ( x ) ⇒ Broken ( x, do ( drop ( r, x ) , s )) NextTo ( b, x, s ) ⇒ Broken ( x, do ( explode ( b ) , s )) These can be rewritten as ∃ r { a = drop ( r, x ) ∧ Fragile ( x ) }∨∃ b { a = explode ( b ) ∧ NextTo ( b, x, s ) } ⇒ Broken ( x, do ( a, s )) Similarly, consider the negative effect axiom ¬ Broken ( x, do ( repair ( r, x ) , s )) which can be rewritten as ∃ r { a = repair ( r, x ) } ⇒ ¬ Broken ( x, do ( a, s )) AI Slides (6e) c � Lin Zuoquan@PKU 1998-2020 7 17
Normal form for effect axioms In general, for any fluent F , rewrite all the effect axioms as as two formulas of the form (1) P F ( x , a, s ) ⇒ F ( x , do ( a, s )) (2) N F ( x , a, s ) ⇒ ¬ F ( x , do ( a, s )) where P F ( x , a, s ) and N F ( x , a, s ) are formulas whose free vari- ables are among the x i , a , and s ( x = ( x 1 , . . . , x n ) ) AI Slides (6e) c � Lin Zuoquan@PKU 1998-2020 7 18
Recommend
More recommend