25
1 Plan-Space Planning Dr. Héctor Muñoz-Avila Sources: • Ch. 5 • Appendix A •Slides from Dana Nau’s lecture

1 Plan-Space Planning Dr. Héctor Muñoz-Avila Sources: Ch. 5 Appendix A Slides from Dana Nau’s lecture

Embed Size (px)

Citation preview

1

Plan-Space Planning

Dr. Héctor Muñoz-Avila

Sources:• Ch. 5• Appendix A•Slides from Dana Nau’s lecture

2

Domains for Evaluations http://members.deri.at/~joergh/ff-domains.html Choose one of the following:

Assembly Freecell Fridge Logistics Miconic-STRIPS Schedule Tyreworld

E-mail me your choice. First take, first get. You may need to adapt domain to run in a system. You need 30 problems.

Create them manually, or Use a random problem generator (yours or create one) Problems must scale: 4 goals, 5 goals, …, 9 goals (5 problems each)

3

Remember the Sussman Anomaly?

Initial state goal

A set of goals G is serializable if: An ordering g1, …, gn of the goals in G can be found such as:

» Every plan P1 satisfying g1, can be extended to a plan P2 satisfying g1 and g2, and so forth

• Extend means that neither constraints nor steps in P1 need to be removed to obtain P2

Problem: Goals in the Sussman Anomaly are not serializable This is not an exception. Goals for many problems are not serializable

c

a b c

a

b

4

Plan-Space Planning

Initial plancomplete plan for

goals

• Search is performed in the plan space

• Plan space•V: set of plans•E: plan refinement transitions

• As before: computed graph is a subset of plan space

•Remember the number of states for DWR states?

• Least commitment:•Does not commit on action ordering

5

Plan-Space Planning - Basic Idea Backward search from the goal Each node of the search space is a partial plan

» A set of partially-instantiated actions» A set of constraints

Make more and more refinements,until we have a solution

Types of constraints: precedence constraint:

a must precede b binding constraints:

» inequality constraints, e.g., v1 ≠ v2 or v ≠ c» equality constraints (e.g., v1 = v2 or v = c) or substitutions

causal link:» use action a to establish the precondition p needed by action b

How to tell we have a solution: no more flaws in the plan Will discuss flaws and how to resolve them A partial plan is complete if plan has no flaws

a(x)Precond: …Effects: p(x)

b(y)Precond: p(y)Effects: …

c(x)Precond: p(x)Effects: …

p(x)

x ≠ y

Dana Nau: Lecture slides for Automated PlanningLicensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/

Can this link be made?

6

Flaw: An action a has a precondition p that we haven’t

decided how to establish

Resolving the flaw: Find an action b

• (either already in the plan, or insert it) that can be used to establish p

• can precede a and produce p Instantiate variables Create a causal link

a(y)Precond: …Effects: p(y)

c(x)Precond: p(x)Effects: …

a(x)Precond: …Effects: p(x)

c(x)Precond: p(x)Effects: …

p(x)

Open Goal

Dana Nau: Lecture slides for Automated PlanningLicensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/

7

Threat

Flaw: a deleted-condition interaction Action a establishes a condition (e.g., p(x)) for action b Another action c is capable of deleting this condition p(x)

» And action c is “parallel” to the causal link Resolving the flaw:

impose a constraint to prevent c from deleting p(x) Three possibilities:

Make b precede c Make c precede a Constrain variable(s)

to prevent c fromdeleting p(x)

a(x)Precond: …Effects: p(x)

c(y)Precond: …Effects: p(y)

b(x)Precond: p(x)Effects: …

p(x)

8

The PSP Procedure

PSP is both sound and complete See next slide

Dana Nau: Lecture slides for Automated PlanningLicensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/

9

Solution: A Complete Partial Plan

Plan: any sequence of actions = a1, a2, …, an such thateach ai is a ground instance of an operator in O

The plan is a solution for P=(O,s0,g) if it is executable and achieves g

i.e., if there are states s0, s1, …, sn such that

» (s0,a1) = s1

» (s1,a2) = s2

» …

» (sn–1,an) = sn

» sn satisfies g

But in PSP returns a “complete partial plan”. Is this a solution in terms of the definition of plans above?

10

Example Similar (but not identical) to an example in Russell and Norvig’s

Artificial Intelligence: A Modern Approach (1st edition) Operators:

Start

Precond: none

Effects: At(Home), sells(HWS,Drill), Sells(SM,Milk), Sells(SM,Banana)

Finish

Precond: Have(Drill), Have(Milk), Have(Banana), At(Home) Go(l,m)

Precond: At(l)

Effects: At(m), At(l) Buy(p,s)

Precond: At(s), Sells(s,p)

Effects: Have(p)Dana Nau: Lecture slides for Automated PlanningLicensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/

11

Example (continued)

Initial plan

Sells(SM,Milk), Sells(SM,Bananas) At(Home), Sells(HWS,Drill),

Have(Bananas), At(Home)Have(Drill), Have(Milk),

Dana Nau: Lecture slides for Automated PlanningLicensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/

12

Example (continued)

The only possible ways to establish the “Have” preconditions

At(s1), Sells(s1,Drill) At(s2), Sells(s2,Milk) At(s3), Sells(s3,Bananas)

Buy(Drill, s1) Buy(Milk, s2) Buy(Bananas, s2)

Have(Drill), Have(Milk), Have(Bananas), At(Home)

Dana Nau: Lecture slides for Automated PlanningLicensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/

“standardization”

13

Example (continued)

The only possible way to establish the “Sells” preconditions

Buy(Drill,HWS) Buy(Milk,SM) Buy(Bananas,SM)

At(SM), Sells(SM,Milk)At(HWS), Sells(HWS,Drill) At(SM), Sells(SM,Bananas)

Have(Drill), Have(Milk), Have(Bananas), At(Home)

Dana Nau: Lecture slides for Automated PlanningLicensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/

14

At(SM), Sells(SM,Milk)At(HWS), Sells(HWS,Drill) At(SM), Sells(SM,Bananas)

At(x)

Buy(Milk,SM) Buy(Bananas,SM)

At(l2)

Go(l2, SM)

At(l1)

Go(l1,HWS)

Buy(Drill,HWS)

Have(Drill), Have(Milk), Have(Bananas), At(Home)

Example (continued)

The only ways to establish At(HWS) and At(SM) Let us enumerate threats

How can we solve all these threats in one step?

Dana Nau: Lecture slides for Automated PlanningLicensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/

15

To resolve the third threat, make Buy(Drill) precede Go(SM) This resolves all three threats

Example (continued)

At(SM), Sells(SM,Milk)At(HWS), Sells(HWS,Drill) At(SM), Sells(SM,Bananas)

At(x)

Buy(Milk,SM) Buy(Bananas,SM)

At(l2)

Go(l2, SM)

At(l1)

Go(l1,HWS)

Buy(Drill,HWS)

Have(Drill), Have(Milk), Have(Bananas), At(Home)

Dana Nau: Lecture slides for Automated PlanningLicensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/

16

Example (continued)

Establish At(l1) with l1=Home

At(SM), Sells(SM,Milk)At(HWS), Sells(HWS,Drill) At(SM), Sells(SM,Bananas)

At(x)

Buy(Milk,SM) Buy(Bananas,SM)

At(l2)

Go(l2, SM)

At(Home)

Go(Home,HWS)

Buy(Drill,HWS)

Have(Drill), Have(Milk), Have(Bananas), At(Home)

Dana Nau: Lecture slides for Automated PlanningLicensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/

17

Example (continued)

Establish At(l2) with l2=HWS

Buy(Milk,SM) Buy(Bananas,SM)

At(x) At(HWS)

Go(HWS,SM)

At(Home)

Go(Home,HWS)

At(SM), Sells(SM,Milk)At(HWS), Sells(HWS,Drill) At(SM), Sells(SM,Bananas)

Buy(Drill,HWS)

Have(Drill), Have(Milk), Have(Bananas), At(Home)

Dana Nau: Lecture slides for Automated PlanningLicensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/

18

Example (continued)

Establish At(Home) for Finish

Buy(Milk,SM) Buy(Bananas,SM)

At(x) At(HWS)

Go(HWS,SM)

At(Home)

Go(Home,HWS)

At(SM), Sells(SM,Milk)At(HWS), Sells(HWS,Drill) At(SM), Sells(SM,Bananas)

Buy(Drill,HWS)

Have(Drill), Have(Milk), Have(Bananas), At(Home)

At(l3)

Go(l3, Home)

Dana Nau: Lecture slides for Automated PlanningLicensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/

19

Example (continued)

Constrain Go(Home) to remove threats to At(SM)

Buy(Milk,SM) Buy(Bananas,SM)

At(x) At(HWS)

Go(HWS,SM)

At(Home)

Go(Home,HWS)

At(SM), Sells(SM,Milk)At(HWS), Sells(HWS,Drill) At(SM), Sells(SM,Bananas)

Buy(Drill,HWS)

Have(Drill), Have(Milk), Have(Bananas), At(Home)

At(l3)

Go(l3, Home)

Dana Nau: Lecture slides for Automated PlanningLicensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/

20

Complete Partial Plan

Establish At(l3) with l3=SM

Buy(Milk,SM) Buy(Bananas,SM)

At(x) At(HWS)At(Home)

Go(Home,HWS)

At(SM), Sells(SM,Milk)At(HWS), Sells(HWS,Drill) At(SM), Sells(SM,Bananas)

Buy(Drill,HWS)

Have(Drill), Have(Milk), Have(Bananas), At(Home)

At(SM)

Go(SM,Home)

Go(HWS,SM)

Dana Nau: Lecture slides for Automated PlanningLicensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/

21

Comments

PSP doesn’t commit to orderings andinstantiations until necessary Avoids generating search trees like this one:

Problem: how to prune infinitely long paths? Loop detection is based on recognizing states

we’ve seen before In a partially ordered plan, we don’t know the states

» Computing an state is NP complete

Can we prune if we see the same action more than once?

a bc

b a

b a ba c

b c ac b

goal

go(b,a) go(a,b) go(b,a) at(a)• • •

No. Sometimes we might need the same action several times in different states of the world (see next slide)

22

Example 3-digit binary counter starts at 000, want to get to 110

s0 = {d3=0, d2=0, d1=0}

g = {d3=1, d2=1, d1=0}

Operators to  increment the counter by 1:

incr0

Precond: d1=0

Effects: d1=1

incr01

Precond: d2=0, d1=1

Effects: d2=1, d1=0

incr011

Precond: d3=0, d2=1, d1=1

Effects: d3=1, d2=0, d1=0

Veloso call this “linkiability”

23

Comments (II) Note a potential combinatorial problem when solving threats

Can someone explain?

Why does PSP solves the Sussman Anomaly?

Heuristics for PSP might be harder to formulate than with state space planning Why?

Universal Classical Planning Combines state-space and plan-space planning in an unified

framework

24

Reminder: STRIPS and the Sussman Anomaly

C

A B

B C

A

Pick up B

Put B on C

Pick up C

Pick up A

Put C on table

Put A on B

C

A

B

c

a bc

a

b

25

POP and the Sussman Anomaly

C

A B

B

A

Pick up B

Put B on C

Pick up C

Pick up A

Put C on table

Put A on B

C

B

c

a bc

a

b

Can we sort these steps

to achieve these two goals?