use of at.ac.tuwien.kr.alpha.core.common.NoGood in project Alpha by alpha-asp.
the class HeapOfActiveAtoms method newNoGoods.
/**
* Stores newly grounded {@link NoGood}s and updates associated activity counters.
*/
public void newNoGoods(Collection<NoGood> newNoGoods) {
for (NoGood newNoGood : newNoGoods) {
Type type = newNoGood.getType();
if (type != Type.LEARNT && type != Type.INTERNAL) {
analyzeNewNoGood(newNoGood);
initActivity(newNoGood);
}
}
}
use of at.ac.tuwien.kr.alpha.core.common.NoGood in project Alpha by alpha-asp.
the class BerkMinTest method reachDecayPeriodTwice.
@Test
public void reachDecayPeriodTwice() {
berkmin.setDecayPeriod(2);
berkmin.setDecayFactor(0.75);
NoGood violatedNoGood = new NoGood(fromOldLiterals(1, 2));
berkmin.violatedNoGood(violatedNoGood);
berkmin.analyzedConflict(pseudo(violatedNoGood));
assertEquals(1, berkmin.getActivity(fromOldLiterals(1)), DOUBLE_COMPARISON_EPSILON);
assertEquals(1, berkmin.getActivity(fromOldLiterals(2)), DOUBLE_COMPARISON_EPSILON);
berkmin.violatedNoGood(violatedNoGood);
berkmin.analyzedConflict(pseudo(violatedNoGood));
assertEquals(1.5, berkmin.getActivity(fromOldLiterals(1)), DOUBLE_COMPARISON_EPSILON);
assertEquals(1.5, berkmin.getActivity(fromOldLiterals(2)), DOUBLE_COMPARISON_EPSILON);
berkmin.violatedNoGood(violatedNoGood);
berkmin.analyzedConflict(pseudo(violatedNoGood));
assertEquals(2.5, berkmin.getActivity(fromOldLiterals(1)), DOUBLE_COMPARISON_EPSILON);
assertEquals(2.5, berkmin.getActivity(fromOldLiterals(2)), DOUBLE_COMPARISON_EPSILON);
berkmin.violatedNoGood(violatedNoGood);
berkmin.analyzedConflict(pseudo(violatedNoGood));
assertEquals(2.625, berkmin.getActivity(fromOldLiterals(1)), DOUBLE_COMPARISON_EPSILON);
assertEquals(2.625, 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 BerkMinTest method countPositiveLiteralsOnce.
@Test
public void countPositiveLiteralsOnce() {
NoGood violatedNoGood = new NoGood(fromOldLiterals(1, 2));
berkmin.violatedNoGood(violatedNoGood);
berkmin.analyzedConflict(pseudo(violatedNoGood));
assertEquals(1, berkmin.getActivity(fromOldLiterals(1)), DOUBLE_COMPARISON_EPSILON);
assertEquals(1, 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 BerkMinTest method countPositiveLiteralsTwice.
@Test
public void countPositiveLiteralsTwice() {
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 BerkMinTest method countPositiveLiteralsThenNegativeLiterals.
@Test
public void countPositiveLiteralsThenNegativeLiterals() {
NoGood violatedNoGood = new NoGood(fromOldLiterals(1, 2));
berkmin.violatedNoGood(violatedNoGood);
berkmin.analyzedConflict(pseudo(violatedNoGood));
violatedNoGood = new NoGood(fromOldLiterals(-1, -2));
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);
}
Aggregations