use of org.logicng.transformations.cnf.BDDCNFTransformation in project symja_android_library by axkr.
the class BooleanFunctions method transformation.
/**
* Get the transformation from the ast options. Default is DNF.
*
* @param ast
* @param engine
* @return <code>null</code> if no or wrong method is defined as option
*/
private static FormulaTransformation transformation(final IAST ast, EvalEngine engine) {
int size = ast.argSize();
if (size > 1 && ast.get(size).isString()) {
IStringX lastArg = (IStringX) ast.get(size);
String method = lastArg.toString();
if (method.equals("DNF") || method.equals("SOP")) {
return new DNFFactorization();
} else if (method.equals("CNF") || method.equals("POS")) {
// don't use CNFFactorization, because of bad memory space complexity
return new BDDCNFTransformation();
}
// `1` currently not supported in `2`.
IOFunctions.printMessage(ast.topHead(), "unsupported", F.list(lastArg, S.Method), engine);
return null;
}
return new DNFFactorization();
}
Aggregations