|
Adiar 2.1.0
An External Memory Decision Diagram Library
|
To play around with the examples below, please take a look at examples/basic.cpp.
The Boolean constants true and false can be obtained directly with the adiar::bdd_true and adiar::bdd_false functions.
Alternatively, boolean constants can also be created directly from a value of type bool.
For a single variable, e.g. xi, parse the label i to adiar::bdd_ithvar.
For the negation of a single variable, use adiar::bdd_nithvar
Use adiar::bdd_not or the ~ operator. For example, res below is equivalent to adiar::bdd_nithvar of 0.
Use adiar::bdd_apply with an adiar::bool_op.
Alternatively, there is a specializations of adiar::bdd_apply for each adiar::bool_op and for and, or, and xor one can also use the &, |, and ^ operators.
Use adiar::bdd_ite.
In other BDD packages, this function is good for manually constructing a BDD bottom-up. But, here you should use adiar::bdd_builder instead (see Manual Construction).
Use adiar::bdd_restrict. For example, res below is equivalent to ~x1.
Specifically to restrict the top variable, you can use adiar::bdd_low and adiar::bdd_high.
See also the Function Objects tutorial for better ways to use this operation.
Use adiar::bdd_exists and adiar::bdd_forall. For example, res below is equivalent to adiar::bdd_true().
See also the Function Objects tutorial for better ways to use these operations.
To get the number of satisfying assignments, use adiar::bdd_satcount. Its second (optional) argument is the total number of variables (including the possibly suppressed ones in the BDD).
To get a cube of the lexicographical minimal or maximal assignment, use adiar::bdd_satmin and adiar::bdd_satmax respectively.
Use adiar::bdd_isconst to check whether a BDD is a constant Boolean value.
Use adiar::bdd_istrue and adiar::bdd_isfalse to check for it being specifically \(\top\) or \(\bot\), respectively.
Use adiar::bdd_isvar check whether a BDD represents a formula of exactly one variable, i.e. a literal.
Use adiar::bdd_isithvar, and adiar::bdd_isnithvar to check whether a BDD represents a formula of a positive or negative variable, respectively.
To check whether a BDD represents a cube, i.e. where all the variables in its support have a fixed value, use adiar::bdd_iscube.
Use adiar::bdd_equal and adiar::bdd_unequal or the == and != operators.
Use adiar::bdd_nodecount to get the number of BDD nodes.
Use adiar::bdd_varcount to get the number of variables present in the BDD.
Use adiar::bdd_pathcount to get the number of paths to true.
The top (smallest) variable present in the BDD can be obtained with adiar::bdd_topvar (adiar::bdd_minvar).
On the other hand, the last variable present in the BDD can be obtained with adiar::bdd_maxvar.
The BDD can be exported to the DOT format with adiar::bdd_printdot. The second argument can either be an output stream, e.g. std::cout, or a filename.