380 likes | 389 Views
This planning approach uses partial order regression to find a sequence of actions that transforms an initial state into a desired state. It is based on the STRIPS approach and supports temporal representation.
E N D
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: • with their preconditions that should hold in the world • with their effects on the world • Find: • a sequence of actions that transform the initial state into the final one.
Partial order regression planning The STRIPS approach
State descriptions in STRIPS • States of the world are represented individually in logic: • Meaning: there is NO representation of how one state relates to the next • Nor any representation of time! • Only ground facts are used. • Example: the blocks world:
Action description in STRIPS • Preconditions: • a set of ground facts that need to be true in the state for the action to be applicable. • Effects: • two sets of ground facts: • the delete list: • need to be removed from the previous state • the add list: • need to be added to the previous state
If on(x,y) clear(x) clear(z) Preconditions Add on(x,z) clear(y) Add list Delete on(x,y) clear(z) Delete list Example:Some operator patterns: • Action1: “move block x from block y to block z”
If on(x,y) clear(x) Add on(x,Table) clear(y) Delete on(x,y) Example:Operator patterns (2): • Action2: “move block x from block y to Table”
If on(x,Table) clear(x) clear(z) Add on(x,z) Delete on(x,Table) clear(z) Example:Operator patterns (3): • Action3: “move block x from Table to block z” • Note:actual operators are ground instances of these!
What about using search in forward chaining on this? • Such search is NOT goal directed! • No information on what state to reach • This is similar to Automated Reasoning: bottom-up inference is not goal directed, top-down reasoning is! • See example:
Backward chaining: • Planning as regression: • start from the goal state and reason backwards to the initial state • Forward chaining would be progression: • move from initial state to goal state • Example: limited to 1 goal fact! • and only 1 possible path explored
Regression planning:goal reduction. • Select an atomic goal that still needs to be established • Find an operator that establishes it ( add list) • Add the operator to the plan and add an ESTABLISH link between operator and goal. • In general: complex goals are decomposed into atomic ones that themselves are reduced to new goals. • Is somewhat similar to ‘top-down’ goal-directed reasoning in AR.
Principle of least commitment (1) • Establish links only impose a partial order: • they do NOT impose that first operator needs to occur EXACTLY before second operator • BUT they are protected links: • NO operator may be scheduled between them that UNDOES the established property ! • Clue: do not decide on a choice before it is necessary!
While not(complete) and not(blocked) do Case: O operators threatens E(O1,O2) establishes: Initialize: operators: = empty; establishes:= empty; before:= empty; High-level algorithm complete:= false; blocked:= false; Case:before has loop: blocked:= true; add B(O,O1) OR add B(O2,O) to before; … … …
… … … Case: O operators has unsatisfied condition: End-While High-level algorithm(continued) find O’ operators OR add O’ to operators AND install establishes and before links Otherwise:complete:= true;
Some comments: • The algorithm is imprecise: • The Case for threatens links can be activated infinitely often for the same link • should test whether it has been dealt with
While not(complete) and not(blocked) do Case: O operators threatens E(O1,O2) establishes: Initialize: operators: = empty; establishes:= empty; before:= empty; complete:= false; blocked:= false; Case:before has loop: blocked:= true; add B(O,O1) OR add B(O2,O) to before; … … … High-level algorithm
Some comments: • The algorithm is imprecise: • The Case for threatens links can be activated infinitely often for the same link • should test whether it has been dealt with • The initial situation and goal situation are not explicitly present • and, the initial situation is not considered for unsatisfied conditions • add the initial and goal situation to operators in the Initialization • initial operator has no conditions, just adds initial situation • final operator adds/deletes nothing, just has a condition part.
If Add on(A,C) on(C,Table) clear(A) on(D,B) on(B,Table) clear(D) Delete If on(A,B) on(B,C) Add Delete Blocks example: • Initial operator: • Final operator:
Further refinement:backtracking: • When it exits the While loop because blocked = true (there is a before loop), then don’t terminate, but backtrack over operator choices.
While not(complete) and not(blocked) do Case: O operators threatens E(O1,O2) establishes: Initialize: operators: = empty; establishes:= empty; before:= empty; complete:= false; blocked:= false; Case:before has loop: blocked:= true; add B(O,O1) OR add B(O2,O) to before; … … … High-level algorithm
… … … Case: O operators has unsatisfied condition: End-While High-level algorithm(continued) find O’ operators OR add O’ to operators AND install establishes and before links Otherwise:complete:= true;
Further refinement:backtracking: • When it exits the While loop because blocked = true (there is a before loop), then don’t terminate, but backtrack over operator choices. • Note: no point in backtracking over selection of unsatisfied pre-conditions: • they ALL need to be satisfied anyway at the end
… … … Case: O operators has unsatisfied condition: End-While High-level algorithm(continued) find O’ operators OR add O’ to operators AND install establishes and before links Otherwise:complete:= true;
Further refinement:backtracking: • When it exits the While loop because blocked = true (there is a before loop), then don’t terminate, but backtrack over operator choices. • Note: no point in backtracking over selection of unsatisfied pre-conditions: • they ALL need to be satisfied anyway at the end • PS: note how this is similar to the ‘top-down’ automated reasoning techniques. • (backtrack over previous clause selections, not over previous atom selections).
Least commitment(2):plan with operator patterns • Key point: • Use operator patterns: • move x from y to Table • move x from Table to y • move x from y to z • instead of explicit operators: • move A from B to Table • move A from Table to B • move A from B to C • Avoids to make choices when the information to decide upon various alternatives is not yet there!
on(A,B) clear(A) on(B,Table) on(A,Table) goal initial move x from y to Table on(A,Table) on(A,B) clear(A) on(B,Table) if on(x,y) clear(x) add clear(y) on(x,Table) delete on(x,y) establishes unification: {x/A) on(A,B) clear(A) on(B,Table) if on(A,y) clear(A) add clear(y) on(A,Table) delete on(A,y) on(A,Table) establishes unification: {y/B) Blocks example:
Case: O operators has unsatisfied condition: find O’ operators OR add O’ to operators AND install establishes and before links Change in the algorithm: • O and O’ are (partially instantiated) operator patternsnow • The unsatisfied needs to be unifiable with an element of the add list of O’ now (not be identical) • The unifier needs to be applied on the entire set of operators constructed so far!
move A from C to y if on(A,C) clear(A) add clear(C) on(A,y) delete on(A,C) clear(y) establishes establishes on(A,B) on(B,D) clear(A) clear(B) clear(C) on(B,Table) threat? move B from z to Table if on(B,z) clear(B) add clear(z) on(B,Table) delete on(B,z) establishes establishes When is there a threat? • Example:
Dealing with possible threats 1) Ignore them, until they become instantiated to real threats. • Example: only if ‘delete clear(y)’ becomes ‘delete clear(B)’ we consider it a threat • Optimization: at least check whether there is still a consistent value for the variables(Ex.: y can still be assigned value D) 2) Introduce inequality constraints and replace unification by constraint solving • Example: constraint y B + unification must now also respect the inequalities 3) Choose a value for y • Ex.: assign y = D.