Search in sources :

Example 21 with NoGood

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

the class NaiveNoGoodStoreTest method naryNoGoodViolatedDuringAdditionAllTrue.

@Test
@Disabled("Checks for conflict detection in add.")
public void naryNoGoodViolatedDuringAdditionAllTrue() {
    NoGood noGood = new NoGood(fromOldLiterals(1, 2, 3));
    assertNull(assignment.assign(1, TRUE));
    assertNull(assignment.assign(2, TRUE));
    assertNull(assignment.assign(3, TRUE));
    ConflictCause conflictCause = store.add(11, noGood);
    assertNotNull(conflictCause);
    assertNotNull(conflictCause.getAntecedent());
}
Also used : NoGood(at.ac.tuwien.kr.alpha.core.common.NoGood) Test(org.junit.jupiter.api.Test) Disabled(org.junit.jupiter.api.Disabled)

Example 22 with NoGood

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

the class NaiveNoGoodStoreTest method binaryNoGoodViolatedDuringAdditionAllMbt.

@Test
@Disabled("Checks for conflict detection in add.")
public void binaryNoGoodViolatedDuringAdditionAllMbt() {
    NoGood noGood = new NoGood(fromOldLiterals(1, 2));
    assertNull(assignment.assign(1, MBT));
    assertNull(assignment.assign(2, MBT));
    ConflictCause conflictCause = store.add(11, noGood);
    assertNotNull(conflictCause);
    assertNotNull(conflictCause.getAntecedent());
}
Also used : NoGood(at.ac.tuwien.kr.alpha.core.common.NoGood) Test(org.junit.jupiter.api.Test) Disabled(org.junit.jupiter.api.Disabled)

Example 23 with NoGood

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

the class NaiveNoGoodStoreTest method propagateViolatedConstraintHeadless.

@Test
public void propagateViolatedConstraintHeadless() {
    NoGood noGood = new NoGood(fromOldLiterals(3, 11, 19));
    assertNull(store.add(24, noGood));
    assertNull(assignment.assign(3, TRUE));
    assertNull(assignment.assign(11, TRUE));
    assertNull(assignment.assign(19, TRUE));
    ConflictCause conflictCause = store.propagate();
    assertNotNull(conflictCause);
    assertFalse(store.didPropagate());
    assertTrue(antecedentsEquals(noGood.asAntecedent(), conflictCause.getAntecedent()));
}
Also used : NoGood(at.ac.tuwien.kr.alpha.core.common.NoGood) Test(org.junit.jupiter.api.Test)

Example 24 with NoGood

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

the class NaiveNoGoodStoreTest method constraintWithAssignment.

@Test
public void constraintWithAssignment() {
    assignment.assign(123, MBT);
    assignment.assign(23, TRUE);
    store.add(3, new NoGood(fromOldLiterals(-123, 22, 23)));
}
Also used : NoGood(at.ac.tuwien.kr.alpha.core.common.NoGood) Test(org.junit.jupiter.api.Test)

Example 25 with NoGood

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

the class NaiveNoGoodStoreTest method neverViolatedNoGood.

@Test
public void neverViolatedNoGood() {
    NoGood noGood = new NoGood(fromOldLiterals(-44, 10, 13, 44));
    assertNull(store.add(80, noGood));
    assertNull(assignment.assign(10, TRUE));
    assertNull(assignment.assign(13, TRUE));
    assertNull(assignment.assign(44, FALSE));
    assertNull(store.propagate());
}
Also used : NoGood(at.ac.tuwien.kr.alpha.core.common.NoGood) Test(org.junit.jupiter.api.Test)

Aggregations

NoGood (at.ac.tuwien.kr.alpha.core.common.NoGood)91 Test (org.junit.jupiter.api.Test)73 Disabled (org.junit.jupiter.api.Disabled)10 TrailAssignment (at.ac.tuwien.kr.alpha.core.solver.TrailAssignment)4 LinkedHashMap (java.util.LinkedHashMap)4 Substitution (at.ac.tuwien.kr.alpha.api.grounder.Substitution)3 ASPCore2Program (at.ac.tuwien.kr.alpha.api.programs.ASPCore2Program)3 NormalProgram (at.ac.tuwien.kr.alpha.api.programs.NormalProgram)3 Atom (at.ac.tuwien.kr.alpha.api.programs.atoms.Atom)3 BasicSubstitution (at.ac.tuwien.kr.alpha.commons.substitutions.BasicSubstitution)3 RuleAtom (at.ac.tuwien.kr.alpha.core.atoms.RuleAtom)3 AtomStore (at.ac.tuwien.kr.alpha.core.common.AtomStore)3 AtomStoreImpl (at.ac.tuwien.kr.alpha.core.common.AtomStoreImpl)3 StratifiedEvaluation (at.ac.tuwien.kr.alpha.core.programs.transformation.StratifiedEvaluation)3 CompiledRule (at.ac.tuwien.kr.alpha.core.rules.CompiledRule)3 ConflictAnalysisResult (at.ac.tuwien.kr.alpha.core.solver.learning.GroundConflictNoGoodLearner.ConflictAnalysisResult)3 Predicate (at.ac.tuwien.kr.alpha.api.programs.Predicate)2 Literal (at.ac.tuwien.kr.alpha.api.programs.literals.Literal)2 Literals.atomToLiteral (at.ac.tuwien.kr.alpha.core.atoms.Literals.atomToLiteral)2 Literals.atomToNegatedLiteral (at.ac.tuwien.kr.alpha.core.atoms.Literals.atomToNegatedLiteral)2