Basic Idea to handle interactive compound goals uses goal stacks, Here the stack contains :
Consider the following where wish to proceed from the start to goal state.
Fig. 24 Goal Stack Planning Example
We can describe the start state:
ON(B, A) ONTABLE(A) ONTABLE(C) ONTABLE(D) ARMEMPTY
and goal state:
ON(C, A) ON(B,D) ONTABLE(A) ONTABLE(D)
ON(C,A)ON(B,D)
ON(C,A) ON(B,D)
ONTABLE(A) ONTABLE(D)
ON(B,D)ON(C,A)
ON(C,A) ON(B,D)
ONTABLE(A) ONTABLE(D)
The method is to
Consider alternative 1 above further:
B<>STACK (C,A)ON(B,D)
ON(C,A) ON(B,D)
ONTABLE(A) ONTABLE(D)
B<>CLEAR(A)HOLDING(C)
CLEAR(A) HOLDING(C)
STACK (C,A)
ON(B,D)
ON(C,A) ON(B,D)
ONTABLE(A) ONTABLE(D)
B<>ON(B,A)CLEAR(B)
ARMEMPTY
ON(B,A) CLEAR(B)
ARMEMPTY
UNSTACK(B,A)
HOLDING(C)
CLEAR(A) HOLDING(C)
ONTABLE(A) ONTABLE(C) ONTABLE(D) HOLDING(C) CLEAR(A)
HOLDING(C)CLEAR(A) HOLDING(C)
STACK (C,A)
ON(B,D)
ON(C,A) ON(B,D) ONTABLE(A)
ONTABLE(D)
ON(C, x)CLEAR(C)
ARMEMPTY
ON(C, x) CLEAR(C)
ARMEMPTY
UNSTACK(C,x)
CLEAR(A) HOLDING(C)
STACK (C,A)
ON(B,D)
ON(C,A) ON(B,D) ONTABLE(A)
ONTABLE(D)
ONTABLE(C)CLEAR(C)
ARMEMPTY
ONTABLE(C) CLEAR(C)
ARMEMPTY
PICKUP(C)
CLEAR(A) HOLDING(C)
STACK (C,A)
ON(B,D)
ON(C,A) ON(B,D) ONTABLE(A)
ONTABLE(D)
In this first route we can see three references to some block, x and these must refer to the same block, although in the search it is conceivable several blocks will become temporarily attached. Hence the binding of variables to blocks must be recorded. Investigating further we need to satisfy the first goal and this requires stacking C on some block which is clear.
CLEAR(x)HOLDING(C)
CLEAR(x) HOLDING(C)
STACK (C, x)
CLEAR(C)
ARMEMPTY
We now notice that one of the goals created is HOLDING(C) which was the goal we were trying to achieve by applying UNSTACK(C, some block) in this case and PICKUP(C) in the other approach. So it would appear that we have added new goals and not made progress and in terms of the A* algorithm it seems best to try the other approach.
So looking at the second approach
The new goal stack becomes;
CLEAR(D)HOLDING(B)
CLEAR(D) HOLDING(B)
STACK (B, D)
ONTABLE(C) CLEAR(C) ARMEMPTY
PICKUP(C)
ONTABLE(A) ONTABLE(C) ONTABLE(D) ON(B,D) ARMEMPTY
This method produces a plan using good Artificial Intelligence techniques such as heuristics to find matching goals and the A* algorithm to detect unpromising paths which can be discarded.