Subsections
The Explorer is a graphical tool of the Alice programming
environment. It can run scripts and display the explored search
trees. It can also display the information in the constraint stores
associated with the nodes of the search tree.
The statement:
Explorer.ExploreAll smm
tells the Explorer to run the script smm and explore the entire search
tree. The Explorer will pop up a window and display the explored nodes
of the search tree (see Figure 5). Choice nodes appear
as blue circles, failure nodes as red boxes, and solution nodes as
green diamonds. Fully explored subtrees not containing solution nodes
are collapsed into a single red triangle.
Figure 5:
The Explorer with the compact search tree of smm.
|
You can select any node of the displayed search tree (excepting a
failure node) by clicking it with the left mouse button.
It is also possible to select the parent node of a node that
is actually selected with the command (Ctrl + Up), the left child node
(the selected node is an open choice node) with the command (Ctrl + Down).
Is the left child a failure node, the right child is selected. Further, you can select
a left sibling (resp. right sibling) with the command (Ctrl + Left) (resp.
(Ctrl + Right)). Again, none of the commands above can select a failure node!
Select the red triangle and type the command H (hide/unhide).
This will replace the triangle with the
actual nodes of the tree (see Figure 6).
You now see the full search tree of smm , which consists of three choice nodes,
three failure nodes, and one solution node. Typing the command h once
more will switch back to the compact representation of the failed
subtree. It is not only failed subtrees that you can hide with
the command H. If you hide a subtree with command H and
there is a solution node in that subtree, a big green triangle replaces
that subtree. If there is an open choice node in the subtree, a big
green triangle with a small grey triangle appears. The command
F just hides failed subtrees.
Figure 6:
The Explorer with the full search tree of smm
|
Next, double-click the green solution node with the left mouse button.
A new window is popped - up by the Alice Inspector.
It will display the unique solution
of the Money Puzzle (see figure 7).
Figure 7:
The Inspector showing the solution of smm
|
You can also double click a blue choice node.
This will display the information about the solution
that was accumulated in the constraint store before the node was
branched. Double clicking the top node of the tree, for instance,
results in figure 8.
Figure 8:
The Inspector showing the result at the first choice node
|
This way, the Explorer and the Inspector can display the
annotated search tree shown in Figure 4.
The statement
Explorer.exploreOne smm
tells the Explorer to run the script smm until the first solution is
found. This time the Explorer will show a partial search tree that
contains the solution node in the lefttmost position, and also
contains an open choice node. An open choice node is a choice
node for which not all direct descendents have been explored yet. A
closed choice node is a choice node for which all direct descendents
have been explored already. While closed choice nodes are displayed
as blue circles, open choice nodes are displayed as grey triangles. Not yet
explored descendents of an open choice node are not displayed.
To check whether there are further solutions, you can resume the
search process by selecting the root node and typing the command N
(next). This will resume the search until either the next solution
is found or all nodes of the search tree are explored.
You can stop the exploring Explorer at any time with the command Ctrl + C.
You can resume the exploration of a partial search tree by selecting
any choice node and typing the command N or A. The command N (next)
will resume the exploration of the selected subtree until a further
solution is found or the subtree is fully explored. The command A
(all) will resume the exploration of the selected subtree until it
is fully explored.
The command Ctrl + R will reset the Explorer and show only the root node of
the search tree (grey triangle). You
can request the exploration of the seach tree by typing N or A.
You can guide the search of the Explorer by hand. Reset the Explorer
by typing Ctrl + R. This will select the root node, which is an open choice
node. Now type the command S to compute the first descendents of
the root. Now, you can select another open choice node and compute its first
descendants. You can repeat this exploration until no open choice nodes are left.
The right vertical scroll bar of the Explorer's window zooms the
size of the displayed search tree. You can zoom the tree to fit
the size of the window by clicking the zoom button above the
vertical scroll bar with the left mouse button.
Andreas Rossberg
2006-08-28