Chap : Planning
BY PRATYUSA MUKHERJEE, ASSISTANT PROFESSOR (II)
KIIT DEEMED TO BE UNIVERSITY
AI NOTES BY PRATYUSA MUKHERJEE 1
Planning
•Planning stands for devising a plan of action to achieve one’s goals—is a critical part
of AI.
•The problem-solving agent can find sequences of actions that result in a goal state.
But it deals with atomic representations of states and thus needs good domain-
specific heuristics to perform well.
•The hybrid propositional logical agent can find plans without domain-specific
heuristics because it uses domain-independent heuristics based on the logical
structure of the problem.
•Planning researchers have settled on a factored representation— one in which a
state of the world is represented by a collection of variables.
•We use a language called PDDL, the Planning Domain Definition Language, that
allows us to express all actions with one action schema.
AI NOTES BY PRATYUSA MUKHERJEE 2
Cpmponents of PDDL
PDDL describes the four things we need to define a search problem:
•the initial state,
•the actions that are available in a state,
•the result of applying an action,
•the goal test.
AI NOTES BY PRATYUSA MUKHERJEE 3
States in PDDL
•Each state is represented as a conjunction of fluents that are ground, functionless
atoms.
oFor example, Poor ∧ Unknown might represent the state of a hapless agent, and a state in
a package delivery problem might be At(Truck 1, Melbourne) ∧ At(Truck 2, Sydney).
• Any fluents that are not mentioned are false.
• Use unique names means that Truck 1 and Truck 2 are distinct.
•The following fluents are not allowed in a state:
o At(x, y) (because it is non-ground),
o¬Poor (because it is a negation),
oAt(Father (Fred ), Sydney) (because it uses a function symbol).
AI NOTES BY PRATYUSA MUKHERJEE 4
Actions in PDDL
•Actions are described by a set of action schemas that implicitly define the
ACTIONS(s) and RESULT(s, a) functions needed to do a problem-solving search.
For example, here is an action schema for flying a plane from one location to another:
Action(Fly(p, from, to),
PRECOND:At(p, from) ∧ Plane(p) ∧ Airport (from) ∧ Airport (to)
EFFECT: ¬At(p, from) ∧ At(p, to))
•Thus. the schema consists of the action name, a list of all the variables used in the
schema, a precondition and an effect.
•The precondition defines the states in which the action can be executed, and the
effect defines the result of executing the action. We say that action a is
APPLICABLE in state s if the preconditions are satisfied by s.
AI NOTES BY PRATYUSA MUKHERJEE 5
Example 1: Air cargo transport
•It involves loading and unloading cargo and flying it from place to place.
•The problem can be defined with three actions: Load , Unload, and Fly.
•The actions affect two predicates: In(c, p) means that cargo c is inside plane p, and At(x, a)
means that object x (either plane or cargo) is at airport a.
•A little bit more detail of At predicate:
oWhen a plane flies from one airport to another, all the cargo inside the plane goes with it. In first-order
logic it would be easy to quantify over all objects that are inside the plane. But basic PDDL does not
have a universal quantifier, so we need a different solution.
oThe approach we use is to say that a piece of cargo ceases to be At anywhere when it is In a plane; the
cargo only becomes At the new airport when it is unloaded.
oSo At really means “available for use at a given location.”
• An example :
[Load (C1, P1, SFO), Fly(P1, SFO, JFK),Unload(C1, P1, JFK),
Load (C2, P2, JFK), Fly(P2, JFK, SFO),Unload(C2, P2, SFO)] .
AI NOTES BY PRATYUSA MUKHERJEE 6
AI NOTES BY PRATYUSA MUKHERJEE 7
Example 2: The spare tire problem
•Consider the problem of changing a flat tire.
•The goal is to have a good spare tire properly mounted onto the car’s axle, where
the initial state has a flat tire on the axle and a good spare tire in the trunk.
•There are just four actions: removing the spare from the trunk, removing the flat tire
from the axle, putting the spare on the axle, and leaving the car unattended
overnight.
•We assume that the car is parked in a particularly bad neighborhood, so that the effect of
leaving it overnight is that the tires disappear.
•A solution to the problem is [Remove(Flat , Axle), Remove(Spare, Trunk ),
PutOn(Spare, Axle)].
AI NOTES BY PRATYUSA MUKHERJEE 8
AI NOTES BY PRATYUSA MUKHERJEE 9
Example 3: The blocks world
•It consists of a set of cube-shaped blocks
sitting on a table.
•The blocks can be stacked, but only one
block can fit directly on top of another.
•A robot arm can pick up a block and move
it to another position, either on the table or
on top of another block.
•The arm can pick up only one block at a
time, so it cannot pick up a block that has
another one on it.
•The goal will always be to build one or
more stacks of blocks, specified in terms
of what blocks are on top of what other
blocks.
AI NOTES BY PRATYUSA MUKHERJEE 10
• We use On(b, x) to indicate that block b is on x, where x is either another block or the table.
• The action for moving block b from the top of x to the top of y will be Move(b, x, y). Planner can
use Move(b, x, Table) instead of MoveToTable(b, x).
• predicate Clear (x) that is true when nothing is on x which means there is a clear space on x to
hold a block. Thus, Clear (Table) will always be true
AI NOTES BY PRATYUSA MUKHERJEE 11
Partial Order Planning
In AI, partial-order planning (POP) is a method for constructing plans where
actions are arranged with only the necessary ordering constraints, allowing
flexibility and multiple valid execution sequences.
Unlike total-order planners, POP doesn't force a strict order on all actions, but
rather allows them to remain unordered unless dependencies dictate otherwise.
12
Eg: Simple problem of
putting on a pair of shoes
13
DAA NOTES BY PRATYUSA MUKHERJEE 14