Top Banner
PLANNING PLANNING Partial order regression planning Partial order regression planning Temporal representation 1 Temporal representation 1 Deductive planning in Logic Deductive planning in Logic Temporal representation 2 Temporal representation 2
38

PLANNING

Jan 02, 2016

Download

Documents

Gavin Gregory

PLANNING. Partial order regression planning Temporal representation 1 Deductive planning in Logic Temporal representation 2. The task of planning. Given:. a description of an initial state of the world a description of a desired state of the world a set of actions: - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: PLANNING

PLANNINGPLANNING

Partial order regression planningPartial order regression planning

Temporal representation 1Temporal representation 1

Deductive planning in LogicDeductive planning in Logic

Temporal representation 2Temporal representation 2

Page 2: PLANNING

2

The task of planningThe task of planning

Given:Given:

a description of an initial state of the worlda description of an initial state of the world a description of a desired state of the worlda description of a desired state of the world a set of actions:a set of actions:

with their preconditions that should hold in the with their preconditions that should hold in the worldworld

with their effects on the world with their effects on the world

Find:Find: a sequence of actions that transform the initial a sequence of actions that transform the initial

state into the final one.state into the final one.

Page 3: PLANNING

Partial order regression planningPartial order regression planning

The STRIPS approachThe STRIPS approach

Page 4: PLANNING

4

State descriptions in STRIPSState descriptions in STRIPS

Only ground facts are used.Only ground facts are used.

Example: the blocks world:Example: the blocks world:

States of the world are represented individually in States of the world are represented individually in logic:logic:

Meaning: there is NO representation of how Meaning: there is NO representation of how one one state relates to the nextstate relates to the next

Nor any representation of time!Nor any representation of time!

Page 5: PLANNING

5

Page 6: PLANNING

6

Action description in STRIPSAction description in STRIPS

Effects:Effects: two sets of ground facts:two sets of ground facts:

Preconditions:Preconditions: a set of ground facts that need to be true in the state a set of ground facts that need to be true in the state

for the action to be applicable. for the action to be applicable.

the delete list:the delete list:– need to be removed from the previous need to be removed from the previous

statestate the add list:the add list:– need to be added to the previous stateneed to be added to the previous state

Page 7: PLANNING

7

Example:Example:Some operator patterns: Some operator patterns:

Action1: Action1: “move block x from block y to block z”“move block x from block y to block z”

PreconditionsPreconditionsIf If on(x,y)on(x,y) clear(x)clear(x) clear(z)clear(z)

Add listAdd listAdd Add on(x,z)on(x,z) clear(y)clear(y)

Delete listDelete listDelete Delete on(x,y)on(x,y) clear(z)clear(z)

Page 8: PLANNING

8

Example:Example:Operator patterns (2): Operator patterns (2):

Action2: Action2: “move block x from block y to Table”“move block x from block y to Table”

If If on(x,y)on(x,y) clear(x)clear(x)

Add Add on(x,Table)on(x,Table) clear(y)clear(y)

Delete Delete on(x,y)on(x,y)

Page 9: PLANNING

9

Example:Example:Operator patterns (3): Operator patterns (3):

Action3: Action3: “move block x from Table to block z”“move block x from Table to block z”

Note:Note: actual operators are ground instances of actual operators are ground instances of these!these!

If If on(x,Table)on(x,Table) clear(x)clear(x) clear(z)clear(z)

Add Add on(x,z)on(x,z)

Delete Delete on(x,Table)on(x,Table) clear(z)clear(z)

Page 10: PLANNING

10

What about using search in forward What about using search in forward chaining on this?chaining on this?

This is similar to Automated Reasoning: bottom-up This is similar to Automated Reasoning: bottom-up inference is not goal directed, top-down reasoning is!inference is not goal directed, top-down reasoning is!

See example:See example:

Such search is Such search is NOTNOT goal directed! goal directed!No information on what state to reachNo information on what state to reach

Page 11: PLANNING

11

Page 12: PLANNING

12

Backward chaining:Backward chaining:

Forward chaining would be Forward chaining would be progressionprogression::move from initial state to goal statemove from initial state to goal state

Example: limited to 1 goal fact!Example: limited to 1 goal fact!and only 1 possible path exploredand only 1 possible path explored

Planning as Planning as regressionregression::start from the goal state and reason backwards to start from the goal state and reason backwards to

the initial statethe initial state

Page 13: PLANNING

13

Page 14: PLANNING

14

Page 15: PLANNING

15

Page 16: PLANNING

16

Page 17: PLANNING

17

Page 18: PLANNING

18

Page 19: PLANNING

19

Page 20: PLANNING

20

Regression planning:Regression planning:goal reduction.goal reduction.

Select an atomic goal that still needs to be Select an atomic goal that still needs to be establishedestablished Find an operator that Find an operator that establishesestablishes it ( it ( add list) add list)

Add the operator to the plan and add an Add the operator to the plan and add an ESTABLISHESTABLISH link between operator and goal.link between operator and goal.

In generalIn general: complex goals are decomposed into atomic : complex goals are decomposed into atomic ones that themselves are reduced to new goals.ones that themselves are reduced to new goals.

Is somewhat similar to ‘top-down’ goal-directed Is somewhat similar to ‘top-down’ goal-directed reasoning in AR.reasoning in AR.

Page 21: PLANNING

21

Principle of Principle of least commitment (1)least commitment (1)

EstablishEstablish links only impose a partial order: links only impose a partial order: they do they do NOTNOT impose that first operator needs to impose that first operator needs to

occur occur EXACTLYEXACTLY before second operator before second operator

BUTBUT they are protected links: they are protected links: NONO operator may be scheduled between them that operator may be scheduled between them that

UNDOESUNDOES the established property ! the established property !

ClueClue: do not decide on a choice before it is necessary!: do not decide on a choice before it is necessary!

Page 22: PLANNING

22

High-level algorithmHigh-level algorithm

Initialize:Initialize: operatorsoperators: = empty;: = empty; establishesestablishes:= empty;:= empty; beforebefore:= empty;:= empty;

completecomplete:= false;:= false;blockedblocked:= false;:= false;

Case:Case: beforebefore has loop: has loop: blockedblocked:= := true;true;

WhileWhile not( not(completecomplete) and ) and not(not(blockedblocked) ) dodo Case:Case: O O operatorsoperators threatens threatens E(O1,O2) E(O1,O2) establishesestablishes::

add B(O,O1) add B(O,O1) OROR add B(O2,O) add B(O2,O) to to beforebefore;; … … …… … …

Page 23: PLANNING

23

… … … … … …

End-WhileEnd-While

Case:Case: O O operatorsoperators has has unsatisfied unsatisfied condition:condition: find O’ find O’ operatorsoperators OROR add O’ to add O’ to operatorsoperators ANDAND install install establishesestablishes and and beforebefore links links Otherwise:Otherwise: completecomplete:= true;:= true;

High-level algorithmHigh-level algorithm(continued)(continued)

Page 24: PLANNING

24

Some comments:Some comments: The algorithm is imprecise:The algorithm is imprecise:

The The CaseCase for threatens links can be activated for threatens links can be activated infinitely often for the same linkinfinitely often for the same link should test whether it has been dealt withshould test whether it has been dealt with

Page 25: PLANNING

25

High-level algorithmHigh-level algorithm

Initialize:Initialize: operatorsoperators: = empty;: = empty; establishesestablishes:= empty;:= empty; beforebefore:= empty;:= empty;

completecomplete:= false;:= false;blockedblocked:= false;:= false;

Case:Case: beforebefore has loop: has loop: blockedblocked:= := true;true;

WhileWhile not( not(completecomplete) and ) and not(not(blockedblocked) ) dodo Case:Case: O O operatorsoperators threatens threatens E(O1,O2) E(O1,O2) establishesestablishes::

add B(O,O1) add B(O,O1) OROR add B(O2,O) add B(O2,O) to to beforebefore;; … … …… … …

Page 26: PLANNING

26

Some comments:Some comments: The algorithm is imprecise:The algorithm is imprecise:

The The CaseCase for threatens links can be activated for threatens links can be activated infinitely often for the same linkinfinitely often for the same link should test whether it has been dealt withshould test whether it has been dealt with

The initial situation and goal situation are not The initial situation and goal situation are not explicitly presentexplicitly present

and, the initial situation is not considered for and, the initial situation is not considered for unsatisfied conditionsunsatisfied conditions

add the initial and goal situation to add the initial and goal situation to operatorsoperators in the in the InitializationInitialization

– initial operator has initial operator has no conditionsno conditions, just adds , just adds initial situationinitial situation

– final operator final operator adds/deletes nothingadds/deletes nothing, just has a , just has a condition part.condition part.

Page 27: PLANNING

27

Blocks example:Blocks example: Initial operator:Initial operator:

IfIf

Add Add on(A,C) on(C,Table) clear(A)on(A,C) on(C,Table) clear(A) on(D,B) on(B,Table) clear(D)on(D,B) on(B,Table) clear(D)

DeleteDelete

Final operator:Final operator:

If If on(A,B)on(A,B) on(B,C)on(B,C)

AddAdd

DeleteDelete

Page 28: PLANNING

28

Further refinement:Further refinement:backtracking:backtracking:

When it exits the When it exits the WhileWhile loop because loop because blocked blocked = = truetrue (there is a before loop), then don’t (there is a before loop), then don’t terminate, but terminate, but backtrackbacktrack over operator choices. over operator choices.

Page 29: PLANNING

29

High-level algorithmHigh-level algorithm

Initialize:Initialize: operatorsoperators: = empty;: = empty; establishesestablishes:= empty;:= empty; beforebefore:= empty;:= empty;

completecomplete:= false;:= false;blockedblocked:= false;:= false;

Case:Case: beforebefore has loop: has loop: blockedblocked:= := true;true;

WhileWhile not( not(completecomplete) and ) and not(not(blockedblocked) ) dodo Case:Case: O O operatorsoperators threatens threatens E(O1,O2) E(O1,O2) establishesestablishes::

add B(O,O1) add B(O,O1) OROR add B(O2,O) add B(O2,O) to to beforebefore;; … … …… … …

Page 30: PLANNING

30

… … … … … …

End-WhileEnd-While

Case:Case: O O operatorsoperators has has unsatisfied unsatisfied condition:condition: find O’ find O’ operatorsoperators OROR add O’ to add O’ to operatorsoperators ANDAND install install establishesestablishes and and beforebefore links links Otherwise:Otherwise: completecomplete:= true;:= true;

High-level algorithmHigh-level algorithm(continued)(continued)

Page 31: PLANNING

31

Further refinement:Further refinement:backtracking:backtracking:

When it exits the When it exits the WhileWhile loop because loop because blocked blocked = = truetrue (there is a before loop), then don’t (there is a before loop), then don’t terminate, but terminate, but backtrackbacktrack over operator choices. over operator choices.

NoteNote: no point in backtracking over selection of : no point in backtracking over selection of unsatisfied pre-conditions: unsatisfied pre-conditions: they ALL need to be satisfied anyway at the endthey ALL need to be satisfied anyway at the end

Page 32: PLANNING

32

… … … … … …

End-WhileEnd-While

Case:Case: O O operatorsoperators has has unsatisfied unsatisfied condition:condition: find O’ find O’ operatorsoperators OROR add O’ to add O’ to operatorsoperators ANDAND install install establishesestablishes and and beforebefore links links Otherwise:Otherwise: completecomplete:= true;:= true;

High-level algorithmHigh-level algorithm(continued)(continued)

Page 33: PLANNING

33

Further refinement:Further refinement:backtracking:backtracking:

When it exits the When it exits the WhileWhile loop because loop because blocked blocked = = truetrue (there is a before loop), then don’t (there is a before loop), then don’t terminate, but terminate, but backtrackbacktrack over operator choices. over operator choices.

NoteNote: no point in backtracking over selection of : no point in backtracking over selection of unsatisfied pre-conditions: unsatisfied pre-conditions: they ALL need to be satisfied anyway at the endthey ALL need to be satisfied anyway at the end

PS: note how this is similar to the ‘top-down’ PS: note how this is similar to the ‘top-down’ automated reasoning techniques.automated reasoning techniques.(backtrack over previous clause selections, not (backtrack over previous clause selections, not

over previous atom selections).over previous atom selections).

Page 34: PLANNING

34

Least commitment(2):Least commitment(2):plan with operator plan with operator patternspatterns

Key point:Key point:

Use operator patterns:Use operator patterns: move x from y to Tablemove x from y to Table move x from Table to ymove x from Table to y move x from y to zmove x from y to z

instead of explicit operators:instead of explicit operators: move A from B to Tablemove A from B to Table move A from Table to Bmove A from Table to B move A from B to Cmove A from B to C

Avoids to make choices when the information to Avoids to make choices when the information to decide upon various alternatives is not yet there!decide upon various alternatives is not yet there!

Page 35: PLANNING

35

Blocks example:Blocks example:

on(A,Table)on(A,Table)

goalgoal

on(A,B)on(A,B)clear(A)clear(A)on(B,Table)on(B,Table)

initialinitial

on(A,B)on(A,B)clear(A)clear(A)on(B,Table)on(B,Table)

on(A,Table)on(A,Table)if on(A,y)if on(A,y) clear(A)clear(A)add clear(y)add clear(y) on(A,Table)on(A,Table)delete on(A,y)delete on(A,y)

on(A,B)on(A,B)clear(A)clear(A)on(B,Table)on(B,Table)

on(A,Table)on(A,Table)

establishesestablishesunification: {x/A)unification: {x/A)

if on(x,y)if on(x,y) clear(x)clear(x)add clear(y)add clear(y) on(x,Table)on(x,Table)delete on(x,y)delete on(x,y)

move x from y to Tablemove x from y to Table

establishesestablishesunification: {y/B)unification: {y/B)

Page 36: PLANNING

36

Change in the algorithm:Change in the algorithm:Case:Case: O O operatorsoperators has unsatisfied has unsatisfied condition:condition: find O’ find O’ operatorsoperators OROR add O’ to add O’ to operatorsoperators ANDAND install install establishesestablishes and and beforebefore links links

OO and and O’ O’ are (partially instantiated) operator are (partially instantiated) operator patternspatterns nownow

The unsatisfied needs to be The unsatisfied needs to be unifiableunifiable with an with an element of the add list of element of the add list of O’O’ now (not be identical) now (not be identical)

The unifier needs to be applied on The unifier needs to be applied on the entire the entire set of operatorsset of operators constructed so far! constructed so far!

Page 37: PLANNING

37

When is there a threat?When is there a threat? Example:Example:

on(A,B)on(A,B)on(B,D)on(B,D)clear(A)clear(A)clear(B)clear(B)

clear(C)clear(C)on(B,Table)on(B,Table)

if on(A,C)if on(A,C) clear(A)clear(A)add clear(C)add clear(C) on(A,y)on(A,y)delete on(A,C)delete on(A,C) clear(y)clear(y)

move A from C to ymove A from C to y

establishesestablishes

if on(B,z)if on(B,z) clear(B)clear(B)add clear(z)add clear(z) on(B,Table)on(B,Table)delete on(B,z)delete on(B,z)

move B from z to Tablemove B from z to Table

establishesestablishes

establishesestablishes

threat?threat?

establishesestablishes

Page 38: PLANNING

38

Dealing with possible threatsDealing with possible threats1) Ignore them, until they become instantiated to 1) Ignore them, until they become instantiated to

real threats.real threats. Example:Example: only if only if ‘delete clear(y)’‘delete clear(y)’ becomes ‘ becomes ‘delete delete

clear(B)’clear(B)’ we consider it a threat we consider it a threat Optimization: at least check whether there is still Optimization: at least check whether there is still

a consistent value for the variablesa consistent value for the variables ((Ex.:Ex.: y can y can still be assigned value D)still be assigned value D)

2) Introduce 2) Introduce inequalityinequality constraints and replace constraints and replace unification by constraint solvingunification by constraint solving Example:Example: constraint constraint y y B B + unification must now + unification must now

also respect the inequalitiesalso respect the inequalities

3) Choose a value for y3) Choose a value for y Ex.:Ex.: assign assign y = Dy = D..