Planning: Part 2 Partial Order Planning COMP151 April 2, 2007.

Post on 19-Dec-2015

221 views 3 download

Tags:

Transcript of Planning: Part 2 Partial Order Planning COMP151 April 2, 2007.

Planning: Part 2Partial Order Planning

COMP151April 2, 2007

Planning: Chapter 11

• 11.1 The planning problem• 11.2 Planning with state-space search• 11.3 Partial-order planning• 11.4 Planning graphs• 11.5 Planning with propositional logic• 11.6 Analysis of planning approaches

Partial-order Planning• Progression and regression planning are

totally ordered plan search forms.• They cannot take advantage of problem

decomposition• Decisions must be made on how to sequence actions

on all the subproblems

• POP:• Work on subgoals independently• Construct plan by working on obvious or more

important decisions first• Least commitment strategy: delay choice during

search

Shoe ExampleGoal(RightShoeOn LeftShoeOn)Init()Action(RightShoe, PRECOND: RightSockOn

EFFECT: RightShoeOn)Action(RightSock, PRECOND:

EFFECT: RightSockOn)Action(LeftShoe, PRECOND: LeftSockOn

EFFECT: LeftShoeOn)Action(LeftSock, PRECOND:

EFFECT: LeftSockOn)

Planner: combine two action sequences (1)leftsock, leftshoe (2)rightsock, rightshoe

Partial-order Planning (POP)• Any planning algorithm that can place two actions into a plan without

which comes first is a PO plan.

(linearizations)

POP as a Search Problem• Q: Assuming we have partial plans for subgoals,

how can we construct a complete plan?• A: Construct a search problem

• States are (mostly unfinished) plans• Start with an empty plan

• An empty plan contains only start and finish actions

• Actions are actions on plans (not the actions in the real world)

• Add a step to the plan• Impose an ordering on steps

POP as a Search Problem• Each plan has 4 components:

• (1) A set of actions (steps of the plan)• Start action: no precondition, effect = initial state• Finish action: no effect, precondition = goal state• Other actions: from partial plans

• (2) A set of ordering constraints: A ≺ B (A before B)

• Cycles represent contradictions

POP as a Search Problem• Each plan has 4 components:

• (3) A set of causal linksmeans “A achieves p for B”,where p is a precondition for B

• Action C conflicts with A p B if C has effect ¬p and C could come between A and B

• The causal link protects p from being negated over the interval A to B

• (4) A set of open preconditions• A precondition is open if it is not achieved by some action

currently in the plan

A p B

POP as a Search Problem• A consistent plan is one in which:

• there are no cycles in the ordering constraints• no conflicts with the causal links

• A solution is• a consistent plan with no open preconditions

Example of SolutionActions = { Rightsock, Rightshoe, Leftsock, Leftshoe,

Start, Finish }

Orderings = { Rightsock ≺ Rightshoe,

Leftsock ≺ Leftshoe }

Causal Links = { LeftSock LeftSockOn LeftShoe, RightSock RightSockOn RightShoe, LeftShoe LeftShoeOn Finish, RightShoe RightShoeOn Finish }

Open preconditions = { }

POP Algorithm• The initial plan contains Start and Finish, the ordering

constraint Start ≺ Finish, no causal links, all the preconditions in Finish are open.

• Successor function :• pick one open precondition p on an action B and• generate a successor plan for every

possible consistent way of choosing action A that achieves p.(see next slide for enforcing consistency)

• Test goal (no open preconditions)

Enforcing consistency• When generating successor plan:

• The causal link A p B and the ordering constraint A ≺ B are added to the plan.

• If A is new also add Start ≺ A and A ≺ Finish to the plan

• Resolve conflicts between new causal link and all existing actions

• Resolve conflicts between action A (if new) and all existing causal links.

• A conflict between A p B and C is resolved by adding C ≺ A or B ≺ C.

Algorithm Summary• Operators on partial plans

• Add link from existing plan to open precondition.• Add a step to fulfill an open condition.• Order one step w.r.t another to remove possible

conflicts

• Gradually move from incomplete/vague plans to complete/correct plans

• Backtrack if an open condition is unachievable or if a conflict is irresolvable.

Example: Spare Tire ProblemInit(At(Flat, Axle) At(Spare,trunk))Goal(At(Spare,Axle))Action(Remove(Spare,Trunk) PRECOND: At(Spare,Trunk)

EFFECT: ¬At(Spare,Trunk) At(Spare,Ground)) Action(Remove(Flat,Axle) PRECOND: At(Flat,Axle)

EFFECT: ¬At(Flat,Axle) At(Flat,Ground)) Action(PutOn(Spare,Axle)

PRECOND: At(Spare,Ground) ¬At(Flat,Axle)EFFECT: At(Spare,Axle) ¬Ar(Spare,Ground))

Action(LeaveOvernight PRECOND: <none>EFFECT: ¬ At(Spare,Ground) ¬ At(Spare,Axle) ¬ At(Spare,trunk) ¬ At(Flat,Ground) ¬ At(Flat,Axle) )

Example: Spare Tire Problem

• Initial plan: Start with EFFECTS and Finish with PRECOND

Example: Spare Tire Problem

• Pick an open precondition: At(Spare, Axle)• Only PutOn(Spare, Axle) is applicable• Add causal link: PutOn(Spare, Axle) At(Spare, Axle) Finish• Add constraint : PutOn(Spare, Axle) ≺ Finish

Example: Spare Tire Problem

• Pick an open precondition: At(Spare, Ground)• Only Remove(Spare, Trunk) is applicable• Add causal link:

Remove(Spare, Trunk) At(Spare, Ground) PutOn(Spare,Axle)• Add constraint :

Remove(Spare, Trunk) ≺ PutOn(Spare,Axle)

Example: Spare Tire Problem

• Pick an open precondition: ¬At(Flat, Axle)• LeaveOverNight is applicable• conflict: LeaveOverNight also has the effect ¬ At(Spare,Ground),

which conflicts withRemove(Spare, Trunk) At(Spare, Ground) PutOn(Spare,Axle)

• To resolve, add constraint : LeaveOverNight ≺ Remove(Spare, Trunk)

Example: Spare Tire Problem

• Add causal link: LeaveOverNight ¬At(Flat,Axle) PutOn(Spare,Axle)

Example: Spare Tire Problem

• Pick an open precondition: At(Spare, Trunk)• Only Start is applicable• Add causal link: Start At(Spare, Trunk) Remove(Spare, Trunk)• Conflict: causal link with effect ¬At(Spare,Trunk) in LeaveOverNight

• No re-ordering solution possible.• backtrack

Example: Spare Tire Problem

• Remove LeaveOverNight, Remove(Spare, Trunk) and causal links• Repeat step with Remove(Spare,Trunk)• Add also RemoveFlatAxle and finish

Some details …• What happens when a first-order representation that

includes variables is used?• Complicates the process of detecting and resolving conflicts.• Can be resolved by introducing inequality constraint.

• CSP’s most-constrained-variable constraint can be used for planning algorithms to select a PRECOND.