return;
}
final List<IntSet> otherColumns = new LinkedList<IntSet>();
int firstColFactor = (int) StrictMath.pow(usize, arity-1);
IntSet firstCol = Ints.bestSet(usize);
for(IntIterator rbIter = set.iterator(); rbIter.hasNext(); ) {
firstCol.add(rbIter.next() / firstColFactor);
}
refinePartitions(firstCol);
int idenFactor = (1 - firstColFactor) / (1 - usize);
for(ListIterator<IntSet> partsIter = parts.listIterator(); partsIter.hasNext(); ) {
IntSet part = partsIter.next();
if (firstCol.contains(part.min())) { // contains one, contains them all
range2domain.clear();
for(IntIterator atoms = part.iterator(); atoms.hasNext(); ) {
int atom = atoms.next();
IntSet atomRange = Ints.bestSet(firstColFactor);
for(IntIterator rbIter = set.iterator(atom*firstColFactor, (atom+1)*firstColFactor - 1);
rbIter.hasNext(); ) {
atomRange.add(rbIter.next() % firstColFactor);
}
IntSet atomDomain = range2domain.get(atomRange);
if (atomDomain != null) atomDomain.add(atom);
else range2domain.put(atomRange, oneOf(usize, atom));
}
partsIter.remove();
IntSet idenPartition = Ints.bestSet(usize);
for(Map.Entry<IntSet, IntSet> entry : range2domain.entrySet()) {
if (entry.getValue().size()==1 && entry.getKey().size()==1 &&
entry.getKey().min() == entry.getValue().min() * idenFactor) {
idenPartition.add(entry.getValue().min());
} else {
partsIter.add(entry.getValue());
otherColumns.add(entry.getKey());
}
}
if (!idenPartition.isEmpty())
partsIter.add(idenPartition);
}
}
// refine based on the remaining columns