Search in sources :

Example 1 with ExtendedProposition

use of org.logicng.propositions.ExtendedProposition in project LogicNG by logic-ng.

the class DRUPTest method testWithCcPropositions.

@Test
public void testWithCcPropositions() throws ParserException {
    final FormulaFactory f = new FormulaFactory();
    final SATSolver solver = MiniSat.miniSat(f, MiniSatConfig.builder().proofGeneration(true).cnfMethod(MiniSatConfig.CNFMethod.PG_ON_SOLVER).build());
    final ExtendedProposition<StringBackpack> p1 = new ExtendedProposition<>(new StringBackpack("CC"), f.parse("A + B + C <= 1"));
    final StandardProposition p2 = new StandardProposition(f.parse("A"));
    final StandardProposition p3 = new StandardProposition(f.parse("B"));
    final StandardProposition p4 = new StandardProposition(f.parse("X & Y"));
    solver.add(p1);
    solver.add(p2);
    solver.add(p3);
    solver.add(p4);
    assertThat(solver.sat()).isEqualTo(FALSE);
    assertThat(solver.unsatCore().propositions()).containsExactlyInAnyOrder(p1, p2, p3);
}
Also used : SATSolver(org.logicng.solvers.SATSolver) StandardProposition(org.logicng.propositions.StandardProposition) FormulaFactory(org.logicng.formulas.FormulaFactory) ExtendedProposition(org.logicng.propositions.ExtendedProposition) LogicNGTest(org.logicng.LogicNGTest) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)1 LogicNGTest (org.logicng.LogicNGTest)1 FormulaFactory (org.logicng.formulas.FormulaFactory)1 ExtendedProposition (org.logicng.propositions.ExtendedProposition)1 StandardProposition (org.logicng.propositions.StandardProposition)1 SATSolver (org.logicng.solvers.SATSolver)1