9.2 A Domain-Splitting Distributor

In this section we program a distributor for the domain-splitting strategy (see *). The program is shown in Figure 9.2.

proc {SplitDistributor Is}
      Fs={Filter Is fun {$ I} {FD.reflect.size I}>end}
      case Fs  
      of nil then skip 
      [] F|Fr then  
         MinVar#_ = {FoldL Fr fun {$ Var#Size X}
                                 if {FD.reflect.size X}<Size then 
                                    X#{FD.reflect.size X}
                              end F#{FD.reflect.size F}}
         Mid = {FD.reflect.mid MinVar}  
         choice MinVar =<: Mid {SplitDistributor Fs}
         []     MinVar >: Mid  {SplitDistributor Fs}

Figure 9.2: A distributor for a domain-splitting strategy.

As in the previous section we first discard all determined variables. Then we select the variable MinVar which has the smallest domain (as it is done for the first-fail distribution strategy). For the selected variable we determine the value that is in the middle of the least and largest possible value by

Mid = {FD.reflect.mid MinVar} 

After this is done we distribute with the constraint that MinVar should be smaller than or equal to Mid.

Christian Schulte and Gert Smolka
Version 1.4.0 (20080702)