download

Matakuliah
Tahun
Versi
: T0264/Intelijensia Semu
: Juli 2006
: 2/1
Pertemuan 17
Planning
1
Learning Outcomes
Pada akhir pertemuan ini, diharapkan mahasiswa
akan mampu :
• << TIK-99 >>
• << TIK-99>>
2
Outline Materi
•
•
•
•
•
Materi 1
Materi 2
Materi 3
Materi 4
Materi 5
3
13.1. Overview
• Often the problem that must be solved is divided
into smaller pieces and to solve those pieces
separately.
• The word Planning refers to the process of the
computing several steps of the problem-solving
procedure before executing any of them.
• This methods focus on way of decomposing the
original problem into appropriate subparts and on
way of recording and handling interactions among
the subparts as they are detected during the
problem-solving process.
4
Overview
•
Decomposability
•
Predictability
•
Plan failures
•
Planning vs. doing
5
Components of a Planning System
•
•
•
•
•
Choose the best rule to apply next based on
the best available heuristic information.
Apply the chosen rule to compute the new
problem state that arises from its application.
Detect when a solution has been found.
Detect dead ends so that they can be
abandoned and the system’s effort directed in
more fruitful directions.
Detect when an almost correct solution has
been found and employ special techniques to
make it totally correct.
6
13.2. An Example Domain
The Blocks World
Operators :
• UNSTACK(A,B)  Pick up block A from its current
position on block B. The arm must be empty and
block A must have no blocks on top of it.
• STACK(A,B)  Place block A on block B. The
arm must already be holding A and the surface of
B must be clear.
• PICKUP(A)  Pick Up 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)  Put block A down on the table.
The arm must have been holding block A.
7
The Blocks World
Predicates :
• ON(A,B)  Block A is on block B.
• ONTABLE(A)  Block A is on the table.
• CLEAR(A)  There is nothing on top of block A.
• HOLDING(A)  The arm is holding block A.
• ARMEMPTY The arm is holding nothing.
Inference rules :
• - x : HOLDING(x)  ARMEMPTY
• - x : ONTABLE(x)  Y : y ON(x,y)
• - x : y : ON(y,x)  CLEAR(x)
8
The Blocks World
• A Simple Blocks World Description
ON(A,B,S0)
ONTTABLE(B,S0)
CLEAR(A,S0)
9
The Blocks World
• STRIPS-Style Operators for the Blocks World
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
10
The Blocks World
A
B
We start with the situation shown and we would describe it as:
ON(A,B)  ONTABLE(B)  CLEAR(A)
After applying the operator UNSTACK(A,B), our description of
the world would be :
ONTABLE(B)  CLEAR(A)  CLEAR(B)  HOLDING(A)
11
The Blocks World
• A Simple Search Tree
ONTABLE(B) 
CLEAR(A) 
CLEAR(B) 
ONTABLE(A)
12
13.4. Goal Stack Planning
• Goal stack planning is one of the earliest
techniques to be developed for solving compound
goal that may interact was the use of a goal stack.
• This was the approach used by STRIPS.
• The problem solver makes use of a single stack
that contains both goals and operator that have
been proposed to satisfy those goals.
13
Goal Stack Planning
• The goal-stack planning method attacks problem
involving conjoined goal by solving the goal one
at a time, in order.
• A plan generated by this method contains a
sequence of operators of operator for attaining
the first goal, followed by a complete sequence
for the second goal, etc.
14
Goal Stack Planning
• A Very Simple Blocks World Problem
Start : ON(B,A) 
Goal : ON(C,A) 
ONTABLE(A) 
ON(B,D) 
ONTABLE(C) 
ONTABLE(A) 
ONTABLE(D) 
ONTABLE(D)
ARMEMPTY
15
Goal Stack Planning
•
Initial goal stack :
ON(C,A)  ON(B,D)  ONTABLE(A)  ONTABLE(D)
•
Choose to work on ON(C,A) before ON(B,D) :
ON(C,A)
ON(B,D)
ON(C,A)  ON(B,D)  OTAD
•
Achieve ON(C,A) with STACK(C,A) :
STACK(C,A)
ON(B,D)
ON(C,A)  ON(B,D)  OTAD
16
Goal Stack Planning
•
Add STACK’s preconditions :
CLEAR(A)
HOLDING(C)
CLEAR(A)  HOLDING(C)
STACK(C,A)
ON(B,D)
ON(C,A)  ON(B,D)  OTAD
17
Goal Stack Planning
• Achieve CLEAR(A) with 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)  OTAD
18
Goal Stack Planning
• Now the top element of the stack is the operator
UNSTACK(B,A).
• Now guaranteed that its preconditions are satisfied, so it
can be applied to produce a new world model from which
the rest of the problem-solving process can continue.
• Meanwhile we record that UNSTACK(B,A) is the first
operator of proposed solution sequence.
• At this point, the database corresponding to the world
model is :
• ONTABLE(A)  ONTABLE(C)  ONTABLE(D) 
HOLDING(B)  CLEAR(A)
19
Goal Stack Planning
•
The goal stack now is :
HOLDING(C)
CLEAR(A)  HOLDING(C)
STACK(C,A)
ON(B,D)
ON(C,A)  ON(B,D)  OTAD
20
Goal Stack Planning
•
Achieve HOLDING(C) with PICKUP(C)
ONTABLE(C)
CLEAR(C)
ARMEMPTY
ONTABLE(C)  CLEAR(C)  ARMEMPTY
PICKUP(C)
CLEAR(A)  HOLDING(C)
STACK(C,A)
ON(B,D)
ON(C,A)  ON(B,D)  OTAD
21
Goal Stack Planning
•
Achieve HOLDING(C) with UNSTACK(C,x)
ON(C,x)
CLEAR(C)
ARMEMPTY
ON(C,x)  CLEAR(C)  ARMEMPTY
UNSTACK(C,x)
CLEAR(A)  HOLDING(C)
STACK(C,A)
ON(B,D)
ON(C,A)  ON(B,D)  OTAD
x = any block from which C could be unstack.
22
Goal Stack Planning
•
Achieve ON(C,x) by STACK(C,x) :
CLEAR(x)
HOLDING(C)
CLEAR(x)  HOLDING(C)
STACK(C,x)
CLEAR(C)
ARMEMPTY
ON(C,x)  CLEAR(C)  ARMEMPTY
UNSTACK(C,x)
CLEAR(A)  HOLDING(C)
STACK(C,A)
ON(B,D)
ON(C,A)  ON(B,D)  OTAD
23
Goal Stack Planning
•
•
Teminate path because HOLDING(C) is duplicated.
Achieve HOLDING(C) with PICKUP, not UNSTACK :
ONTABLE(C)
CLEAR(C)
ARMEMPTY
ONTABLE(C)  CLEAR(C)  ARMEMPTY
PICKUP(C)
CLEAR(A)  HOLDING(C)
STACK(C,A)
ON(B,D)
ON(C,A)  ON(B,D)  OTAD
24
Goal Stack Planning
•
Pop ONTABLE(C) and CLEAR(C), and achieve
ARMEMPTY by STACK(B,D) :
CLEAR(D)
HOLDING(B)
CLEAR(D)  HOLDING(B)
STACK(B,D)
ONTABLE(C)  CLEAR(C)  ARMEMPTY
PICKUP(C)
CLEAR(A)  HOLDING(C)
STACK(C,A)
ON(B,D)
ON(C,A)  ON(B,D)  OTAD
25
Goal Stack Planning
•
Pop entire stack, and return plan :
1. UNSTACK(B,A)
2. STACK(B,D)
3. PICKUP(C)
4. STACK(C,A)
26
<<Closing >>
End of Pertemuan 17
Good Luck
27