Search in sources :

Example 41 with NoGood

use of at.ac.tuwien.kr.alpha.common.NoGood in project Alpha by alpha-asp.

the class BerkMinTest method countPositiveLiteralsOnce.

@Test
public void countPositiveLiteralsOnce() {
    NoGood violatedNoGood = new NoGood(1, 2);
    berkmin.violatedNoGood(violatedNoGood);
    berkmin.analyzedConflict(pseudo(violatedNoGood));
    assertEquals(1, berkmin.getActivity(1), EPSILON);
    assertEquals(1, berkmin.getActivity(2), EPSILON);
}
Also used : NoGood(at.ac.tuwien.kr.alpha.common.NoGood) Test(org.junit.Test)

Example 42 with NoGood

use of at.ac.tuwien.kr.alpha.common.NoGood in project Alpha by alpha-asp.

the class BerkMinTest method countNegativeLiteralsOnce.

@Test
public void countNegativeLiteralsOnce() {
    NoGood violatedNoGood = new NoGood(-1, -2);
    berkmin.violatedNoGood(violatedNoGood);
    berkmin.analyzedConflict(pseudo(violatedNoGood));
    assertEquals(1, berkmin.getActivity(-1), EPSILON);
    assertEquals(1, berkmin.getActivity(-2), EPSILON);
}
Also used : NoGood(at.ac.tuwien.kr.alpha.common.NoGood) Test(org.junit.Test)

Example 43 with NoGood

use of at.ac.tuwien.kr.alpha.common.NoGood in project Alpha by alpha-asp.

the class NoGoodStoreAlphaRoamingTest method binaryNoGoodViolatedDuringAdditionAllTrue.

@Test
public void binaryNoGoodViolatedDuringAdditionAllTrue() {
    NoGood noGood = new NoGood(1, 2);
    assertTrue(assignment.assign(1, TRUE));
    assertTrue(assignment.assign(2, TRUE));
    NoGoodStore.ConflictCause conflictCause = store.add(11, noGood);
    assertNotNull(conflictCause);
    assertNotNull(conflictCause.violatedNoGood);
}
Also used : NoGood(at.ac.tuwien.kr.alpha.common.NoGood) Test(org.junit.Test)

Example 44 with NoGood

use of at.ac.tuwien.kr.alpha.common.NoGood in project Alpha by alpha-asp.

the class NoGoodStoreAlphaRoamingTest method conflictingBinary.

@Test
public void conflictingBinary() {
    final NoGood noGood = new NoGood(1, 2);
    assignment.assign(1, TRUE);
    assignment.assign(2, TRUE);
    NoGoodStore.ConflictCause conflictCause = store.add(1, noGood);
    assertEquals(noGood, conflictCause.violatedNoGood);
}
Also used : NoGood(at.ac.tuwien.kr.alpha.common.NoGood) Test(org.junit.Test)

Example 45 with NoGood

use of at.ac.tuwien.kr.alpha.common.NoGood in project Alpha by alpha-asp.

the class NoGoodStoreAlphaRoamingTest method naryNoGoodViolatedAfterAddition.

@Test
public void naryNoGoodViolatedAfterAddition() {
    NoGood noGood = new NoGood(1, 2, 3);
    assertNull(store.add(11, noGood));
    assertTrue(assignment.assign(1, MBT));
    assertTrue(assignment.assign(2, MBT));
    assertTrue(assignment.assign(3, MBT));
    store.propagate();
    assertNotNull(store.getViolatedNoGood());
}
Also used : NoGood(at.ac.tuwien.kr.alpha.common.NoGood) Test(org.junit.Test)

Aggregations

NoGood (at.ac.tuwien.kr.alpha.common.NoGood)50 Test (org.junit.Test)41 AnswerSet (at.ac.tuwien.kr.alpha.common.AnswerSet)1 BooleanAssignmentReader (at.ac.tuwien.kr.alpha.grounder.BooleanAssignmentReader)1 ConflictAnalysisResult (at.ac.tuwien.kr.alpha.solver.GroundConflictNoGoodLearner.ConflictAnalysisResult)1