On Automata, MDDs and BDDs in Constraint Satisfaction Tarik Hadzic and Esben Rune Hansen and Barry O’Sullivan Abstract. In this paper we analyze the relationships between the variants of deterministic finite-state automata (DFAs), multi-valued decision diagrams (MDDs) and binary decision diagrams (BDDs) as currently used for compiling constraint satisfaction problems (CSPs). We highlight the lim- itations and benefits of using Boolean encodings and BDDs, in comparison to their multi-valued counterparts: MDDs and DFAs. In particular, we show the close relationship between these structures when the Boolean encoding of a CSP is using the clustered variable ordering. We also note that, differences between the variants of DFAs and MDDs used in the CSP literature are minor, and appear only due to the removal of redundant nodes in MDDs. We experimentally compare these structures over a set of real-world and random instances. 1 Introduction An ever increasing list of different compact representations for constraint satisfaction problems makes it increasingly hard to identify the right one for a given task [Bry86, Vem92, Weg00, MMD07]. While recently there has been significant work on describing the relationships between a number of these struc- tures [DM02], there is still much to clarify, especially when comparing between functions involving multi-valued variables and Boolean functions. In particular, a class of ordered acyclic directed graphs in- cluding deterministic finite-state automata (DFAs) [Vem92, AFM02], multi-valued decision diagrams (MDDs) [Weg00], and binary decision diagrams (BDDs) [MAH02] has often been used for decision support [MAH02, AFM02] and enhanc- ing inference in CSP search [Pes04, CY06, AHHT07]. While DFAs and MDDs represent integer variables directly by label- ing each edge with a CSP value, BDD representations allow only binary labeling of edges, therefore requiring a Boolean encoding of the CSP. This is usually done by using either log-encoding or direct-encoding [Wal00]. In this paper we highlight the limitations and benefits of using BDDs in comparison to their multi-valued counterparts: MDDs and DFAs. In particular, we show the close relationship between these structures when Boolean CSP variables are or- dered in finite-domain clusters. We also note that differences between the variants of DFAs and MDDs used in the CSP literature are minor, and appear only due to the removal of redundant nodes in MDDs. Our theoretical observations are supplemented by experimental comparison of these structures over a set of real-world and artificially constructed instances. The reminder of the paper is organized as follows. In Section 2 we provide background work. In Section 3 we describe the relationship between MDDs and DFAs while in Section 4 we discuss compilation of CSPs into BDDs. The relationship be- tween BDDs with clustered ordering and MDDs is described in Section 5. In Section 6 we experimentally compare the size of the various structures discussed in the paper and finally conclude in Section 7. 2 Background A constraint satisfaction problem C = (X, D, C) is de- fined over variables X = {x 1 ,...,x n } with finite domains D1,...,Dn. Each constraint c C is defined over a subset of variables scope(c) X, and defines the set of assignments to the variables in the scope(c) allowed by the constraint. The solution space of Sol(C) denotes the set of all solutions to the CSP C. For illustration purposes we will consider a T-Shirt configuration problem in Example 1. Example 1 (An Example CSP) Consider specifying a T- shirt by choosing the color (black, white, red, or blue), the size (small, medium, or large) and the print (”Men In Black” - MIB or ”Save The Whales” - STW). There are two con- straints that we have to observe: if we choose the MIB print then the color black has to be chosen as well, and if we choose the small size then the STW print cannot be selected. The CSP model of the T-shirt example consists of variables X = {x 1 ,x 2 ,x 3 } representing color, size and print. Variable domains are D 1 = {0, 1, 2, 3} (standing for black , white , red , blue), D2 = {0, 1, 2} (small , medium, large), and D 3 = {0, 1} (MIB , STW). The two constraints translate to C = {c1,c2}, where c1 is (x3 = 0 ) (x1 = 0 ) and c2 is (x 3 = 1 ) (x 2 = 0 ). In reminder of this section we briefly review the variants of automata and decision diagrams that are currently used in the constraint satisfaction community. Deterministic Finite Automaton (DFA).A finite-state automaton A is defined by the input alphabet Σ, set of states S, initial state s 0 and state-transition function σ : S × Σ S. Some of the states in S are accepting states. A sequence of symbols is accepted by A if it corresponds to a sequence of transitions from the initial state to an accepting state. Se- quences of symbols accepted by A define a language accepted by the automaton. We denote such a language as L(A). De- terministic finite automata additionally require that for each state there is at most one transition for each input symbol.