920 likes | 2.03k Views
Artificial Intelligence Planning System. L. Manevitz. Components of a Planning System. Chose the best rule to apply next based on the best available heuristic information. Apply the chosen rule to compute the new problem state that arises from its application.
E N D
Artificial IntelligencePlanning System L. Manevitz L. Manevitz Lecture 6
Components of a Planning System • Chose the best rule to apply next based on the best available heuristic information. • Apply the chosen rule to compute the new problem state that arises from its application. • Detect when a solution has been found. L. Manevitz Lecture 6
Components of a Planning System cont. • Detect dead ends so that they can be abandoned and the system’s effort directed in more fruitful directions. • Detect when an almost correct solution has been found and employ special techniques to make it totally correct. L. Manevitz Lecture 6
The Blocks World • Operators: • UNSTACK(A,B) – Pick up block A from its current position on block B. The arm must be empty and block A must have no blocks on top of it. • STACK(A,B) – Place block A on block B. The arm must already be holding A and the surface of B must be clear. L. Manevitz Lecture 6
The Blocks World cont. • PICKUP(A) – Pick up block A from the table and hold it. Te arm must be empty and there must be nothing on top of block A. • PUTDOWN(A) – Put block A down on the table. The arm must have been holding block A. L. Manevitz Lecture 6
The Blocks World cont. • Predicates: • ON(A,B) – Block A is on block B. • ONTABLE(A) – Block A is on the table. • CLEAR(A) – There is nothing on top of block A. • HOLDING(A) – The arm is holding block A. • ARMEMPTY – The arm is holding nothing. L. Manevitz Lecture 6
The Blocks World cont. • Inference rules: • [ x : HOLDING(x)] ARMEMPTY • x : ONTABLE(x) y : ON(x,y) • x : [ y : ON(y,x)] CLEAR(x) L. Manevitz Lecture 6
A B ON(A,B,S0) ONTABLE(B,S0) CLEAR(A,S0) A Simple Blocks World Description L. Manevitz Lecture 6
STRIPS – Style Operate for the Blocks World STACK(x,y) P: CLEAR(y) HOLDING(x) D: CLEAR(y) HOLDING(x) A: ARMEMPTY ON(x,y) UNSTACK(x,y) P: ON(x,y) CLEAR(x) ARMEMPTY D: ON(X,Y) ARMEMPTY A: HOLDING(x) CLEAR(y) L. Manevitz Lecture 6
STRIPS – Style Operate for the Blocks World cont. PICKUP(x) P: CLEAR(x) ONTABLE(x) ARMEMPTY D: ONTABLE(x) ARMEMPTY A: HOLDING(x) PUTDOWN(x) P: HOLDING(x) D: HOLDING(x) A: ONTABLE(x) ARMEMPTY L. Manevitz Lecture 6
1 2 3 A Simple Search Tree UNSTACK(A,B) PUTDOWN(A) Global database at this point ONTABLE(B) CLEAR(A) CLEAR(B) ONTABLE(A) L. Manevitz Lecture 6
B C B A C D A D Start: ON(B,A) ONTABLE(A) ONTABLE(C) ONTABLE(D) ARMEMPTY Goal: ON(C,A) ON(B,D) ONTABLE(A) ONTABLE(D) A Very Simple Blocks World Problem L. Manevitz Lecture 6
ON(C,A) ON(B,D) ONTABLE(A) ONTABLE(D) Goal Stack Planning • Initial goal stack: L. Manevitz Lecture 6
ON(C,A) ON(B,D) OTAD Goal Stack Planning cont. • Choose to work on ON(C,A) before ON(B,D): ON(C,A) ON(B,D) L. Manevitz Lecture 6
ON(C,A) ON(B,D) OTAD Goal Stack Planning cont. • Achieve ON(C,A) with STACK(C,A): ON(C,A) STACK(C,A) ON(B,D) L. Manevitz Lecture 6
CLEAR(A) HOLDING(C) ON(C,A) ON(B,D) OTAD Goal Stack Planning cont. • Add STACK’s preconditions: CLEAR(A) HOLDING(C) STACK(C,A) ON(B,D) L. Manevitz Lecture 6
ON(B,A) CLEAR(B) ARMEMPTY CLEAR(A) HOLDING(C) ON(C,A) ON(B,D) OTAD Goal Stack Planning cont. • Achieve CLEAR(A) with UNSTACK(B,A): ON(B,A) CLEAR(B) ARMEMPTY UNSTACK(B,A) CLEAR(A) HOLDING(C) STACK(C,A) ON(B,D) L. Manevitz Lecture 6
ON(B,A) CLEAR(B) ARMEMPTY CLEAR(A) HOLDING(C) ON(C,A) ON(B,D) OTAD Goal Stack Planning cont. • Pop satisfied predicates: ON(B,A) CLEAR(B) ARMEMPTY UNSTACK(B,A) HOLDING(C) STACK(C,A) ON(B,D) L. Manevitz Lecture 6
ON(C,x) CLEAR(C) ARMEMPTY CLEAR(A) HOLDING(C) ON(C,A) ON(B,D) OTAD Goal Stack Planning cont. • Achieve HOLDING(C) with UNSTACK(C,x): ON(C,x) CLEAR(C) ARMEMPTY UNSTACK(C,x) HOLDING(C) STACK(C,A) ON(B,D) L. Manevitz Lecture 6
CLEAR(x) HOLDING(C) ON(C,x) CLEAR(C) ARMEMPTY CLEAR(A) HOLDING(C) ON(C,A) ON(B,D) OTAD Goal Stack Planning cont. • Achieve ON(C,x) by STACK(C,x): CLEAR(x) HOLDING(C) ON(C,x) STACK(C,x) CLEAR(C) ARMEMPTY UNSTACK(C,x) STACK(C,A) ON(B,D) L. Manevitz Lecture 6
CLEAR(x) HOLDING(C) ON(C,x) CLEAR(C) ARMEMPTY CLEAR(A) HOLDING(C) ON(C,A) ON(B,D) OTAD Goal Stack Planning cont. • Terminate path because HOLDING(C) is duplicated. CLEAR(x) HOLDING(C) STACK(C,x) CLEAR(C) ARMEMPTY UNSTACK(C,x) STACK(C,A) ON(B,D) L. Manevitz Lecture 6
ONTABLE(C) CLEAR(C) ARMEMPTY CLEAR(A) HOLDING(C) ON(C,A) ON(B,D) OTAD Goal Stack Planning cont. • Achieve HOLDING(C) with PICKUP, not UNSTACK: ONTABLE(C) CLEAR(C) ARMEMPTY PICKUP(C) STACK(C,A) ON(B,D) L. Manevitz Lecture 6
ONTABLE(C) CLEAR(C) ARMEMPTY CLEAR(A) HOLDING(C) CLEAR(D) HOLDING(B) ON(C,A) ON(B,D) OTAD Goal Stack Planning cont. • Pop ONTABLE(C) and CLEAR(C), and achieve ARMEMPTY by STACK(B,D): CLEAR(D) ONTABLE(C) HOLDING(B) CLEAR(C) ARMEMPTY STACK(B,D) PICKUP(C) STACK(C,A) ON(B,D) L. Manevitz Lecture 6
Goal Stack Planning cont. • Pop entire stack, and return plan: • UNSTACK(B,A). • STACK(B,D). • PICKUP(C). • STACK(C,A). L. Manevitz Lecture 6
A C B A B C Start: ON(C,A) ONTABLE(A) ONTABLE(B) ARMEMPTY Goal: ON(A,B) ON(B,C) A Slightly Harder Blocks Problem L. Manevitz Lecture 6
ON(A,B) ON(B,C) ON(B,C) ON(A,B) ON(A,B) ON(B,C) ON(A,B) ON(B,C) 2 1 Goal Stack Planning • There are two ways to begin solving: L. Manevitz Lecture 6
CLEAR(A) ARMEMPTY CLEAR(C) ARMEMPTY CLEAR(B) HOLDING(A) ON(A,B) ON(B,C) Goal Stack Planning cont. • Let’s choose alternative 1.we will eventually produce this goal stack: CLEAR(C) ARMEMPTY CLEAR(A) UNSTACK(C,A) ARMEMPTY PICKUP(A) HOLDING(A) STACK(A,B) ON(A,B) ON(B,C) L. Manevitz Lecture 6
CLEAR(A) ARMEMPTY CLEAR(C) ARMEMPTY CLEAR(B) HOLDING(A) ON(A,B) ON(B,C) Goal Stack Planning cont. • We can pop off the stack goals that have already been satisfied: CLEAR(C) ARMEMPTY To satisfy ARMEMPTY we need to PUTDOWN(C). UNSTACK(C,A) HOLDING(C) ARMEMPTY PUTDOWN(C) PICKUP(A) STACK(A,B) ON(B,C) L. Manevitz Lecture 6
CLEAR(A) ARMEMPTY CLEAR(B) HOLDING(A) ON(A,B) ON(B,C) Goal Stack Planning cont. • We can continue popping: HOLDING(C) PUTDOWN(C) PICKUP(A) STACK(A,B) ON(B,C) L. Manevitz Lecture 6
C A B Goal Stack Planning cont. • The current state is: • The sequence of operators applied so far is: • UNSTACK(C,A) • PUTDOWN(C) • PICKUP(A) • STACK(A,B) ONTABLE(B) ON(A,B) ONTABLE(C) ARMEMPTY L. Manevitz Lecture 6
Goal Stack Planning cont. • Now we can begin to work on ON(B,C). We need to stack B on C. To do that we need to unstack A from B. By the time we have achieved the goal ON(B,C), and popped it off the stack, we will have executed the following additional sequence of operators L. Manevitz Lecture 6
C A B Goal Stack Planning cont. • The sequence of operators : • UNSTACK(A,B) • PUTDOWN(A) • PICKUP(B) • STACK(B,C) • The problem state will be: ON(B,C) ONTABLE(A) ONTABLE(C) ARMEMPTY L. Manevitz Lecture 6
ON(A,B) ON(B,C) Goal Stack Planning cont. • But now when we check the remaining goal on the stack: we discover that it is not satisfied. We have undone ON(A,B) in the process of achieving ON(B,C). • The sequence of operators we need to add: • PICKUP(A) • STACK(A,B) L. Manevitz Lecture 6
Goal Stack Planning cont. The complete plan that has been discovered is: • UNSTACK(C,A) • PUTDOWN(C) • PICKUP(A) • STACK(A,B) • UNSTACK(A,B) • PUTDOWN(A) • PICKUP(B) • STACK(B,C) • PICKUP(A) • STACK(A,B) • Although this plan • will achieve the desired • goal, it does not do so • very efficiently. • The same would have • happened if we had • chosen the • second alternative. L. Manevitz Lecture 6
Goal Stack Planning cont. • There are two approaches we can take to the question of how a good plan could be found: • Look at ways to repair the plan we already have – look for places in the plan where we perform an operation and then immediately undo it. We can eliminate both the doing and the undoing steps from the plan. • Use a plan-finding procedure that could construct efficient plans directly – the Nonlinear Planning. L. Manevitz Lecture 6
Repairing the First Plan • UNSTACK(C,A) • PUTDOWN(C) • PICKUP(A) • STACK(A,B) • UNSTACK(A,B) • PUTDOWN(A) • PICKUP(B) • STACK(B,C) • PICKUP(A) • STACK(A,B) • UNSTACK(C,A) • PUTDOWN(C) • PICKUP(B) • STACK(B,C) • PICKUP(A) • STACK(A,B) L. Manevitz Lecture 6
C A B C The Nonlinear Planning • Begin work on the goal ON(A,B) by clearing A, thus putting C on the table. L. Manevitz Lecture 6
A B B C Nonlinear Planning cont. • Achieve the goal ON(B,C) by stacking B on C. L. Manevitz Lecture 6
A A B C Nonlinear Planning cont. • Complete the goal ON(A,B) by stacking A on B. L. Manevitz Lecture 6
Backwards Non-Linear Planner • Finds “Last Operator” recursively • Uses theorem prover to prune paths L. Manevitz Lecture 6
The Problem Solving System NOAH • NOAH plans by developing a hierarchy of subgoals. • The procedural net contains several levels of representation of a plan, each level more detailed than the previous one. • For example: the node representing the abstract goal make coffee may be expanded to : grind coffee, boil water, put the coffee in a filter, pour the water through it. L. Manevitz Lecture 6
NOAH cont. • We’ll use NOAH to solve the blocks problem. • The operators used in this example are slightly different from those we have been using . • STACK – will put any object on any other (including the table), provided that both objects are clear. It includes the picking up of the object to be moved. L. Manevitz Lecture 6
A C B A B C Start: ON(C,A) ONTABLE(A) ONTABLE(B) ARMEMPTY Goal: ON(A,B) ON(B,C) The Blocks Problem • A reminder of the problem : L. Manevitz Lecture 6
(ON(A,B) ON(B,C)) NOAH Solution • The initial state of the problem solver: Level 1 L. Manevitz Lecture 6
ON(A,B) S J ON(B,C) NOAH Solution cont. • The first thing that it does is to divide the problem into two subproblems: Level 2 Split Join L. Manevitz Lecture 6
J S S S CLEAR(B) CLEAR(C) STACK(B,C) STACK(A,B) J J 6 3 1 5 4 2 NOAH Solution cont. • At the third level the preconditions of STACK are considered – the two blocks involved must be clear. Level 3: before criticism CLEAR(A) CLEAR(B) L. Manevitz Lecture 6
NOAH Solution cont. • Now NOAH employs a set of critics to examine the plan and detect interactions among the subplans. • Each critic is a little program that makes specific observations about the proposed plan. L. Manevitz Lecture 6
CLEAR(B): asserted: node 2 “Clear B” denied: node 3 “Stack A on B” asserted: node 4 “Clear B” CLEAR(C): asserted: node 5 “Clear C” denied: node 6 “Stack B on C” The Resolve Conflicts critic • The Resolve Conflicts critic – constructs a table that lists all the literals that are mentioned more than once in the plan. L. Manevitz Lecture 6