Chapter 16 Planning Methods
Chapter 16 Contents (1) • STRIPS • STRIPS Implementation • Partial Order Planning • The Principle of Least Commitment • Propositional Planning • SAT Planning
Chapter 16 Contents (2) • Planning Graphs • GraphPlan • ADL and PDDL • Probabilistic Planning • Dynamic World Planning • Case-Based Planning • Scheduling
STRIPS (1) • Stanford Research Institute Problem Solver. • An operator based planning system. • STRIPS uses wffs in FOPC to describe the world. • For example: • STRIPS was designed to enable a planner to devise plans for a robot to solve problems in the blocks world.
STRIPS (2) • STRIPS defines operators as in the following rule schemata: Precondition: AT(r, x) Λ AT(o, x) Delete: AT(r, x) AT(o, x) Add: AT(r, y) AT(o, y) • The preconditions specify what must be true for the operator to be applied. • The delete and add lists specify the changes that will take place after the operator is applied.
STRIPS Implementation • STRIPS uses resolution and means-ends analysis to devise plans: • The goal is negated, and the rule schemata are instantiated with objects from the real world. • If the resolution fails, then the goal has been achieved. • Otherwise, a plan is devised.
Example 1 • Three blocks – a,b,c • Block a on table, block b is on c • Predicates • On(x,y) means x is on y • Clear(x) means x has no block on top of it • t is the table • Goal On(c,a) get c on a
Example 2 • Start state On(a,t) On(b,c) On(c,t) Clear(b) Clear(a) Clear(t)
Example 3 • Operators • MoveOnto(x,y) move x onto top y • Preconditions On(x,z) Λ Clear(x) Λ Clear(y) • Delete On(x,z), Clear(y) • Add On(x,y), Clear(z) • moveOntoTable(x) • Preconditions On(x,y) Λ Clear(x) • Delete On(x,y) • Add On(x,t) Clear(y)
Example 4 • Approaches • Forward chaining – search forward through the space of possible plans until we find one • Build tree – first move choices • MoveOnto(a,b) • MoveOnto(b,a) • MoveOntoTable(b)
Example 5 • Choose MoveOntoTable(b) • Preconditions On(b,y) Λ Clear(b) matched by instantiating y with c. • Apply • Delete: On(b,c) • Add: On(b,t), Clear(c)
Example 6 • Current state description On(a,t) On(b,t) On(c,t) Clear(b) Clear(a) Clear(c) Clear(t)
Example 7 • Applicable moves MoveOnto(a,b) MoveOnto(a,c) MoveOnto(b,a) MoveOnto(b,c) MoveOnto(c,a) MoveOnto(c,b)
Example comments • Continue in this manner until a suitable plan is found • Does not use means-ends analysis • Works only for small problems • Could enhance by using backward chaining – MoveOntoTable(b) has the effect of clearing c, which helps • Used unification and resolution
Partial Order Planning (1) • A total order plan specifies the order in which all actions must be carried out. • A partial order plan can specify some actions in parallel – these actions can be carried out in any order relative to each other.
Partial Order Planning (2) • A partial order plan can be implemented in one of several ways. • The partial order plan on the left is implemented in one of two ways, shown in the total order plans, center and right:
The Principle of Least Commitment • In building a plan there will be some variables and objects that can be ignored, as they are superfluous to the goal of the plan. • Some variables do not need to be instantiated – for example it is preferable, where possible, to use MoveOnto (a, y) than to use MoveOnto (a, b). • This is the Principle of Least Commitment.
Propositional Planning (1) • Any STRIPS plan can be expressed in propositional logic. • This will often involve increasing the number of variables.
Propositional Planning (2) • Any STRIPS plan can be expressed in propositional logic. • This will often involve increasing the number of variables. For example: Clear (x) On (x, y) • These predicates can be represented as propositions: X1 is equivalent to Clear (A) X2 is equivalent to Clear (B) X3 is equivalent to On (A, B) X4 is equivalent to On (B, A)
Propositional Planning (3) • States can be represented as an assignment of truth values to the propositions: X1 Λ ¬X2 Λ X3 Λ ¬ X4 • This state can be represented in STRIPS notation as: Clear (A) Λ ¬Clear (B) Λ On (A, B) Λ ¬On (B, A) • The following sentence represents all states in which A is clear and B is not clear: X1 Λ ¬X2
Propositional Planning (4) • Actions can also be represented as the preconditions and the results of the action. • We use the notation ¬X1’ to indicate that X1’ is no longer true after the action. • Hence, an action might be: X1 Λ X2 Λ ¬X3 Λ ¬X4 Λ X1’ Λ ¬X2’ Λ X3’ Λ ¬X4’ • This action is MoveOnto (A, B). • This is a simple example, but propositional planning can lead to very complex expressions being used. • The advantage of using propositional planning is that automated systems can be built to manipulate the plans. • Requires n2 variables for n blocks
Satisfiability (SAT) Planning • The satisfiability problem, of determining whether a given propositional logic sentence is satisfiable or not, is NP-Complete. • A number of efficient methods have been developed for devising plans by determining the satisfiability of propositional logic expressions. • Methods are either systematic, which involve checking all possible assignments of truth values, or stochastic.
Planning Graphs (1) • Even-numbered levels represent states. Odd-numbered levels actions. • Level 0 contains the propositions that represent the start state. The arrows from level 0 to level 1 show how those propositions match the preconditions of the actions in level 1. • All possible actions are shown in the graph.
Planning Graphs (2) • The partial planning graph shown includes persistence actions (things which do not change) as lines with squares on. • The heavy black lines show mutexes: • Two propositions joined by such a line are mutually exclusive, and cannot both be used in the same plan.
Planning Graphs (3) • The planning graph for even a simple problem can be extremely complex. • By producing a complete planning graph for a problem, it can be determined whether a plan is possible, and the plan itself can also be derived. • Algorithms such as GraphPlan can be used to extract the plan.
GraphPlan • Problems are expressed in STRIPS notation. • GraphPlan iteratively builds a planning graph, starting from the initial state and working towards the goal state. • All applicable operators are applied at each level to produce the next level . • When the propositions necessary for the goal are included in the current level, and they are not mutex, a possible solution may have been reached.
ADL • Another method for representing planning problems. • ADL – Action Description Language: • More expressive than STRIPS. • Allows quantified expressions such as: x.P(x) Λ ¬ Q(x) • Preconditions can include disjunctions. • Allows conditional effects – effects of actions that are dependent on other factors.
Probabilistic Planning • Thus far we have assumed that all actions are deterministic. • In fact, some actions are non-deterministic – their effects can vary. • It is possible to extend situation calculus to deal with non-deterministic actions.
Dynamic World Planning • Our discussion so far has assumed the world is static. • In fact, the world is dynamic – things outside of the control of the planner change. • Execution monitoring is used to monitor the execution of plans: • If something changes during execution, replanning may be necessary. • Another approach is conditional planning – this includes every possible outcome in the plan.
Case-Based Planning • Case-based planning involves storing each plan that is devised. • Plans (and partial plans) can be re-used later to solve other, similar problems. • Example: CHEF. A system that is used to devise recipes for Chinese food given a set of ingredients. • If presented with a set of ingredients it has not seen before, it is able to use similar sets of ingredients it has seen before to devise a new recipe.
Scheduling • Scheduling is like planning, but also takes into account the length of time each action takes to execute. • Job-shop scheduling involves allocating machinery to a set of tasks. • The scheduler plans when each task will start, and how long it will take. • Scheduling can be treated as planning with constraints, where the constraints specify how long tasks will take.