Planning
MODULE6
• Representation for planning-Partial order Planning – Total order
Planning –Learning – Learning - Forms of learning – Choosing the best
hypothesis , Classification and regression
Planning
• Already studied how to take actions in the world (search)
• We studied how to represent objects, relations, etc. (logic)
• Now we will combine the two!
Aim of AI
• “Intelligent” systems, decide themselves
• what to do, and
• how to do it.
• Planning is…
• given what to do (goals),
• determine how (and when) to do it (plan).
• Buying a book –have(x) and buy(x)
• Buying a four book – heuristic function
• The goal is have(a) and have(b) and have(c) and have(d)
• Problem decomposition
Applications
Action choice + resource handling
• for transportation of goods
• at schools, hospitals
• Hubble Space Telescope scheduler
Interactive decision making
• for military operations
• for astronomic observations
• Plan-based interfaces (plan recognition)
Planning problem
• How to get from the current state to your goal state?
Planning involves
• Action selection
• Action sequencing
• Resource handling
Plans can be
• Action sequences
• Policies/strategies (action trees)
Planning problem: find sequence of actions that lead to a goal
Challenges:
– Build a representation language for modeling action and change
– Design of special search algorithms for a given representation
The condition that we want to achieve is called the goal, and the
sequence of actions we seek that will make the goal true is called a plan.
Example : Blocks World
•STRIPS : A planning system – Has rules with
precondition deletion list and addition list
Robot Robot
hand
A hand
C B
A B C
START GOAL
on(B, table) on(C, table)
on(A, table) on(B, C)
on(C, A) on(A, B)
hand empty hand empty
clear(C) clear(A)
clear(B)
Rules
•R1 : pickup(x)
Precondition & Deletion List : handempty,
on(x,table), clear(x)
Add List : holding(x)
•R2 : putdown(x)
Precondition & Deletion List : holding(x)
Add List : handempty, on(x,table), clear(x)
Rules
•R3 : stack(x,y)
Precondition & Deletion List :holding(x), clear(y)
Add List : on(x,y), clear(x), handempty
•R4 : unstack(x,y)
Precondition & Deletion List : on(x,y),
clear(x),handempty
Add List : holding(x), clear(y)
Plan for the block world problem
• For the given problem, Start Goal can be achieved
by the following sequence :
1. Unstack(C,A)
2. Putdown(C)
3. Pickup(B)
4. Stack(B,C)
5. Pickup(A)
6. Stack(A,B)
• Execution of a plan: achieved through a data structure
called Triangular Table.
c
Motivation a b
• In many situations, actions may have Intended
more than one possible outcome outcome
c
• Action failures a b
• e.g., gripper drops its load Grasp
• Exogenous events block c
a b c
• e.g., road closed
Unintended
• Would like to be able to plan in such situations outcome
• One approach: Markov Decision Processes
Planning
Graphs
Planning graphs are an efficient way to create a representation of a
planning problem that can be used to
🞑 Achieve better heuristic estimates
🞑 Directly construct plans
Planning graphs only work for
propositional problems.
Planning
Graphs
Planning graphs consists of a seq of levels
that correspond to time steps in the plan.
🞑 Level 0 is the initial state.
🞑 Each level consists of a set of literals and a set
of actions that represent what might be possible
at that step in the plan
🞑 Might be is the key to efficiency
🞑 Records only a restricted subset of
possible negative interactions among
actions.
Planning Graphs
Each level consists of
Literals = all those that could be true at that
time step, depending upon the actions
executed at preceding time steps.
Actions = all those actions that could have their
preconditions satisfied at that time step,
depending on which of the literals actually hold.
PG Example
Init(Have(Cake))
Goal(Have(Cake) Eaten(Cake))
Action(Eat(Cake),
PRECOND: Have(Cake)
EFFECT: ¬Have(Cake)
Eaten(Cake)) Action(Bake(Cake),
PRECOND: ¬ Have(Cake)
EFFECT: Have(Cake))
PG Example
Create level 0 from initial problem state.
PG Example
Add all applicable actions.
Add all effects to the next state.
PG Example
Add persistence actions (inaction = no-ops)
to map all literals in state Si to state Si+1.
PG Example
Identify mutual exclusions between actions and
literals based on potential conflicts.
Mutual exclusion
A mutex relation holds between two actions
when:
Inconsistent effects: one action negates the effect of another.
🞑
🞑 Interference: one of the effects of one action is the negation of a
precondition of the other.
🞑 Competing needs: one of the preconditions of one action is
mutually
exclusive with the precondition of the other.
A mutex relation holds between two literals
when:
🞑 one is the negation of the other OR
🞑 each possible action pair that could achieve the literals
is mutex (inconsistent support).
Cake example
Level S1 contains all literals that could result from
picking any subset of actions in A0
🞑 Conflicts between literals that can not occur
together (as a consequence of the selection action)
are represented by mutex links.
🞑 S1 defines multiple states and the mutex links are the constraints
that define this set of states.
Cake example
Repeat process until graph levels
off:
🞑 two consecutive levels are identical, or
🞑 contain the same amount of
literals (explanation follows later)
The GRAPHPLAN
Algorithm
Extract a solution directly from the PG
function GRAPHPLAN(problem) return solution or failure
graph INITIAL-PLANNING-GRAPH(problem)
goals GOALS[problem]
loop do
if goals all non-mutex in last level of graph then do
solution EXTRACT-SOLUTION(graph, goals,
LENGTH(graph))
if solution failure then return solution
else if NO-SOLUTION-POSSIBLE(graph) then return
failure
graph EXPAND-GRAPH(graph, problem)
GRAPHPLAN example
Initially the plan consist of 5 literals from the initial state and the CWA literals
(S0).
Add actions whose preconditions are satisfied by EXPAND-GRAPH (A0)
Also add persistence actions and mutex relations.
Add the effects at level S1
Repeat until goal is in level Si
GRAPHPLAN example
EXPAND-GRAPH also looks for mutex relations
🞑 Inconsistent effects
E.g. Remove(Spare, Trunk) and LeaveOverNight due to At(Spare,Ground) and not At(Spare, Ground)
🞑 Interference
E.g. Remove(Flat, Axle) and LeaveOverNight At(Flat, Axle) as PRECOND and not At(Flat,Axle) as
EFFECT
🞑 Competing needs
E.g. PutOn(Spare,Axle) and Remove(Flat, Axle) due to At([Link]) and not At(Flat, Axle)
🞑 Inconsistent support
E.g. in S2, At(Spare,Axle) and At(Flat,Axle)
GRAPHPLAN example
In S2, the goal literals exist and are not mutex with any
other
🞑 Solution might exist and EXTRACT-SOLUTION will try to find it
EXTRACT-SOLUTION can use Boolean CSP to solve the
problem or a search process:
🞑 Initial state = last level of PG and goal goals of planning
problem
🞑 Actions = select any set of non-conflicting actions that
cover the goals in the state
🞑 Goal = reach level S0 such that all goals are satisfied
GRAPHPLAN
Termination
Termination? YES
PG are monotonically increasing or decreasing:
🞑 Literals increase monotonically
🞑 Actions increase monotonically
🞑 Mutexes decrease monotonically
Because of these properties and because there
is a finite number of actions and literals, every
PG will eventually level off
Dinner Date example
Initial Conditions: (and (garbage) (cleanHands) (quiet))
Goal: (and (dinner) (present) (not (garbage))
Actions:
• 🞑 Cook :precondition (cleanHands)
• :effect (dinner)
:effect (present)
• 🞑 Wrap :precondition (quiet)
🞑 Carry :precondition
:effect (and (not (garbage)) (not (cleanHands))
🞑 Dolly :precondition
:effect (and (not (garbage)) (not (quiet)))
Dinner Date example
Dinner Date example
Dinner Date example
Rocket domain
Planning Graph
Example Rocket
problem