4.3 Search

Set variables will require different search organization. Basically, during search the decisions will be made whether an element belongs to a set or it does not belong to this set.

JaCoP still uses DepthFirstSearch but needs different methods for set variable selection implementing ComparatorVariable and a method for value selection implementing Indomain. The special methods are specified in appendix B.2. In addition, variable selection methods MostConstrainedStatic and MostConstrainedDynamic will also work.

An example search can be specified as follows.

   Search<SetVar> search = new DepthFirstSearch<SetVar>(); 
 
   SelectChoicePoint<SetVar> select = new SimpleSelect<SetVar>( 
                                vars, 
                                new MinLubCard<SetVar>(), 
                                new MaxGlbCard<SetVar>(), 
                                new IndomainsetMin<SetVar>()); 
   search.setSolutionListener(new SimpleSolutionListener<SetVar>()); 
 
   boolean result = search.labeling(store, select);