Go backward to Operator application.
Go up to Using lookahead search.
Go forward to Search control.
Evaluating states
-----------------
As described in Section See Subgoaling and default productions on page
See Subgoaling and default productions, knowledge must be added that
allows the states of the lookahead search to be evaluated. The simplest case
involves detecting that the desired state has been achieved. In this case,
the lookahead state is augmented with ^success <d>, where <d> is the
identifier of the desired state. The detection of success has to be specific
to the desired state because a single state may occur in more than one goal
with different desired states. Default productions will match against the
detection of success and translate it into an evaluation for the task
operator being tested in lookahead. This evaluation is then converted to an
appropriate preference (in this case best) for the task operator, possibly
breaking the tie impasse.
For the Blocks World, the detection of success is decomposed into two
productions. The first detects when one of the blocks has gotten into its
desired ontop position. This is determined by testing that the current state
has an object-dynamic that corresponds to one in the desired state. The goal
is then augmented with the identifier of the object that is in its desired
position. Since this is done with an entailment, it will be retracted if the
current state ever changes so that the block is no longer in its desired
position.
(sp blocks-world*elaborate*operator*achieved
(goal <g> ^state <s> ^desired <d>)
(<s> ^object-dynamic <block-dyn>)
(<block-dyn> ^ontop <blockb> ^object-static <blocka>)
(<d> ^object-dynamic <dblock-dyn>)
(<dblock-dyn> ^ontop <blockb> ^object-static <blocka>)
-->
(<g> ^achieved <dblock-dyn> <dblock-dyn> &))
The second production tests that all three blocks are in their desired
places. For this test to work, the original desired state must be augmented
with the count of the number of objects that must be stacked, otherwise this
production would fire in cases where more than three blocks must be stacked,
but only three are in position.
(sp blocks-world*elaborate*state*success
(goal <g> ^state <s>
^desired <d>
^achieved <dontop1>
{ <> <dontop1> <dontop1> }
{<> <dontop1> <> <dontop1> <dontop3>})
(<d> ^object-count 3)
-->
(<s> ^success <d> <d> &))