use of org.logicng.knowledgecompilation.bdds.jbuddy.BDDKernel in project LogicNG by logic-ng.
the class Formula method bdd.
/**
* Generates a BDD from this formula with a given variable ordering. This is done by generating a new BDD factory,
* generating the variable order for this formula, and building a new BDD. If more sophisticated operations should
* be performed on the BDD or more than one formula should be constructed on the BDD, an own instance of
* {@link BDDFactory} should be created and used.
* @param variableOrdering the variable ordering
* @return the BDD for this formula with the given ordering
*/
public BDD bdd(final VariableOrdering variableOrdering) {
final Formula formula = this.nnf();
final int varNum = formula.variables().size();
final BDDKernel kernel;
if (variableOrdering == null) {
kernel = new BDDKernel(this.f, varNum, varNum * 30, varNum * 20);
} else {
final VariableOrderingProvider provider = variableOrdering.provider();
kernel = new BDDKernel(this.f, provider.getOrder(formula), varNum * 30, varNum * 20);
}
return BDDFactory.build(formula, kernel, null);
}
Aggregations