@Test(groups = "1s", timeOut = 6000000) public void testAA13() throws ContradictionException { HashMap<IntVar, IntIterableRangeSet> lits = Explainer.execute(model.getSolver(), (i) -> { x.instantiateTo(2, Cause.Null); }, b, b); Assert.assertTrue(lits.containsKey(b)); Assert.assertTrue(lits.containsKey(x)); IntIterableRangeSet rng = new IntIterableRangeSet(0); Assert.assertEquals(lits.get(b), rng); rng.clear(); rng.add(3); Assert.assertEquals(lits.get(x), rng); }
@Override public boolean instantiateTo(int value, ICause cause) throws ContradictionException { assert cause != null; boolean done = false; if (!this.contains(value)) { model.getSolver().getEventObserver().instantiateTo(this, value, cause, getLB(), getUB()); this.contradiction(cause, MSG_EMPTY); } else if (!isInstantiated()) { model.getSolver().getEventObserver().instantiateTo(this, value, cause, getLB(), getUB()); notifyPropagators(IntEventType.INSTANTIATE, cause); this.fixed.set(true); if (reactOnRemoval) { delta.add(1 - value, cause); } if (value == 1) { done = var.instantiateTo(cste, this); } else { done = var.removeValue(cste, this); } } return done; }
EqView extends IntBoolView { @Override public boolean instantiateTo(int value, ICause cause) throws ContradictionException { assert cause != null; boolean done = false; if (!this.contains(value)) { model.getSolver().getEventObserver().instantiateTo(this, value, cause, getLB(), getUB()); this.contradiction(cause, MSG_EMPTY); } else if (!isInstantiated()) { model.getSolver().getEventObserver().instantiateTo(this, value, cause, getLB(), getUB()); notifyPropagators(IntEventType.INSTANTIATE, cause); this.fixed.set(true); if (reactOnRemoval) { delta.add(1 - value, cause); } if (value == 1) { done = var.instantiateTo(cste, this); } else { done = var.removeValue(cste, this); } } return done; } }
EqView extends IntBoolView { @Override public boolean instantiateTo(int value, ICause cause) throws ContradictionException { assert cause != null; boolean done = false; if (!this.contains(value)) { model.getSolver().getEventObserver().instantiateTo(this, value, cause, getLB(), getUB()); this.contradiction(cause, MSG_EMPTY); } else if (!isInstantiated()) { model.getSolver().getEventObserver().instantiateTo(this, value, cause, getLB(), getUB()); notifyPropagators(IntEventType.INSTANTIATE, cause); this.fixed.set(true); if (reactOnRemoval) { delta.add(1 - value, cause); } if (value == 1) { done = var.instantiateTo(cste, this); } else { done = var.removeValue(cste, this); } } return done; } EqView(final IntVar var, final int cste); }
EqView extends IntBoolView { @Override public boolean instantiateTo(int value, ICause cause) throws ContradictionException { assert cause != null; boolean done = false; if (!this.contains(value)) { model.getSolver().getEventObserver().instantiateTo(this, value, cause, getLB(), getUB()); this.contradiction(cause, MSG_EMPTY); } else if (!isInstantiated()) { model.getSolver().getEventObserver().instantiateTo(this, value, cause, getLB(), getUB()); notifyPropagators(IntEventType.INSTANTIATE, cause); this.fixed.set(true); if (reactOnRemoval) { delta.add(1 - value, cause); } if (value == 1) { done = var.instantiateTo(cste, this); } else { done = var.removeValue(cste, this); } } return done; } EqView(final IntVar var, final int cste); @Override ESat getBooleanValue(); @Override boolean instantiateTo(int value, ICause cause); @Override int getDomainSize(); @Override boolean isInstantiated(); @Override boolean contains(int value); @Override boolean isInstantiatedTo(int value); @Override int getLB(); @Override int getUB(); @Override int nextValue(int v); @Override int nextValueOut(int v); @Override int previousValue(int v); @Override int previousValueOut(int v); @Override void justifyEvent(IntEventType mask, int one, int two, int three); @Override void explain(int p, ExplanationForSignedClause explanation); }
EqView extends IntBoolView { @Override public boolean instantiateTo(int value, ICause cause) throws ContradictionException { assert cause != null; boolean done = false; if (!this.contains(value)) { model.getSolver().getEventObserver().instantiateTo(this, value, cause, getLB(), getUB()); this.contradiction(cause, MSG_EMPTY); } else if (!isInstantiated()) { model.getSolver().getEventObserver().instantiateTo(this, value, cause, getLB(), getUB()); notifyPropagators(IntEventType.INSTANTIATE, cause); this.fixed.set(true); if (reactOnRemoval) { delta.add(1 - value, cause); } if (value == 1) { done = var.instantiateTo(cste, this); } else { done = var.removeValue(cste, this); } } return done; } EqView(final IntVar var, final int cste); @Override ESat getBooleanValue(); @Override boolean instantiateTo(int value, ICause cause); @Override int getDomainSize(); @Override boolean isInstantiated(); @Override boolean contains(int value); @Override boolean isInstantiatedTo(int value); @Override int getLB(); @Override int getUB(); @Override int nextValue(int v); @Override int nextValueOut(int v); @Override int previousValue(int v); @Override int previousValueOut(int v); @Override void justifyEvent(IntEventType mask, int one, int two, int three); @Override void explain(int p, ExplanationForSignedClause explanation);  }