}
protected void filter() throws ContradictionException {
buildSCC();
int j, ub;
IntVar v;
for (int i = 0; i < n; i++) {
v = vars[i];
ub = v.getUB();
for (int k = v.getLB(); k <= ub; k = v.nextValue(k)) {
j = map.get(k);
if (nodeSCC[i] != nodeSCC[j]) {
if (matching[i] == j) {
v.instantiateTo(k, aCause);
} else {
v.removeValue(k, aCause);
digraph.removeArc(i, j);
}
}
}
}
for (int i = 0; i < n; i++) {
v = vars[i];
if (!v.hasEnumeratedDomain()) {
ub = v.getUB();
for (int k = v.getLB(); k <= ub; k++) {
j = map.get(k);
if (!(digraph.arcExists(i, j) || digraph.arcExists(j, i))) {
v.removeValue(k, aCause);
}
}
int lb = v.getLB();
for (int k = v.getUB(); k >= lb; k--) {
j = map.get(k);
if (!(digraph.arcExists(i, j) || digraph.arcExists(j, i))) {
v.removeValue(k, aCause);
}
}
}
}
}