use of at.ac.tuwien.kr.alpha.core.common.NoGood in project Alpha by alpha-asp.
the class NoGoodStoreAlphaRoamingTest 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 NoGoodStoreAlphaRoamingTest method binaryNoGoodViolatedAfterAddition.
@Test
public void binaryNoGoodViolatedAfterAddition() {
NoGood noGood = new NoGood(fromOldLiterals(1, 2));
assertNull(store.add(11, 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 NoGoodStoreAlphaRoamingTest method addedViolatedNaryNoGoodPropagatesAfterBacktracking.
@Test
public void addedViolatedNaryNoGoodPropagatesAfterBacktracking() {
NoGood noGood = new NoGood(fromOldLiterals(70, 195, 36));
assertNull(assignment.choose(70, MBT));
assertNull(assignment.choose(195, MBT));
assertNull(assignment.choose(36, MBT));
assertNotNull(store.add(3, noGood));
assignment.backtrack();
assertNull(store.add(3, noGood));
store.propagate();
assertEquals(FALSE, assignment.getTruth(36));
}
use of at.ac.tuwien.kr.alpha.core.common.NoGood in project Alpha by alpha-asp.
the class NoGoodStoreAlphaRoamingTest method binaryNoGoodPropagatesTrueFromTrue.
@Test
public void binaryNoGoodPropagatesTrueFromTrue() {
NoGood noGood = headFirst(fromOldLiterals(-11, 12));
assertNull(store.add(5, noGood));
assertNull(assignment.choose(12, TRUE));
store.propagate();
assertEquals(TRUE, assignment.getTruth(11));
}
use of at.ac.tuwien.kr.alpha.core.common.NoGood in project Alpha by alpha-asp.
the class NoGoodStoreAlphaRoamingTest method propagationAtLowerDecisionLevel.
@Test
@Disabled("TrailAssignment no longer propagates at lower decision level.")
public void propagationAtLowerDecisionLevel() {
NoGood noGood = headFirst(fromOldLiterals(-1, 2, -3));
assertNull(assignment.choose(3, FALSE));
assertNull(assignment.choose(2, TRUE));
assertNull(assignment.choose(4, TRUE));
assertNull(store.add(10, noGood));
store.propagate();
assertEquals(TRUE, assignment.getTruth(1));
Assignment.Entry entry = assignment.get(1);
assertEquals(TRUE, entry.getTruth());
assertEquals(2, entry.getDecisionLevel());
}
Aggregations