15.2.4 FD-Distribution

Oz supports distribution for finite domain variables but only within encapsulated search. This is only operation which creates a choice node in a search tree.

Distributors can be created by applying the procedure FD.distribute to the name of a distribution strategy and a list of variables. For instance, the a distributor for the stategy first-fail (ff) picks a variable X of minimal current domain, splits this domain into two disjoint parts, each of which it considers in an independent part.

X \in D_1 \cup D_2  \qquad \Longrightarrow   \qquad  X\in D_1 \quad \vee\quad  X\in D_2

Given that the domain D_1 \cup D_2 is split, encapsulated search process both possiblities X\in D_1 and X\in D_2 independently.

As said before, the split operation is evoked by the procedure FD.distribute. For instance, the domains of X and Y are split when in the following example:

<Distribution>=
declare 
proc{Problem Sol}
  X Y  
in 
  Sol = solution(x:X y:Y)
  X :: 1#5   
  Y :: 2#3
  {FD.distribute ff [X Y]}
end 
{Explorer.all Problem}

Distribution in Oz is support during encapsulated search only (but NOT on top-level). This means that a problem has to encapsulated into a unary procedure which is then and then passed to the Oz-Explorer. Applying this procedure directely does not lead to distribution on top-level.

Note also that a distributor such as {FD.distribute ff [X Y]} blocks its thread (all subsequent statements) until distribution has happend (for ever on top-level). Therefor, a distributor should always be the last statement of its thread. This can be archieved either by writing it into the last line of the problem definition or by using a new thread anyway.

 thread {FD.distribute ff [X Y]} end 


Denys Duchier, Claire Gardent and Joachim Niehren
Version 1.3.99 (20050412)