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

## Presentation on theme: "Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16."— Presentation transcript:

Planning III Introduction to Artificial Intelligence CS440/ECE448 Lecture 16

Mid-Term Mean: 71% Median:70% Max: 96% Min: 41%

Last lecture STRIPS planningSTRIPS planning Partial order planningPartial order planning This lecture More partial order planning Planning in the real world Extensions Reasoning in the presence of uncertainty Reading Reading Chapters 11, 12, 13

The 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: { }

A Partial Order Planning Algorithm A partial order regression planner that searches through plan space.

POP Algorithm Continued

Example: Blocks World Operators Symbols: Table, A, B, C Predicates: On (x, y), Cl(x) A B C

Example: Simple Blocks World Symbols: A, B, C, Table Predicates: ON(x,y) – Object x is on top of object y CL(x) – x doesnt 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) AB C A B C

Example: Simple Blocks World On(A, Table) On(B, Table) ON(C,Table) Cl(A) Cl(B) Cl(C) ON(B, A) On(C, B) AB C A B C Start Finish Steps: { Start, Finish,} Orderings: { Start < Finish } Links: {}

Example: Simple Blocks World On(A, Table) On(B, Table) ON(C,Table) Cl(A) Cl(B) Cl(C) ON(B, A) On(C, B) AB 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)

Example: Simple Blocks World On(A, Table) On(B, Table) ON(C,Table) Cl(A) Cl(B) Cl(C) ON(B, A) On(C, B) AB C A B C Start Finish Steps: { Start, Finish, S1} Orderings: { Start < Finish, Start < S1, S1 < Finish} Links: {S1-c0->Finish Start –c1->S1} S1: PutOn(B,A) ~On(B,Table) ~Cl (A) Cl (Table), On(B,A) On(B,Table) Cl(A) Cl(B)

Example: Simple Blocks World On(A, Table) On(B, Table) ON(C,Table) Cl(A) Cl(B) Cl(C) ON(B, A) On(C, B) AB C A B C Start Finish Steps: { Start, Finish, S1} Orderings: { Start < Finish, Start < S1, S1 < Finish} Links: {S1-c0->Finish Start –c1->S1 Start –c2->S1 } S1: PutOn(B,A) ~On(B,Table) ~Cl (A) Cl (Table), On(B,A) On(B,Table) Cl(A) Cl(B)

Example: Simple Blocks World On(A, Table) On(B, Table) ON(C,Table) Cl(A) Cl(B) Cl(C) ON(B, A) On(C, B) AB C A B C Start Finish Steps: { Start, Finish, S1} Orderings: { Start < Finish, Start < S1, S1 < Finish} Links: {S1-c0->Finish Start –c1->S1 Start –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)

Example: Simple Blocks World On(A, Table) On(B, Table) ON(C,Table) Cl(A) Cl(B) Cl(C) ON(B, A) On(C, B) AB 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->Finish Start –c1->S1 Start –c2->S1 Start –c3->S1 S2 –c2->Finish Start –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)

Example: Simple Blocks World On(A, Table) On(B, Table) ON(C,Table) Cl(A) Cl(B) Cl(C) ON(B, A) On(C, B) AB 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->Finish Start –c1->S1 Start –c2->S1 Start – c3->S1 S2 –c2->Finish Start –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)

A Partial Order Planning Algorithm A partial order regression planner that searches through plan space.

Clobbering and promotion/demotion A 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) 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).

POP Algorithm Continued

Example: Blocks World Symbols: A, B, C, Table Predicates: ON(x,y) – Object x is on top of object y CL(x) – x doesnt 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)

Example: Blocks World Operators

Initial and Final conditions Steps: { Start, Finish,} Orderings: { Start < Finish } Steps: { Start, Finish,} Orderings: { Start < Finish }

Insert operation to achieve goal precondition Steps: { Start, Finish,S1} Orderings: { Start < Finish, Start { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/7/1716453/slides/slide_22.jpg", "name": "Insert operation to achieve goal precondition Steps: { Start, Finish,S1} Orderings: { Start < Finish, Start

PutOn(A,B) is a threat to PutOn(B,C) Solid lines denote causal links Steps: { Start, Finish,S1, S2 } Orderings: { Start < Finish, Start { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/7/1716453/slides/slide_23.jpg", "name": "PutOn(A,B) is a threat to PutOn(B,C) Solid lines denote causal links Steps: { Start, Finish,S1, S2 } Orderings: { Start < Finish, Start

PutOnTable(C) meets precondition but must be in right order Steps: { Start, Finish,S1, S2, S3} Orderings: { Start < Finish, Start { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/7/1716453/slides/slide_24.jpg", "name": "PutOnTable(C) meets precondition but must be in right order Steps: { Start, Finish,S1, S2, S3} Orderings: { Start < Finish, Start

Why is called the Sussman Anomaly? Goal Cond1 Cond2 Subplan A Subplan BSub-subplan AASub-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.

POP Summary POP is: –Sound, –Complete (assuming breadth first or iterative deepening search).

The 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)

Solutions 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.

Preconditions for Remaining Plan

Replanning 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.

Some Extensions to POP (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.

Hierarchical Decomposition into a Partial-Order Plan

Uncertainty Let action A t = leave for airport t minutes before flight from Ohare Will A t 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: A 135 will get me there on time, or 2) leads to conclusions that are too weak for decision making: A 13 5 will get me there on time if there's no accident on I-57 and it doesn't rain and my tires remain intact, etc., etc. ( A 1440 might reasonably be said to get me there on time but I'd have to stay overnight in the airport …)

Methods for handling uncertainty Default or nonmonotonic logic: Assume my car does not have a flat tire. Assume A 125 works unless contradicted by evidence. Issues: What assumptions are reasonable? How to handle contradiction? Rules with fudge factors: A 135 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, A 135 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)

Fuzzy Logic in Real World

Probability Probabilistic 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(A 135 | 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(A 135 | no reported accidents, 5 a.m.) = 0.15 (Analogous to logical entailment status; i.e., does KB |= )

Making 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

Unconditional 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.