public void explain(Deduction d, Explanation e) {
e.add(solver.getExplainer().getPropagatorActivation(this));
e.add(this);
if (d != null && d.getmType() == Deduction.Type.ValRem) {
ValueRemoval vr = (ValueRemoval) d;
IntVar var = (IntVar) vr.getVar();
int val = vr.getVal();
// 1. find the pos of var in vars
boolean ispos;
if (pos < (l / 2)) {
int i;
for (i = 0; i < pos && vars[i].getId() != var.getId(); i++) {
}
ispos = i < pos;
} else {
int i;
for (i = pos; i < l && vars[i].getId() != var.getId(); i++) {
}
ispos = i == l;
}
if (val < var.getLB()) { // explain LB
int i = 0;
for (; i < pos; i++) { // first the positive coefficients
if (vars[i] != var) {
vars[i].explain(ispos ? VariableState.UB : VariableState.LB, e);
}
}
for (; i < l; i++) { // then the negative ones
if (vars[i] != var) {
vars[i].explain(ispos ? VariableState.LB : VariableState.UB, e);
}
}
} else if (val > var.getUB()) { // explain UB
int i = 0;
for (; i < pos; i++) { // first the positive coefficients
if (vars[i] != var) {
vars[i].explain(ispos ? VariableState.LB : VariableState.UB, e);
}