Part IV — Deliberative control · Chapter 14

Planning: STRIPS and beyond

~50 min read2 interactive widgets2 plates

In this chapter

  1. Planning in AI, and the two special cases in robotics
  2. Basic ingredients of planning
  3. Plans: sequences, contingencies, and the three uses
  4. Planning as search in state space, and A*'s limits
  5. STRIPS: representation
  6. The STRIPS algorithm
  7. Example: the blocks world
  8. Example: fetching a box
  9. Generalized plans and PLANEX
  10. Planning graphs and conditional planning
  11. Check your understanding

1. Planning in AI, and the two special cases in robotics

The planning problem

Given a set of moves, an initial state of the world and a goal (final state), find a sequence of moves to execute so as to attain the goal.

Examples: a puzzle; path planning; the assembly of a complex artefact (e.g. a car); the control of complex experimental equipment (e.g. the Hubble Space Telescope).

A fundamental need in robotics is to have algorithms that convert high-level specifications of tasks from humans into low-level descriptions of how to move. Two special cases:

Bibliographic support of the deck: S.M. LaValle, Planning Algorithms (Cambridge University Press, 2006, freely downloadable); Russell & Norvig, chapters 11–12; the SRI report on Shakey; and Fikes, Hart and Nilsson, Learning and Executing Generalized Robot Plans, Artificial Intelligence 3 (1972) — the paper of section 9.

2. Basic ingredients of planning

IngredientWhat it is
StateThe state space captures all possible situations that could arise: position and orientation of a robot, locations of tiles in a puzzle, position and velocity of a helicopter. Both discrete (finite or countably infinite) and continuous (uncountably infinite) state spaces are possible; in most applications the size of the state space is much too large to be explicitly represented
TimeAll planning problems involve a sequence of decisions applied over time. Time may be explicit (driving as quickly as possible through an obstacle course) or implicit (actions must follow in succession; the particular speed is not specified in the plan)
ActionsA plan generates actions that manipulate the state; the formulation must specify how the state changes when actions are applied — a state-valued function for discrete time, or an ordinary differential equation for continuous time
Initial and goal statesA planning problem usually starts in some initial state and tries to arrive at a specified goal state, or any state in a set of goal states
CriterionEncodes the desired outcome in terms of state and actions: feasibility (find a plan that reaches a goal state, regardless of efficiency) or optimality (find a feasible plan that optimises performance in a carefully specified manner)
PlanImposes a specific strategy or behaviour on a decision maker

3. Plans: sequences, contingencies, and the three uses

A plan may simply specify a sequence of actions; however, it could be more complicated. If it is impossible to predict future states, the plan may specify actions as a function of statecontingency plans, where the appropriate action is determined from whatever information is available up to the current time (an information state, on which the actions of a plan are conditioned).

Once a plan is determined, there are three ways to use it:

  1. Execution: execute it either in simulation or in a mechanical device (robot) connected to the physical world;
  2. Refinement: refine it into a better and more detailed plan;
  3. Hierarchical inclusion: encapsulate it as an atomic (possibly parametric) action in a higher-level plan.
Editor note

Point 3 is how Shakey's plans became Shakey's knowledge: a solved plan, generalised and stored, becomes a macro-action usable inside new plans — the learning mechanism of section 9. Hierarchical inclusion is also the bridge to behaviour composition: the "actions" a plan manipulates are the same "actions" Chapter 6 defined as simpler than behaviours. The levels just nest.

4. Planning as search in state space, and A*'s limits

Classical planning problems are solved by A* (Chapter 13). But A* has limitations that planning must overcome:

A possible solution: a language tailored to planning problems, and backward search — i.e. goal oriented. The prominent case: STRIPS — the STanford Research Institute Problem Solver, developed for Shakey.

5. STRIPS: representation

States and goals

States and goals are defined as conjunctions of literals. E.g. on(alpha,beta) ∧ onTable(beta) means "block alpha is on block beta and block beta is on the table".

Actions

Each operator is described by three entities:

putdown(Block1,Block2):
  PRECOND:  clear(Block2) ∧ holding(Block1)
  ADD LIST: on(Block1,Block2) ∧ empty
  DELETE LIST: clear(Block2) ∧ holding(Block1)

In the Shakey system (Fikes, Hart & Nilsson, 1972), the robot's knowledge of the world is stored in a model composed of well-formed formulas (wffs) in the predicate calculus — e.g. the robot knows there is a doorway D1 between rooms R1 and R2 by the presence of the wff CONNECTS-ROOMS(D1,R1,R2). Tasks are given as predicate calculus wffs; to direct the robot to go to room R2, we pose the goal wff INROOM(ROBOT,R2). Operators transform one model into another: applying an (assumed applicable) operator deletes from the model all clauses in its delete list and adds all clauses in its add list.

A STRIPS OPERATOR TRANSFORMS THE MODEL PRECONDITION what must hold before the action can be executed EFFECTS ADD LIST: what becomes true DELETE LIST: what becomes false delete, then add MODEL world wffs
Plate 14.1 — The STRIPS operator as a state transformer. The representation is deliberately limited: conjunctions of literals, no negation as a first-class operator, deterministic effects. The limits buy the goal-oriented search of the next section.

6. The STRIPS algorithm

The main idea: start from the goal and find a relevant action that leads to the goal, i.e. whose effects prove the goal or a subgoal; the preconditions of this action then become the new goal to be proved; the process iterates until the incumbent goal can be directly proved in the current state of the world.

Issues: the goal is in general a conjunction of subgoals → STRIPS tries to satisfy one subgoal at a time; the order in which subgoals are considered is non-deterministic and affects the efficiency, as backtracking might occur; the choice of relevant actions is also non-deterministic, so backtracking might occur there too.

Search algorithm data structures: two data structures — the current state S and a stack of goals. Init: push goal on stack. Stop: empty stack (if not, no more actions to be tried ↔ the instance has no solution with the formulation provided — e.g. because the actions are not sufficient).

1  Select a subgoal and try to establish that it is true in the current
   state. If it is so, go to Step 4. Otherwise:
2  Choose as a relevant action one whose add list specifies clauses
   that allow the incomplete proof of Step 1 to be continued.
3  The appropriately instantiated precondition of the selected
   operator constitutes a new subgoal. Go to Step 1.
4  If the subgoal is the main goal, terminate. Otherwise, remove the
   subgoal from the stack. If now an action is at the top of the
   stack, apply it and change the state S accordingly. Go to Step 1.

Observations from the deck: STRIPS gives good results on rather simple problems; in some cases it is inefficient (see Sussman's anomaly, where satisfying the subgoals one at a time in the wrong order forces backtracking); it might not terminate (in the case of a contradictory goal). Improvements: plan generalisation and failure detection and replanning.

7. Example: the blocks world

The blocks world: a world composed of blocks that can be piled up by a gripper ("hand"), with simple goals, simple actions, deterministic and with complete information.

Widget — Blocks world: you are the planner

State: A on table, B on A, C on table; hand empty. Goal: on(C,B) ∧ on(B,A). Apply actions and validate them against preconditions, exactly as STRIPS would — but here you choose the order.

8. Example: fetching a box

The classic Shakey example (Fikes et al., 1972): the robot has to retrieve a box from an adjacent room. Initial model M0:

INROOM(ROBOT, R1)
CONNECTS(D1, R1, R2)
CONNECTS(D2, R2, R3)
BOX(BOX1)
INROOM(BOX1, R2)

Goal G0: ∃x [ BOX(x) ∧ INROOM(x, R1) ] — a box in room R1. The two operators (schema variables in lower case, constants in upper case):

GOTHRU(d, r1, r2)         robot goes through Door d from Room r1 into Room r2
  PRECOND:  INROOM(ROBOT, r1) ∧ CONNECTS(d, r1, r2)
  DELETE:   INROOM(ROBOT, $)        (any clause with this predicate form)
  ADD:      INROOM(ROBOT, r2)

PUSHTHRU(b, d, r1, r2)    robot pushes Object b through Door d from Room r1 into Room r2
  PRECOND:  INROOM(b, r1) ∧ INROOM(ROBOT, r1) ∧ CONNECTS(d, r1, r2)
  DELETE:   INROOM(ROBOT, $), INROOM(b, $)
  ADD:      INROOM(ROBOT, r2), INROOM(b, r2)

The STRIPS trace, condensed:

  1. Try to prove the overall goal G0 — fails in the current state.
  2. Find a relevant action: PUSHTHRU can satisfy INROOM(BOX1,R1).
  3. Push PUSHTHRU(BOX1,d,r1,R1) on the stack, then its preconditions INROOM(BOX1,r1) ∧ INROOM(ROBOT,r1) ∧ CONNECTS(d,r1,R1) — call this G1.
  4. G1 is not globally satisfied, so satisfy one subgoal at a time: INROOM(BOX1,r1) with r1 = R2; CONNECTS(d,R2,R1) with d = D1. Hence the subgoal INROOM(ROBOT,R2) — in the add list of GOTHRU, so push GOTHRU(d,r1,R2) and its preconditions.
  5. The new top goal G2: INROOM(ROBOT,r1) ∧ CONNECTS(d,r1,R2) — provable with r1 = R1, d = D1.
  6. Execute GOTHRU(D1,R1,R2); the current state changes.
  7. The remaining stack [INROOM(BOX1,R2) ∧ INROOM(ROBOT,R2) ∧ CONNECTS(D1,R2,R1), PUSHTHRU(BOX1,D1,R2,R1), BOX(x) ∧ INROOM(x,R1)]: the top goal is now satisfied in the current state, so pop.
  8. Execute PUSHTHRU(BOX1,D1,R2,R1). The new state satisfies the main goal with x = BOX1. Stack empty: stop.

Solution: GOTHRU(D1,R1,R2), PUSHTHRU(BOX1,D1,R2,R1).

Widget — The STRIPS stack, step by step

Replay the fetching-box trace. The highlighted entry is the subgoal currently being worked; the note explains the decision — relevance, instantiation, or execution.

9. Generalized plans and PLANEX

The 1972 paper describes major additions to STRIPS: a process for generalizing a plan produced by STRIPS so that problem-specific constants are replaced by problem-independent parameters. The generalized plan, stored in a convenient format called a triangle table, has two functions: as a single macro action usable by STRIPS (in whole or in part) during the solution of a subsequent problem; and as the basis of PLANEX, the process that monitors the real-world execution of a plan and allows the robot to react "intelligently" to unexpected consequences of actions.

The scenario: the robot is given the task "close window WIND1 and turn off light LITE1". It decides to push box BOX1 to the window, climb on it, close the window, then turn off the light. The system generalizes this specific plan to produce a plan that can, under certain specified conditions, close an arbitrary window and turn off an arbitrary light. During execution, suppose the robot fails to push BOX1 to the window because another box is already under it: PLANEX recognizes that the new box will serve the purpose that BOX1 was to serve, and plan execution proceeds — reexecuting the offending actions with different arguments rather than repeating identically.

Given a new problem, "close window WIND5 and lock door DOOR1", the system recognises that a portion of the old generalized plan can help: the sequence of component actions to close the window is obtained as a single macro action, and the planning time is thereby reduced. Generalisation thus becomes a powerful form of learning: it reduces planning time for similar tasks and allows the formation of much longer plans, previously beyond the combinatoric capabilities of STRIPS.

For the exam — the two ideas to keep

First, macro-actions: a generalised plan is stored and reused as a single component of new plans — planning time for similar tasks drops and longer plans become reachable. Second, execution monitoring: PLANEX supervises execution and, on failure, reexecutes actions with different arguments instead of restarting from scratch. Both are answers to the drawbacks of section 2 (time-scale, unmodelled changes) — and both reappear, in different clothes, as behaviour composition in Part II and as hierarchy in behaviour trees (Chapter 8).

10. Planning graphs and conditional planning

Planning graphs

A planning graph consists of a sequence of levels that correspond to time steps; each level contains alternatively states or actions. Constraints among states and actions are posted, and CSP solvers are used to find a feasible plan. The graph encodes, level by level, what is possibly true and which actions are possibly applicable, plus mutual-exclusion constraints between incompatible literals/actions — a structure that both upper-bounds the plan length and prunes the search.

Conditional planning

Here the solution is a policy instead of a sequence of actions: a policy specifies what actions to take from which state. Specific actions are introduced to check the state — they are sensing actions. There is no need of replanning, as in principle all the possible plans are combined in a tree structure. Drawbacks: (a) computationally expensive, and (b) — the deck cuts off here, but the direction is clear — the tree of contingencies can grow without bound, which is exactly why conditional planning remains limited to small domains and why the course's reactive alternative (Part II) exists at all.

SEQUENCE vs POLICY CLASSICAL PLAN — a sequence a1 a2 a3 goal assumes the world evolves as predicted CONDITIONAL PLAN — a policy sense a4 a5 if state S1 if state S2 no replanning needed — all contingencies are in the tree
Plate 14.2 — The two kinds of solution. A classical plan is a sequence that assumes prediction; a conditional plan is a policy whose branches are selected by sensing actions. The price of the policy is computational expense — the tree of contingencies grows with the uncertainty of the world.

Check your understanding

State the planning problem and the two special cases in robotics.

Given a set of moves, an initial state of the world and a goal (final state), find a sequence of moves to execute so as to attain the goal. In robotics: motion planning (e.g. the Piano Mover's Problem — a continuous path among obstacles) and trajectory planning (executing the motion planner's actions in a sound and safe way, taking into account dynamics and constraints, with the contribution of control theory).

List the basic ingredients of planning.

State (the state space capturing all possible situations; often too large to be explicitly represented); time (explicit or implicit); actions (with a specification of how the state changes — state-valued function for discrete time, ODE for continuous); initial and goal states; a criterion (feasibility or optimality); a plan (sequence of actions, or actions as a function of state — contingency plans).

Give the three ways to use a plan.

Execution (in simulation or on a real robot); refinement (into a better and more detailed plan); hierarchical inclusion (encapsulate it as an atomic, possibly parametric, action in a higher-level plan).

What are A*'s limitations as a planning method, and what is the proposed solution?

Forward search explores too many useless nodes; language expressiveness is limited; heuristics have low effectiveness for typical planning problems; decomposition is not exploited. The solution: a language tailored to planning problems and backward (goal-oriented) search — the prominent case being STRIPS.

Describe STRIPS representation: states, goals, actions.

States and goals are conjunctions of literals (e.g. on(alpha,beta) ∧ onTable(beta)). Each operator has preconditions (conjunction of literals that must hold before execution), an add list (what becomes true) and a delete list (what becomes false). Applying an operator deletes the delete-list clauses from the model and adds the add-list clauses.

Explain the STRIPS algorithm: main idea, data structures, and the four steps.

Main idea: start from the goal, find a relevant action whose effects prove the goal or a subgoal, make its preconditions the new goal, iterate until the incumbent goal is provable in the current state. Data structures: current state S and a stack of goals (init: push goal; stop: empty stack). Steps: (1) try to establish a subgoal in the current state; if not, (2) choose a relevant action whose add list continues the proof, (3) push the instantiated precondition as a new subgoal; (4) if the subgoal is the main goal terminate, else pop it and, if an action is on top, apply it and update S.

What are the known issues of STRIPS?

Good results on simple problems; inefficient in some cases (Sussman's anomaly — satisfying conjunctive subgoals one at a time in the wrong order forces backtracking); might not terminate (contradictory goal). Improvements: plan generalisation and failure detection and replanning.

Work out the fetching-box example: operators, trace, solution.

Operators GOTHRU(d,r1,r2) (precond INROOM(ROBOT,r1) ∧ CONNECTS(d,r1,r2); deletes INROOM(ROBOT,$); adds INROOM(ROBOT,r2)) and PUSHTHRU(b,d,r1,r2) (precond INROOM(b,r1) ∧ INROOM(ROBOT,r1) ∧ CONNECTS(d,r1,r2); adds INROOM(ROBOT,r2) and INROOM(b,r2)). Goal: ∃x BOX(x) ∧ INROOM(x,R1). STRIPS pushes PUSHTHRU and its preconditions, satisfies subgoals with r1=R2, d=D1, pushes GOTHRU and its preconditions (provable with r1=R1, d=D1), executes GOTHRU(D1,R1,R2), pops the satisfied top goal, executes PUSHTHRU(BOX1,D1,R2,R1). Solution: GOTHRU(D1,R1,R2), PUSHTHRU(BOX1,D1,R2,R1).

What are generalized plans and macro-actions, and what is PLANEX?

STRIPS generalises a produced plan by replacing problem-specific constants with parameters; the generalized plan is stored in a triangle table. As a macro action it can be used (whole or in part) to solve new problems, reducing planning time and enabling longer plans — a powerful form of learning. PLANEX is the process that monitors real-world plan execution, allowing the robot to react to unexpected consequences (e.g. reexecuting actions with different arguments, as in the close-window scenario).

Describe planning graphs.

A planning graph is a sequence of levels corresponding to time steps; each level contains alternately states or actions. Constraints among states and actions are posted (including mutual exclusions), and CSP solvers are used to find a feasible plan.

Describe conditional planning and its drawbacks.

The solution is a policy instead of a sequence of actions: it specifies what actions to take from which state, with specific sensing actions to check the state. No replanning is needed since all possible plans are combined in a tree structure. Drawbacks: computationally expensive, and the tree of contingencies can grow without bound.