// *********************************************************************************** // PROPAGATION // *********************************************************************************** @Override public void propagate(int evtmask) throws ContradictionException { toCheck.clear(); for (int v = 0; v < n; v++) { if (vars[v].instantiated()) { toCheck.push(v); } } fixpoint(); }
private void fixpoint() throws ContradictionException { try { while (toCheck.size() > 0) { int vidx = toCheck.pop(); int val = vars[vidx].getValue(); for (int i = 0; i < n; i++) { if (i != vidx) { if (vars[i].removeValue(val, aCause)) { if (vars[i].instantiated()) { toCheck.push(i); } } } } } } catch (ContradictionException cex) { toCheck.clear(); throw cex; } }
@Override public void propagate(int varIdx, int mask) throws ContradictionException { toCheck.push(varIdx); fixpoint(); }