Anda di halaman 1dari 15

4/18/2011

Jurusan Teknik Informatika – Universitas Widyatama


Overview

• Deskripsi
• Introduction
Planning • Hierarchical Planning
• Sensorless Planning
• Conditional Planning
Pertemuan : 11 • Execution Monitoring and Replanning
Dosen Pembina : • Continous Planner
Sriyani Violina • State of the world (STRIPS language)
Danang Junaedi • The Block World
– Goal stack Planning (GSP)
IF-UTAMA 1 IF-UTAMA 2

Deskripsi Introduction
• Pertemuan ini mempelajari bagaimana • We studied how to take actions in the world
memecahkan suatu masalah dengan teknik (search)
planning. • We studied how to represent objects, relations,
• Metode planning yang dibahas pada etc. (logic)
pertemuan ini adalah Goal Stack Planning
(GSP) • Now we will combine the two!

IF-UTAMA 3 IF-UTAMA 4

IF-UTAMA 1
4/18/2011

Introduction Hierarchical Planning


• Problem-solving is a search through a state space. • Hierarchical Task Network(HTN)
• Planning is the process of computing several steps – At each “level,” only a small number of
of a problem-solving procedure before executing
individual planning actions, then descend to
them.
lower levels to “solve these” for real.
• Planning = problem sloving in advance.
• Planning is important if solutions cannot be undone. – At higher levels, the planner ignores “internal
• If the universe is not predictable, then a plan can fail effects” of decompositions. But these have to be
resolved at some level…
⇒ dynamic plan revision.

IF-UTAMA 5 IF-UTAMA 6

HTN Sample HTN Sample (cont)


• Construction Domain: • Macro Action in Library:
– Actions: – Build House:
• Buy Land: Money  Land
• Get Load: Good Credit  Money
• Get Permit: Land  Permit
• Hire Builder:  Contract
• Construction: Permit ∧ Contract  House Built
• Pay Builder: Money ∧ House Built  House
• …

IF-UTAMA 7 IF-UTAMA 8

IF-UTAMA 2
4/18/2011

HTN Sample (cont) HTN Sample (cont)

IF-UTAMA 9 IF-UTAMA 10

HTN Cons and Pros NonDeterministic Domains


• What’s Bad? • What if we don’t know all about situations
– Recursion? and effects.
– Sub Task Sharing:
• Enjoy honey moon in Hawaii and raise a family.
• Library:
– Enjoy Honey moon in Hawaaii: Get Married , Go to Hawaii.
– Raise Family: Get Married, Have two children. • E.g.
• What’s Good: – Init: A table and a chair of unknown colors.
– Almost all real applications are HTN + some thing else. – Goal: A table and a chair of the same colors.
– It’s a heuristic to decrease the branching factor by a great
– Condition: Painting may have flaws.
level.

IF-UTAMA 11 IF-UTAMA 12

IF-UTAMA 3
4/18/2011

Sensorless Planning Conditional Planning


• We don’t know all beforehand and we can’t • We can check the state ahead, then perform
find it out, even when it is done. the pre-planned program.
– Plan so that to reach the goal state, regardless of – Sense Actions
everything. (Coercion) – Conditional Branches
– Not always possible.

IF-UTAMA 13 IF-UTAMA 14

Conditional Planning in
Fully Observable Domains
Notation Expantion:
• Vacuum World: • Expanding Plan Notation:
– Left: AtRight  AtLeft ∧ ¬AtRight – If (state) Then (…) else (…)
– Left: AtRight 
(AtLeft ∧ ¬AtRight)∨ (¬AtLeft ∧ AtRight) – If (AtLeft∧CleanLeft ∧CleanRight) Then {}
– Suck: when AtLeftCleanLeft else Suck.
when AtRightCleanRight
– Left: when AtLeft ¬CleanLeft
when AtRightAtLeft ¬AtRight

IF-UTAMA 15 IF-UTAMA 16

IF-UTAMA 4
4/18/2011

State Space: Conditional Planner:

IF-UTAMA 17 IF-UTAMA 18

Unavoidable Loops in Conditional


Partially Observable Domains
Planner

• New Notation:
– Instead of just Left : while (AtRight) Left

IF-UTAMA 19 IF-UTAMA 20

IF-UTAMA 5
4/18/2011

Partially Observable Domains Execution Monitoring and Replanning

• Easiest Approach: • Check if the plan is going on is pre-decided?


– Assume set of current states and the next state If not, replan based on current situation.
sets are created, quite similar to non- • Action Monitoring:
deterministic actions case. • See if current state is as it was supposed, if not, find a
solution to return it to what it was (repair).

IF-UTAMA 21 IF-UTAMA 22

Execution Monitoring in Partially


Execution Monitoring & Replanning
Observable Domains
• Plan Monitoring: • Things may fail and we don’t know.
– See if the previous plan is still wise?
• Sensing actions may be required
– Serendipity! – And they may need extra-planning.
– A precondition of future actions has failed and
can not be recovered.
• We may stuck in futile attempts:
– The electronic key is incorrect, but we think it
might be due to incorrect pushing in.

IF-UTAMA 23 IF-UTAMA 24

IF-UTAMA 6
4/18/2011

Continues Planner Continuous Planner


• Keep planning, sensing and executing… • POP + …
– Which is not unlikely, such as maintenance – Missing Goal:
planning, auto-pilot, plant control, … • A new goal has erupted. Just add it.
– Open precondition:
• An action has lost its support links. Add a new causal
link.
– Causal Conflicts:
• A causal link is suddenly threatened. Choose an
appropriate ordering.

IF-UTAMA 25 IF-UTAMA 26

Continuous Planner State of the world (STRIPS language)

• POP + … • State of the world = conjunction of positive, ground,


function-free literals
– Unsupported Link:
• At(Home) AND IsAt(Umbrella, Home) AND
• A link from start to something has suddenly last its CanBeCarried(Umbrella) AND IsUmbrella(Umbrella) AND
true value. Remove it. HandEmpty AND Dry
• Not OK as part of the state:
– Redundant Action: – NOT(At(Home)) (negative)
• An action no more produces something needed. – At(x) (not ground)
Remove it. – At(Bedroom(Home)) (uses the function Bedroom)
• Any literal not mentioned is assumed false
– Other languages make different assumptions, e.g., negative literals
part of state, unmentioned literals unknown

IF-UTAMA 27 IF-UTAMA 28

IF-UTAMA 7
4/18/2011

An action: TakeObject Another action


• TakeObject(location, x) • WalkWithUmbrella(location1, location2,
• Preconditions: umbr)
– HandEmpty
– CanBeCarried(x) • Preconditions:
– At(location) – At(location1)
– IsAt(x, location)
– Holding(umbr)
• Effects (“NOT something” means that that
– IsUmbrella(umbr)
something should be removed from state):
– Holding(x) • Effects:
– NOT(HandEmpty) – At(location2)
– NOT(IsAt(x, location))
– NOT(At(location1))
IF-UTAMA 29 IF-UTAMA 30

Yet another action A goal and a plan

• WalkWithoutUmbrella(location1, • Goal: At(Work) AND Dry


• Recall initial state:
location2) – At(Home) AND IsAt(Umbrella, Home) AND
CanBeCarried(Umbrella) AND IsUmbrella(Umbrella) AND
• Preconditions: HandEmpty AND Dry
– At(location1) • TakeObject(Home, Umbrella)
– At(Home) AND CanBeCarried(Umbrella) AND
• Effects: IsUmbrella(Umbrella) AND Dry AND Holding(Umbrella)
– At(location2) • WalkWithUmbrella(Home, Work, Umbrella)
– NOT(At(location1)) – At(Work) AND CanBeCarried(Umbrella) AND
IsUmbrella(Umbrella) AND Dry AND Holding(Umbrella)
– NOT(Dry)

IF-UTAMA 31 IF-UTAMA 32

IF-UTAMA 8
4/18/2011

Planning to write a paper Some start states


• Suppose your goal is to be a co-author on an AI paper with both
theorems and experiments, within a year
LearnAbout(x,y) ProveTheorems(x)
• Start1: HasTimeForStudy(You) AND Knows(You,Math) AND
Preconditions: HasTimeForStudy(x) Preconditions: Knows(x,AI), Knows(You,Coding) AND Knows(You,Writing)
Knows(x,Math), Idea • Start2: HasTimeForStudy(You) AND Creative(You) AND
Effects: Knows(x,y),
NOT(HasTimeForStudy(x)) Effect: Theorems, Contributed(x) Knows(Advisor,AI) AND Knows(Advisor,Math) AND
PerformExperiments(x) Knows(Advisor,Coding) AND Knows(Advisor,Writing)
HaveNewIdea(x)
Preconditions: Knows(x,AI), (Good luck with that plan…)
Preconditions: Knows(x,AI),
Creative(x) Knows(x,Coding), Idea • Start3: Knows(You,AI) AND Knows(You,Coding) AND
Effect: Experiments, Contributed(x) Knows(OfficeMate,Math) AND HasTimeForStudy(OfficeMate) AND
Effects: Idea, Contributed(x)
WritePaper(x) Knows(Advisor,AI) AND Knows(Advisor,Writing)
FindExistingOpenProblem(x) • Start4: HasTimeForStudy(You) AND Knows(Advisor,AI) AND
Preconditions: Knows(x,AI),
Preconditions: Knows(x,AI) Knows(x,Writing), Idea, Knows(Advisor,Math) AND Knows(Advisor,Coding) AND
Effects: Idea Theorems, Experiments Knows(Advisor,Writing)
Effect: Paper, Contributed(x)
Goal: Paper AND Contributed(You) We’ll use these as examples…
Name a few things that are
IF-UTAMA missing/unrealistic… 33 IF-UTAMA 34

Forward state-space search (progression Backward state-space search (regression


planning) planning)
• Successors: all states that can be reached with an action
• Predecessors: for every action that accomplishes one of the
whose preconditions are satisfied in current state
At(Home) WalkWithUmbrella( At(Work) literals (and does not undo another literal), remove that
Holding(Umbrella)
Home, Work, Holding(Umbrella) literal and add all the preconditions
TakeObject(Home, Umbrella) Umbrella)
CanBeCarried(Umbrella) CanBeCarried(Umbrella) WalkWithUmbrella(
TakeObject(location2, umbr)
IsUmbrella(Umbrella) WalkWithoutUm IsUmbrella(Umbrella) location1, Work,
At(location1) At(location1)
At(Home) brella(Home, umbr)
Dry Dry At(location2) Holding(umbr) At(Work)
IsAt(Umbrella, Home) Work)
GOAL! IsAt(umbr, location2) IsUmbrella(umbr) Dry
CanBeCarried(Umbrella)
CanBeCarried(umbr) Dry
IsUmbrella(Umbrella) At(Work) WalkWithout GOAL
IsUmbrella(umbr)
HandEmpty IsAt(Umbrella, Home) Umbrella(Wor At(Home)
HandEmpty
Dry CanBeCarried(Umbrella) k, Home) IsAt(Umbrella, Home)
WalkWithUmbrella(location2, location1)
Dry
IsUmbrella(Umbrella) CanBeCarried(Umbrella)
WalkWithoutUm
IsUmbrella(Umbrella) This is accomplished in the
brella(Home, HandEmpty
start state, by substituting
Work) HandEmpty
location1=location2=Home, WalkWithoutUmbrella can never be used, because it undoes Dry
WalkWithoutUmbrella( umbr=Umbrella
Home, Umbrella) (!) IF-UTAMA 35 (this is good)IF-UTAMA 36

IF-UTAMA 9
4/18/2011

Heuristics for state-space search The Blocks World


• Cost of a plan: (usually) number of actions
• Heuristic 1: plan for each subgoal (literal) separately, sum
costs of plans
– Does this ever underestimate? Overestimate?
B C B
• Heuristic 2: solve a relaxed planning problem in which A C D A D
actions never delete literals (empty-delete-list heuristic)
– Does this ever underestimate? Overestimate? start goal
– Very effective, even though requires solution to (easy) planning

Planning = generating a sequence of


problem
• Progression planners with empty-delete-list heuristic
perform well actions to achieve the goal
from the start
IF-UTAMA 37 IF-UTAMA 38

The Blocks World The Blocks World


Actions: Conditions and results:
• UNSTACK(A, B) : angkat balok A yang menempel • ON(A, B) : balok a menempel di atas balok B
di atas balok B • ONTABLE(A) : balok A berada di permukaan meja
• STACK(A, B) : simpan balok A di atas balok B • CLEAR(A) : tidak ada balok yang menempel di atas
• PICKUP(A) : angkat balok A dari atas meja balok A
• PUTDOWN(A) : simpan balok A di permukaan • HOLDING(A) : lengan robot sedang memegang
meja balok A
• MOVE(A,B,C): simpan balok A di atas balok C • ARMEMPTY: lengan robot tidak sedang memegan
• MOVETOTABLE(A,B) : simpan balok A yang balok
menempel di atas balok B ke atas permukaan meja

IF-UTAMA 39 IF-UTAMA 40

IF-UTAMA 10
4/18/2011

The Blocks World The Blocks World


Specification of actions: Specification of actions:
• PRECONDITION (P): list of predicates that must STACK(x, y):
be true for an operator to be applied. P: CLEAR(y) ∧ HOLDING(x)
D: CLEAR(y) ∧ HOLDING(x)
• ADD (A): list of new predicates that an operator
causes to become true. A: ARMEMPTY ∧ ON(x, y)
UNSTACK(x, y):
• DELETE(D): list of old predicates that an operator P: ON(x, y) ∧ CLEAR(x) ∧ ARMEMPTY
causes to become false.
D: ON(x, y) ∧ ARMEMPTY
• Predicates not in ADD nor DELETE are unaffacted. A: HOLDING(x) ∧ CLEAR(y)

IF-UTAMA 41 IF-UTAMA 42

The Blocks World The Blocks World


Specification of actions: Specification of actions:
PICKUP(x): MOVE(x,y,z):
P: CLEAR(x) ∧ ONTABLE(x) ∧ ARMEMPTY P: ON(x,y), CLEAR(x), CLEAR(z)
D: ONTABLE(x) ∧ ARMEMPTY D: ON(x,y) ∧ CLEAR(Z)
A: HOLDING(x) A: ON(x,z), CLEAR(y), NOT(ON(x,y)), NOT(CLEAR(z))
PUTDOWN(x): MOVETOTABLE(x,y):
P: HOLDING(x) P: ON(x,y), CLEAR(x)
D: HOLDING(x) D: ON(x,y)
A: ONTABLE(x) ∧ ARMEMPTY A: ONTABLE(x) ∧ ONTABLE(y) ∧CLEAR(y) ∧NOT(ON(x,y))

IF-UTAMA 43 IF-UTAMA 44

IF-UTAMA 11
4/18/2011

The Blocks World Goal Stack Planning

Stack Database
B C B
A C D A D Goals Current situation
start: ON(B, A) ∧ goal: ON(C, A) ∧
ONTABLE(A) ∧
ONTABLE(C) ∧
ON(B, D) ∧
ONTABLE(A) ∧
Operators to
satisfy
+ Specification of
the Goals Operators/Actions
ONTABLE(D) ∧ ONTABLE(D) ∧
ARMEMPTY

IF-UTAMA 45 IF-UTAMA 46

Goal Stack Planning Goal Stack Planning


Push the original goal to the stack. Repeat until the
stack is empty:
– If stack top is a compound goal, push its unsatisfied B C B
subgoals to the stack.
A C D A D
– If stack top is a single unsatisfied goal, replace it by an
operator that makes it satisfied and push the operator’s start: ON(B, A) ∧ goal: ON(C, A) ∧
precondition to the stack. ONTABLE(A) ∧ ON(B, D) ∧
ONTABLE(C) ∧ ONTABLE(A) ∧
– If stack top is an operator, pop it from the stack, execute ONTABLE(D) ∧ ONTABLE(D) ∧
it and change the database by the operation’s affects. ARMEMPTY
– If stack top is a satisfied goal, pop it from the stack.

IF-UTAMA 47 IF-UTAMA 48

IF-UTAMA 12
4/18/2011

Goal Stack Planning Goal Stack Planning


Stack Database
3 ON(B,A) OTACD
Stack Database CLEAR(B) HOLDING(B)
1 ON(C, A) ON(B, A) ARMEMPTY
ON(B, D) OTACD ON(B,A) ∧CLEAR(B) ∧ARMEMPTY
ON(C, A) ∧ ON(B, D) ∧ OTAD ARMEMPTY UNSTACK(B,A) Planning :
HOLDING(C) 1.UNSTACK(B,A)
CLEAR(A) ∧ HOLDING(C)
CLEAR(A) STACK(C, A)
2 ON(B, A)
HOLDING(C) ON(B, D)
OTACD
CLEAR(A) ∧ HOLDING(C) ON(C, A) ∧ ON(B, D) ∧ OTAD
ARMEMPTY
STACK(C, A)
ON(B, D) Note:
OTAD = ONTABLE(A)∧
ON(C, A) ∧ ON(B, D) ∧ OTAD

ONTABLE(D)

IF-UTAMA 49 IF-UTAMA 50

Goal Stack Planning Goal Stack Planning


Stack Database Stack Database
4 HOLDING(C) OTACD 6 CLEAR(D) OTACD
CLEAR(A) ∧ HOLDING(C) HOLDING(B) HOLDING(B) ON(B,D)
STACK(C, A) CLEAR(D)∧ HOLDING(B) ARMEMPTY
ON(B, D) Planning : STACK(B,D)
1.UNSTACK(B,A) Planning:
ON(C, A) ∧ ON(B, D) ∧ OTAD OTC ∧ CLEAR(C) ∧ ARMEMPTY
PICKUP(C) 1.UNSTACK(B,A)
OTC HOLDING(C) 2.STACK(B,D)
5 OTACD
CLEAR(C) HOLDING(B) CLEAR(A) ∧ HOLDING(C)
ARMEMPTY STACK(C, A)
OTC ∧ CLEAR(C) ∧ ARMEMPTY Planning : ON(B, D)
PICKUP(C) 1.UNSTACK(B,A) ON(C, A) ∧ ON(B, D) ∧ OTAD
HOLDING(C)
CLEAR(A) ∧ HOLDING(C)
STACK(C, A)
ON(B, D)
ON(C, A) ∧ ON(B, D) ∧ OTAD
IF-UTAMA 51 IF-UTAMA 52

IF-UTAMA 13
4/18/2011

Goal Stack Planning Goal Stack Planning


Stack Database
7 OTC ∧ CLEAR(C) ∧ ARMEMPTY OTAD
PICKUP(C) ON(B,D)
HOLDING(C) HOLDING(C) A
CLEAR(A) ∧ HOLDING(C) Planning :
STACK(C, A) C B
ON(B, D) 1.UNSTACK(B,A)
ON(C, A) ∧ ON(B, D) ∧ OTAD 2.STACK(B,D) A B C
3.PICKUP(C)
8 HOLDING(C) OTAD start: ON(C, A) ∧ goal: ON(A, B) ∧
CLEAR(A) ∧ HOLDING(C) ON(B,D) ONTABLE(A) ∧ ON(B, C)
STACK(C, A) ON(C,A) ONTABLE(B) ∧
ON(B, D) ARMEMPTY ARMEMPTY
ON(C, A) ∧ ON(B, D) ∧ OTAD Planning : 1.UNSTACK(B,A)
2.STACK(B,D) Sussman Anomaly (1975)
3.PICKUP(C)
IF-UTAMA
4.STACK(C,A) 53 IF-UTAMA 54

Goal Stack Planning Goal Stack Planning

Plan Plan
1. UNSTACK(C, A) 1. UNSTACK(C, A)
2. PUTDOWN(C) 2. PUTDOWN(C)
3. PICKUP(A) 3. PICKUP(A)
4. STACK(A, B) 4. STACK(A, B)
5. UNSTACK(A, B) 5. UNSTACK(A, B)
6. PUTDOWN(A) 6. PUTDOWN(A)
7. PICKUP(B) 7. PICKUP(B)
8. STACK(B, C) 8. STACK(B, C)
9. PICKUP(A) 9. PICKUP(A)
10. STACK(A, B) 10. STACK(A, B)

IF-UTAMA 55 IF-UTAMA 56

IF-UTAMA 14
4/18/2011

Studi Kasus/Tugas Referensi


1. Jabarkan proses GSP untuk slide 54 sehingga 1. Suyanto.2007.”Artificial Intelligence” .Informatika.
Bandung
menghasilkan planning pada slide 55
2. Ramin Halavati.-. “An Introduction to
2. Jelaskan secara singkat Artificial Intelligence Chapter 12 – Planning and
a. Teknik planning prinsipnya hapir sama dengan searching, apa Acting in Real World[online]”.url : -. Tanggal Akses :
perbedaanya?Untuk kasus-kasus tertentu kenapa planning 11 April 2011
cenderung lebih baik dibanding searching? 3. -.-.” Planning[online]” url:-.Tanggal Akses: 11 April
b. Kapan dan kenapa sebaiknya kita memilih planning dibanding 2011
searching?
4. Vincent Conitzer.-.” CPS 270: Artificial Intelligence
Planning[online]” url:
http://www.cs.duke.edu/courses/fall08/cps270/.Tangg
al Akses: 11 April 2011
5. Dan sumber-sumber lain yang terkait

IF-UTAMA 57 IF-UTAMA 58

IF-UTAMA 15

Anda mungkin juga menyukai