Search in sources :

Example 1 with MinFillDTreeGenerator

use of org.logicng.knowledgecompilation.dnnf.datastructures.dtree.MinFillDTreeGenerator in project LogicNG by logic-ng.

the class DnnfFactory method compile.

/**
 * Compiles the given formula to a DNNF instance.
 * @param formula the formula
 * @return the compiled DNNF
 */
public Dnnf compile(final Formula formula) {
    final SortedSet<Variable> originalVariables = new TreeSet<>(formula.variables());
    final Formula cnf = formula.cnf();
    originalVariables.addAll(cnf.variables());
    final Formula simplifedFormula = simplifyFormula(cnf);
    final DnnfCompiler compiler = new DnnfCompiler(simplifedFormula);
    final Formula dnnf = compiler.compile(new MinFillDTreeGenerator());
    return new Dnnf(originalVariables, dnnf);
}
Also used : Formula(org.logicng.formulas.Formula) MinFillDTreeGenerator(org.logicng.knowledgecompilation.dnnf.datastructures.dtree.MinFillDTreeGenerator) Dnnf(org.logicng.knowledgecompilation.dnnf.datastructures.Dnnf) Variable(org.logicng.formulas.Variable) TreeSet(java.util.TreeSet)

Aggregations

TreeSet (java.util.TreeSet)1 Formula (org.logicng.formulas.Formula)1 Variable (org.logicng.formulas.Variable)1 Dnnf (org.logicng.knowledgecompilation.dnnf.datastructures.Dnnf)1 MinFillDTreeGenerator (org.logicng.knowledgecompilation.dnnf.datastructures.dtree.MinFillDTreeGenerator)1