use of at.ac.tuwien.kr.alpha.core.common.NoGood in project Alpha by alpha-asp.
the class NaiveNoGoodStoreTest method naryNoGoodPropagatesTrueFromFalse.
@Test
public void naryNoGoodPropagatesTrueFromFalse() {
NoGood noGood = headFirst(fromOldLiterals(-1, 2, -3));
assertNull(store.add(10, noGood));
assertNull(assignment.assign(2, TRUE));
store.propagate();
assertNull(assignment.assign(3, FALSE));
store.propagate();
assertEquals(TRUE, assignment.getTruth(1));
}
use of at.ac.tuwien.kr.alpha.core.common.NoGood in project Alpha by alpha-asp.
the class NaiveNoGoodStoreTest method binaryNoGoodViolatedAfterAddition.
@Test
public void binaryNoGoodViolatedAfterAddition() {
NoGood noGood = new NoGood(fromOldLiterals(1, 2));
assertNull(store.add(1, noGood));
assertNull(assignment.assign(1, MBT));
assertNull(assignment.assign(2, MBT));
assertNotNull(store.propagate());
}
use of at.ac.tuwien.kr.alpha.core.common.NoGood in project Alpha by alpha-asp.
the class NaiveNoGoodStoreTest method propagateBinaryMBTTwice.
@Test
public void propagateBinaryMBTTwice() {
assignment.assign(2, MBT);
store.add(1, new NoGood(fromOldLiterals(-1, 2)));
store.add(2, new NoGood(fromOldLiterals(-3, 1)));
store.propagate();
assertEquals(MBT, assignment.getTruth(1));
assertEquals(MBT, assignment.getTruth(3));
}
use of at.ac.tuwien.kr.alpha.core.common.NoGood in project Alpha by alpha-asp.
the class NaiveNoGoodStoreTest method addedViolatedBinaryNoGoodPropagatesAfterBacktracking.
@Test
public void addedViolatedBinaryNoGoodPropagatesAfterBacktracking() {
NoGood noGood = new NoGood(fromOldLiterals(70, 195));
assertNull(assignment.choose(70, MBT));
assertNull(assignment.choose(195, MBT));
assertNotNull(store.add(3, noGood));
assignment.backtrack();
assertNull(store.add(3, noGood));
store.propagate();
assertEquals(FALSE, assignment.getTruth(195));
}
use of at.ac.tuwien.kr.alpha.core.common.NoGood in project Alpha by alpha-asp.
the class NaiveNoGoodStoreTest method propagateViolatedConstraintHeadlessMbt.
@Test
public void propagateViolatedConstraintHeadlessMbt() {
NoGood noGood = new NoGood(fromOldLiterals(3, 11, 19));
assertNull(store.add(24, noGood));
assertNull(assignment.assign(3, MBT));
assertNull(assignment.assign(11, MBT));
assertNull(assignment.assign(19, MBT));
ConflictCause conflictCause = store.propagate();
assertNotNull(conflictCause);
assertFalse(store.didPropagate());
assertTrue(antecedentsEquals(noGood.asAntecedent(), conflictCause.getAntecedent()));
}
Aggregations