We present a general framework for determining the number
of solutions of constraint satisfaction problems (CSPs) with a
high precision. Our first strategy uses additional binary variables
for the CSP, and applies an XOR or parity constraint
based method introduced previously for Boolean satisfiability
(SAT) problems. In the CSP framework, in addition to the
naive individual filtering of XOR constraints used in SAT, we
are able to apply a global domain filtering algorithm by viewing
these constraints as a collection of linear equalities over
the field of two elements. Our most promising strategy extends
this approach further to larger domains, and applies the
so-called generalized XOR constraints directly to CSP variables.
This allows us to reap the benefits of the compact and
structured representation that CSPs offer. We demonstrate
the effectiveness of our counting framework through experimental
comparisons with the solution enumeration approach
(which, we believe, is the current best generic solution counting
method for CSPs), and with solution counting in the context
of SAT and integer programming.