Search in sources :

Example 1 with NumberOfNodesBDDHandler

use of org.logicng.handlers.NumberOfNodesBDDHandler in project LogicNG by logic-ng.

the class LargeBDDTest method testNumberOfNodesHandlerSmall.

@Test
public void testNumberOfNodesHandlerSmall() {
    final FormulaFactory f = new FormulaFactory();
    final NQueensGenerator generator = new NQueensGenerator(f);
    final Formula queens = generator.generate(4);
    final BDDKernel kernel = new BDDKernel(f, queens.variables().size(), 10000, 10000);
    final NumberOfNodesBDDHandler handler = new NumberOfNodesBDDHandler(1000);
    final BDD bdd = BDDFactory.build(queens, kernel, handler);
    assertThat(handler.aborted()).isFalse();
    assertThat(bdd.index()).isNotEqualTo(BDDKernel.BDD_ABORT);
}
Also used : Formula(org.logicng.formulas.Formula) FormulaFactory(org.logicng.formulas.FormulaFactory) BDDKernel(org.logicng.knowledgecompilation.bdds.jbuddy.BDDKernel) NumberOfNodesBDDHandler(org.logicng.handlers.NumberOfNodesBDDHandler) NQueensGenerator(org.logicng.testutils.NQueensGenerator) Test(org.junit.jupiter.api.Test)

Example 2 with NumberOfNodesBDDHandler

use of org.logicng.handlers.NumberOfNodesBDDHandler in project LogicNG by logic-ng.

the class LargeBDDTest method testNumberOfNodesHandler.

@Test
public void testNumberOfNodesHandler() throws ParserException {
    final FormulaFactory f = new FormulaFactory();
    final Formula formula = f.parse("A <=> ~(B => C & F & G & ~H | A & D & ~E)");
    final BDDKernel kernel = new BDDKernel(f, formula.variables().size(), 10000, 10000);
    final NumberOfNodesBDDHandler handler = new NumberOfNodesBDDHandler(5);
    final BDD bdd = BDDFactory.build(formula, kernel, handler);
    assertThat(handler.aborted()).isTrue();
    assertThat(bdd.index()).isEqualTo(BDDKernel.BDD_ABORT);
}
Also used : Formula(org.logicng.formulas.Formula) FormulaFactory(org.logicng.formulas.FormulaFactory) BDDKernel(org.logicng.knowledgecompilation.bdds.jbuddy.BDDKernel) NumberOfNodesBDDHandler(org.logicng.handlers.NumberOfNodesBDDHandler) Test(org.junit.jupiter.api.Test)

Example 3 with NumberOfNodesBDDHandler

use of org.logicng.handlers.NumberOfNodesBDDHandler in project LogicNG by logic-ng.

the class LargeBDDTest method testNumberOfNodesHandlerLarge.

@Test
public void testNumberOfNodesHandlerLarge() {
    final FormulaFactory f = new FormulaFactory();
    final NQueensGenerator generator = new NQueensGenerator(f);
    final Formula queens = generator.generate(10);
    final BDDKernel kernel = new BDDKernel(f, queens.variables().size(), 10000, 10000);
    final NumberOfNodesBDDHandler handler = new NumberOfNodesBDDHandler(5);
    final BDD bdd = BDDFactory.build(queens, kernel, handler);
    assertThat(handler.aborted()).isTrue();
    assertThat(bdd.index()).isEqualTo(BDDKernel.BDD_ABORT);
}
Also used : Formula(org.logicng.formulas.Formula) FormulaFactory(org.logicng.formulas.FormulaFactory) BDDKernel(org.logicng.knowledgecompilation.bdds.jbuddy.BDDKernel) NumberOfNodesBDDHandler(org.logicng.handlers.NumberOfNodesBDDHandler) NQueensGenerator(org.logicng.testutils.NQueensGenerator) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)3 Formula (org.logicng.formulas.Formula)3 FormulaFactory (org.logicng.formulas.FormulaFactory)3 NumberOfNodesBDDHandler (org.logicng.handlers.NumberOfNodesBDDHandler)3 BDDKernel (org.logicng.knowledgecompilation.bdds.jbuddy.BDDKernel)3 NQueensGenerator (org.logicng.testutils.NQueensGenerator)2