return (vars[i + off].getLB() >= vars[j + off].getUB() + vars[j + off + 2 * n].getUB())
|| (vars[j + off].getLB() >= vars[i + off].getUB() + vars[i + off + 2 * n].getUB());
}
protected void filterFromBox(int i) throws ContradictionException {
ISet s = overlappingBoxes.getNeighOf(i);
// check energy
int xm = vars[i].getLB();
int xM = vars[i].getUB() + vars[i + 2 * n].getUB();
int ym = vars[i + n].getLB();
int yM = vars[i + n].getUB() + vars[i + 3 * n].getUB();
int am = vars[i + 2 * n].getLB() * vars[i + 3 * n].getLB();
for (int j = s.getFirstElement(); j >= 0; j = s.getNextElement()) {
xm = Math.min(xm, vars[j].getLB());
xM = Math.max(xM, vars[j].getUB() + vars[j + 2 * n].getUB());
ym = Math.min(ym, vars[j + n].getLB());
yM = Math.max(yM, vars[j + n].getUB() + vars[j + 3 * n].getUB());
am += vars[j + 2 * n].getLB() * vars[j + 3 * n].getLB();
if (am > (xM - xm) * (yM - ym)) {
contradiction(vars[i], "");
}
}
// mandatory part based filtering
boolean horizontal = true;
boolean vertical = false;
for (int j = s.getFirstElement(); j >= 0; j = s.getNextElement()) {
if (doOverlap(i, j, horizontal)) {
filter(i, j, vertical);
}
if (doOverlap(i, j, vertical)) {
filter(i, j, horizontal);