38
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

PLANNING

Embed Size (px)

DESCRIPTION

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

Citation preview

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

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.

Partial order regression planningPartial order regression planning

The STRIPS approachThe STRIPS approach

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!

5

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

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)

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)

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)

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

11

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

13

14

15

16

17

18

19

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.

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!

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;; … … …… … …

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)

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

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;; … … …… … …

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.

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

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.

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;; … … …… … …

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)

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

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)

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).

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!

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)

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!

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

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..