Format of Scripts

In Alice a script is a function f : space $ \rightarrow$ t that takes the following form:
fun f space = let
# declare problem variables
in
# post constraints
# specify branching strategy
end

The procedure declares the variables needed, posts the constraints modeling the problem, and specifies the branching strategy. The argument space stands for the computational architecture mentioned in 2.3. The result type t is called the interface and is used to specify a solution of the problem. Often, the result type is just a record of the problem variables.

There are two ways to obtain the solutions of a CSP. One way is by off-line search using the functions from the Search library structure. The other and easiest way is to interactively explore the induced search tree by using the Explorer.

The Explorer must first be imported:

import structure Explorer from ''x-alice:/lib/tools/Explorer''
If you want to get all solutions of the problem, you use:
Explorer.exploreAll (script)
and the script will be run until the entire search tree is explored. With
Explorer.exploreOne (script)
you obtain a tree with just one solution.

Now, by double-clicking on a solution node (green diamond) of the search tree, a window will open, called the Inspector. The inspector shows the variable assignments of this solution. If you double-click on an inner node, the inspector will display the information available at the respective point of the search tree.

Andreas Rossberg 2006-08-28