The Tweak planning method involves the following heuristics.
Now lets look at the effect of each heuristic.
We must try and achieve the preconditions of the STACK operation above.
We could try picking up the respective blocks:
At the moment there is no plan as the postconditions of the this set could negate the preconditions of the first (STACK) plan so we must introduce order:
This gives four steps partially ordered and four unachieved conditions
We can use the promotion heuristic to force one operator to precede another so that the postcondition of one operator STACK(A,B) does not negate the precondition CLEAR(B) of another operator PICKUP(B). This ordering is represented by
We can use promotion to achieve one of the ARMEMPTY preconditions:
Making PICKUP(B) precede PICKUP(A) ensures that the arm is empty and all the conditions for PICKUP(B) are met.
This is written
Unfortunately a postcondition of the first operator is that the arm becomes not empty, so we need to use the declobbering heuristic to achieve the preconditions of the second operator PICKUP(A).
PICKUP(B) STACK(B,C) PICKUP(A)
We still need to achieve CLEAR(A):
The appropriate operator is UNSTACK(x,A) by step addition. This leads to the following set of conditions
The variable x can be bound to the block C by the simple establishment heuristic since C is on A in the initial state.
The preconditions CLEAR(C) and ARMEMPTY are negated by STACK(B,C) and by PICKUP(B) or PICKUP(A) however.
So we must introduce three orderings by promotion to ensure the operator UNSTACK(C,A).
UNSTACK(C,A) leftarrow STACK(B,C)
UNSTACK(C,A) leftarrow PICKUP(A)
UNSTACK(C,A) leftarrow PICKUP(B)
Promotion involves adding a step and this clobbers one of the preconditions of PICKUP(B) viz ARMEMPTY, always a potential problem with this heuristic.
However all is not lost as there is an operator, PUTDOWN that has the required postcondition and given that the operator UNSTACK(C,A) had generated the precondition for it of HOLDING(C) we can produce an extra operator successfully
This operator declobbers the operator PICKUP(B) yielding the sequence
UNSTACK(C,A) PUTDOWN(C) PICKUP(B)
This yields the final sequence:
Let us finish this section by looking at the formal form of the TWEAK algorithm:
until the set S is empty.