lecture 9: first-order logic and planningdprecup/courses/ai/lectures/ai-lecture09.… · lecture 9:...

30
Lecture 9: First-order Logic and Planning First-order logic Inference in first-order logic Expressing planning problems: PDDL and STRIPS language and PDDL State-space planning Forward planners Goal regression Plan-space planning What to do if plans fail COMP-424, Lecture 9 - February 4, 2013 1 Recall: Propositional Logic The good: Propositional logic is very simple! Just facts (literals), usual logical connectives, inference is simple The bad: Propositional logic is very simple! We cannot express things in a compact way Knowledge base may need to have many similar facts and sentences E.g. in the wumpus world, we want to be able to express how a move works for all squares in one sentence COMP-424, Lecture 9 - February 4, 2013 2

Upload: others

Post on 30-May-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Lecture 9: First-order Logic and Planning

• First-order logic

• Inference in first-order logic

• Expressing planning problems: PDDL and STRIPS language and PDDL

• State-space planning

– Forward planners– Goal regression

• Plan-space planning

• What to do if plans fail

COMP-424, Lecture 9 - February 4, 2013 1

Recall: Propositional Logic

• The good: Propositional logic is very simple!

Just facts (literals), usual logical connectives, inference is simple

• The bad: Propositional logic is very simple!

– We cannot express things in a compact way– Knowledge base may need to have many similar facts and sentences

• E.g. in the wumpus world, we want to be able to express how a moveworks for all squares in one sentence

COMP-424, Lecture 9 - February 4, 2013 2

First-Order Logic (FOL)

• A key element of FOL are predicates, which are used to describe objects,properties, and relationships between objects

E.g. On(x,y)

• A quantified statement is a statement that applies to a class of objects

E.g. ∀x On(x,Table) → Fruit(x)

– This means that there is only fruit on the table– The first element is called a quantifier, x is a variable and Table is a

constant– On is a predicate

• The use of quantifiers allows FOL to handle infinite domains, whilepropositional logic can only handle finite domains.

COMP-424, Lecture 9 - February 4, 2013 3

Syntax of FOL: Basic elements

Constants Wumpus, 2, CS424, ...Predicates At, >,...Functions log, exp,...Variables x, y, ...Connectives ∧ ∨ ¬ → ↔Equality =Quantifiers ∀ ∃

COMP-424, Lecture 9 - February 4, 2013 4

Atomic sentences

Atomic sentence = predicate(term1,...,termn)or term1 = term2

Term = function(term1,...,termn)or constant or variable

E.g., At(Wumpus,2,1) is an atomic sentence with one predicate

COMP-424, Lecture 9 - February 4, 2013 5

Complex sentences

Complex sentences are made from atomic sentences using connectives

¬S, S1 ∧ S2, S1 ∨ S2, S1 → S2, S1 ↔ S2

E.g. At(Wumpus,2,1) → ¬ At(Wumpus,1,2)>(1, 2) ∨ ≤(1, 2)>(1, 2) ∧ ¬>(1, 2)

COMP-424, Lecture 9 - February 4, 2013 6

Universal Quantification

• Syntax: ∀variables sentence• E.g. Everyone taking AI is smart.∀x Taking(x,AI) → Smart(x)

• Semantics: ∀x S is equivalent to the conjunction of instantiations of S:

Taking(John,AI) → Smart(John)∧ Taking(Ann,AI) → Smart(Ann)∧ ...

• Typically, → is the main connective with ∀.

COMP-424, Lecture 9 - February 4, 2013 7

Example

• What does this statement mean:

∀x Taking(x,AI) ∧ Smart(x)

• Common mistake: using ∧ as the main connective with ∀:∀x Taking(x,AI) ∧ Smart(x)

means “Everyone is taking AI and everyone is smart”

COMP-424, Lecture 9 - February 4, 2013 8

Existential Quantification

• Syntax: ∃variables sentence• Someone taking AI is smart:

∃x Taking(x,AI) ∧ Smart(x)

• Semantics: ∃x S is equivalent to the disjunction of instantiations of S

(Taking(Ann,AI) ∧ Smart(Ann))∨ (Taking(John,AI) ∧ Smart(John))∨ ...

• Typically, ∧ is the main connective with ∃.

COMP-424, Lecture 9 - February 4, 2013 9

Example

• What does this mean:

∃x Taking(x,AI) → Smart(x)

• Common mistake: using → as the main connective with ∃:∃x Taking(x,AI) → Smart(x) is true if there is anyone who is not takingAI!

COMP-424, Lecture 9 - February 4, 2013 10

Properties of quantifiers

• ∀x∀y is the same as ∀y∀x• ∃x∃y is the same as ∃y∃x• ∃x∀y is not the same as ∀y∃x∃x∀yLoves(x, y)“There is a person who loves everyone in the world”

∀y∃xLoves(x, y)“Everyone in the world is loved by at least one person”

COMP-424, Lecture 9 - February 4, 2013 11

Example

Let x and y be real numbers.

• ∀x∃y x > y

• ∃x∀y x > y

What does each sentence mean? Are they valid, satisfiable or unsatisfiable?

COMP-424, Lecture 9 - February 4, 2013 12

Abellard-Eloise Games

• Abellard handles the universal quantifiers ∀• Eloise handles the existential quantifiers ∃• Abellard is trying to choose values to make the sentence inside thequantifiers false

• Eloise is trying to make the statement inside the quantifiers true

• They take turns as specified by the order of the quantifiers, left to right

• The sentence is valid if and only if Eloise has a winning strategy

COMP-424, Lecture 9 - February 4, 2013 13

Quantifier Duality

Each quantifier can be expressed using the other quantifier and negation:

• ∀x Likes(x,IceCream) is equivalent to ¬∃x ¬Likes(x,IceCream)

• ∃x Likes(x,Broccoli) is equivalent to ¬∀x ¬Likes(x,Broccoli)

COMP-424, Lecture 9 - February 4, 2013 14

Fun with Sentences

• Brothers are siblings

∀x∀yBrother(x, y) → Sibling(x, y)

• “Sibling” is reflexive

∀x∀ySibling(x, y) ↔ Sibling(y, x)

• One’s mother is one’s female parent

∀x∀yMother(x, y) ↔ (Female(x) ∧ Parent(x, y))

• A first cousin is a child of a parent’s sibling

∀x∀yF irstCousin(x, y) ↔ ∃p∃psParent(p, x) ∧Sibling(ps, p) ∧ Parent(ps, y)

COMP-424, Lecture 9 - February 4, 2013 15

Equality

• term1 = term2 is true under a given interpretation if and only if term1

and term2 refer to the same object

• Example:

Obj1=Obj2 is satisfiable2 = 2 is valid

• Example: definition of the sibling predicate:

∀x∀ySibling(x, y) ↔ [¬(x = y) ∧∃m∃f¬(m = f) ∧ Parent(m,x) ∧ Parent(f, x) ∧Parent(m, y) ∧ Parent(f, y)]

COMP-424, Lecture 9 - February 4, 2013 16

Proofs

The proof process can be viewed as a search in which the operators areinference rules:

• Modus Ponens (MP)

α, α → β

β

Takes(Joe,AI) Takes(Joe,AI) → Cool(Joe)

Cool(Joe)

• And-Introduction (AI)

α β

α ∧ β

Cool(Joe) CSMajor(Joe)

Cool(Joe) ∧ CSMajor(Joe)

• Universal Elimination (UE): τ must be a ground term i.e. a term withno variables

∀xαα{x/τ}

∀x Takes(x,AI) → Cool(x)

Takes(Pat,AI) → Cool(Pat)

COMP-424, Lecture 9 - February 4, 2013 17

Example Proof

Bob is a buffalo 1. Buffalo(Bob)Pat is a pig 2. Pig(Pat)Buffaloes outrun pigs 3. ∀x∀y Buffalo(x) ∧ Pig(y) → Faster(x,y)AI 1 & 2 4. Buffalo(Bob) ∧ Pig(Pat)UE 3, x/Bob, y/Pat 5. Buffalo(Bob) ∧ Pig(Pat) → Faster(Bob,Pat)MP 4 & 5 6. Faster(Bob,Pat)

COMP-424, Lecture 9 - February 4, 2013 18

Search with Primitive Inference Rules

Operators are inference rules

States are sets of sentences

Goal test checks state to see if it contains query sentence

AI, UE, MP is a common inference patternProblem: branching factor huge, especially forUEIdea: find a substitution that makes the rulepremise match some known facts⇒ a single, more powerful inference rule

COMP-424, Lecture 9 - February 4, 2013 19

Unification

• A substitution σ unifies atomic sentences p and q if pσ = qσ

p q σ

Knows(John,x) Knows(John,Jane) x/JaneKnows(John,x) Knows(y,Mary) y/John,x/MaryKnows(John,x) Knows(y,Mother(y)) y/John,x/Mother(John)

• Idea: Unify rule premises with known facts, apply unifier to conclusion

• E.g., if we know q and the rule: Knows(John,x) →Likes(John,x), weconclude:

– Likes(John,Jane)– Likes(John,Mary)– Likes(John,Mother(John))

COMP-424, Lecture 9 - February 4, 2013 20

Generalized Modus Ponens (GMP)

p1�, p2

�, . . . , pn�, (p1 ∧ p2 ∧ . . . ∧ pn ⇒ q)

qσwhere pi

�σ = piσ for all i

E.g. p1� = Faster(Bob,Pat)p2

� = Faster(Pat,Steve)p1 ∧ p2 → q = Faster(x,y) ∧ Faster(y,z) → Faster(x,z)

σ = x/Bob,y/Pat,z/Steveqσ = Faster(Bob,Steve)

GMP is used with KB of definite clauses (exactly 1 positive literal):

• A single atomic sentence• Or a clause of the form: (conjunction of atomic sentences) ⇒ (atomicsentence)

All variables assumed universally quantified.

COMP-424, Lecture 9 - February 4, 2013 21

Completeness in FOL

• Procedure i is complete if and only if

KB �i α whenever KB |= α

• GMP is complete for KBs of universally quantified definite clauses, butincomplete for general first-order logic

• Example:

PhD(x) → HighlyQualified(x)¬ PhD(x) → EarlyEarnings(x)

HighlyQualified(x) → Rich(x)EarlyEarnings(x) → Rich(x)

should be able to infer

Rich(Doina). But the second sentence has two positive literals, soModus ponens will not work.

COMP-424, Lecture 9 - February 4, 2013 22

Resolution

• Entailment in first-order logic is only semi-decidable: we can find a proofof α if KB |= α but cannot always prove that KB �|= α

Cf. Halting Problem (see COMP-330): proof procedure may be aboutto terminate with success or failure, or may go on for ever

• However, there is a sound an complete inference procedure, calledresolution

COMP-424, Lecture 9 - February 4, 2013 23

Resolution

• Resolution is a sound and complete inference method for first-order logic.

• Resolution is a refutation procedure: to prove that KB |= α, we showthat KB ∧¬α is unsatisfiable

• The knowledge base and ¬α are expressed in universally quantified,conjunctive normal form

• Like in propositional logic, the resolution inference rule combines twoclauses to make a new one:

• Inference continues until an empty clause is derived (contradiction)

COMP-424, Lecture 9 - February 4, 2013 24

Resolution inference rule

Basic propositional version:

α ∨ β, ¬β ∨ γ

α ∨ γor equivalently

¬α → β, β → γ

¬α → γ

Full first-order version:

p1 ∨ . . . pj . . . ∨ pm,

q1 ∨ . . . qk . . . ∨ qn

(p1 ∨ . . . pj−1 ∨ pj+1 . . . pm ∨ q1 . . . qk−1 ∨ qk+1 . . . ∨ qn)σ

where pjσ = ¬qkσ

COMP-424, Lecture 9 - February 4, 2013 25

Conjunctive Normal Form (CNF)

• Literal = (possibly negated) atomic sentence, e.g., ¬ Rich(Me)

• Clause = disjunction of literals, e.g., ¬ Rich(Me) ∨ Unhappy(Me)

• The knowledge base is a big conjunction of clauses.

• Example:¬Rich(x) ∨ Unhappy(x)Rich(Me)

Unhappy(Me)

with σ = {x/Me}

COMP-424, Lecture 9 - February 4, 2013 26

Converting a Knowledge Base to CNF

1. Replace P→Q by ¬P∨Q2. Move ¬ inwards, e.g., ¬∀xP becomes ∃x¬P3. Standardize variables apart, e.g., ∀xP ∨ ∃xQ becomes ∀xP ∨ ∃y Q

4. Move quantifiers left in order, e.g., ∀xP ∨ ∃xQ becomes ∀x∃y P ∨ Q

5. Eliminate ∃ by Skolemization (next slide)

6. Drop universal quantifiers

7. Distribute ∧ over ∨, e.g., (P ∧Q) ∨R becomes (P ∨R) ∧ (Q ∨R)

COMP-424, Lecture 9 - February 4, 2013 27

Skolemization

• We want to get rid of existentially quantified variables: ∃Rich(x) becomesRich(G1) where G1 is a new Skolem constant.

• Example: ∃k ddy(k

y) = ky becomes ddy(e

y) = ey

• It gets more tricky when ∃ is inside ∀• E.g.: “Everyone has a heart”∀x Person(x) → ∃y Heart(y) ∧ Has(x,y)

How should we replace y here?

• Incorrect: ∀x Person(x) → Heart(H1) ∧ Has(x,H1)

• Correct: ∀x Person(x) → Heart(H(x)) ∧ Has(x,H(x))where H is a new symbol called a Skolem function

• Skolem functions have as arguments all enclosing universally quantifiedvariables

COMP-424, Lecture 9 - February 4, 2013 28

Resolution Proof

To prove α:

1. Negate it

2. Convert to CNF

3. Add the result to the knowledge base

4. Infer a contradiction (empty clause)

Example: to prove Rich(Doina), add ¬ Rich(Doina) to the CNF KB¬ PhD(x) ∨ HighlyQualified(x)PhD(x) ∨ EarlyEarnings(x)¬ HighlyQualified(x) ∨ Rich(x)¬ EarlyEarnings(x) ∨ Rich(x)

COMP-424, Lecture 9 - February 4, 2013 29

Resolution Strategies

Heuristics that impose a sensible order on the resolutions we attempt:

• Unit resolution: prefer to perform resolution if one clause is just a literal- yields shorter sentences

• Set of support: identify a subset of the KB (hopefully small); everyresolution will take a clause from the set and resolve it with anothersentence, then add the result to the set of support

– Can make inference incomplete!

• Input resolution: always combine a sentence from the query or KB withanother sentence

– Modus ponens is a kind of input resolution– Not compete in general

COMP-424, Lecture 9 - February 4, 2013 30

More resolution strategies

• Linear resolution: resolve P and Q if P is in the original KB or is anancestor of Q in the proof tree.

• Subsumption: eliminate all sentences more specific than a sentencealready in the KB

• Demodulation and paramodulation: special extra inference rules to allowtreatment of equality

COMP-424, Lecture 9 - February 4, 2013 31

Applications of First-Order Logic

• Prolog: a logic programming languages

• Production systems

• Semantic nets

• Automated theorem proving

• Planning

COMP-424, Lecture 9 - February 4, 2013 32

STRIPS

• Developed at Stanford in early 1970s (Stanford Research InstitutePlanning System), for the first “intelligent” robot

• Domain: a set of typed objects; usually represented as propositions

• States are represented as first-order predicates over objects

– Closed-world assumption: everything not stated is false; the onlyobjects in the world are the ones defined

• Operators/Actions defined in terms of:

– Preconditions: when can the action be applied?– Effects: what happens after the action?

No explicit description of how the action should be executed

• Goals: conjunctions of literals

COMP-424, Lecture 9 - February 4, 2013 33

STRIPS representations

• States are represented as conjunctions

In(Robot,room) ∧ ¬ In(Charger, r) ∧ ...

• Goals are represented as conjunctions:

(implicit ∃ r) In(Robot, r) ∧ In(Charger, r)

• Actions (operators):

– Name: Go(here, there)– Preconditions: expressed as conjunctions

At(Robot, here) ∧ Path(here, there)– Postconditions (effects): expressed as conjunctions

At(Robot, there) ∧ ¬ At(Robot, here)

• Variables can only be instantiated with objects of the correct type

COMP-424, Lecture 9 - February 4, 2013 34

STRIPS Operator Representation

• Operators have a name, preconditions and postconditions or effects

• Preconditions are conjunctions of positive literals

• Postconditions/effects are represented in terms of:

– Add-list: list of propositions that become true after the action– Delete-list: list of propositions that become false after the action

COMP-424, Lecture 9 - February 4, 2013 35

Semantics

• If the precondition is false in a world state, the action does not changeanything (since it cannot be applied)

• If the precondition is true:

– Delete the items in the Delete-list– Add the items in the Add-list.

Order of operations is important here!

This is a very restricted language, which means we can do efficient inference.

COMP-424, Lecture 9 - February 4, 2013 36

Example: Buying Action

• Action: Buy(x) (where x is a good)

• Precondition: At(s), Sells(s,x,p), HaveMoney(p) (where s is a store, p isthe price)

• Effect:

– Add-list: Have(x)– Delete-list: HaveMoney(p)

• Note that many important details are abstracted away!

• Additional propositions can be added to show that now the store has themoney, the stock has decreased etc.

COMP-424, Lecture 9 - February 4, 2013 37

Example: Move Action

• Action: Move(object, from, to)

• Preconditions: At(object, from), Clear(to), Clear(object)

• Effects:

– Add-list: At(object, to), Clear(from)– Delete-list: At(object, from), Clear(to)

COMP-424, Lecture 9 - February 4, 2013 38

Pros and cons of STRIPS

• Pros:

– Since it is restricted, inference can be done efficiently– All operators can be viewed as simple deletions and additions of

propositions to the knowledge base

• Cons:

– Assumes that a small number of propositions will change for eachaction (otherwise operators are hard to write down, and reasoningbecomes expensive)

– Limited language (preconditions and effects are expressed asconjunctions, implicit quantifiers), so not applicable to all domainsof interest.

COMP-424, Lecture 9 - February 4, 2013 39

Example: Blocks World

7

COMP-424: Artificial intelligence Joelle Pineau13

Example: Move action

• Action:

– Move(object, from, to)

• Preconditions:

– At(object, from), Clear(to), Clear(object)

• Effects:

– Add-list: At(object, to), Clear(from)

– Delete-list: At(object, from), Clear(to)

COMP-424: Artificial intelligence Joelle Pineau14

Welcome to the Blocks World!

Initial state = On(A,table) ! On(B,table) ! On(C,table) ! Clear(A) ! Clear(B) ! Clear(C)

Goal state = On(A,B) !On (B,C)

Action = Move(b,x,y)

Precondition = On(b,x) ! Clear(b) ! Clear(y)

Effect = On(b,y) ! Clear(x) ! ¬On(b,x) ! ¬Clear(y)

Action = MoveToTable(b,x)

Preconditions = On(b,x) ! Clear(b)

Effect = On(b,Table) ! Clear(x) ! ¬On(b,x)

CA B C

A

B

Initial state Goal state

COMP-424, Lecture 9 - February 4, 2013 40

State Transitions in the Blocks World

8

COMP-424: Artificial intelligence Joelle Pineau15

STRIPS state transitions

COMP-424: Artificial intelligence Joelle Pineau16

Pros and cons of STRIPS

• Pros:

– Since it is restricted, inference can be done efficiently.

– All operators can be viewed as simple deletions and additions of

propositions to the knowledge base.

• Cons:

– Assumes that a small number of propositions will change for each

action (otherwise operators are hard to write down, and reasoning

becomes expensive.)

– Limited language (preconditions and effects are expressed as

conjunctions), so not applicable to all domains of interest.

COMP-424, Lecture 9 - February 4, 2013 41

Two Basic Approaches to Planning

1. State-space planning works at the level of the states and operators

• Finding a plan is formulated as a search through state space, lookingfor a path from the start state to the goal state(s)

• Most similar to constructive search

2. Plan-space planning works at the level of plans

• Finding a plan is formulated as a search through the space of plans• We start with a partial, possibly incorrect plan, then apply changes toit to make it a full, correct plan

• Most similar to iterative improvement/repair

COMP-424, Lecture 9 - February 4, 2013 42

Plan-Space Planning in the Blocks World

• Start with plan: Put(A,B), Put(B,C)

• Plan fails because the precondition of the second action is not satisfiedafter the first action

• So we can try to add a step, remove a step, or re-order the steps

COMP-424, Lecture 9 - February 4, 2013 43

State-Space Planners

• Progression planners reason from the start state, trying to find theoperators that can be applied (match preconditions)

• Regression planners reason from the goal state, trying to find the actionsthat will lead to the goal (match effects or post-conditions)

In both cases, the planners work with sets of states instead of usingindividual states, like in straightforward search

COMP-424, Lecture 9 - February 4, 2013 44

Progression (Forward) Planning

1. Determine all operators that are applicable in the start state

2. Ground the operators, by replacing any variables with constants

3. Choose an operator to apply

4. Determine the new content of the knowledge base, based on the operatordescription

5. Repeat until goal state is reached.

COMP-424, Lecture 9 - February 4, 2013 45

Example: Supermarket Domain

• In the start state we have At(Home), which allows us to apply operatorsof the type Go(x,y).

• The operator can be instantiated as Go(Home, HardwareStore),Go(Home,GroceryStore), Go(Home, School), ...

• If we choose to apply Go(Home, HardwareStore), we will delete from theKB At(Home) and add At(HardwareStore).

• The new proposition enables new actions, e.g. Buy

Note that in this case there are a lot of possible operators to perform!

COMP-424, Lecture 9 - February 4, 2013 46

Goal Regression

• Introduced in Newell & Simon’s General Problem Solver

• Algorithm:

1. Pick an action that satisfies (some of) the goal propositions2. Make a new goal by:

– Removing the goal conditions satisfied by the action– Adding the preconditions of this action– Keeping any unsolved goal propositions

3. Repeat until the goal set is satisfied by the start state

COMP-424, Lecture 9 - February 4, 2013 47

Example: Supermarket Domain

• In the goal state we have At(Home) ∧ Have(Milk) ∧ Have(Drill)

• The action Buy(Milk) would allow us to achieve Have(Milk)

• To apply this action we need to have the precondition At(GroceryStore),so we add it to the set of propositions we want to achieve

• The goal set becomes: At(Home) ∧ At(GroceryStore) ∧ Have(Drill)

• Next, we may want to achieve At(HardwareStore)

Note that in this case the order in which we try to achieve these propositionsmatters!

COMP-424, Lecture 9 - February 4, 2013 48

Variations of Goal Regression

• Using a stack of goals - also called linear planning

This is not complete! I.e. we may not find a plan even if one exists

• Using a set of goals - also called non-linear planning

This is complete, but more expensive (need to decide what to work onnext)

• Both versions are sound: only legal plans will be found

COMP-424, Lecture 9 - February 4, 2013 49

Prodigy Planner

• Do both forward search and goal regression at the same time.

• At each step, choose either an operator to apply or goal to regress

• Uses domain-dependent heuristics to guide the search

• General heuristics (e.g. number of propositions satisfied) do not workwell in planning, because subgoals interact

COMP-424, Lecture 9 - February 4, 2013 50

Total vs. Partial Order

• Total order: Plan is always a strict sequence of actions

2

COMP-424: Artificial intelligence Joelle Pineau3

Total vs. Partial Order

• Total order: Plan is always a strict sequence of actions

E.g. To paint the ceiling

• Partial order: Plan steps may be unordered

Start Get Brush Get Ladder Paint ceiling Finish

Start Get BrushGet Ladder Paint ceiling Finish

Start

Get Brush

Get Ladder

Paint ceiling Finish

Plan 1:

Plan 2:

COMP-424: Artificial intelligence Joelle Pineau4

Partial Order Planning (POP)

• Basic idea:

– Search in plan space and use least commitment whenever possible.

Can maintain both state and plans (e.g. Prodigy)

•In state space search:

–Search space is a set of states of the world

–Transitions between states are actions

–Plan is path through space

•In plan space search:

–Search space is a set of partial plans

–Transitions are plan operators

• Partial order: Plan steps may be unordered

2

COMP-424: Artificial intelligence Joelle Pineau3

Total vs. Partial Order

• Total order: Plan is always a strict sequence of actions

E.g. To paint the ceiling

• Partial order: Plan steps may be unordered

Start Get Brush Get Ladder Paint ceiling Finish

Start Get BrushGet Ladder Paint ceiling Finish

Start

Get Brush

Get Ladder

Paint ceiling Finish

Plan 1:

Plan 2:

COMP-424: Artificial intelligence Joelle Pineau4

Partial Order Planning (POP)

• Basic idea:

– Search in plan space and use least commitment whenever possible.

Can maintain both state and plans (e.g. Prodigy)

•In state space search:

–Search space is a set of states of the world

–Transitions between states are actions

–Plan is path through space

•In plan space search:

–Search space is a set of partial plans

–Transitions are plan operators

COMP-424, Lecture 9 - February 4, 2013 51

Partial Order Planning

• Search in plan space and use least commitment whenever possible

• In state space search:

– Search space is a set of states of the world– Actions cause transitions between states– Plan is a path through state space

• In plan space search:

– Search space is a set of partial plans– Plan operators cause transitions– Goal is a legal plan

• Can maintain both state and plans (e.g. Prodigy)

COMP-424, Lecture 9 - February 4, 2013 52

Plan-Space Planners

Plan is defined by �A,O,B,L�:

• A is a set of actions/operators from the problem domain

• O is a set of ordering constraints of the form ai < aj

The constraint specifies that ai must come before aj but does not sayexactly when

• B is a set of bindings, of the form vi = C, vi �= C, vi = vj or vi �= vj,where vi, vj are variables and C is a constant

• L is a set of causal links, which records why a certain ordering has tooccur:

ai →c aj means that action ai achieves effect c which is a preconditionof aj

COMP-424, Lecture 9 - February 4, 2013 53

Plan Transformations

• Adding actions

• Specifying orderings

• Binding variables

Constraint satisfaction is used along the way to ensure the consistency oforderings

COMP-424, Lecture 9 - February 4, 2013 54

Discussion of Partial-Order Planning

• Advantages:

– Plan steps may be unordered (plan will be ordered, or linearized, beforeexecution)

– Handles concurrent plans– Least commitment can lead to shorter search times– Sound and complete– Typically produces the optimal plan

• Disadvantages:

– Complex plan operators lead to high cost for generating every action– Larger search space, because of concurrent actions– Hard to determine what is true in a state

COMP-424, Lecture 9 - February 4, 2013 55

The real world

Things are usually not as expected:

• Incomplete information

– Unknown preconditions, e.g., Intact(Spare)– Disjunctive effects, e.g., Inflate(x) causes Inflated(x) according to

the knowledge base, but in reality it actually causes Inflated(x) ∨SlowHiss(x) ∨ Burst(x) ∨ BrokenPump ∨ . . .

• Incorrect information

– Current state incorrect, e.g., spare NOT intact– Missing/incorrect postconditions in operators

• Qualification problem: can never finish listing all the requiredpreconditions and possible conditional outcomes of actions

COMP-424, Lecture 9 - February 4, 2013 56

Solutions

• Conditional (contingency) planning:

1. Plans include observation actions which obtain information2. Sub-plans are created for each contingency (each possible outcome of

the observation actions)

E.g. Check the tire. If it is intact, then we’re ok, otherwise there areseveral possible solutions: inflate, call AAA....

Expensive because it plans for many unlikely cases

• Monitoring/Replanning:

1. Assume normal states, outcomes2. Check progress during execution, replan if necessary

Unanticipated outcomes may lead to failure (e.g., no AAA card)

In general, some monitoring is unavoidable

COMP-424, Lecture 9 - February 4, 2013 57

Monitoring

• Execution monitoring: “failure” means that the preconditions of theremaining plan not met

• Action monitoring: “failure” means that the preconditions of thenext action not met (or action itself fails)

In both cases, need to replan

COMP-424, Lecture 9 - February 4, 2013 58

Replanning

• Simplest: on failure, replan from scratch

• Better: plan to get back on track by reconnecting to best continuation

In this case, we can try to reconnect to the plan’s next action, or somefuture action

The latter is typically more expensive in terms of planning computation(lots of possible places to reconnect!) but usually yields better plans (e.g.if it is very hard to achieve the preconditions of the very next action)

COMP-424, Lecture 9 - February 4, 2013 59

Summary

• Planning is very related to search, but allows the actions/states havemore structure

• We typically use logical inference to construct solutions

• State-space vs.plan-space planning

• Least-commitment: we build partial plans, order them only as necessary

• In the real world, it is necessary to consider failure cases - replanning

• Hierarchy and abstraction make planning more efficient

• Many varieties of planners that we have not looked at: case-basedplanners, MDP planners (we will see this later on) etc.

COMP-424, Lecture 9 - February 4, 2013 60