The cnf2eadt compiler

cnf2eadt is a compiler associating with an input CNF formula an equivalent representation from the language EADT of (extended) affine decision trees. An extended affine decision tree simply is a tree with affine decision nodes and some specific decomposable conjunction or disjunction nodes. Unlike standard decision trees, the decision nodes of an EADT formula are not labeled by variables but by affine clauses. Interestingly, the models of an EADT representation can be counted efficiently.

We study EADT, and several subsets of it along the lines of the knowledge compilation map. We also describe a compiler and present some experimental results. Those results show that the EADT compilation-based approach is competitive with (and in some cases is able to outperform) the model counter Cachet and the d-DNNF compilation-based approach to model counting based on the C2D compiler.

For more details, see the paper:

F. Koriche, J.-M. Lagniez, P. Marquis and S. Thomas. "Affine Decision Trees for Model Counting". Proceedings of IJCAI'13, pages 947-953. (pdf)

The cnf2eadt compiler (v1.0)

The runtime code ./cnf2eadt can be launched on any computer with a 64-bit architecture, under Linux OS. [EADT compiler] [Benchmarks]

To run the compiler on a given CNF instance, use ./cnf2eadt instance.cnf. The instance must conform to the standard DIMACS format.

Example of DIMACS CNF formula
p cnf 5 5
4 -5 0
5 3 2 0
-4 -1 0
5 -2 0
-5 2 0

The corresponding output gives successively:

Example of invocation
./cnf2eadt ais6.cnf
#Variables: 61
#Clauses: 581
#ORNodes: 127
#ANDNodes: 0
#TrueNodes: 21
#FalseNodes: 107
Compilation time: 0.000000
Model counting time: 0.000000

#Models: 24

In order to count the number of models of the instance instance.cnf once conditioned successively by some queries (terms), put a instance.queries file in the same folder as the one used for instance.cnf.

Every .queries file must conform to the following format:

The command is ./cnf2eadt instance.cnf -queries

Example: .queries file
queries 1000 61 3
-52 32 48 0
-30 55 3 0
-10 -20 58 0
...

The corresponding output gives successively:

Example: invocation with queries
./cnf2eadt ais6.cnf -queries | head -n 15
#Variables: 61
#Clauses: 581
#ORNodes: 127
#ANDNodes: 0
#TrueNodes: 21
#FalseNodes: 107
Compilation time: 0.010000
Cumulated model counting time: 0.000000

Query 1: -52 32 48
#Models: 0
Query 2: -30 55 3
#Models: 2
Query 3: -10 -20 58
#Models: 7

Finally, the option -uq=n can be used in conjunction with -queries to make precise a specific query (the one of rank n in the instance.queries file), on which one wants to focus.

Example: specific query
./cnf2eadt ais6.cnf -queries -uq=10
#Variables: 61
#Clauses: 581
#ORNodes: 127
#ANDNodes: 0
#TrueNodes: 21
#FalseNodes: 107
Compilation time: 0.000000
Model Counting time: 0.000000

Query 10: -12 56 4
#Models: 2