use of at.ac.tuwien.kr.alpha.core.common.NoGood in project Alpha by alpha-asp.
the class VSIDSTest method testTwoConflicts.
/**
* First, calls {@link #testConflict()}.
* Then, simulates a second conflict, learning { -1, 4 } with resolved atoms { 2 }.
* Due to decay, scores of atoms { 1, 4, 2 } must increase by the increased activity delta of {@link VSIDS#DEFAULT_DECAY_FACTOR}.
*/
@Test
public void testTwoConflicts() {
testConflict();
double activity1 = vsids.getActivity(lit1);
double activity2 = vsids.getActivity(lit2);
double activity3 = vsids.getActivity(lit3);
double activity4 = vsids.getActivity(lit4);
NoGood learnedNoGood = new NoGood(lit1Neg, lit4);
Collection<Integer> resolutionAtoms = Arrays.asList(2);
ConflictAnalysisResult analysisResult = new ConflictAnalysisResult(learnedNoGood, 1, resolutionAtoms);
vsids.analyzedConflict(analysisResult);
assertEquals(activity1 + VSIDS.DEFAULT_DECAY_FACTOR, vsids.getActivity(lit1), DOUBLE_COMPARISON_EPSILON);
assertEquals(activity2 + VSIDS.DEFAULT_DECAY_FACTOR, vsids.getActivity(lit2), DOUBLE_COMPARISON_EPSILON);
assertEquals(activity3, vsids.getActivity(lit3), DOUBLE_COMPARISON_EPSILON);
assertEquals(activity4 + VSIDS.DEFAULT_DECAY_FACTOR, vsids.getActivity(lit4), DOUBLE_COMPARISON_EPSILON);
assertEquals(-1, vsids.getSignBalance(1));
assertEquals(1, vsids.getSignBalance(2));
assertEquals(1, vsids.getSignBalance(3));
assertEquals(1, vsids.getSignBalance(4));
}
Aggregations