You are on page 1of 25

Planning and Machine

Learning
Planning

Definition:
Planning is the process of computing
several steps of a problem-solving
procedure before executing any of them.
Basic Plan Generation Systems
• Planning problems are hard problems:
• They are certainly non-trivial.
• Solutions involve many aspects that we
have studied so far:
– Search and problem solving strategies.
– Knowledge Representation schemes.
– Problem decomposition -- breaking problem
into smaller pieces and trying to solve these
first.
Blocks World Planning Examples
• What is the Blocks World? -- The world consists of:
• A flat surface such as a tabletop
• An adequate set of identical blocks which are
identified by letters.
• The blocks can be stacked one on one to form
towers of apparently unlimited height.
• The stacking is achieved using a robot arm which
has fundamental operations and states which can
be assessed using logic and combined using logical
operations.
• The robot can hold one block at a time and only one
block can be moved at a time.
Four actions
• UNSTACK(A,B)
-- pick up block A from its current position on block B;
-- the arm must be empty & block A have no blocks on top
of it.
• STACK(A,B)
-- place block A on block B;
-- The arm must already be holding A and surface of B must
be clear
• PICKUP(A)
-- lift block A from the table and hold it.
-- The arm must be empty and there must be nothing on top
of block A
• PUTDOWN(A)
-- place the held block A onto a free space on the table.
Five predicates:
• ON(A,B)
-- block A is on block B.
• ONTABLE(A)
-- block A is on the table.
• CLEAR(A)
-- block A has nothing on top of it.
• HOLDING(A)
-- the arm holds block A.
• ARMEMPTY
-- the arm holds nothing.
• Using logic but not logical notation we can say that
–If the arm is holding a block it is not empty
£x:HOLDING(x) -> ~ARMEMPTY
- If block A is on the table it is not on any other block
Vx:ONTABLE(x) -> ~£y :ON(x,y)
– If block A is on block B, block B is not clear.
Vx: [£y : ON(y,x)] -> ~CLEAR(x)
Why Use the Blocks world as an example?
The blocks world is chosen because:
• it is sufficiently simple and well behaved.
• easily understood
• yet still provides a good sample environment to study planning:
–problems can be broken into nearly distinct subproblems
–we can show how partial solutions need to be combined
to form a realistic complete solution.
.
Planning System Components

Simple problem solving tasks basically involve


the following tasks:
• Choose the best rule based upon heuristics.
• Apply this rule to create a new state.
• Detect when a solution is found.
• Detect dead ends so that they can be avoided.
• Repairing an almost correct solution.
More complex problem solvers often add a fifth
task:
A simple Blocks World Description

ON(A,B,S0) ^
A ONTABLE(B,S0)
B ^ CLEAR(A,S0)
Choice of best rule

Methods used involve


• Finding the differences between the current states
and the goal states and then
• Choosing the rules that reduce these differences
most effectively.
• Means end analysis good example of this.
If we wish to travel by car to visit a friend
• The first thing to do is to fill up the car with fuel.
• If we do not have a car then we need to acquire one.
• The largest difference must be tackled first.
Rule application

• Previously rules could be applied without


any difficulty as complete systems were
specified and rules enabled the system to
progress from one state to the next.
• Now we must be able to handle rules
which only cover parts of systems.
• A number of approaches to this task have
been used.
[CLEAR(x,s) ^ ON(x,y,s)] ->
[HOLDING(x,DO(UNSTACK(x,y),s)) ^
CLEAR(y,DO(UNSTACK(x,y),s))]
If we execute UNSTACK(A,B) in state s0 ,
then in s1
HOLDING(A,S1) ^ CLEAR(B,S1)
Detecting a Solution
• A Planning system has succeeded in
finding a solution to a problem
when it has found a sequence of
operators that transforms the initial
problem state to the goal state
Detecting Dead Ends
• Planning system must be able to detect
when it is exploring a path that can never
lead to a solution
eg : place block A on top of B , but there
is no block B in table
Repairing an Almost Correct
Solution
• Useful in solving decomposable problems
• Proceed to solve the subproblems
separately, then check that when the sub-
solutions are combined, they yield a
solution to the original problem
• If we got the solution, nothing to be done
• If not, throw out the solution, look for
another one
• It leads to great deal of wasted effort
STRIPS
• STanford Research Institute Problem
Solver
• It is a logic-based language designed for
robot problem solving.
• STRIPS maintains a set of world models,
each of which is a set of ground
predicates
A STRIPS operator (analogous to a clause in
predicate calculus) consists of:
• precondition list(P): a set of predicates
that must be true before the operator can
be applied.
• delete list(D): a set of predicates to be
deleted from the world model when the
operator is applied.
• add list(A): a set of predicates to be added
to the world model when the operator is
applied.
STRIPS –Style Operators for Blocks
World
STRIPS operators for a robot arm:
• stack(x, y): 
P: Clear(y) & Holding(x), D: Clear(y)& Holding(x), A:
ARMEMPTY&On(x,y)
• unstack(x, y): 
P:On(x,y)&Clear(x)&Armempty, D: On(x,y)&Armempty,
A: Holding(x)&Clear(y)
• pickup(x): 
P: Clear(x)&Ontable(x)&Armempty,D:
Ontable(x)&Armempty, A:Holding(x)
• putdown(x): 
P: holding(x) , D:Holding(x),A:Ontable(x)&Armempty
• ON(A,B) ^ ONTABLE(B) ^ CLEAR(A)
After applying operator UNSTACK(A,B) ,
description of block world will be

ONTABLE(B)^CLEAR(A)^CLEAR(B)^HOLDI
NG(A)
GOAL STACK PLANNING
• Basic Idea to handle interactive compound goals
uses goal stacks, Here the stack contains :
• goals,
• operators -- ADD, DELETE and PREREQUISITE lists
• a database maintaining the current situation for
each operator used.
• Consider the following where wish to proceed from
the start to goal state.
Goal Stack Planning Example
We can describe the start state:
• ON(B, A)   ONTABLE(A)   ONTABLE(C) 
 ONTABLE(D)   ARMEMPTY
and goal state:
• ON(C, A)   ON(B,D)   ONTABLE(A)   ONTABLE(D)
Initially the goal stack is the goal state.
We then split the problem into four subproblems
Two are solved as they already are true in the
initial state -- ONTABLE(A), ONTABLE(D).
With the other two -- there are two ways to proceed:
ON(C,A)  
ON(B,D)
ON(C,A) ON(B,D) ONTABLE(A) ONTABLE(D)

ON(B,D)  
ON(C,A)
ON(C,A) ON(B,D) ONTABLE(A) ONTABLE(D)

STACK(C,A)
ON(B,D)
ON(C,A) ON(B,D) ONTABLE(A) ONTABLE(D)
• In order to apply STACK(C,A), its preconditions must hold
CLEAR(A)
HOLDING(C)
CLEAR(A) ^ HOLDING(c)
STACK(C,A)
ON(B,D)
ON(C,A) ON(B,D) ONTABLE(A) ONTABLE(D)
To see if clear(A) is true. Need operator UNSTACK(B,A)
ON(B,A)
CLEAR(B)
ARMEMPTY
ON(B,A)^CLEAR(B)^ARMEMPTY
UNSTACK(B,A)
HOLDING(C)
CLEAR(A) ^ HOLDING(c)
STACK(C,A)
ON(B,D)
ON(C,A) ON(B,D) ONTABLE(A) ONTABLE(D)
Top element of the stack is UNSTACK(B,A). Its preconditions
are satisfied
Database corresponds to the world model is
ONTABLE(A) ^
ONTABLE(C)^ONTABLE(D)^HOLDING(B)^CLEAR(A)
GOAL STACK IS
HOLDING(C)
CLEAR(A) ^ HOLDING(c)
STACK(C,A)
ON(B,D)
ON(C,A) ON(B,D) ONTABLE(A) ONTABLE(D)
• Like the above, goal stack will remain
changed and the problem solver return its
answer plan and halt
• Answer plan
UNSTACK(B,A)
STACK(B,D)
PICKUP(C)
STACK(C,A)

You might also like