Notes 10 Planning STRIPs Planning Systems ICS 271

  • Slides: 68
Download presentation
Notes 10: Planning; STRIPs Planning Systems ICS 271 Fall 2008

Notes 10: Planning; STRIPs Planning Systems ICS 271 Fall 2008

Outline: Planning w Situation Calculus w STRIPS Planning w Partial order planning w Planning

Outline: Planning w Situation Calculus w STRIPS Planning w Partial order planning w Planning graphs w Readings: Russel and. Norvig chapter 11, Nillson’s Chapters 21 -22

The Situation Calculus w A goal can be described by a sentence (wff): if

The Situation Calculus w A goal can be described by a sentence (wff): if we want to have a block on B w Planning: finding a set of actions to achieve a goal wff. w Situation Calculus (Mc. Carthy, Hayes, 1969, Green 1969) n n A Predicate Calculus formalization of states, actions, and their effects. So state in the figure can be described by: we reify the state and include them as arguments

The Situation Calculus (continued) w The atoms denotes relations over states called fluents. w

The Situation Calculus (continued) w The atoms denotes relations over states called fluents. w We can also have. w Knowledge about state and actions = predicate calculus theory. w Inferene can be used to answer: n n Is there a state satisfying a goal? How can the present state be transformed into that state by actions? The answer is a plan

Representing Actions w w w Reify the actions: denote an action by a symbol

Representing Actions w w w Reify the actions: denote an action by a symbol actions are functions move(B, A, F 1): move block A from block B to F 1 move (x, y, z) - action schema do: A function constant, do denotes a function that maps actions and states into states n action state

Representing Actions (continued) w Express the effects of actions. n n Example: (on, move)

Representing Actions (continued) w Express the effects of actions. n n Example: (on, move) (expresses the effect of move on “On”) Positive effect axiom: n Positive: describes how action makes a fluent true n Negative : describes how action makes a fluent false n Antecedent: pre-condition for actions n Consequent: how the fluent is changed

Representing Actions (continued) w Effect axioms for (clear, move): (move(x, y, z)) w Precondition

Representing Actions (continued) w Effect axioms for (clear, move): (move(x, y, z)) w Precondition are satisfied with w B/x, A/y, S 0/s, F 1/z w What was true in S 0 remains true .

Frame Axioms w Not everything true can be inferred On(C, F 1) remains true

Frame Axioms w Not everything true can be inferred On(C, F 1) remains true but cannot be inferred w Actions have local effect n n n We need frame axioms for each action and each fluent that does not change as a result of the action example: frame axioms for (move, on) If a block is on another block and move is not relevant, it will stay the same. w Positive: w negative

Frame Axioms n n n (continued) Frame axioms for (move, clear): The frame problem:

Frame Axioms n n n (continued) Frame axioms for (move, clear): The frame problem: need axioms for every pair of {action, fluent}!!! There are languages that embed some assumption on frame axioms that can be derived automatically: w Default logic w Negation as failure w Nonmonotonic reasoning w Minimizing change

Other problems w The qualification problem: qualifying the antecedent for all possible exception. Needs

Other problems w The qualification problem: qualifying the antecedent for all possible exception. Needs to enumerate all exceptions n ~heavy and ~glued and ~armbroken can-move n ~bird and ~cast-in-concrete and ~dead… flies w Solutions: default logics, Non-monotonic logics w The ramification problem: n If a robot carries a package, the package will be where the robot is. But what about the frame axiom, when can we infer about the effect of the actions and when we cannot.

Generating plans w To generate a plan to achieve a goal, w w we

Generating plans w To generate a plan to achieve a goal, w w we attempt to prove Example: Get block B on the floor from S 0. Prove: By resolution refutation: add forall s not On(B, F 1, s) (page 370 top, try it)

Proof w w w w ~On(B, F 1, s) v Ans(s) On(B, A, S

Proof w w w w ~On(B, F 1, s) v Ans(s) On(B, A, S 0) On(A, C, S 0) On(C, F 1, S 0) Clear(B, S 0) Clear(F 1, S 0) [On(x, y, s) / Clear(x, s) / Clear(z, s)/(x not equal y) On(x, z, do(move(x, y, z), s))] w (inequality is negation of equality and we assume infinite supply of (A=A))

Alternative to frame problem STRIPS Planning systems

Alternative to frame problem STRIPS Planning systems

STRIPS: describing goals and state w w w On(B, A) On(A, C) On(C, F

STRIPS: describing goals and state w w w On(B, A) On(A, C) On(C, F 1) Clear(B) Clear(F 1) The formula describes a set of world states Planning search for a formula satisfying a goal description State descriptions: conjunctions of ground literals. Also universal formulas: On(x, y) (y=F 1) or ~Clear(y) Goal wff: Given a goal wff, the search algorithm looks for a sequence of actions That transform into a state description that entails the goal wff.

STRIPS Description of Operators w A STRIPS operator has 3 parts: n A set,

STRIPS Description of Operators w A STRIPS operator has 3 parts: n A set, PC (preconditions) of ground literals n A set D, of ground literals called the delete list n A set A, of ground literals called add list w Usually described by Schema: Move(x, y, z) n n n PC: On(x, y) and Clear(x) and Clear(z) D: Clear(z) , On(x, y) A: On(x, z), Clear(y), Clear(F 1) w A state S 1 is created applying operator O by adding A and deleting D from S 1.

Example: the move operator

Example: the move operator

Strips vs ADL language (ADL: Action Description Language)

Strips vs ADL language (ADL: Action Description Language)

STRIPS formulation for transportation problem In(c, p)- cargo c is inside plane p At(x,

STRIPS formulation for transportation problem In(c, p)- cargo c is inside plane p At(x, a) – object x is at airport a

STRIP for spare tire problem

STRIP for spare tire problem

The block world

The block world

Planning forward and backwords

Planning forward and backwords

Forward Search Methods: can use A* with some h and g

Forward Search Methods: can use A* with some h and g

Recursive STRIPS w Forward search with islands: w Achieve one subgoal at a time.

Recursive STRIPS w Forward search with islands: w Achieve one subgoal at a time. Achieve a new conjunct without ever violating already achieved conjuncts or maybe temporarily violating previous subgoals. w General Problem Solver (GPS) by Newell Shaw and Simon (1959) uses Means-Ends analysis. w Each subgoal is achieved via a matched rule, then its preconditions are subgoals and so on. This leads to a planner called STRIPS(gamma) when gamma is a goal formula.

STRIPS algorithm w Given a goal stack: w 1. Consider the top goal w

STRIPS algorithm w Given a goal stack: w 1. Consider the top goal w 2. Find a sequence of actions satisfying the goal from the current state and apply them. w 3. The next goal is considered from the new state. w 4. Temination: stack empty w 5. Check goals again.

The Sussman annomaly w RSTRIPS cannot achieve shortest plan w Two possible orderings of

The Sussman annomaly w RSTRIPS cannot achieve shortest plan w Two possible orderings of subgoals: n On(A, B) and On(B, C) or On(B, C) and On(A, B)

Backward search methods; w Regressing a ground operator

Backward search methods; w Regressing a ground operator

Regressing an ungrounded operator

Regressing an ungrounded operator

Example of Backward Search

Example of Backward Search

Heuristics for state-space search w Use relax problem idea to get lower bounds on

Heuristics for state-space search w Use relax problem idea to get lower bounds on least number of actions to the goal. n Remove all or some preconditions w Subgoal independence: the cost of solving a set of subgoals equal the sum cost of solving each one independently. n Can be pesimistic (interacting subplans) n Can be optimistic (negative effects) w Simple: number of unsatisfied subgoals. w Various ideas related to removing negative effects or positive effects.

Partial order planning w w w Least commitment planning Nonlinear planning Search in the

Partial order planning w w w Least commitment planning Nonlinear planning Search in the space of partial plans A state is a partial incomplete partially ordered plan Operators transform plans to other plans by: n n n Adding steps Reordering Grounding variables w SNLP: Systematic Nonlinear Planning (Mc. Allester and Rosenblitt 1991) w NONLIN (Tate 1977)

A partial order plan for putting shoes and socks

A partial order plan for putting shoes and socks

State-space vs Plan-space search

State-space vs Plan-space search

Plan-Transforming Operators

Plan-Transforming Operators

STRIPS RULES w w Graph structure Oval nodes are operators Boxed: preconditions Boxed: effects

STRIPS RULES w w Graph structure Oval nodes are operators Boxed: preconditions Boxed: effects

Goal and Initials states are rules w Example: Sussman w Initial plan

Goal and Initials states are rules w Example: Sussman w Initial plan

The next Plan structure w A possible transformation: add a rule to achieve one

The next Plan structure w A possible transformation: add a rule to achieve one of the conjuncts: On(A, B)

A subsequent Plan structure w Attempt to Clear(A) by: move(u, A, v) w Then

A subsequent Plan structure w Attempt to Clear(A) by: move(u, A, v) w Then instantiate u to C and V to F 1 and add correspondence links. w Preconditions of moves are established. Order constraint b < a

Achieving next subgoal: On(B, C) w Add move(B, z, C) w Instantiate z to

Achieving next subgoal: On(B, C) w Add move(B, z, C) w Instantiate z to F 1

Add Threat arcs w An arc from an operator to precondition if the operator

Add Threat arcs w An arc from an operator to precondition if the operator can delete a precondition w Complete plan when we find a consistent set of ordering constraints that discharge threats w We have b<c<a

Solving the flat tire problem by partial planning

Solving the flat tire problem by partial planning

The initial partial plan for Spare tire w From initial plan, pick an open

The initial partial plan for Spare tire w From initial plan, pick an open precond (At(Spare, Axle)) and choose an applicable action (Put. On)) w Pick precond At(Spare, ground) and choose an applicable action Remove(Spare, trunk)

Spare-tire, continued w Pick precond ~At(Flat, Axle) and choose Leaveovernight action. w Because it

Spare-tire, continued w Pick precond ~At(Flat, Axle) and choose Leaveovernight action. w Because it has ~At(Spare, ground) it conflicts with “Remove”, w We add athreat constraint

Flate-tire, continued w Removeovernight doesn’t work so: w Consider ~At(Flat, Axle) and choose Remove(Flat,

Flate-tire, continued w Removeovernight doesn’t work so: w Consider ~At(Flat, Axle) and choose Remove(Flat, axle) w Pick At(Spare, Trunk) precond, and Start to achieve it.

Planning Graphs w A planning graph consists of a sequence of levels that correspond

Planning Graphs w A planning graph consists of a sequence of levels that correspond to time-steps in the plan w w Level 0 is the initial state. Each level contains a set of literals and a set of actions Literals are those that could be true at the time step. Actions are those that their preconditions could be satisfied at the time step. w Works only for propositional planning.

Example: Have cake and eat it too

Example: Have cake and eat it too

The Planning graphs for “have cake”, w w w Persistence actions: Represent “inactions” by

The Planning graphs for “have cake”, w w w Persistence actions: Represent “inactions” by boxes: frame axiom Mutual exclusions (mutex) are represented between literals and actions. S 1 represents multiple states Continue until two levels are identical. The graph levels off. The graph records the impossibility of certain choices using mutex links. Complexity of graph generation: polynomial in number of literals.

Defining Mutex relations w A mutex relation holds between two actions on the same

Defining Mutex relations w A mutex relation holds between two actions on the same level iff any of the following holds: n Inconsistency effect: one action negates the effect of another. Example “eat cake and presistence of have cake” n Interference: One of the effect of one action is the negation of n the precondition of the other. Example: eat cake and persistence of Have cake Competing needs: one of the preconditions of one action is mutually exclusive with a precondition of another. Example: Bake(cake) and Eat(Cake). n A mutex relation holds between 2 literals at the same level iff one is the negation of the other or if each possible pair of actions that can achieve the 2 literals is mutually exclusive.

Planning graphs for heuristic estimation w Estimate the cost of achieving a goal by

Planning graphs for heuristic estimation w Estimate the cost of achieving a goal by the leve in the planning graph where it appears. w To estimate the cost of a conjunction of goals use one of the following: w Max-level: take the maximum level of any goal (admissible) w Sum-cost: Take the sum of levels (inadmissible) w Set-level: find the level where they all appear without Mutex w Graph plans are relaxation of the problem. Rrepresenting more than pair-wise mutex is not cost-effective

The graphplan algorithm

The graphplan algorithm

Planning graph for spare tire a S 2 goal: at(spare, axle) w S 2

Planning graph for spare tire a S 2 goal: at(spare, axle) w S 2 has all goals and no mutex so we can try to extract solutions w Use either CSP algorithm with actions as variables w Or search backwards

Search planning-graph backwards with heuristics w w w How to choose an action during

Search planning-graph backwards with heuristics w w w How to choose an action during backwards search: Use greedy algorithm based on the level cost of the literals. For any set of goals: 1. Pick first the literal with the highest level cost. 2. To achieve the literal, choose the action with the easiest preconditions first (based on sum or max level of precond literals).

Properties of planning graphs; termination w Literals increase monotonically n Once a literal is

Properties of planning graphs; termination w Literals increase monotonically n Once a literal is in a level it will persist to the next level w Actions increase monotonically n Since the precondition of an action was satisfied at a level and literals persist the action’s precond will be satisfied from now on w Mutexes decrease monotonically: n If two actions are mutex at level Si, they will be mutex at all previous levels at which they both appear w Because literals increase and mutex decrease it is guaranteed that we will have a level where all goals are non-mutex

Planning with propositional logic w w Express propositional planning as a set of propositions.

Planning with propositional logic w w Express propositional planning as a set of propositions. w w Unknown propositions are not stated. Index propositions with time steps: On(A, B)_0, ON(B, C)_0 Goal conditions: the goal conjuncts at time T, T is determined arbitrarily. Propositions known not to be true are stated negatively. Actions: a proposition for each action for each time slot. Succesor state axioms need to be expressed for each action (like in the situation calculus but it is propositional)

Planning with propositional logic (continued) w We write the formula: n Initial state and

Planning with propositional logic (continued) w We write the formula: n Initial state and succesor state axioms and goal w We search for a model to the formula. Those actions that are assigned true consititute a plan. w To have a single plan we may have a mutual exclusion for all actions in the same time slot. w We can also choose to allow partial order plans and only write exclusions between actions that interfere with each other. w Planning: iteratively try to find longer and longer plans.

SATplan algorithm

SATplan algorithm

Complexity of satplan w The total number of action symbols is: n |T|x|Act|x|O|^p n

Complexity of satplan w The total number of action symbols is: n |T|x|Act|x|O|^p n O = number of objects, p is scope of atoms. w Number of clauses is higher. w Example: 10 time steps, 12 planes, 30 airports, the complete action exclusion axiom has 583 million clauses. w More information is in project papers

Summary: Planning w w w w Situation Calculus STRIPS Planning Forward and backward planning

Summary: Planning w w w w Situation Calculus STRIPS Planning Forward and backward planning Partial order planning Heirarchical planning Graph planning Satplan Readings: Nillson’s Chapters 21 -22, RN 11