Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16.

38
Planning III Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16

Transcript of Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16.

Page 1: Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16.

Planning IIIPlanning III

Introduction to Artificial Intelligence

CS440/ECE448

Lecture 16

Page 2: Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16.

Mid-TermMid-Term

Mean: 71%

Median:70%

Max: 96%

Min: 41%

Page 3: Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16.

Last lectureLast lecture• STRIPS planningSTRIPS planning• Partial order planningPartial order planning

This lectureThis lecture• More partial order planning• Planning in the real world• Extensions• Reasoning in the presence of uncertainty

ReadingReading• Chapters 11, 12, 13

Page 4: Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16.

The Initial PlanThe Initial Plan• A plan with two steps (STRIPS operators):• Start Step:

– Preconditions: None– Effect: Add all propositions that are initially true

• Finish Step: – Precondition: Goal state– Effects: None

• Steps: { Start, Finish}• Orderings: { Start < Finish }• Bindings: { }• Links: { }

Page 5: Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16.

A Partial Order Planning AlgorithmA Partial Order Planning AlgorithmA partial order regression planner that

searches through plan space.

Page 6: Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16.

POP Algorithm ContinuedPOP Algorithm Continued

Page 7: Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16.

Example: Blocks WorldExample: Blocks World

Operators

•Symbols: Table, A, B, C

•Predicates: On (x, y), Cl(x)

A

B C

Page 8: Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16.

Example: Simple Blocks WorldExample: Simple Blocks World

Symbols: A, B, C, Table

Predicates:

ON(x,y) – Object x is on top of object y

CL(x) – x doesn’t have anything on top

Start State

On(A, Table)

On(B, Table)

ON(C,Table)

Cl(A)

Cl(B)

Cl(C)

Goal State

ON(B, A)

On(C, B)

A B C A

B

C

Page 9: Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16.

Example: Simple Blocks WorldExample: Simple Blocks World

On(A, Table) On(B, Table) ON(C,Table) Cl(A) Cl(B) Cl(C)

ON(B, A) On(C, B)

A B C

A

B

C

Start

Finish

Steps: { Start, Finish,}

Orderings: { Start < Finish }

Links: {}

Page 10: Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16.

Example: Simple Blocks WorldExample: Simple Blocks World

On(A, Table) On(B, Table) ON(C,Table) Cl(A) Cl(B) Cl(C)

ON(B, A) On(C, B)

A B C

A

B

C

Start

Finish

Steps: { Start, Finish, S1}

Orderings: { Start < Finish, Start < S1, S1 < Finish}

Links: {S1-c0->Finish}

S1: PutOn(B,A)

~On(B,Table) ~Cl (A)Cl (Table), On(B,A)

On(B,Table) Cl(A) Cl(B)

Page 11: Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16.

Example: Simple Blocks WorldExample: Simple Blocks World

On(A, Table) On(B, Table) ON(C,Table) Cl(A) Cl(B) Cl(C)

ON(B, A) On(C, B)

A B C

A

B

C

Start

Finish

Steps: { Start, Finish, S1}

Orderings: { Start < Finish, Start < S1, S1 < Finish}

Links: {S1-c0->FinishStart –c1->S1}

S1: PutOn(B,A)

~On(B,Table) ~Cl (A)Cl (Table), On(B,A)

On(B,Table) Cl(A) Cl(B)

Page 12: Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16.

Example: Simple Blocks WorldExample: Simple Blocks World

On(A, Table) On(B, Table) ON(C,Table) Cl(A) Cl(B) Cl(C)

ON(B, A) On(C, B)

A B C

A

B

C

Start

Finish

Steps: { Start, Finish, S1}

Orderings: { Start < Finish, Start < S1, S1 < Finish}

Links: {S1-c0->FinishStart –c1->S1Start –c2->S1 }

S1: PutOn(B,A)

~On(B,Table) ~Cl (A)Cl (Table), On(B,A)

On(B,Table) Cl(A) Cl(B)

Page 13: Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16.

Example: Simple Blocks WorldExample: Simple Blocks World

On(A, Table) On(B, Table) ON(C,Table) Cl(A) Cl(B) Cl(C)

ON(B, A) On(C, B)

A B C

A

B

C

Start

Finish

Steps: { Start, Finish, S1}

Orderings: { Start < Finish, Start < S1, S1 < Finish}

Links: {S1-c0->FinishStart –c1->S1Start –c2->S1 Start –c3->S1}

S1: PutOn(B,A)

~On(B,Table) ~Cl (A)Cl (Table), On(B,A)

On(B,Table) Cl(A) Cl(B)

Page 14: Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16.

Example: Simple Blocks WorldExample: Simple Blocks World

On(A, Table) On(B, Table) ON(C,Table) Cl(A) Cl(B) Cl(C)

ON(B, A) On(C, B)

A B C

A

B

C

Start

Finish

Steps: { Start, Finish, S1, S2 }

Orderings: { Start < Finish, Start < S1, S1 < Finish, Start < S2,S2 < Finish}

Links: {S1-c0->FinishStart –c1->S1Start –c2->S1 Start –c3->S1S2 –c2->FinishStart –c1->S2 …}

S1: PutOn(B,A)

~On(B,Table) ~Cl (A)Cl (Table), On(B,A)

On(B,Table) Cl(A) Cl(B)

S2: PutOn(C,B)

~On(C,Table) ~Cl (B)Cl (Table), On(C,B)

On(C,Table) Cl(C) Cl(B)

Page 15: Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16.

Example: Simple Blocks WorldExample: Simple Blocks World

On(A, Table) On(B, Table) ON(C,Table) Cl(A) Cl(B) Cl(C)

ON(B, A) On(C, B)

A B C

A

B

C

Start

Finish

Steps: { Start, Finish, S1, S2 }

Orderings: { Start < Finish, Start < S1, S1 < Finish, Start < S2,S2 < Finish, S1 < S2}

Links: {S1-c0->FinishStart –c1->S1Start –c2->S1 Start – c3->S1S2 –c2->FinishStart –c1->S2 …}

S1: PutOn(B,A)

~On(B,Table) ~Cl (A)Cl (Table), On(B,A)

On(B,Table) Cl(A) Cl(B)

S2: PutOn(C,B)

~On(C,Table) ~Cl (B)Cl (Table), On(C,B)

On(C,Table) Cl(C) Cl(B)

Page 16: Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16.

A Partial Order Planning AlgorithmA Partial Order Planning AlgorithmA partial order regression planner that

searches through plan space.

Page 17: Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16.

Clobbering and promotion/demotionClobbering and promotion/demotionA clobberer is a potentially intervening step that destroys the

condition achieved by a causal link.

Consider two steps of plan with goal:

Go(HWS)

Buy(Drill)

At(HWS)

At(HWS)

Finish

At(Home)

Go(Home)

At(Home)

• To meet precondition of goal, add step Go(Home).• But, this threatens (clobbers) precondition of Buy(Drill).

Options to protect Buy(Drill):1. Demotion: put before Go(HWS).

2. Promotion: put after Buy(Drill).

Page 18: Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16.

POP Algorithm ContinuedPOP Algorithm Continued

Page 19: Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16.

Example: Blocks WorldExample: Blocks World

Symbols: A, B, C, Table

Predicates:

ON(x,y) – Object x is on top of object y

CL(x) – x doesn’t have anything on top

Start State

ON(C,A)

On(A, Table)

On(B, Table)

Cl(B)

Cl(C)

Goal State

ON(A,B)

On(B, C)

Page 20: Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16.

Example: Blocks WorldExample: Blocks World

Operators

Page 21: Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16.

Initial and Final conditionsInitial and Final conditions

Steps: { Start, Finish,}

Orderings: { Start < Finish }

Steps: { Start, Finish,}

Orderings: { Start < Finish }

Page 22: Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16.

Insert operation to achieve goal preconditionInsert operation to achieve goal precondition

Steps: { Start, Finish,S1}

Orderings: { Start < Finish,Start<S1,S1< Finish}

Steps: { Start, Finish,S1}

Orderings: { Start < Finish,Start<S1,S1< Finish}

S1

Solid lines denote causal links

Page 23: Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16.

PutOn(A,B) is a threat to PutOn(B,C)PutOn(A,B) is a threat to PutOn(B,C)

Solid lines denote causal links

Steps: { Start, Finish,S1, S2 }

Orderings: { Start < Finish,Start<S1,S1< Finish, Start<S2, S2<Finish,S1<S2}

Steps: { Start, Finish,S1, S2 }

Orderings: { Start < Finish,Start<S1,S1< Finish, Start<S2, S2<Finish,S1<S2}

S1S2

Page 24: Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16.

PutOnTable(C)PutOnTable(C) meets precondition but must meets precondition but must be in right orderbe in right order

Steps: { Start, Finish,S1, S2, S3}

Orderings: { Start < Finish,Start<S1,S1< Finish, Start<S2, S2<Finish,S1<S2, Start<S3, S3<Finish, S3<S2, S3<S1}

Steps: { Start, Finish,S1, S2, S3}

Orderings: { Start < Finish,Start<S1,S1< Finish, Start<S2, S2<Finish,S1<S2, Start<S3, S3<Finish, S3<S2, S3<S1}

S1S2

S3

Page 25: Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16.

Why is called the Sussman Anomaly?Why is called the Sussman Anomaly?

Goal

Cond1 Cond2

Subplan ASubplan B

Sub-subplan AA Sub-subplan AB

In older planners, each subplan would be completely executed before the other subplan would be executed, for example:

Subplan B, [Sub-subplan AA, Sub-subplan AB, Subplan A]

“Sussman Anomaly” cannot be solved using this type of plan – must be interleaved.

Page 26: Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16.

POP SummaryPOP Summary

POP is: – Sound,– Complete (assuming breadth first or iterative

deepening search).

Page 27: Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16.

The real world: Things go wrongThe real world: Things go wrong

• Incomplete information– Unknown preconditions, e.g., Is the spare actually intact?– Disjunctive effects, e.g., Inflating a tire with a pump may cause

the tire to inflate or a slow hiss or the tire may burst or …

• Incorrect information– Current state incorrect, e.g., spare NOT intact.– Missing/incorrect postconditions (effects) in operators.

• Qualification problem:– can never finish listing all the required preconditions and

possible conditional outcomes of actions.

Consider a plan for changing a tire after getting a flat using operators of RemoveTire(x), PutOnTire(x), InflateTire(x)

Page 28: Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16.

SolutionsSolutions• Conditional planning

– Plan to obtain information (observation actions).– Subplan for each contingency, e.g.,

[Check(Tire1), [IF Intact(Tire1)

THEN [Inflate(Tire1)]ELSE [CallAAA] ]

– Expensive because it plans for many unlikely cases.

• Monitoring/Replanning– Assume normal states, outcomes.– Check progress during execution, replan if necessary.– Unanticipated outcomes may lead to failure (e.g., no AAA card).

• In general, some monitoring is unavoidable.

Page 29: Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16.

Preconditions for Remaining PlanPreconditions for Remaining Plan

Page 30: Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16.

ReplanningReplanning

• Simplest: on failure, replan from scratch.

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

• Generates ``loop until done'' behavior with no explicit loop.

Page 31: Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16.

Some Extensions to POPSome Extensions to POP(Chapter 12 Lite)(Chapter 12 Lite)

• More expressive representation:

– Disjunctive and negated goals (and subgoals/preconditions).

– Conditional effects reduce number of operators.

• More general temporal constraints:

– In POP/STRIPS actions take one time unit.

– Operators can take varying time periods.

• Resources, costs, value, etc.

• Hierarchical planning for efficiency:

– ABSTRIPS.

– Decompose abstract operator into multiple simple operators.

Page 32: Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16.

Hierarchical Decomposition into a Hierarchical Decomposition into a Partial-Order PlanPartial-Order Plan

Page 33: Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16.

UncertaintyUncertainty• Let action At = leave for airport t minutes before flight from O’hare• Will At get me there on time?

Problems:1. Partial observability (road state, other drivers' plans, etc.).2. Noisy sensors (traffic reports).3. Uncertainty in action outcomes (flat tire, etc.).4. Immense complexity of modelling and predicting traffic.

Hence a purely logical approach either:

1) risks falsehood: “A135 will get me there on time,” or 2) leads to conclusions that are too weak for decision making:

“A135 will get me there on time if there's no accident on I-57and it doesn't rain and my tires remain intact, etc., etc.”

(A1440 might reasonably be said to get me there on time but I'd have to stay overnight in the airport …)

Page 34: Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16.

Methods for handling uncertaintyMethods for handling uncertaintyDefault or nonmonotonic logic:

Assume my car does not have a flat tire.

Assume A125 works unless contradicted by evidence.

Issues: What assumptions are reasonable? How to handle contradiction?

Rules with fudge factors:

A135 0 .3 get there on time.

Sprinkler 0.99 WetGrass.

WetGrass 0.7 Rain.

Issues: Problems with combination, e.g., Sprinkler causes Rain??

Probability theory

Given the available evidence,

A135 will get me there on time with probability 0.04.

(Fuzzy logic handles degree of truth NOT uncertainty

e.g., WetGrass is true to degree 0.2)

Page 35: Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16.

Fuzzy Logic in Real WorldFuzzy Logic in Real World

Page 36: Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16.

ProbabilityProbabilityProbabilistic assertions summarize effects of

Ignorance: lack of relevant facts, initial conditions, etc.

Laziness: failure to enumerate exceptions, qualifications, etc.

Subjective or Bayesian probability:

Probabilities relate propositions to one's own state of knowledge

e.g., P(A135 | no reported accidents) = 0.06

These are NOT assertions about the world, but represent belief about the whether the assertion is true.

Probabilities of propositions change with new evidence:

e.g., P(A135 | no reported accidents, 5 a.m.) = 0.15

(Analogous to logical entailment status; i.e., does KB |= )

Page 37: Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16.

Making decisions under uncertaintyMaking decisions under uncertainty• Suppose I believe the following:

P(A 135 gets me there on time | ...) = 0.04

P(A 180 gets me there on time | ...) = 0.70

P(A 240 gets me there on time | ...) = 0.95

P(A 1440 gets me there on time | ...) = 0.9999

• Which action to choose?

• Depends on my preferences for missing flight vs. airport cuisine, etc.

• Utility theory is used to represent and infer preferences

• Decision theory = utility theory + probability theory

Page 38: Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16.

Unconditional ProbabilityUnconditional Probability• Let A be a proposition, P(A) denotes the unconditional

probability that A is true.

• Example: if Male denotes the proposition that a particular person is male, then P(Male)=0.5 means that without any other information, the probability of that person being male is 0.5 (a 50% chance).

• Alternatively, if a population is sampled, then 50% of the people will be male.

• Of course, with additional information (e.g. that the person is a CS440 student), the “posterior probability” will likely be different.