For Friday Finish chapter 10 No homework. Program 2 Any questions?

Slides:



Advertisements
Similar presentations
REVIEW : Planning To make your thinking more concrete, use a real problem to ground your discussion. –Develop a plan for a person who is getting out of.
Advertisements

Language for planning problems
Planning  We have done a sort of planning already  Consider the “search” applied to general problem solving  The sequence of moves with the “Jugs” was.
Planning II: Partial Order Planning
Planning Module THREE: Planning, Production Systems,Expert Systems, Uncertainty Dr M M Awais.
Causal-link Planning II José Luis Ambite. 2 CS 541 Causal Link Planning II Planning as Search State SpacePlan Space AlgorithmProgression, Regression POP.
Planning Module THREE: Planning, Production Systems,Expert Systems, Uncertainty Dr M M Awais.
Plan Generation & Causal-Link Planning 1 José Luis Ambite.
For Monday Take home exam due Exam 1. For Wednesday Read chapter 10, sections 1-2 Prolog Handout 4.
Chapter 4 - Planning 4.1 State Space Planning 4.2 Partial Order Planning 4.3Planning in the Real World Part II: Methods of AI.
Artificial Intelligence II S. Russell and P. Norvig Artificial Intelligence: A Modern Approach Chapter 11: Planning.
Planning Search vs. planning STRIPS operators Partial-order planning.
ARTIFICIAL INTELLIGENCE [INTELLIGENT AGENTS PARADIGM] Professor Janis Grundspenkis Riga Technical University Faculty of Computer Science and Information.
Planning Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 11.
CS 460, Session 20 1 Planning Search vs. planning STRIPS operators Partial-order planning.
Artificial Intelligence Chapter 11: Planning
CS 561, Session Planning Search vs. planning STRIPS operators Partial-order planning.
Planning Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 11.
AI Principles, Lecture on Planning Planning Jeremy Wyatt.
Planning Department of Computer Science & Engineering Indian Institute of Technology Kharagpur.
PLANNING Partial order regression planning Temporal representation 1 Deductive planning in Logic Temporal representation 2.
For Wednesday Read chapter 12, sections 3-5 Program 2 progress due.
Course Overview  What is AI?  What are the Major Challenges?  What are the Main Techniques?  Where are we failing, and why?  Step back and look at.
1 Plan-Space Planning Dr. Héctor Muñoz-Avila Sources: Ch. 5 Appendix A Slides from Dana Nau’s lecture.
1 07. The planning problem 2  Inputs: 1. A description of the world state 2. The goal state description 3. A set of actions  Output: A sequence of actions.
April 3, 2006AI: Chapter 11: Planning1 Artificial Intelligence Chapter 11: Planning Michael Scherger Department of Computer Science Kent State University.
CS.462 Artificial Intelligence SOMCHAI THANGSATHITYANGKUL Lecture 07 : Planning.
For Friday Finish Chapter 18 Homework: –Chapter 18, exercises 1-2.
Planning, page 1 CSI 4106, Winter 2005 Planning Points Elements of a planning problem Planning as resolution Conditional plans Actions as preconditions.
Planning (Chapter 10)
Partial Ordering Planning Lecture Module 10. Partial Ordering Any planning algorithm that can place two actions into a plan without specifying which comes.
For Monday Read chapter 12, sections 1-2 Homework: –Chapter 10, exercise 3.
Planning, Executing, Sensing, and Replanning for Information Gathering Presented by Hector Gonzalez (Based on slides from Craig Knoblock and L. Joskowicz)
CPS 270: Artificial Intelligence Planning Instructor: Vincent Conitzer.
1 Search vs. planning Situation calculus STRIPS operators Search vs. planning Situation calculus STRIPS operators.
For Friday No new reading Logic and Resolution Homework.
For Friday No reading Homework: –Chapter 11, exercise 4.
CPS 570: Artificial Intelligence Planning Instructor: Vincent Conitzer.
Planning (Chapter 10)
Lecture 3-1CS251: Intro to AI/Lisp II Planning to Learn, Learning to Plan.
1 Chapter 16 Planning Methods. 2 Chapter 16 Contents (1) l STRIPS l STRIPS Implementation l Partial Order Planning l The Principle of Least Commitment.
Introduction to Planning Dr. Shazzad Hosain Department of EECS North South Universtiy
Partial Order Planning 1 Brian C. Williams J/6.834J Sept 16 th, 2002 Slides with help from: Dan Weld Stuart Russell & Peter Norvig.
Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License:
AI Lecture 17 Planning Noémie Elhadad (substituting for Prof. McKeown)
Partial Order Plan Execution 1 Brian C. Williams J/6.834J Sept. 16 th, 2002 Slides with help from: Dan Weld Stuart Russell & Peter Norvig.
For Friday Read Chapter 11, sections 1 and 2 Homework: –Chapter 10, exercises 1 and 5.
For Monday Make sure you have read chapter 11 through section 3. No homework.
Planning I: Total Order Planners Sections
Planning in FOL Systems sequences of actions to achieve goals.
Consider the task get milk, bananas, and a cordless drill.
Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License:
Causal-link planning 1 Jim Blythe. 2 USC INFORMATION SCIENCES INSTITUTE Causal Link Planning The planning problem Inputs: 1. A description of the world.
Planning (Chapter 10) Slides by Svetlana Lazebnik, 9/2016 with modifications by Mark Hasegawa-Johnson, 9/2017
L9. Planning Agents L7_exAnswer and explanation Review
For Wednesday Read Chapter 18, sections 1-3 Homework:
Planning (Chapter 10)
Planning Search vs. planning STRIPS operators Partial-order planning
Dana S. Nau University of Maryland 3:10 AM September 12, 2018
Planning (Chapter 10)
Dana S. Nau University of Maryland 1:50 AM September 14, 2018
Consider the task get milk, bananas, and a cordless drill
Planning Search vs. planning STRIPS operators Partial-order planning
Planning Search vs. planning STRIPS operators Partial-order planning
AI Planning.
Planning José Luis Ambite.
For Friday Read Chapter 11, section 3
L11. Planning Agents and STRIPS
© James D. Skrentny from notes by C. Dyer, et. al.
Causal-link planning 2 Jim Blythe.
Presentation transcript:

For Friday Finish chapter 10 No homework

Program 2 Any questions?

Negation Can’t say something is NOT true Use a closed world assumption Not simply means “I can’t prove that it is true”

Dynamic Predicates A way to write self-modifying code, in essence. Typically just storing data using Prolog’s built-in predicate database. Dynamic predicates must be declared as such.

Using Dynamic Predicates assert and variants retract –Fails if there is no clause to retract retractall –Doesn’t fail if no clauses

Search What are characteristics of good problems for search? What does the search know about the goal state? Consider the package problem on the exam: –How well would search REALLY work on that problem?

Search vs. Planning Planning systems: –Open up action and goal representation to allow selection –Divide and conquer by subgoaling –Relax the requirement for sequential construction of solutions

Planning in Situation Calculus PlanResult(p,s) is the situation resulting from executing p in s PlanResult([],s) = s PlanResult([a|p],s) = PlanResult(p,Result(a,s)) Initial state At(Home,S_0)   Have(Milk,S_0)  … Actions as Successor State axioms Have(Milk,Result(a,s))  [(a=Buy(Milk)  At(Supermarket,s))  Have(Milk,s)  a ...)] Query s=PlanResult(p,S_0)  At(Home,s)  Have(Milk,s)  … Solution p = Go(Supermarket),Buy(Milk),Buy(Bananas),Go(HWS),…] Principal difficulty: unconstrained branching, hard to apply heuristics

The Blocks World We have three blocks A, B, and C We can know things like whether a block is clear (nothing on top of it) and whether one block is on another (or on the table) Initial State: Goal State: A BC A B C

Situation Calculus in Prolog holds(on(A,B),result(puton(A,B),S)) :­ holds(clear(A),S), holds(clear(B),S), neq(A,B). holds(clear(C),result(puton(A,B),S)) :­ holds(clear(A),S), holds(clear(B),S), holds(on(A,C),S), neq(A,B). holds(on(X,Y),result(puton(A,B),S)) :­ holds(on(X,Y),S), neq(X,A), neq(Y,A), neq(A,B). holds(clear(X),result(puton(A,B),S)) :­ holds(clear(X),S), neq(X,B). holds(clear(table),S).

neq(a,table). neq(table,a). neq(b,table). neq(table,b). neq(c,table). neq(table,c). neq(a,b). neq(b,a). neq(a,c). neq(c,a). neq(b,c). neq(c,b).

Situation Calculus Planner plan([],_,_). plan([G1|Gs], S0, S) :­ holds(G1,S), plan(Gs, S0, S), reachable(S,S0). reachable(S,S). reachable(result(_,S1),S) :­ reachable(S1,S). However, what will happen if we try to make plans using normal Prolog depth­first search?

Stack of 3 Blocks holds(on(a,b), s0). holds(on(b,table), s0). holds(on(c,table),s0). holds(clear(a), s0). holds(clear(c), s0). | ?­ cpu_time(db_prove(6,plan([on(a,b),on(b,c)],s0,S)), T). S = result(puton(a,b),result(puton(b,c),result(puton(a,table),s0))) T = E+01

Invert stack holds(on(a,table), s0). holds(on(b,a), s0). holds(on(c,b),s0). holds(clear(c), s0). ?­ cpu_time(db_prove(6,plan([on(b,c),on(a,b)],s0,S)),T). S = result(puton(a,b),result(puton(b,c),result(puton(c,table),s0))), T = 7.034E+00

Simple Four Block Stack holds(on(a,table), s0). holds(on(b,table), s0). holds(on(c,table),s0). holds(on(d,table),s0). holds(clear(c), s0). holds(clear(b), s0). holds(clear(a), s0). holds(clear(d), s0). | ?­ cpu_time(db_prove(7,plan([on(b,c),on(a,b),on(c,d)],s0,S)),T). S = result(puton(a,b),result(puton(b,c),result(puton(c,d),s0))), T = E hours!

STRIPS Developed at SRI (formerly Stanford Research Institute) in early 1970's. Just using theorem proving with situation calculus was found to be too inefficient. Introduced STRIPS action representation. Combines ideas from problem solving and theorem proving. Basic backward chaining in state space but solves subgoals independently and then tries to reachieve any clobbered subgoals at the end.

STRIPS Representation Attempt to address the frame problem by defining actions by a precondition, and add list, and a delete list. (Fikes & Nilsson, 1971). –Precondition: logical formula that must be true in order to execute the action. –Add list: List of formulae that become true as a result of the action. –Delete list: List of formulae that become false as result of the action.

Sample Action Puton(x,y) –Precondition: Clear(x) Ù Clear(y) Ù On(x,z) –Add List: {On(x,y), Clear(z)} –Delete List: {Clear(y), On(x,z)}

STRIPS Assumption Every formula that is satisfied before an action is performed and does not belong to the delete list is satisfied in the resulting state. Although Clear(z) implies that On(x,z) must be false, it must still be listed in the delete list explicitly. For action Kill(x,y) must put Alive(y), Breathing(y), Heart­Beating(y), etc. must all be included in the delete list although these deletions are implied by the fact of adding Dead(y)

Subgoal Independence If the goal state is a conjunction of subgoals, search is simplified if goals are assumed independent and solved separately (divide and conquer) Consider a goal of A on B and C on D from 4 blocks all on the table

Subgoal Interaction Achieving different subgoals may interact, the order in which subgoals are solved in this case is important. Consider 3 blocks on the table, goal of A on B and B on C If do puton(A,B) first, cannot do puton(B,C) without undoing (clobbering) subgoal: on(A,B)

Sussman Anomaly Goal of A on B and B on C Starting state of C on A and B on table Either way of ordering subgoals causes clobbering

STRIPS Approach Use resolution theorem prover to try and prove that goal or subgoal is satisfied in the current state. If it is not, use the incomplete proof to find a set of differences between the current and goal state (a set of subgoals). Pick a subgoal to solve and an operator that will achieve that subgoal. Add the precondition of this operator as a new goal and recursively solve it.

STRIPS Algorithm STRIPS(init­state, goals, ops) Let current­state be init­state; For each goal in goals do If goal cannot be proven in current state Pick an operator instance, op, s.t. goal  adds(op); /* Solve preconditions */ STRIPS(current­state, preconds(op), ops); /* Apply operator */ current­state := current­state + adds(op) ­ dels(ops); /* Patch any clobbered goals */ Let rgoals be any goals which are not provable in current­state; STRIPS(current­state, rgoals, ops).

Algorithm Notes The “pick operator instance” step involves a nondeterministic choice that is backtracked to if a dead­end is ever encountered. Employs chronological backtracking (depth­first search), when it reaches a dead­ end, backtrack to last decision point and pursue the next option.

Norvig’s Implementation Simple propositional (no variables) Lisp implementation of STRIPS. #S(OP ACTION (MOVE C FROM TABLE TO B) PRECONDS ((SPACE ON C) (SPACE ON B) (C ON TABLE)) ADD­LIST ((EXECUTING (MOVE C FROM TABLE TO B)) (C ON B)) DEL­LIST ((C ON TABLE) (SPACE ON B))) Commits to first sequence of actions that achieves a subgoal (incomplete search). Prefers actions with the most preconditions satisfied in the current state. Modified to to try and re-achieve any clobbered subgoals (only once).

STRIPS Results ; Invert stack (good goal ordering) > (gps '((a on b)(b on c) (c on table) (space on a) (space on table)) '((b on a) (c on b))) Goal: (B ON A) Consider: (MOVE B FROM C TO A) Goal: (SPACE ON B) Consider: (MOVE A FROM B TO TABLE) Goal: (SPACE ON A) Goal: (SPACE ON TABLE) Goal: (A ON B) Action: (MOVE A FROM B TO TABLE)

Goal: (SPACE ON A) Goal: (B ON C) Action: (MOVE B FROM C TO A) Goal: (C ON B) Consider: (MOVE C FROM TABLE TO B) Goal: (SPACE ON C) Goal: (SPACE ON B) Goal: (C ON TABLE) Action: (MOVE C FROM TABLE TO B) ((START) (EXECUTING (MOVE A FROM B TO TABLE)) (EXECUTING (MOVE B FROM C TO A)) (EXECUTING (MOVE C FROM TABLE TO B)))

; Invert stack (bad goal ordering) > (gps '((a on b)(b on c) (c on table) (space on a) (space on table)) '((c on b)(b on a))) Goal: (C ON B) Consider: (MOVE C FROM TABLE TO B) Goal: (SPACE ON C) Consider: (MOVE B FROM C TO TABLE) Goal: (SPACE ON B) Consider: (MOVE A FROM B TO TABLE) Goal: (SPACE ON A) Goal: (SPACE ON TABLE) Goal: (A ON B) Action: (MOVE A FROM B TO TABLE) Goal: (SPACE ON TABLE) Goal: (B ON C) Action: (MOVE B FROM C TO TABLE)

Goal: (SPACE ON B) Goal: (C ON TABLE) Action: (MOVE C FROM TABLE TO B) Goal: (B ON A) Consider: (MOVE B FROM TABLE TO A) Goal: (SPACE ON B) Consider: (MOVE C FROM B TO TABLE) Goal: (SPACE ON C) Goal: (SPACE ON TABLE) Goal: (C ON B) Action: (MOVE C FROM B TO TABLE) Goal: (SPACE ON A) Goal: (B ON TABLE) Action: (MOVE B FROM TABLE TO A)

Must reachieve clobbered goals: ((C ON B)) Goal: (C ON B) Consider: (MOVE C FROM TABLE TO B) Goal: (SPACE ON C) Goal: (SPACE ON B) Goal: (C ON TABLE) Action: (MOVE C FROM TABLE TO B) ((START) (EXECUTING (MOVE A FROM B TO TABLE)) (EXECUTING (MOVE B FROM C TO TABLE)) (EXECUTING (MOVE C FROM TABLE TO B)) (EXECUTING (MOVE C FROM B TO TABLE)) (EXECUTING (MOVE B FROM TABLE TO A)) (EXECUTING (MOVE C FROM TABLE TO B)))

STRIPS on Sussman Anomaly > (gps '((c on a)(a on table)( b on table) (space on c) (space on b) (space on table)) '((a on b)(b on c))) Goal: (A ON B) Consider: (MOVE A FROM TABLE TO B) Goal: (SPACE ON A) Consider: (MOVE C FROM A TO TABLE) Goal: (SPACE ON C) Goal: (SPACE ON TABLE) Goal: (C ON A) Action: (MOVE C FROM A TO TABLE) Goal: (SPACE ON B) Goal: (A ON TABLE) Action: (MOVE A FROM TABLE TO B) Goal: (B ON C)

Consider: (MOVE B FROM TABLE TO C) Goal: (SPACE ON B) Consider: (MOVE A FROM B TO TABLE) Goal: (SPACE ON A) Goal: (SPACE ON TABLE) Goal: (A ON B) Action: (MOVE A FROM B TO TABLE) Goal: (SPACE ON C) Goal: (B ON TABLE) Action: (MOVE B FROM TABLE TO C) Must reachieve clobbered goals: ((A ON B)) Goal: (A ON B) Consider: (MOVE A FROM TABLE TO B)

Goal: (SPACE ON A) Goal: (SPACE ON B) Goal: (A ON TABLE) Action: (MOVE A FROM TABLE TO B) ((START) (EXECUTING (MOVE C FROM A TO TABLE)) (EXECUTING (MOVE A FROM TABLE TO B)) (EXECUTING (MOVE A FROM B TO TABLE)) (EXECUTING (MOVE B FROM TABLE TO C)) (EXECUTING (MOVE A FROM TABLE TO B)))

How Long Do 4 Blocks Take? ;; Stack four clear blocks (good goal ordering) > (time (gps '((a on table)(b on table) (c on table) (d on table)(space on a) (space on b) (space on c) (space on d)(space on table)) '((c on d)(b on c)(a on b)))) User Run Time = 0.00 seconds ((START) (EXECUTING (MOVE C FROM TABLE TO D)) (EXECUTING (MOVE B FROM TABLE TO C)) (EXECUTING (MOVE A FROM TABLE TO B)))

;; Stack four clear blocks (bad goal ordering) > (time (gps '((a on table)(b on table) (c on table) (d on table)(space on a) (space on b) (space on c) (space on d)(space on table)) '((a on b)(b on c) (c on d)))) User Run Time = 0.06 seconds ((START) (EXECUTING (MOVE A FROM TABLE TO B)) (EXECUTING (MOVE A FROM B TO TABLE)) (EXECUTING (MOVE B FROM TABLE TO C)) (EXECUTING (MOVE B FROM C TO TABLE)) (EXECUTING (MOVE C FROM TABLE TO D)) (EXECUTING (MOVE A FROM TABLE TO B)) (EXECUTING (MOVE A FROM B TO TABLE)) (EXECUTING (MOVE B FROM TABLE TO C)) (EXECUTING (MOVE A FROM TABLE TO B)))

State-Space Planners State­space (situation space) planning algorithms search through the space of possible states of the world searching for a path that solves the problem. They can be based on progression: a forward search from the initial state looking for the goal state. Or they can be based on regression: a backward search from the goals towards the initial state STRIPS is an incomplete regression­based algorithm.

Plan-Space Planners Plan­space planners search through the space of partial plans, which are sets of actions that may not be totally ordered. Partial­order planners are plan­based and only introduce ordering constraints as necessary (least commitment) in order to avoid unnecessarily searching through the space of possible orderings

Partial Order Plan Plan which does not specify unnecessary ordering. Consider the problem of putting on your socks and shoes.

Plans A plan is a three tuple –A: A set of actions in the plan, {A 1,A 2,...A n } –O: A set of ordering constraints on actions {A i <A j, A k <A l,...A m <A n }. These must be consistent, i.e. there must be at least one total ordering of actions in A that satisfy all the constraints. –L: a set of causal links showing how actions support each other

Causal Links and Threats A causal link, A p  Q A c, indicates that action A p has an effect Q that achieves precondition Q for action A c. A threat, is an action A t that can render a causal link A p  Q A c ineffective because: –O  {A P < A t < A c } is consistent –A t has ¬Q as an effect

Threat Removal Threats must be removed to prevent a plan from failing Demotion adds the constraint A t < A p to prevent clobbering, i.e. push the clobberer before the producer Promotion adds the constraint A c < A t to prevent clobbering, i.e. push the clobberer after the consumer

Initial (Null) Plan Initial plan has –A={ A 0, A  } –O={A 0 < A  } –L ={} A 0 (Start) has no preconditions but all facts in the initial state as effects. A  (Finish) has the goal conditions as preconditions and no effects.

Example Op( Action: Go(there); Precond: At(here); Effects: At(there), ¬At(here) ) Op( Action: Buy(x), Precond: At(store), Sells(store,x); Effects: Have(x) ) A 0 : –At(Home) Sells(SM,Banana) Sells(SM,Milk) Sells(HWS,Drill) A  –Have(Drill) Have(Milk) Have(Banana) At(Home)

POP Algorithm Stated as a nondeterministic algorithm where choices must be made. Various search methods can be used to explore the space of possible choices. Maintains an agenda of goals that need to be supported by links, where an agenda element is a pair where Q is a precondition of A i that needs supporting. Initialize plan to null plan and agenda to conjunction of goals (preconditions of Finish). Done when all preconditions of every action in plan are supported by causal links which are not threatened.

POP(, agenda) 1) Termination: If agenda is empty, return. Use topological sort to determine a totally ordered plan. 2) Goal Selection: Let be a pair on the agenda 3) Action Selection: Let A add be a nondeterministically chosen action that adds Q. It can be an existing action in A or a new action. If there is no such action return failure. L ’ = L  {A add  Q A need } O ’ = O  {A add < A need } if A add is new then A ’ = A  {A add } and O ’ =O ’ È {A 0 < A add <A  } else A ’ = A

4) Update goal set: Let agenda ’ = agenda - { } If A add is new then for each conjunct Q i of its precondition, add to agenda ’ 5) Causal link protection: For every action A t that threatens a causal link A p  Q A c add an ordering constraint by choosing nondeterministically either (a) Demotion: Add A t < A p to O ’ (b) Promotion: Add A c < A t to O ’ If neither constraint is consistent then return failure. 6) Recurse: POP(, agenda ’ )

Example Op( Action: Go(there); Precond: At(here); Effects: At(there), ¬At(here) ) Op( Action: Buy(x), Precond: At(store), Sells(store,x); Effects: Have(x) ) A 0 : –At(Home) Sells(SM,Banana) Sells(SM,Milk) Sells(HWS,Drill) A  –Have(Drill) Have(Milk) Have(Banana) At(Home)

Example Steps Add three buy actions to achieve the goals Use initial state to achieve the Sells preconditions Then add Go actions to achieve new pre- conditions

Handling Threat Cannot resolve threat to At(Home) preconditions of both Go(HWS) and Go(SM). Must backtrack to supporting At(x) precondition of Go(SM) from initial state At(Home) and support it instead from the At(HWS) effect of Go(HWS). Since Go(SM) still threatens At(HWS) of Buy(Drill) must promote Go(SM) to come after Buy(Drill). Demotion is not possible due to causal link supporting At(HWS) precondition of Go(SM)

Example Continued Add Go(Home) action to achieve At(Home) Use At(SM) to achieve its precondition Order it after Buy(Milk) and Buy(Banana) to resolve threats to At(SM)