@Override public void propagate(int evtmask) throws ContradictionException { int min = 0; int max = 0; ISet nodes = g.getPotentialNodes(); for (int i = nodes.getFirstElement(); i >= 0; i = nodes.getNextElement()) { if (g.getMandSuccOrNeighOf(i).contain(i)) { min++; max++; } else if (g.getPotSuccOrNeighOf(i).contain(i)) { max++; } } k.updateLowerBound(min, aCause); k.updateUpperBound(max, aCause); if (min == max) { setPassive(); } else if (k.isInstantiated()) { if (k.getValue() == max) { for (int i = nodes.getFirstElement(); i >= 0; i = nodes.getNextElement()) { if (g.getPotSuccOrNeighOf(i).contain(i)) { g.enforceArc(i, i, aCause); } } setPassive(); } else if (k.getValue() == min) { for (int i = nodes.getFirstElement(); i >= 0; i = nodes.getNextElement()) { if (!g.getMandSuccOrNeighOf(i).contain(i)) { g.removeArc(i, i, aCause); } } setPassive(); } } }
@Override public ESat isEntailed() { int min = 0; int max = 0; ISet env = g.getPotentialNodes(); for (int i = env.getFirstElement(); i >= 0; i = env.getNextElement()) { if (g.getMandSuccOrNeighOf(i).contain(i)) { min++; max++; } else if (g.getPotSuccOrNeighOf(i).contain(i)) { max++; } } if (k.getLB() > max || k.getUB() < min) { return ESat.FALSE; } if (min == max) { return ESat.TRUE; } return ESat.UNDEFINED; }