Introduction to Planning Introduction to Planning Course: CS40022 - - PowerPoint PPT Presentation

introduction to planning introduction to planning
SMART_READER_LITE
LIVE PREVIEW

Introduction to Planning Introduction to Planning Course: CS40022 - - PowerPoint PPT Presentation

Introduction to Planning Introduction to Planning Course: CS40022 Course: CS40022 Instructor: Dr. Pallab Dasgupta Pallab Dasgupta Instructor: Dr. Department of Computer Science & Engineering Department of Computer Science &


slide-1
SLIDE 1

Introduction to Planning Introduction to Planning

Course: CS40022 Course: CS40022 Instructor: Dr. Instructor: Dr. Pallab Dasgupta Pallab Dasgupta

Department of Computer Science & Engineering Department of Computer Science & Engineering Indian Institute of Technology Indian Institute of Technology Kharagpur Kharagpur

slide-2
SLIDE 2

2

CSE, IIT CSE, IIT Kharagpur Kharagpur

Outline Outline

  • Planning versus Search

Planning versus Search

  • Representation of planning problems

Representation of planning problems

  • Situation calculus

Situation calculus

  • STRIPS

STRIPS

  • ADL

ADL

  • Planning Algorithms

Planning Algorithms

  • Partial order planning

Partial order planning

  • GraphPlan

GraphPlan

  • SATPlan

SATPlan

slide-3
SLIDE 3

3

CSE, IIT CSE, IIT Kharagpur Kharagpur

The Planning Problem The Planning Problem

Get tea, biscuits, and a book. Get tea, biscuits, and a book.

  • Given:

Given:

  • Initial state:

Initial state: The agent is at The agent is at home home without without tea, biscuits, book tea, biscuits, book

  • Goal state:

Goal state: The agent is at The agent is at home home with tea, with tea, biscuits, book biscuits, book

slide-4
SLIDE 4

4

CSE, IIT CSE, IIT Kharagpur Kharagpur

The Planning Problem The Planning Problem

  • States can be represented by predicates

States can be represented by predicates such as such as At(x), Have(y), Sells(x, y) At(x), Have(y), Sells(x, y)

  • Actions:

Actions:

  • Go(y) :

Go(y) : Agent goes to y Agent goes to y – – causes At(y) to be true causes At(y) to be true

  • Buy(z):

Buy(z): Agent buys z Agent buys z – – causes Have(z) to be true causes Have(z) to be true

  • Steal(z):

Steal(z): Agent steals z Agent steals z

slide-5
SLIDE 5

5

CSE, IIT CSE, IIT Kharagpur Kharagpur

Planning as Search Planning as Search

  • Actions are given as logical descriptions of

Actions are given as logical descriptions of preconditions and effects. preconditions and effects.

  • This enables the planner to make direct

This enables the planner to make direct connections between states and actions. connections between states and actions.

  • The planner is free to add actions to the plan

The planner is free to add actions to the plan wherever they are required, rather than in an wherever they are required, rather than in an incremental way starting from the initial state. incremental way starting from the initial state.

  • Most parts of the world are independent of

Most parts of the world are independent of most other parts most other parts – – hence divide & conquer hence divide & conquer works well. works well.

slide-6
SLIDE 6

6

CSE, IIT CSE, IIT Kharagpur Kharagpur

Situation Calculus

Initial state: At(Home, s0) ∧ ¬ Have(Tea, s0) ∧ ¬ Have(Biscuits, s0) ∧ ¬Have(Book, s0) Goal state: ∃s At(Home, s) ∧ Have(Tea, s) ∧ Have(Biscuits, s) ∧ Have(Book, s)

slide-7
SLIDE 7

7

CSE, IIT CSE, IIT Kharagpur Kharagpur

Situation Calculus

Operators: ∀ a,s Have(Tea, Result(a,s)) ⇔ [(a = Buy(Tea) ∧ At(Tea-shop,s)) ∨ (Have(Tea, s) ∧ a ≠ Drop(Tea))] Result(a,s) names the situation resulting from executing the action a in the situation s

slide-8
SLIDE 8

8

CSE, IIT CSE, IIT Kharagpur Kharagpur

Practical Planners Practical Planners

  • To make planning practical we need to:

To make planning practical we need to:

  • Restrict the language with which we define

Restrict the language with which we define

  • problems. With a restrictive language,
  • problems. With a restrictive language,

there are fewer possible solutions to there are fewer possible solutions to search through search through

  • Use a special

Use a special-

  • purpose algorithm called a

purpose algorithm called a planner planner rather than a general purpose rather than a general purpose theorem theorem prover prover. .

slide-9
SLIDE 9

9

CSE, IIT CSE, IIT Kharagpur Kharagpur

STRIPS STRIPS

  • STanford

STanford Research Institute Problem Solver Research Institute Problem Solver

  • Many planners today use specification

Many planners today use specification languages that are variants of the one used in languages that are variants of the one used in STRIPS. STRIPS.

slide-10
SLIDE 10

10

CSE, IIT CSE, IIT Kharagpur Kharagpur

Representing states Representing states

  • States are represented by conjunctions of

States are represented by conjunctions of function function-

  • free ground literals

free ground literals At(Home) At(Home) ∧ ∧ ¬ ¬Have(Tea) Have(Tea) ∧ ∧ ¬ ¬Have(Biscuits) Have(Biscuits) ∧ ∧ ¬ ¬Have(Book) Have(Book)

slide-11
SLIDE 11

11

CSE, IIT CSE, IIT Kharagpur Kharagpur

Representing goals Representing goals

  • Goals are also described by conjunctions of

Goals are also described by conjunctions of literals literals At(Home) At(Home) ∧ ∧ Have(Tea) Have(Tea) ∧ ∧ Have(Biscuits) Have(Biscuits) ∧ ∧ Have(Book) Have(Book)

  • Goals can also contain variables

Goals can also contain variables At(x) At(x) ∧ ∧ Sells(x, Tea) Sells(x, Tea)

  • The above goal is

The above goal is being at a shop that being at a shop that sells tea sells tea

slide-12
SLIDE 12

12

CSE, IIT CSE, IIT Kharagpur Kharagpur

Representing Actions Representing Actions

  • Action description

Action description – – serves as a name serves as a name

  • Precondition

Precondition – – a conjunction of positive a conjunction of positive literals (why positive?) literals (why positive?)

  • Effect

Effect – – a conjunction of literals (+ a conjunction of literals (+ve ve or

  • r –

–ve ve) )

  • The original version had an

The original version had an add list add list and a and a delete list delete list. . Op( Op( ACTION: ACTION: Go(there), Go(there), PRECOND: PRECOND: At(here) At(here) ∧ ∧ Path(here, there), Path(here, there), EFFECT: EFFECT: At(there) At(there) ∧ ∧ ¬ ¬At(here)) At(here))

slide-13
SLIDE 13

13

CSE, IIT CSE, IIT Kharagpur Kharagpur

Representing Plans Representing Plans

  • A set of plan steps. Each step is one of the

A set of plan steps. Each step is one of the

  • perators for the problem.
  • perators for the problem.
  • A set of step ordering constraints. Each

A set of step ordering constraints. Each

  • rdering constraint is of the form
  • rdering constraint is of the form S

Si

i p

p S Sj

j,

, indicating indicating S Si

i must occur sometime before

must occur sometime before S Sj

j.

.

  • A set of variable binding constraints of the

A set of variable binding constraints of the form form v = x v = x, where v is a variable in some step, , where v is a variable in some step, and x is either a constant or another variable. and x is either a constant or another variable.

  • A set of causal links written as

A set of causal links written as S S → →c: S c: S’ ’ indicating indicating S satisfies the precondition c for S’ S satisfies the precondition c for S’. .

slide-14
SLIDE 14

14

CSE, IIT CSE, IIT Kharagpur Kharagpur

Example Example

  • Actions

Actions Op( Op( ACTION:

ACTION: RightShoe

RightShoe, ,

PRECOND: PRECOND: RightSockOn

RightSockOn, ,

EFFECT: EFFECT: RightShoeOn

RightShoeOn) ) Op( Op( ACTION:

ACTION: RightSock

RightSock, ,

EFFECT: EFFECT: RightSockOn

RightSockOn) ) Op( Op( ACTION:

ACTION: LeftShoe

LeftShoe, ,

PRECOND: PRECOND: LeftSockOn

LeftSockOn, ,

EFFECT: EFFECT: LeftShoeOn

LeftShoeOn) ) Op( Op( ACTION:

ACTION: LeftSock

LeftSock, ,

EFFECT: EFFECT: LeftSockOn

LeftSockOn) )

slide-15
SLIDE 15

15

CSE, IIT CSE, IIT Kharagpur Kharagpur

Example Example

  • Initial plan

Initial plan Plan( Plan( STEPS: STEPS: { { S1: Op( ACTION: start ), S1: Op( ACTION: start ), S2: Op( ACTION: finish, S2: Op( ACTION: finish, PRECOND: PRECOND: RightShoeOn RightShoeOn ∧ ∧ LeftShoeOn LeftShoeOn ) }, ) }, ORDERINGS: ORDERINGS: { {S S1

1 p

p S S2

2},

}, BINDINGS: BINDINGS: { }, { }, LINKS: LINKS: { } { } ) )

slide-16
SLIDE 16

16

CSE, IIT CSE, IIT Kharagpur Kharagpur

Action Description Language (ADL) Action Description Language (ADL)

Effect P Effect P∧¬ ∧¬Q means Q means add P, add P, ¬ ¬Q and delete Q and delete Q, Q, ¬ ¬P P Effect P Effect P∧¬ ∧¬Q means Q means add P, delete Q add P, delete Q Open World: Open World: Unmentioned literals Unmentioned literals are unknown are unknown Closed World: Closed World: Unmentioned literals Unmentioned literals are false are false Both + Both +ve ve and and – –ve ve literals in states literals in states ¬ ¬Thin Thin ∧ ∧ ¬ ¬Fast Fast Only + Only +ve ve literals in literals in states states Fat Fat ∧ ∧ Slow Slow ADL ADL STRIPS STRIPS

slide-17
SLIDE 17

17

CSE, IIT CSE, IIT Kharagpur Kharagpur

Action Description Language (ADL) Action Description Language (ADL)

Goals allow Goals allow conjunctions and conjunctions and disjunctions disjunctions Goals are conjunctions Goals are conjunctions Quantified variables in Quantified variables in goals goals ∃ ∃x At(Tea,x) x At(Tea,x) ∧ ∧ At(Coffee,x) At(Coffee,x) Only ground literals in Only ground literals in goals goals Fat Fat ∧ ∧ Slow Slow ADL ADL STRIPS STRIPS

slide-18
SLIDE 18

18

CSE, IIT CSE, IIT Kharagpur Kharagpur

Partial Order Planning Partial Order Planning

Initial state: Initial state: Op( Op( ACTION: ACTION: Start, Start, EFFECT: EFFECT: At(Home) At(Home) ∧ ∧ Sells(BS, Book) Sells(BS, Book) ∧ ∧ Sells(TS, Tea) Sells(TS, Tea) ∧ ∧ Sells(TS, Biscuits) ) Sells(TS, Biscuits) ) Goal state: Goal state: Op( Op( ACTION: ACTION: Finish, Finish, PRECOND: PRECOND: At(Home) At(Home) ∧ ∧ Have(Tea) Have(Tea) ∧ ∧ Have(Biscuits) Have(Biscuits) ∧ ∧ Have(Book) ) Have(Book) )

slide-19
SLIDE 19

19

CSE, IIT CSE, IIT Kharagpur Kharagpur

Partial Order Planning Partial Order Planning

Actions: Actions: Op( Op( ACTION: ACTION: Go(there), Go(there), PRECOND: PRECOND: At(here), At(here), EFFECT: EFFECT: At(there) At(there) ∧ ∧ ¬ ¬At(here)) At(here)) Op( Op( ACTION: ACTION: Buy(x), Buy(x), PRECOND: PRECOND: At(store) At(store) ∧ ∧ Sells(store, x), Sells(store, x), EFFECT: EFFECT: Have(x)) Have(x))

slide-20
SLIDE 20

20

CSE, IIT CSE, IIT Kharagpur Kharagpur

Partial Order Planning Algorithm Partial Order Planning Algorithm

Function POP( Function POP( initial, goal, operators initial, goal, operators ) ) // Returns // Returns plan plan plan plan ← ← Make Make-

  • Minimal

Minimal-

  • Plan(

Plan( initial, goal initial, goal ) ) Loop do Loop do If Solution( If Solution( plan plan ) then return ) then return plan plan S, c S, c ← ← Select Select-

  • Subgoal

Subgoal( ( plan plan ) ) Choose Choose-

  • Operator(

Operator( plan, operators plan, operators, S, c , S, c ) ) Resolve Resolve-

  • Threats(

Threats( plan plan ) ) end end

slide-21
SLIDE 21

21

CSE, IIT CSE, IIT Kharagpur Kharagpur

POP Algorithm (Contd.) POP Algorithm (Contd.)

Function Select Function Select-

  • Subgoal

Subgoal( ( plan plan ) ) // Returns // Returns S, c S, c pick a plan step pick a plan step S S from STEPS( from STEPS( plan plan ) ) with a precondition with a precondition C C that that has not been achieved has not been achieved Return Return S, c S, c

slide-22
SLIDE 22

22

CSE, IIT CSE, IIT Kharagpur Kharagpur

Proc Choose Proc Choose-

  • Operator

Operator( ( plan, operators plan, operators, S, c , S, c ) ) choose a step choose a step S’ S’ from from operators

  • perators or
  • r

STEPS( STEPS( plan plan ) ) that has that has c c as an effect as an effect if there is no such step then if there is no such step then fail fail add the causal link add the causal link S’ S’ → → c: S c: S to to LINKS( LINKS( plan plan ) ) add the ordering constraint add the ordering constraint S S’ ’ p p S S to to ORDERINGS( ORDERINGS( plan plan ) ) if if S S’ ’ is a newly added step from is a newly added step from operators

  • perators

then add then add S S’ ’ to to STEPS( STEPS( plan plan ) ) and add and add Start Start p p S S’ ’ p p Finish Finish to to ORDERINGS( ORDERINGS( plan plan ) )

slide-23
SLIDE 23

23

CSE, IIT CSE, IIT Kharagpur Kharagpur

POP Algorithm (Contd.) POP Algorithm (Contd.)

Procedure Resolve Procedure Resolve-

  • Threats

Threats( ( plan plan ) ) for each for each S’’ S’’ that threatens a link that threatens a link S Si

i →

→ c: c: S Sj

j in

in LINKS( LINKS( plan plan ) ) do do choose either choose either Promotion: Promotion: Add Add S S’’ ’’ p p S Si

i to

to ORDERINGS( ORDERINGS( plan plan ) ) Demotion: Demotion: Add Add S Sj

j p

p S S’’ ’’ to to ORDERINGS( ORDERINGS( plan plan ) ) if not if not Consistent( Consistent( plan plan ) ) then then fail fail

slide-24
SLIDE 24

24

CSE, IIT CSE, IIT Kharagpur Kharagpur

Partially instantiated operators Partially instantiated operators

  • So far we have not mentioned anything about

So far we have not mentioned anything about binding constraints binding constraints

  • Should an operator that has the effect, say,

Should an operator that has the effect, say, ¬ ¬At(x) At(x), , be considered a threat to the be considered a threat to the condition, condition, At(Home) At(Home) ? ?

  • Indeed it is a

Indeed it is a possible threat possible threat because because x x may be bound to may be bound to Home Home

slide-25
SLIDE 25

25

CSE, IIT CSE, IIT Kharagpur Kharagpur

Dealing with possible threats Dealing with possible threats

  • Resolve now with an equality constraint

Resolve now with an equality constraint

  • Bind

Bind x x to something that resolves the to something that resolves the threat (say threat (say x = TS x = TS) )

  • Resolve now with an inequality constraint

Resolve now with an inequality constraint

  • Extend the language of variable binding to

Extend the language of variable binding to allow allow x x ≠ ≠ Home Home

  • Resolve later

Resolve later

  • Ignore possible threats. If

Ignore possible threats. If x = Home x = Home is is added later into the plan, then we will added later into the plan, then we will attempt to resolve the threat (by promotion attempt to resolve the threat (by promotion

  • r demotion)
  • r demotion)
slide-26
SLIDE 26

26

CSE, IIT CSE, IIT Kharagpur Kharagpur

Proc Choose Proc Choose-

  • Operator

Operator( ( plan, operators plan, operators, S, c , S, c ) ) choose a step choose a step S’ S’ from from operators

  • perators or
  • r

STEPS( STEPS( plan plan ) ) that has that has c’ c’ as an effect as an effect s.t. s.t. u = u = UNIFY( c, c’, BINDINGS( plan )) UNIFY( c, c’, BINDINGS( plan )) if there is no such step then if there is no such step then fail fail add add u u to to BINDINGS( BINDINGS( plan plan ) ) add the causal link add the causal link S’ S’ → → c: S c: S to to LINKS( LINKS( plan plan ) ) add the ordering constraint add the ordering constraint S S’ ’ p p S S to to ORDERINGS( ORDERINGS( plan plan ) ) if if S S’ ’ is a newly added step from is a newly added step from operators

  • perators then

then add add S S’ ’ to to STEPS( STEPS( plan plan ) ) and add and add Start Start p p S S’ ’ p p Finish Finish to to ORDERINGS( ORDERINGS( plan plan ) )

slide-27
SLIDE 27

27

CSE, IIT CSE, IIT Kharagpur Kharagpur

Procedure Resolve Procedure Resolve-

  • Threats

Threats( ( plan plan ) ) for each for each S Si

i →

→ c: c: S Sj

j in

in LINKS( LINKS( plan plan ) ) do do for each for each S S’’ ’’ in in STEPS( STEPS( plan plan ) ) do do for each for each c c’ ’ in in EFFECTS( S EFFECTS( S’’ ’’) ) do do if if SUBST( BINDINGS( SUBST( BINDINGS(plan plan), c ) ), c ) = SUBST( BINDINGS( = SUBST( BINDINGS(plan plan), ), ¬ ¬c c’ ’ ) ) then choose either then choose either Promotion: Promotion: Add Add S S’’ ’’ p p S Si

i to

to ORDERINGS( ORDERINGS( plan plan ) ) Demotion: Demotion: Add Add S Sj

j p

p S S’’ ’’ to to ORDERINGS( ORDERINGS( plan plan ) ) if not if not Consistent( Consistent( plan plan ) ) then then fail fail