use of at.ac.tuwien.kr.alpha.core.common.NoGood in project Alpha by alpha-asp.
the class BerkMinTest method countNegativeLiteralsTwice.
@Test
public void countNegativeLiteralsTwice() {
NoGood violatedNoGood = new NoGood(fromOldLiterals(-1, -2));
berkmin.violatedNoGood(violatedNoGood);
berkmin.analyzedConflict(pseudo(violatedNoGood));
berkmin.violatedNoGood(violatedNoGood);
berkmin.analyzedConflict(pseudo(violatedNoGood));
assertEquals(2, berkmin.getActivity(fromOldLiterals(-1)), DOUBLE_COMPARISON_EPSILON);
assertEquals(2, berkmin.getActivity(fromOldLiterals(-2)), DOUBLE_COMPARISON_EPSILON);
}
use of at.ac.tuwien.kr.alpha.core.common.NoGood in project Alpha by alpha-asp.
the class NaiveNoGoodStoreTest 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 NaiveNoGoodStoreTest 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 NaiveNoGoodStoreTest method propagateViolatedConstraint.
@Test
public void propagateViolatedConstraint() {
NoGood noGood = headFirst(fromOldLiterals(-3, -2, -1));
assertNull(store.add(1, noGood));
assertNull(assignment.assign(1, FALSE));
assertNull(assignment.assign(2, FALSE));
assertNull(assignment.assign(3, FALSE));
ConflictCause conflictCause = store.propagate();
assertNotNull(conflictCause);
assertFalse(store.didPropagate());
assertTrue(antecedentsEquals(noGood.asAntecedent(), conflictCause.getAntecedent()));
}
use of at.ac.tuwien.kr.alpha.core.common.NoGood in project Alpha by alpha-asp.
the class NaiveNoGoodStoreTest method addedBinaryNoGoodPropagatesTrueFromFalse.
@Test
@Disabled("Checks for propagation in add.")
public void addedBinaryNoGoodPropagatesTrueFromFalse() {
NoGood noGood = headFirst(fromOldLiterals(-11, -12));
assertNull(assignment.choose(12, FALSE));
assertNull(store.add(5, noGood));
assertEquals(TRUE, assignment.getTruth(11));
}
Aggregations