22
1 • L7_exAnswer and explanation • Review • Search vs. planning • Situation calculus • STRIPS operators

L7_exAnswer and explanation Review Search vs. planning Situation calculus STRIPS operators

Embed Size (px)

DESCRIPTION

L9. Planning Agents. L7_exAnswer and explanation Review Search vs. planning Situation calculus STRIPS operators. L7_ex 解答例. Forward chaining example. Let us add facts r1, r2, r3, f1, f2, f3 in turn into KB. r1 . Buffalo(x)  Pig(y)  Faster(x, y) - PowerPoint PPT Presentation

Citation preview

1

• L7_exAnswer and explanation

• Review

• Search vs. planning

• Situation calculus

• STRIPS operators

• L7_exAnswer and explanation

• Review

• Search vs. planning

• Situation calculus

• STRIPS operators

2

L7_ex 解答例

3

Forward chaining exampleForward chaining example

Let us add facts r1, r2, r3, f1, f2, f3 in turn into KB.

r1. Buffalo(x) Pig(y) Faster(x,y)

r2. Pig(y) Slug(z) Faster(y,z)

r3. Faster(x,y) Faster(y,z) Faster(x,z)

f1. Buffalo(Bob) [r1-c1, Bob/x, yes]

f2. Pig(Pat) [r1-c2, Pat/y, yes] f4. Faster(Bob, Pat)

f3. Slug(Steve) [r2-c2, Steve/z, yes]

[r2, f2, f3, Pat/y, Steve/z, yes] f5. Faster(Pat, Steve)

[r3, f4, f5, Bob/x, Pat/y, Steve/z, yes] f6. Faster(Bob, Steve)

x, y, z

4

Backward chaining exampleBackward chaining example

Faster(Bob, Pat)Goal: to prove

Buffalo(x) Pig(y)

Buffalo(Bob) Pig(Pat)

{x/Bob}

{}

r1

{}

{y/Pat}

Bob is a buffalo | 1. Buffalo(Bob) --f1

Pat is a pig | 2. Pig(Pat) --f2

Buffaloes run faster than pigs | 3. x, y Buffalo(x) Pig(y) Faster(x,y) --r1

Faster(x, y)

Buffalo(x) Pig(y)

R(2) – And Elimination

R(8) – Universal Elimination R(8) – Universal Elimination

5

Search in problem solving

• Problem solution:

A path through the state space tree

• State space search:

Search is a traversal of the tree

until the goals is reached.

• State transitions is performed

by operators

   a b c

a

b

c

6

Search in problem solving

Standard search algorithms seems to fail miserably since the goal test is inadequate.

Difficulty using standard search algorithms

What is “finish”?

7

Search in problem solving

Consider the same task get milk, bananas, and a cordless drill

A planning problem is represented in situation calculus by logical sentences that describe the three main parts of a problem.

• Initial state:

At(home, S0) Have(Milk, S0) Have(Banana, S0) Have(Drill, S0)

• Goal state:

s At(home, s) Have(Milk, s) Have(Bananas, s) Have(Drill, s)

• Operators:

a, s Have(Milk, Result (a,s)) [ (a=Buy(Milk)) At(Supermarket, s)

(Have(Milk, s) a Drop(Milk) )]

• Plan:

p = [Go(Supermarket), Buy(Milk), Buy(Bananas), Go(HWS), …]

Planning problem in situation calculus

8

Search in problem solving

• Representation of states

PS: Direct assignment of a symbol to each state

PL: Logic sentences

• Representation of goals

PS: A goal state symbol

PL: Sentences that describe objective

• Representation of actions

PS: Operators that transform one state symbol into another

PL: Addition/deletion of logic sentences describing world state

• Representation of plans

PS: Path through state space

PL: Ordered or partially-orderer sequence of actions.

Problem solving vs. planning

9

Search in problem solving

• Uniform language for describing states, goals, actions,

and their effects.

• Ability to add actions to a plan whenever they are needed,

not just in an incremental sequence from some initial state.

• Ability to capture the fact that most parts of the world are

independent of most other parts.

• It performs better for complex worlds over standard search

algorithm since searching space becomes huge when there

are many initial states and operators in standard search

algorithms.

Advantages of Planning Systems

10

The Situation Calculus

A goal can be described by a wff: x On(x, B) if we want to have a block on B Planning: finding a set of actions to achieve a goal wff. Situation Calculus (McCarthy, Hayes, 1969, Green 1969)

– A Predicate Calculus formalization of states, actions, and their effects.

– So state in figure can be described by:

On(B, A) On(A, C) On(A, Fl) Clear(B)

we reify the state and include them as arguments The atoms denotes relations over states.

On(B, A, S0) On(A, C, S0) On(C, Fl, S0) Clear(B, S0)

We can also have. x, y, s On(x, y, s) (y = Fl) Clear(y, s)

s Clear(Fl, s)

Wff - well formed formula

11

Reify the actions: denote an action by a symbol

– actions are functions move(B,A,Fl): move block B from block A to Fl move (x,y,z) - action schema do: A function constant, do denotes a function that maps actions and

states into states

Express the effects of actions.

– Example: (on, move) (expresses the effect of move on On)

– positive effect axiom:

1),( doaction state

Representing actions

))]),,,((,,(

)(),(),(),,([

szyxmovedozxOn

zxszClearsxClearsyxOn

))]),,,((,,(

)(),(),(),,([

szyxmovedoyxOn

zxszClearsxClearsyxOn

12

Effect axioms for (clear, move)

precondition are satisfied with

B/x, A/y, S0/s, F1/z

what was true in S0 remains true

move(x, y, z) matching?

13

Not everything true can be inferredSuch as, On(C,Fl) remains true but cannot be inferred

Actions have local effect

– We need frame axioms for each action and each fluent that does not change as a result of the action

– example: frame axioms for (move, on)

– If a block is on another block and move is not relevant, it will stay the same.

Positive

Negative

– Frame axioms for (move, clear)

))),,,((,,()](),,([ szvumovedoyxOnuxclearsyxOn

)),,,((,,()])()[(),,(( szvumovedoyxOzyvuxsyxO nn

Frame axioms

A fluent is something that flows and changes across situations

))),,,((,()(),( szyxmovedouClearzusuClear

))),,,((,()(),( szyxmovedouClearyusuClear

14

STRIPS: describing goals and state

STRIPS: STanford Research Institute Planning System

Basic approach in GPS (general Problem Solver):• Find a “difference” (Something in G that is not provable in S0)

• Find a relevant operator f for reducing the difference

• Achieve precondition of f; apply f; from resultant state, achieve G.

15

STRIPS planning

• STRIPS uses logical formulas to represent the states

S0, G, P, etc:

• Description of operator f:

16

On(B,A) On(A,C) On(C,F1) Clear(B) Clear(Fl) The formula describes a set of world states Planning search for a formula satisfying a goal description

• On(A, C)• On(C, Fl)• On(B, Fl)• Clear(A)• Clear(B)

A STRIPS planning example

17

A STRIPS operator has 3 parts:

– A set, PC - preconditions

– A set D - the delete list

– A set A - the add list Usually described by Schema: Move(x,y,z)

– PC: On(x,y) and On(Clear(x) and Clear(z)

– D: Clear(z) , On(x,y)

– A: On(x,z), Clear(y), Clear(F1) A state S1 is created applying operator O by adding A and

deleting D from S1.

STRIPS Description of Operators

18

Example: The move operator

19

Example1: The move operator

S0

G

P:

On(x,y)

Clear(x)

Clear(z)

f: move(x,y, z) add: On(x,z), Clear(y)

del: On(x,y), Clear(z)

x/B, y/A, z/Fl

f(P):

On(x,z)

Clear(x)

Clear(y)

S0->P

x/B, y/A, z/Fl

f(P)->G

20

Example1: The move operator

S0

G

P:

On(x,y)

Clear(x)

Clear(z)

f: move(x,y, z) add: On(x,z), Clear(y)

del: On(x,y), Clear(z)

x/B, y/A, z/Fl

f(P):

On(x,z)

Clear(x)

Clear(y)

S0->P

x/B, y/A, z/Fl

f(P)->G

Clear(F2)+

ABC

21

STRIPS algorithms are to search for operators!!!

We will leave the discussion of STRIPS algorithms to next week.

22

Quiz :

What differences are between standard search algorithms for problem solving and planning systems?What differences are between standard search algorithms for problem solving and planning systems?