A New Look at BDDs for Pseudo-Boolean Constraints

Pseudo-Boolean constraints are omnipresent in practical applications, and thus a significant effort has been devoted to the development of good SAT encoding techniques for them. Some of these encodings first construct a Binary Decision Diagram (BDD) for the constraint, and then encode the BDD into a propositional formula. These BDD-based approaches have some important advantages, such as not being dependent on the size of the coefficients, or being able to share the same BDD for representing many constraints. We first focus on the size of the resulting BDDs, which was considered to be an open problem in our research community. We report on previous work where it was proved that there are Pseudo-Boolean constraints for which no polynomial BDD exists. We also give an alternative and simpler proof assuming that NP is different from Co-NP. More interestingly, here we also show how to overcome the possible exponential blowup of BDDs by phcoefficient decomposition. This allows us to give the first polynomial generalized arc-consistent ROBDD-based encoding for Pseudo-Boolean constraints. Finally, we focus on practical issues: we show how to efficiently construct such ROBDDs, how to encode them into SAT with only 2 clauses per node, and present experimental results that confirm that our approach is competitive with other encodings and state-of-the-art Pseudo-Boolean solvers.


Introduction
In this paperwe study Pseudo-Boolean constraints (PB constraints for short), that is, constraints of the form a 1 x 1 + • • • + a n x n # K, where the a i and K are integer coefficients, the x i are Boolean (0/1) variables, and the relation operator # belongs to {<, >, ≤, ≥, =}.We will assume that # is ≤ and the a i and K are positive since other cases can be easily reduced to this one (see Eén & Sörensson, 2006).Such a constraint (≤ with positive coefficients) is a Boolean function C : {0, 1} n → {0, 1} that is monotonic decreasing in the sense that any solution for C remains a solution after flipping inputs from 1 to 0. Therefore these constraints can be expressed by a set of clauses with only negative literals.For example, each clause could simply define a (minimal) subset of variables that cannot be simultaneously true.Note however that not every such a monotonic function is a PB constraint.For example, the function expressed by the two clauses x 1 ∨ x 2 and x 3 ∨ x 4 has no (single) equivalent PB constraint a 1 x 1 + • • • + a 4 x 4 ≤ K (since without loss of generality a 1 ≥ a 2 and a 3 ≥ a 4 , and then also x 1 ∨ x 3 is needed).Hence, even among the monotonic Boolean functions, PB constraints are a rather restricted class (see also Smaus, 2007).
c 2012 AI Access Foundation.All rights reserved.
PB constraints are omnipresent in practical SAT applications, not just in typical 0-1 linear integer problems, but also as an ingredient in new SAT approaches to, e.g., cumulative scheduling (Schutt, Feydy, Stuckey, & Wallace, 2009), logic synthesis (Aloul, Ramani, Markov, & Sakallah, 2002) or verification (Bryant, Lahiri, & Seshia, 2002), so it is not surprising that a significant number of SAT encodings for these constraints have been proposed in the literature.Here we are interested in encoding a PB constraint C by a clause set S (possibly with auxiliary variables) that is not only equisatisfiable, but also generalized arc-consistent (GAC): given a partial assignment A, if x i is false in every extension of A satisfying C, then unit propagating A on S sets x i to false.
To our knowledge, the only polynomial GAC encoding so far was given by Bailleux, Boufkhad, and Roussel (2009).Some other existing encodings are based on building (forms of) Binary Decision Diagrams (BDDs) and translating these into CNF.Although the approach of Bailleux et al. is not BDD-based, our main motivation to revisit BDD-based encodings is the following: Example 1.Let us consider two Pseudo-Boolean constraints: 3x 1 + 2x 2 + 4x 3 ≤ 5 and 30001x 1 + 19999x 2 + 39998x 3 ≤ 50007.Both are clearly equivalent: the Boolean function they represent can be expressed, e.g., by the clauses x 1 ∨ x 3 and x 2 ∨ x 3 .However, encodings like the one of Bailleux et al. (2009) heavily depend on the concrete coefficients of each constraint, and generate a significantly larger SAT encoding for the second one.Since, given a variable ordering, ROBDDs are a canonical representation for Boolean functions (Bryant, 1986), i.e., each Boolean function has a unique ROBDD, a ROBDD-based encoding will treat both constraints equivalently.
Another reason for revisiting BDDs is that in practical problems numerous PB constraints exist that share variables among each other.Representing them all as a single ROBDD has the potential of generating a much more compact SAT encoding that is moreover likely to have better propagation properties.
As we have mentioned, BDD-based approaches have already been studied in the literature.A good example is the work of Eén and Sörensson (2006), where a GAC encoding using six three-literals clauses per BDD node is given.However, when it comes to study the BDD size, on page 9 they cite the work of Bailleux, Boufkhad, and Roussel (2006) to say "It is proven that in general a PB-constraint can generate an exponentially sized BDD".In Section 7 we explain why the approach of Bailleux et al does not use ROBDDs, and prove that the example they use to show the exponentiality of their method turns out to have polynomial ROBDDs.Somewhat surprisingly, probably due to the different names that PB constraints receive (0-1 integer linear constraints, linear threshold functions, weight constraints, knapsack constraints), the work of Hosaka, Takenaga, and Yajima (1994) has remained unknown to our research community.In that paper, it is proved that there are PB constraints for which no polynomial-sized ROBDDs exist.For self-containedness of this article, and to bring this interesting result to the knowledge of our research community, we include this family of PB constraints and prove that, regardless of the variable ordering, the corresponding ROBDD will always have exponential size.

Main contributions and organization of this paper:
• Subsection 3.2: We reproduce the family of PB constraints proposed by Hosaka et al. (1994), for which no polynomial-size ROBDD exist.For self-containedness, we give a clearer alternative proof than in the original paper.
• Subsection 3.3: A very simple proof that, unless NP=co-NP, there are PB constraints that admit no polynomial-size ROBDD, independently of the variable order.
• Subsection 4.1: A proof that PB constraints whose coefficients are powers of two do admit polynomial-size ROBDDs.
• Subsections 4.2 and 4.3: A GAC and polynomial (size O(n 3 log a max )) ROBDD-based encoding for PB constraints.
• Section 5: An algorithm to construct ROBDDs for Pseudo-Boolean constraints in polynomial time w.r.t. the size of the final ROBDD.
• Section 6: A GAC SAT encoding of BDDs for monotonic functions, a more general class of Boolean functions than PB constraints.This encoding uses only one binary and one ternary clause per node (the standard if-then-else encoding for BDDs used in, e.g., Eén & Sörensson, 2006, requires six ternary clauses per node).Moreover, this translation works for any BDD variable ordering.
• Section 7: A related work section, summarizing the most important ingredients of the existing encodings of Pseudo-Boolean constraints into SAT.
• Section 8: An experimental evaluation comparing our approach with other encodings and tools.
This article extends the shorter preliminary paper "BDDs for Pseudo-Boolean Constraints -Revisited" (Abío, Nieuwenhuis, Oliveras, & Rodríguez-Carbonell, 2011), which was presented at the SAT 2011 conference.Extensions include: (i) proofs of all technical results, (ii) multiple examples illustrating the various concepts and algorithms presented, (iii) the PB constraint family by Hosaka et al. (1994) for which no polynomial ROBDD exists, (iv) an algorithm to efficiently construct ROBDDs for Pseudo-Boolean constraints, (v) a detailed related work section, (vi) extensive experimental results comparing our encoding to other approaches and (vii) a brief report of our experience trying to take advantage of the sharing potential of BDDs.

Preliminaries
Let X = {x 1 , x 2 , . ..} be a fixed set of propositional variables.If x ∈ X then x and x are positive and negative literals, respectively.The negation of a literal l, written l, denotes x if l is x, and A (partial) assignment A is a set of literals such that {x, x} ⊆ A for no x, i.e., no contradictory literals appear.A literal l is true in A if l ∈ A, is false in A if l ∈ A, and is undefined in A otherwise.Sometimes we will write A as a set of pairs x = v, where all its clauses are true in A. In that case, A is a model of F .Systems that decide whether a formula F has any model are called SAT-solvers, and the main inference rule they implement is unit propagation: given a CNF F and an assignment A, find a clause in F such that all its literals are false in A except one, say l, which is undefined, add l to A and repeat the process until reaching a fixpoint.
Pseudo-Boolean constraints (PB constraints for short) are constraints of the form where the a i and K are integer coefficients, the x i are Boolean (0/1) variables, and the relation operator # belongs to {<, >, ≤, ≥, =}.We will assume that # is ≤ and the a i and K are positive, since other cases can be easily reduced to this one 1 : (i) changing into ≤ is straightforward if coefficients can be negative; (ii) replacing −ax by a(1 − x) − a; (iii) replacing (1 − x) by x.Negated variables like x can be handled as positive ones or, alternatively, replaced by a fresh x and adding the clauses x ∨ x and x ∨ x .A particular case of Pseudo-Boolean constraints is the one of cardinality constraints, in which all coefficients a i are equal to 1.
Our main goal is to find CNF encodings for PB constraints.That is, given a PBconstraint C, construct an equisatisfiable clause set (a CNF) S such that any model for S restricted to the variables of C is a model of C and viceversa.Two extra properties are sought: (i) consistency checking by unit propagation or simply consistency: whenever a partial assignment A cannot be extended to a model for C, unit propagation on S and A produces a contradiction (a literal l and its negation l); and (ii) generalized arc-consistency or GAC (again by unit propagation): given an assignment A that can be extended to a model of C, but such that A ∪ {x} cannot, unit propagation on S and A produces x.More concretely, we will use ROBDDs for finding such encodings.ROBDDs are introduced by means of the following example.
Example 2. Figure 1 explains (one method for) the construction of a ROBDD for the PB constraint 2x 1 + 3x 2 + 5x 3 ≤ 6 and the ordering [x 1 , x 2 , x 3 ].The root node has as selector variable x 1 .Its false child represents the PB constraint assuming x 1 = 0 (i.e., 3x 2 +5x 3 ≤ 6) and its true child represents 2+3x 2 +5x 3 ≤ 6, that is, 3x 2 +5x 3 ≤ 4. The two children have the next variable in the ordering (x 2 ) as selector, and the process is repeated until we reach the last variable in the sequence.Then, a constraint of the form 0 ≤ K is the True node (1 in the figure) if K ≥ 0 is positive, and the False node (0) if K < 0. This construction (leftmost in the figure), is known as an Ordered BDD.For obtaining a Reduced Ordered BDD (ROBDD for short in the rest of the paper), two reductions are applied until fixpoint: removing nodes with identical children (as done with the leftmost x 3 node in the second BDD of the figure), and merging isomorphic subtrees, as done for x 3 in the third BDD.The fourth final BDD is a fixpoint.For a given ordering, ROBDDs are a canonical representation of Boolean functions: each Boolean function has a unique ROBDD.BDDs can be encoded into CNF by introducing an auxiliary variable a for every node.If the selector variable of the node is x and the auxiliary variables for the false and true child are f and t, respectively, add the if-then-else clauses: In what follows, the size of a BDD is its number of nodes.We will say that a BDD represents a PB constraint if they represent the same Boolean function.Given an assignment A over the variables of a BDD, we define the path induced by A as the path that starts at the root of the BDD and at each step, moves to the false (true) child of a node if and only if its selector variable is false (true) in A.

Exponential ROBDDs for PB Constraints
In this section we study the size of ROBDDs for PB constraints.We start by defining the notion of the interval of a PB constraint.Then, in Section 3.2 we consider two families of PB constraints and study their ROBDD size: we first prove that the example given by Bailleux et al. (2006) has polynomial ROBDDs, and then we reproduce the example of Hosaka et al. (1994) that has exponential ROBDDs regardless of the variable ordering.Finally, we relate the ROBDD size of a PB constraint with the well-known subset sum problem.

Intervals
Before formally defining the notion of interval of a PB constraint, let us first give some intuitive explanation.
Similarly, we could try to increase the right-hand side of the constraint.However, there is a combination of the coefficients that adds to 7, which implies that the constraint is not equivalent to 2x 1 + 3x 2 + 5x 3 ≤ 7.All in all, we can state that the constraint is equivalent to 2x 1 + 3x 2 + 5x 3 ≤ K for any K ∈ [5,6].It is trivial to see that the set of valid K's is always an interval.
Similarly, given a ROBDD representing a PB constraint and a node ν with selector variable x i ,we will refer to the interval of ν as all the integers M such that the constraint a i x i + • • • a n x n ≤ M is represented (as a Boolean function) by the ROBDD rooted at ν.
In the following, unless stated otherwise, the ordering used in the ROBDD will be [x 1 , x 2 , . . ., x n ].
Proposition 5.If [β, γ] is the interval of a node ν with selector variable x i then: 1.There is an assignment 2. There is an assignment 3. There is an assignment 4. Take h < β.There exists an assignment {x j = v j } n j=i such that a i v i + • • • + a n v n > h and its path goes from ν to True.

Take h > γ.
There exists an assignment {x j = v j } n j=i such that a i v i + • • • + a n v n ≤ h and its path goes from ν to False.
7. The interval of the False node is (−∞, −1].Moreover, it is the only interval with negative values. Proof.
1. Since β − 1 does not belong to the interval of ν, the constraints are different.This means that there is a partial assignment satisfying the second one but not the first one.
2. The proof is analogous to the previous one.
3. Take a partial assignment {x 1 = v 1 , . . ., x i−1 = v i−1 } whose path goes from the root to ν.Therefore, by definition of the ROBDD, ν is the ROBDD of the constraint Therefore, by definition of the interval of ν, 4. Intuitively, this property states that, if h is not in the interval of ν, there is an assignment that satisfies the ROBDD rooted at ν but not the constraint Since h does not belong to the interval of ν, the ROBDD of is not ν.Therefore, there exists an assignment that either We want to prove that the assignment satisfies (ii).Assume that it satisfies (i).Since it goes from ν to False and β belongs to the interval of ν, it holds Since β > h, the assignment does not satisfy C , which is a contradiction.Therefore, the assignment satisfies (ii).
5. Take the assignment of the second point of this proposition.Since γ + 1 does not belong to the interval, the path of the assignment goes from ν to False.Moreover, 6.The True node is the ROBDD of the tautology.Therefore, it represents the PB constraint 0 ≤ h for h ∈ [0, ∞).
7. The False node is the ROBDD of the contradiction.Therefore, represents the PB constraint 0 x n < 0 is also a contradiction, hence that constraint is also represented by the False node.Therefore, there is no other node with an interval with negative values.
We now prove that, given a ROBDD for a PB constraint, one can easily compute the intervals for every node bottom-up.We first start with a motivating example.
Example 6.Let us consider again the constraint 2x 1 + 3x 2 + 5x 3 ≤ 6. Assume that all variables appear in every path from the root to the leaves (otherwise, add extra nodes as in the rightmost BDD of Figure 2).Assume now that we have computed the intervals for the two children of the root (rightmost BDD in Figure 2).This means that the false child of the root is the BDD for 3x 2 +5x 3 ≤ [5, 7] and the true child the BDD for 3x 2 +5x 3 ≤ [3,4].Assuming x 1 to be false, the false child would also represent the constraint 2x 1 +3x 2 +5x 3 ≤ [5, 7], and assuming x 1 to be true, the true child would represent the constraint 2x 1 +3x 2 +5x 3 ≤ [5,6].Taking the intersection of the two intervals, we can infer that the root node represents More formally, the interval of every node can be computed as follows: Proposition 7. Let a 1 x 1 + a 2 x 2 + • • • + a n x n ≤ K be a constraint, and let B be its ROBDD with the order [x 1 , . . ., x n ].Consider a node ν with selector variable x i , false child ν f (with selector variable x f and interval [β f , γ f ]) and true child ν t (with selector variable x t and interval [β t , γ t ]), as shown in Figure 3.The interval of ν is [β, γ], with: Before moving to the proof, we want to note that if in every path from the root to the leaves of the ROBDD all variables were present, the definition of β would be much simpler (β = max{β f , β t + a i }).The other coefficients are necessary to account for the variables that have been removed due to the ROBDD reduction process.
Proof.Let us assume that [β, γ] is not the interval of ν.One of the following statements should hold: 1.There exists h ∈ [β, γ] that does not belong to the interval of ν.
2. There exists h < β belonging to the interval of ν.
3. There exists h > γ belonging to the interval of ν.
We will now prove that none of these cases can hold.

Let us define
C : If h does not belong to the interval, there exists an assignment {x j = v j } n j=i that either satisfies C and its path goes from ν to False or it does not satisfy C and its path goes to True.Assume that the assignment satisfies C and its path goes from ν to False (the other case is similar).There are two possibilities: On the other hand, since h ≤ γ, belongs to the interval of ν f .Since the assignment {x f = v f , . . ., x n = v n } goes from ν f to False, we have: Hence, adding a i v i to the sum one can see that the assignment does not satisfy C , which is a contradiction.
• The case v i = 1 gives a similar contradiction.

By definition of β,
We will only consider the first case, since the other one is similar.Therefore, Due to point 4 of Proposition 5, there exists an assignment and its path goes from ν f to True.Hence, the assignment does not satisfy the constraint a i x i + • • • + a n x n ≤ h and its path goes from ν to True.By definition of interval, h cannot belong to the interval of ν.
3. This case is very similar to the previous one.
This proposition gives a natural way of computing all intervals of a ROBDD in a bottomup fashion.The procedure is initialized by computing the intervals of the terminal nodes as detailed in Proposition 5, points 6 and 7.
Example 8. Let us consider again the constraint 2x 1 + 3x 2 + 5x 3 ≤ 6.Its ROBDD is shown in the left-hand side of Figure 2, together with its intervals.For their computation, we first compute the intervals of the True and False nodes, which are [0, ∞) and (−∞, −1] in virtue of Proposition 5.Then, we can compute the interval of the node having x 3 as selector variable with the previous proposition's formula: In the next step, we compute the interval for the node with selector variable x 2 : β 2 = max{0 + 5, 0 + 3} = 5, γ 2 = min{∞, 4 + 3} = 7.Thus, it its interval is [5,7].Finally, we can compute the root's interval:

Some Families of PB Constraints and their ROBDD Size
We start by revisiting the family of PB constraints given by Bailleux et al. (2006), where it is proved that, for their concrete variable ordering, their non-reduced BDDs grow exponentially for this family.Here we prove that ROBDDs are polynomial for this family, and that this is even independent of the variable ordering.The family is defined by considering a, b and n positive integers such that n i=1 b i < a.The coefficients are ω i = a + b i and the right-hand side of the constraint is K = a • n/2.We will first prove that the constraint C : For simplicity, we assume that n is even.
• Take an assignment satisfying C .In this case, there are at most n/2 − 1 variables x i assigned to true, and the assignment also satisfies C since: • Consider now an assignment not satisfying C .In this case, there are at least n/2 true variables in the assignment and it does not satisfy C either: Since the two constraints are equivalent and ROBDDs are canonical, the ROBDD representation of C and C are the same.But the ROBDD of C is known to be of quadratic size because it is a cardinality constraint (see, for instance, Bailleux et al., 2006).
In the following, we present a family of PB constraints that only admit exponential ROBDDs.This example was first given by Hosaka et al. (1994), but a clearer alternative proof is given next.First of all, we prove a lemma that, under certain technical conditions, gives a lower bound on the number of nodes of the ROBDD for a PB constraint.
Lemma 9. Let a 1 x 1 + • • • + a n x n ≤ K be a PB constraint, and let i be an integer with Let M be the number of different results we can obtain adding some subset of the coefficients a 1 , a 2 , . . ., a i , i.e., Proof.Let us consider a PB constraint that satisfies the conditions of the lemma.We will prove that its ROBDD has at least M distinct nodes by showing that any two assignments of the form Assume that it is not true: there are two assignments that their paths end at the same node.Take the extended assignment Since A satisfies the PB constraint, the path it defines ends at the true node.However, the assignment However, the nodes defined by {x 1 = v 1 , . . ., x i = v i } and {x 1 = v 1 , . . ., x i = v i } were the same, so the path defined by A must also end at the true node, which is a contradiction.
We can now show a family of PB constraints that only admits exponential ROBDDs.
Theorem 10.Let n be a positive integer, and let us define a i,j = 2 j−1 + 2 2n+i−1 for all 1 ≤ i, j ≤ 2n; and K = (2 4n − 1)n.Then, the PB constraint 2n i=1 2n j=1 a i,j x i,j ≤ K has at least 2 n nodes in any variable ordering.
Proof.It is convenient to describe the coefficients in binary notation: First of all, one can see that the sum of all the a's is 2K.
Let us take an arbitrary bijection and consider the ordering defined by it: for every k.We want to prove that the ROBDD of the PB constraint with this ordering has at least 2 n nodes.The proof will consist in showing that the hypotheses of Lemma 9 hold.That is, first we show that for any variable ordering, we can find an integer s such that any assignment to the first s variables can be extended to a full assignment that adds K.Then, we prove that there are at least 2 n different values we can add with the first s coefficients, as required by Lemma 9.
Let us define b k with 1 ≤ k ≤ 2n as the position of the k-th different value of the tuple Analogously, let us define c 1 , . . ., c 2n as Let us denote by i r = F 1 (b r ) and j s = F 2 (c s ) for all 1 ≤ r, s ≤ 2n.Notice that {i 1 , i 2 , . . ., i 2n } and {j 1 , j 2 , . . ., j 2n } are permutations of {1, 2, . . ., 2n}.Assume that b n ≥ c n (the other case is analogous), and take an arbitrary assignment {x We want to extend it to a complete assignment such that Figure 4 represents the initial assignment.All the values are in the top-left square since the assignment is undefined for all x ir,js with r > n or s > n.Extending the assignment so that the sum is K amounts to completing the table in such a way that there are exactly n ones in every column and row.
The assignment can be completed in the following way: first, complete the top left square in any way, for instance, adding zeros to every non-defined cell.Then, copy that square to the bottom-right square and, finally, add the complementary square to the other two squares (i.e., write 0 instead of 1 and 1 instead of 0). Figure 5 shows the extended assignment for that example.
More formally, the assignment is completed as follows: where ¬0 = 1 and ¬1 = 0. Now, let us prove that it satisfies the requirements, i.e., the coefficients corresponding to true variables in the assignment add exactly K. Let us fix r, s ≤ n.Denote by i = i r , j = j s , i = i r+n and j = j s+n .
• If v i,j = 0, by definition v i ,j = v i,j = 1 and v i ,j = 0. Therefore, Figure 4: An arbitrary assignment.There is a 0, 1 or nothing at position (i r , j s ) depending on whether x ir,js is false, true or unassigned.
There are exactly n ones in every column and row.
• Analogously, if v i,j = 1, a i,j v i,j + a i ,j v i ,j + a i,j v i,j + a i ,j v i ,j = a i,j + a i ,j + a i,j + a i ,j 2 . Therefore, By Lemma 9, the number of nodes of the ROBDD is at least the number of different results we can obtain by adding some subset of the coefficients a F (1) , a F (2) , . . ., a F (cn) .Consider the set a F (c 1 ) , a F (c 2 ) , . . ., a F (cn) .We will now see that all its different subsets add different values, and hence the ROBDD size is at least 2 n .
The sum of a subset of {a Let us look at the 2n last bits of S in binary notation: all the digits are 0 except for the positions F 2 (c 1 ), F 2 (c 2 ), . . ., F 2 (c n ), which are v 1 , v 2 , . . ., v n .Therefore, if two subsets add the same, the 2n last digits of the sum are the same.This means that the values of (v 1 , . . ., v n ) are the same, and thus they are the same subset.

Relation between the Subset Sum Problem and the ROBDD Size
In this section, we study the relationship between the ROBDD size for a PB constraint and the subset sum problem.This allows us to, assuming that NP and co-NP are different, give a much simpler proof that there exist PB constraints that do not admit polynomial ROBDDs.
Lemma 9 and the exponential ROBDD example of Theorem 10 suggest that there is a relationship between the size of ROBDDs and the number of ways we can obtain K by adding some of the coefficients of the PB.It seems that if K can be obtained in a lot of different ways, the ROBDD will be large.
In this section we explore another relationship between the problem of adding K with a subset of the coefficients and the size of the ROBDDs.In a sense, we give a proof that the converse of the last paragraph is not true: if NP and co-NP are different, there are exponentially-sized ROBDDs of PB constraints with no subsets of their coefficients adding K. Let us start by defining one version of the well-known subset sum problem.
Definition 11.Given a set of positive integers S = {a 1 , . . ., a n } and an integer K, the subset sum problem of (K, S) consists in determining whether there exists a subset of {a 1 , . . ., a n } that sums to exactly K.
It is well-known that the subset sum problem is NP-complete when K ∼ 2 n , but there are polynomial algorithms in n when K is also a polynomial in n.For a given subset sum problem (K, S) with S = {a 1 , . . ., a n }, we can construct its associated PB constraint In the previous section we have seen one PB constraint family whose coefficients can add K in an exponential number of ways, thus generating an exponential ROBDD.Now, assuming that NP and co-NP are different, we will see that there exists a PB constraint family with exponential ROBDDs in any ordering such that their coefficients cannot add K. First, we show how ROBDDs can act as unsatisfiability certificates for the subset sum problem.
Theorem 12. Let (K, S) be an UNSAT subset sum problem.Then, if a ROBDD for its associated PB constraint has polynomial size, it can act as a polynomial unsatisfiability certificate for (K, S).
Proof.We only need to show how, in polynomial time, we can check whether the ROBDD is an unsatisfiability certificate for (K, S).For that, we note that the subset sum problem is UNSAT if and only if the PB constraints are equivalent, and this happens if and only if their ROBDDs are the same.Therefore, we have to show, in polynomial time, that the given ROBDD represents both constraints.It can be done, for instance, by building the ROBDD (using Algorithm 1 of Section 5) and comparing the ROBDDs.
The key point now is that, if we assume NP to be different from co-NP, there exists a family of UNSAT subset sum problems with no polynomial-sized unsatisfiability certificate.Hence, the family consisting of the associated PB constraints does not admit polynomial ROBDDs.
Hence, PB constraints associated with difficult-to-certify UNSAT subset sum problems will produce exponential ROBDDs.However, subset sum is NP-complete if K ∼ 2 n .In PB constraints from industrial problems usually K ∼ n r for some r, so we could expect non-exponential ROBDDs for these constraints.

Avoiding Exponential ROBDDs
In this section we introduce our positive results.We restrict ourselves to a particular class of PB constraints, where all coefficients are powers of two.As we will show below, these constraints admit polynomial ROBDDs.Moreover, any PB constraint can be reduced to this class by means of coefficient decomposition.

Power-of-two PB Constraints Do Have Polynomial-size ROBDDs
Let us consider a PB constraint of the form: where δ i,r ∈ {0, 1} for all i and r.Notice that every PB constraint whose coefficients are powers of 2 can be expressed in this way.Let us consider its ROBDD representation with the ordering [x 0,1 , x 0,2 , . . ., x 0,n , x 1,1 , . . ., x m,n ].
Lemma 14.Let [β, γ] be the interval of a node with selector variable x i,r .Then 2 i divides β and 0 ≤ β < (n + r − 1) • 2 i .Proof.By Proposition 5.1, β can be expressed as a sum of coefficients all of which are multiples of 2 i , and hence β itself is a multiple of 2 i .By Proposition 5.7, the only node whose interval contains negative values is the False node, and hence β ≥ 0. Now, using Proposition 5.3, there must be an assignment to the variables {x 0,1 , . . ., x i,r−1 } such that 2 0 δ 0,1 x 0,1 + • • • + 2 i δ i,r−1 x i,r−1 belongs to the interval.Therefore: Corollary 15.The number of nodes with selector variable x i,r is bounded by n + r − 1.In particular, the size of the ROBDD belongs to O(n 2 m).
Proof.Let ν 1 , ν 2 , . . ., ν t be all the nodes with selector variable x i,r .Let [β j , γ j ] the interval of ν j .Note that such intervals are pair-wise disjoint since a non-empty intersection would imply that there exists a constraint represented by two different ROBDDs.Hence we can assume, without loss of generality, that and we can conclude that t < n + r.

A Consistent Encoding for PB Constraints
Let us now take an arbitrary PB constraint C : a 1 x 1 + • • • a n x n ≤ K and assume that a M is the largest coefficient.For m = log a M , we can rewrite C splitting the coefficients into powers of two as shown in Example 13: where δ m,r δ m−1,r • • • δ 0,r is the binary representation of a r .Notice that C and C represent the same constraint if we add clauses expressing that x i,r = x r for appropriate i and r.This process is called coefficient decomposition of the PB constraint.A similar idea was given by Bartzis and Bultan (2003).
The important remark is that, using a consistent SAT encoding of the ROBDD for C (e.g. the one given in Eén & Sörensson, 2006, or the one presented in Section 6) and adding clauses expressing that x i,r = x r for appropriate i and r, we obtain a consistent encoding for the original constraint C using O(n 2 log a M ) auxiliary variables and clauses.This is not difficult to see.Take an assignment A over the variables of C which cannot be extended to a model of C.This is because the coefficients corresponding to the variables true in A add more than K. Using the clauses for x i,r = x r , unit propagation will produce an assignment to the x i,r 's that cannot be extended to a model of C. Since the encoding for C is consistent, a false clause will be found.Conversely, if we consider an assignment A over the variables of C that can be extended to a model of C, this assignment can clearly be extended to a model for C and the clauses expressing x i,r = x r .Hence, unit propagation on those clauses and the encoding of C will not detect a false clause.
Example 16.Consider the PB constraint C : 2x 1 + 3x 2 + 5x 3 ≤ 6.For obtaining the consistent encoding we have presented, we first rewrite C by splitting the coefficients into powers of two: Next, we encode C into a ROBDD and finally encode the ROBDD into SAT and add clauses for enforcing the relations x i,j = x j .Or, instead of that, we can replace x i,j by x j into the ROBDD, and encode the result into SAT.Figure 6 shows the decision diagram after the replacement.

A Generalized Arc-consistent Encoding for PB Constraints
Unfortunately, the previous approach does not result in a GAC encoding.The intuitive idea can be seen in the following example: x 2 x 3 x 1 x 1 x 2 x 3 0 1 Example 17.Let us consider the constraint 3x 1 + 4x 2 ≤ 6.After splitting the coefficients into powers of two, we obtain C : x 0,1 + 2x 1,1 + 4x 2,2 ≤ 6.If we set x 2,2 to true, C implies that either x 0,1 or x 1,1 have to be false, but the encoding cannot exploit the fact that both variables will receive the same truth value and hence both should be propagated.Adding clauses stating that x 0,1 = x 1,1 does not help in this sense.
In order to overcome this limitation, we follow the method presented by Bessiere, Katsirelos, Narodytska, and Walsh (2009) and Bailleux et al. (2009).Let C : a 1 x 1 +• • •+a n x n ≤ K be an arbitrary PB constraint.We denote as C i the constraint e., the constraint assuming x i to be true.For every i with 1 ≤ i ≤ n, we encode C i as in Section 4.2 and, in addition, we add the binary clause r i ∨ x i , where r i is the root of the ROBDD for C i .This clause helps us to preserve GAC: given an assignment A such that A ∪ {x i } cannot be extended to a model of C, literal r i will be propagated using A (because the encoding for C i is consistent).Hence the added clause will allow us to propagate x i .
Example 18.Consider again the PB constraint C : 2x 1 + 3x 2 + 5x 3 ≤ 6.Let us define the constraints C 1 : 3x 2 + 5x 3 ≤ 4, C 2 : 2x 1 + 5x 3 ≤ 3 and C 3 : 2x 1 + 3x 2 ≤ 1.Now, we encode these constraints into ROBDDs as in the previous section, with coefficient decomposition.Figure 7 shows the resulting ROBDDs.Finally, we need to encode them into SAT consistently, and then add the clauses r i ∨ x i , assuming that the variable associated with the root of the ROBDD for C i is r i .
This encoding is GAC: take for instance the assignment A = {x 1 = 1}.Constraint C 3 is not satisfied.Hence, by consistency, r 3 is propagated.Therefore, clause r 3 ∨ x 3 propagates x 3 , as wanted.The propagation with other assignments is similar.
All in all, the suggested encoding is GAC and uses O(n 3 log(a M )) clauses and auxiliary variables, where a M is the largest coefficient.

An Algorithm for Constructing ROBDDs for Pseudo-Boolean Constraints
Let us fix a Pseudo-Boolean constraint a . The goal of this section is to prove that one can construct the ROBDD of this constraint using this ordering in polynomial time with respect to the ROBDD size and n.This algorithm builds standard ROBDDs, but it can be used to build ROBDDs with coefficient decomposition: we just need to first split the coefficients and, secondly, apply the algorithm.Forthcoming Example 21 shows in detail the overall process.A very similar version of this algorithm was described by Mayer-Eichberger (2008).
The key point of the algorithm will be to label each node of the ROBDD with its interval.In the following, for every i ∈ {1, 2, . . ., n + 1}, we will use a set L i consisting of pairs ([β, γ], B), where B is the ROBDD of the constraint a [β, γ] is the interval of B).All these sets will be kept in a tuple L = (L 1 , L 2 , . . ., L n+1 ).
Note that by definition of the ROBDD's intervals, if Moreover, the first case holds if and only if B 1 = B 2 .Therefore, L i can be represented with a binary search tree-like data structure, where insertions and searches can be done in logarithmic time.The function search(K, L i ) searches whether there exists a pair ( 1: for all i such that 1 Algorithm 2 Procedure BDDConstruction Require: integer i ∈ {1, 2, . . ., n + 1}, constraint C : a i x i + . . .+ a n x n ≤ K and set L Ensure: returns [β, γ] interval of C and B its ROBDD Proof.Let us first start with the three correctness statements: 1.If K is found in L i at line 1 of Algorithm 2 the statement is obviously true.Otherwise let us reason by induction on i.The base case is when i = n + 1, and since L n+1 contains the intervals (−∞, −1] and [0, ∞], the search call at line 1 will succeed and hence the result holds.For i < n + 1 we can assume, by induction hypothesis, that If the two intervals coincide the result is obvious, otherwise it is also easy to see that 2. Let us prove that in every moment all the tuples of L are correct, i.e., they contain BDDs with their correct interval.Since the returned value is always an element of some L i , this proves the statement.
By Proposition 5.6 and 5.7, initial tuples of L are correct.We have to prove that if all the previously inserted intervals are correct, the current interval is also correct.It follows in virtue of Proposition 7.
3. Let us prove that all the tuples of L contain only reduced BDDs.As before, all the initial BDDs in L are reduced.Let B be a BDD computed by the algorithm, with children B T and B F .By induction hypothesis, they are reduced, so B is reduced if and only if its two children are not equal.The algorithm creates a node only if its children's intervals are different.Therefore, B T and B F do not represent the same Boolean constraint, so they are different BDDs.
Regarding runtime, since the cost of search and insertion in L i is logarithmic in its size, the cost of the algorithm is O(log m) times the number of calls to BDDConstruction.Hence, it only remains to show that there are at most O(nm) calls.Every call (but the first one) to BDDConstruction is done when we are exploring an edge of the ROBDD.Notice that no edge is explored twice, since the edges are only explored from the parent node and whenever we reach an explored node there are no recursive calls to BDDConstruction.On the other hand, for every edge of the ROBDD we make 2k − 1 calls, where k is the length of the edge (if the nodes joined by the edge have variables x i and x j we say that its length is |i − j|).Since the ROBDD has O(m) edges and their length is O(n), the number of calls is O(nm).

Let us illustrate the algorithm with an example:
Example 20.Take the constraint C : 2x 1 + 3x 2 + 5x 3 ≤ 6, and let us apply the algorithm to obtain the ROBDD in the ordering [x 1 , x 2 , x 3 ]. Figure 8 represents the recursive calls to BDDConstruction and the returned parameters (the ROBDD and the interval).• In calls number 3, 5, 6, 8 and 9, the search function returns true and the interval and the ROBDD are returned without any other computation.
• In call number 7, the two recursive calls return the same interval (and, therefore, the same ROBDD).Hence, that ROBDD is returned.
• In call number 1 the two recursive calls return two different ROBDDs, so it adds a node to join the two ROBDDs into another one, which is returned.The same happens in calls number 2 and 4.
2. Apply the algorithm to C and obtain a ROBDD B .
3. Replace y 1 for x 2 , y 2 for x 3 , etc. in the nodes of B .

SAT Encodings of BDDs for Monotonic Functions
In this section we consider a BDD representing a monotonic function F and we want to encode it into SAT.As expected, we want the encoding to be as small as possible and GAC.
The encoding explained here is valid with any type of BDDs, so, in particular, it is valid with ROBDDs.The main differences with the Minisat+ encoding (Eén & Sörensson, 2006) is the number of clauses generated (6 ternary clauses per node versus one binary and one ternary clauses per node) and that our encoding is GAC with any variable ordering.
As usual, the encoding introduces an auxiliary variable for every node.Let ν be a node with selector variable x and auxiliary variable n.Let f be the variable of its false child and t be the variable of its true child.Only two clauses per node are needed: Furthermore, we add a unit clause with the variable of the True node and another one with the negation of the variable of the False node.
Theorem 22.The encoding is consistent in the following sense: a partial assignment A cannot be extended to a model of F if and only if r is propagated by unit propagation, where r is the root of the BDD.
Proof.We prove the theorem by induction on the number of variables of the BDD.If the BDD has no variables, then the BDD is either the True node or the False node and the result is trivial.Assume that the result is true for BDDs with less than k variables, and let F be a function whose BDD has k variables.Let r be the root node, x 1 its selector variable and f, t respectively its false and true children (note that we abuse the notation and identify nodes with their auxiliary variable).We denote by F 1 the function F |x 1 =1 (i.e., F after setting x 1 to true) and by F 0 the function F |x 1 =0 .
• Let A be a partial assignment that cannot be extended to a model of F .
-Assume x 1 ∈ A. Since A cannot be extended, the assignment A \ {x 1 } cannot be extended to a model of F 1 .By definition of the BDD, the function F 1 has t as a BDD.By induction hypothesis, t is propagated, and since x 1 ∈ A, r is also propagated.
-Assume x 1 ∈ A. Then, the assignment A \ {x 1 } cannot be extended to a model of F 0 .Since F 0 has f as a BDD, by induction hypothesis f is propagated, and hence r also is.
• Let A be a partial assignment, and assume r has been propagated.Then, either f has also been propagated or t has been propagated and x 1 ∈ A (note that x 1 has not been propagated because it only appears in one clause which is already true).
-Assume that f has been propagated.Since f is the BDD of F 0 , by induction hypothesis the assignment A \ {x 1 , x 1 } cannot be extended to a model of F 0 .Since the function is monotonic, neither can A \ {x 1 , x 1 } be extended to a model of F .Therefore, A cannot be extended to a model of F .
-Assume that t has been propagated and x 1 ∈ A. Since t is the BDD of F 1 , by induction hypothesis A \ {x 1 } cannot be extended to a model of F 1 , so neither can A be extended to a model of F .
For obtaining a GAC encoding, we only have to add a unit clause.
Theorem 23.If we add a unit clause forcing the variable of the root node to be true, the previous encoding becomes generalized arc-consistent.
Proof.We will prove it by induction on the variables of the BDD.The case with zero variables is trivial, so let us prove the induction case.
As before, let r be the root node, with x 1 its selector variable and n its auxiliary variable, and f, t its false and true children.We denote by F 0 and F 1 the functions F |x 1 =0 and F |x 1 =1 .
Let A be a partial assignment that can be extended to a model of F .Assume that A ∪ {x i } cannot be extended.We want to prove that x i will be propagated.
• Let us assume that x 1 ∈ A. In this case, t is propagated due to the clause t ∧ x 1 → n and the unit clause n.Since x 1 ∈ A and A ∪ {x i } cannot be extended to a model of F , A \ {x 1 } ∪ {x i } neither can be extended to an assignment satisfying F 1 .By induction hypothesis, since t is the BDD of the function F 1 , x i is propagated.
• Let us assume that x 1 ∈ A and x i = x 1 .Since F is monotonic, A ∪ {x i } cannot be extended to a model of F if and only if it cannot be extended to a model of F 0 .Notice that f is propagated thanks to the clause f → n and the unit clause n.By induction hypothesis, the method is GAC for F 0 , so x i is propagated.
• Finally, assume that x 1 ∈ A and x i = x 1 .Since A ∪ {x 1 } cannot be extended to a model of F , A cannot be extended to a model of F 1 .By Theorem 22, t is propagated and, due to t ∧ x 1 → n and n, also is x 1 .
We finish this section with an example illustrating how the suggested encoding of BDDs into SAT can be used in the different PB encoding methods we have presented in this paper.
Example 24.Consider the constraint C : 2x 1 + 3x 2 + 5x 3 ≤ 6.We will encode this constraint into SAT with three methods: with the usual ROBDD encoding; with the consistent approach of ROBDDs and splitting of the coefficients, explained in Section 4.2; and with the GAC approach of ROBDDs and splitting of the coefficients explained in Section 4.3.
1. BDD-1: this method builds the ROBDD for C and then encodes it into SAT.Hence we start by building the ROBDD of C, which can be seen in the last picture of Figure 1.Now, we need to encode it into SAT.Let y 1 , y 2 and y 3 be fresh variables corresponding to the nodes of the ROBDD of C having respectively x 1 , x 2 and x 3 as selector variable.
For node y 1 , we have to add the clauses y 2 → y 1 and x 1 ∧ y 3 → y 1 .
For y 2 , we have to add the clauses → y 2 and x 2 ∧ y 3 → y 2 , where is the tautology symbol.
For y 3 , we have to add the clauses → y 3 and x 3 ∧ ⊥ → y 3 , where ⊥ is the contradiction symbol.
Moreover, we have to add the unit clauses , ⊥ and y 1 .All in all, after removing the units and tautologies, the clauses obtained are y 1 , y 2 , x 1 ∨ y 3 , x 2 ∨ y 3 and x 3 ∨ y 3 .
2. BDD-2: we build the ROBDD of C with coefficient decomposition as in Example 21.
Figure 6 shows the resulting ROBDD.We introduce variables y 1 , y 2 , . . ., y 6 for every node of the ROBDD.More precisely, the first x 2 node (starting top-down) receives variable y 1 , the next x 2 node gets y 5 .The first x 3 receives y 2 and the other one y 6 .Finally the leftmost x 1 node gets variable y 3 and the other one y 4 .We have to add the following clauses: , and the unit clauses , ⊥ and y 1 .
Notice that this encoding is consistent: if we have the assignment A = {x 2 , x 3 }, then y 4 is propagated by the clause y 4 ∨ x 2 , which in turn propagates y 5 due to clause y 5 ∨ y 4 and finally y 6 is propagated by the clause y 6 ∨ x 2 ∨ y 5 .A contradiction is found with clause x 3 ∨ y 6 .
However, the encoding is not GAC: the partial assignment A = {x 1 } can only propagate y 5 .However, x 3 should also be propagated.
3. BDD-3: let C 1 , C 2 and C 3 be the constraints setting respectively x 1 , x 2 and x 3 to true.
Figure 7 shows the ROBDDs of these constraints.We have to encode these ROBDDs as usual, as in BDD-2, but replacing the unit clause r of the root by r → x i .In this case the variables associated with the roots of C 1 , C 2 and C 3 will be y 1 , z 1 and w 1 respectively.
Clauses from C 2 are z 1 ∨ x 2 and x 3 ∨ z 1 .
Finally, clauses from This encoding is GAC.Take, for instance, the assignment A = {x 1 }.In this case, w 1 is propagated in virtue of x 1 ∨ w 1 and x 3 is propagated by clause w 1 ∨ x 3 .

Related Work
Due to the ubiquity of Pseudo-Boolean constraints and the success of SAT solvers, the problem of encoding those constraints into SAT has been thoroughly studied in the literature.
In the following we review the most important contributions, paying special attention to the basic idea on which they are based, the encoding size, and the propagation properties the encodings fulfill.To ease the presentation, in the remaining of this section we will always assume that the constraint we want to encode is a 1 x 1 + . . .+ a n x n ≤ k, with maximum coefficient a max .The first encoding to mention is the one proposed by Warners (1998).In a nutshell, the encoding uses several adders for numbers in binary representation.First of all, the left hand side of the constraint is split into two halves, each of which is recursively treated to compute the corresponding partial sum.After that, the two partial sums are added and the final result is compared with k .The encoding uses O(n log(a max )) clauses and variables and is neither consistent nor GAC.This is not surprising, since adders for numbers in binary make extensive use of xors, which do not have good propagation properties.Bailleux et al. (2006) introduced an encoding "very close to those using a BDD and translating it into clauses".In order to understand the differences between their construction and BDDs let us introduce it in detail.First of all, the coefficients are ordered from small to large.Then, the root is labeled with variable D n,k , expressing that the sum of the first n terms is no more than k.Its two children are D n−1,k and D n−1,k−an , which correspond to setting x n to false and true, respectively.The process is repeated until nodes corresponding to trivial constraints are reached, which are encoded as true or false.For each node D i,b with children D i−1,b and D i−1,b−a i , the following four clauses are added: Example 25.The encoding proposed by Bailleux et al. (2006) on The method fails to identify that these two PB constraints are equivalent and hence subtrees B and C will not be merged, yielding a much larger representation than with ROBDDs.The resulting encoding is GAC, but an example of a PB constraint family is given for which their kind of non-reduced BDDs, with their concrete variable ordering is exponentially large.However, as we have shown in Section 3.2, ROBDDs for this family are polynomial.
Several important new contributions were presented in the paper by the MiniSAT team (Eén & Sörensson, 2006).The paper describes three encodings, all of which are implemented in the MiniSAT+ tool.The first one is a standard ROBDD construction for Pseudo-Boolean constraints.This is done in two steps: first, they suggest a simple dynamic programming algorithm for constructing a non-reduced BDD, which is later reduced.The result is a ROBDD, but the first step may take exponential time even if the final ROBDD is polynomial.Once the ROBDD is constructed, they suggest to encode it into SAT using 6 ternary clauses per node.The paper showed that, given a concrete variable ordering, the encoding is GAC.Regarding the ROBDD size, the authors cite the work of Bailleux et al. (2006) to state the BDDs are exponential in the worst case.As we have seen before, the citation is not correct because Bailleux et al do not construct ROBDDs.
The second method is similar to the one of Warners (1998) in the sense that the construction relies on a network of adders.First of all coefficients are decomposed into binary representation.For each bit i, a bucket is created with all variables whose coefficient has bit i set to one.The i-th bit of the left-hand side of the constraint is computed using a series of full adders and half adders.Finally, the resulting sum is lexicographically compared to k.The resulting encoding is neither consistent nor GAC and uses a number of adders linear in the sum of the number of digits of the coefficients.
The last method they suggest is the use of sorting networks.Numbers are expressed in unary representation and coefficients are decomposed using a mixed radix representation.The smaller the number in this representation, the smaller the encoding.In this setting, sorting networks are used to play the same role of adders, but with better propagation properties.If N is smaller than the sum of the digits of all coefficients in base 2, the size of the encoding is O(N log 2 N ).Whereas this encoding is not GAC for arbitrary Pseudo-Boolean constraints, generalized arc-consistency is obtained for cardinality constraints.(Eén & Sörensson, 2006) O(( log a i ) log 2 ( log a i ) YES NO Watch Dog (WD) (Bailleux et al., 2009) O(n 2 log n log a max ) YES NO Gen. Arc-cons.WD (Bailleux et al., 2009) O(n 3 log n log a max ) YES YES Table 1: Summary comparing the different encodings.
The first polynomial and GAC encoding for Pseudo-Boolean constraints, called Watch-Dog, was introduced by Bailleux et al. (2009).It uses O(n 2 log n log a max ) variables and O(n 3 log n log a max ) clauses.Again, numbers are expressed in unary representation and totalizers are used to play the role of sorting networks.In order to make the comparison with the right hand side trivial, the left-hand side and k are incremented until k becomes a power of two.Then, all coefficients are decomposed in binary representation and each bit is added independently, taking into account the corresponding carry.In the same paper, another encoding which is only consistent and uses O(n log n log a max ) variables and O(n 2 log n log a max ) clauses is also presented.
Finally, it is worth mentioning the work of Bartzis and Bultan (2003).The authors deal with the more general case in which the variables x i are not Boolean, but bounded integers 0 ≤ x i < 2 b .They suggest a BDD-based approach very similar in flavor to our method of Section 4, but instead of decomposing the coefficients as we do, they decompose the variables x i in binary representation.The BDD ordering starts with the first bit of x 1 , then the first bit of the x 2 , etc...After that, the second bit is treated in a similar fashion, and so on.The resulting BDD has O(n • b • a i ) nodes and nothing is mentioned about propagation properties.For the case of Pseudo-Boolean constraints, i.e. b = 1, their approach amounts to standard BDDs.
Table 1 summarizes the different encodings of PB constraints into SAT.

Experimental Results
The goal of this section is to assess the practical interest of the encodings we have presented in the paper.Our aim is to evaluate to which extent BDD-based encodings are interesting from the practical point of view.For us, this means to study whether they are competitive with existing techniques, whether they show good behavior in general or are only interesting for very specific types of problems, or whether they produce smaller encodings.
For that purpose, first of all, we compare our encodings with other SAT encodings in terms of encoding time, number of clauses and number of variables.After that, we also consider total runtime (that is, encoding time plus solving time) of these encodings and we compare it with the runtime of state-of-the-art Pseudo-Boolean solvers.Finally, we briefly report on some experiments with sharing, that is, trying to encode several Pseudo-Boolean constraints in a single ROBDD.
(iii) P i ∩ P j = ∅ for every i = j.Given P a partition of N , we define and p(P ) as the minimum p i,j such that i and j belong to the same subset P k ∈ P .The Bergmann-Hommel test ensures (with a significance level of α) that the methods i and j are not significantly different if and only if there is a partition P with p(P ) > αL(P ) such that i and j belong to the same subset P k ∈ P .Hence, it is a time-consuming test since the number of partitions can be very large.
In our case, the data sets are the families of benchmarks.We have to use the families instead of the benchmarks because the data sets must be independent.

Encodings into SAT
We start by comparing different methods for encoding Pseudo-Boolean constraints into SAT.We have focused on the time spent by the encoding, the number of auxiliary variables used and the number of clauses.Moreover, for each benchmark family, we also report the number of PB-constraints that were encoded into SAT.
The encodings we have included in the experimental evaluation are: the adder encoding as presented by Eén and Sörensson (2006) (Adder), the consistent WatchDog encoding of Bailleux et al. (2009) (WD-1), its GAC version (WD-2), the encoding into ROBDDs without coefficient decomposition, using Algorithm 1 and the encoding from Section 6 (BDD-1); the encoding into ROBDDs after coefficient decomposition as explained in Section 4.2 (BDD-2), with Algorithm 1 and the encoding from Section 6; and the GAC approach from Section 4.3 (BDD-3 ), also with Algorithm 1 and the encoding from Section 6.Notice that BDD-1 method is very similar to the ROBDDs presented by Eén and Sörensson (2006).However, since Algorithm 1 produces every node only once, BDD-1 should be faster.Also, the encoding of Section 6 only creates two clauses per BDD node, as opposed to six clauses as suggested by Eén and Sörensson.
Table 2 shows the number of problems that the different methods could encode without timing out.The first column corresponds to the family of problems.The second column shows the number of problems in this family.The third and fourth columns contain the average number of SAT and Pseudo-Boolean constraints in the problem.For the experiments, we considered a constraint to be SAT if it is a clause or has at most 3 variables.Small PB constraints do not benefit from the above encodings and hence for these constraints a naive encoding into SAT was always used.The remaining columns correspond to the number of encoded problems without timing out.Time limit was set to 1800 seconds per benchmark.
Table 3 shows the time spent to encode the benchmarks by the different methods.As before, the first columns correspond to the family of problems, the number of problems in this family and the average number of SAT and Pseudo-Boolean constraints in the problems.The remaining columns correspond to the average encoding time (in seconds) per benchmarks of each method.Timeouts are counted as 1800 seconds in the average computation.
Table 4 shows the average number of auxiliary variables required for encoding the PB constraints (SAT constraints are not counted).The meaning of the first 4 columns is   3, time spent by the different methods in encoding.
the same as before, and the others contain the average number of auxiliary variables (in thousands) of the benchmarks that did not time out.
Finally, Table 5 contains the average number (in thousands) of clauses needed to encode the problem.As before, we have only considered the benchmarks that have not timed out, and clauses due to the encoding of SAT constraints are not counted.
Figures 10, 11 and 12 represent the Bergmann-Hommel tests of these tables.They show that BDD-1, BDD-2 and Adders are the best methods in terms of time, variables and clauses.It is worth mentioning that BDD-1 and BDD-2 are faster and use significantly less clauses than Adder.However, Adders uses significantly less auxiliary variables than BDD-2.Notice that BDD-1 is GAC, BDD-2 is only consistent and Adder is not consistent, so at least theoretically BDD-1 clauses have more unit propagation power than BDD-2 clauses, and BDD-2 clauses are better than Adder clauses.Hence, BDD-1 is the best method using these criteria and BDD-2 is better than Adder.Regarding the other methods, it seems clear      4, number of auxiliary variables used by the different encodings.that encoding n different constraints in order to obtain GAC, as it is done in WD-2 and BDD-3, is not a good idea in terms of variables and clauses.

SAT vs. PB
In this section we compare the state-of-the-art solvers for Pseudo-Boolean problems and some encodings into SAT.For the SAT approach, once the encoding has been done, the SAT formula is given to the SAT Solver Lingeling (Biere, 2010) version 276.We have considered the same SAT encodings as in the previous section.Regarding Pseudo-Boolean solvers, we have considered MiniSAT+ (Eén & Sörensson, 2006) and the best non-parallel solvers in the No optimization, small integers, linear constraints category of the Pseudo-Boolean Competition: borg (Silverthorn & Miikkulainen, 2010) version pb-dec-11.04.03, bsolo (Manquinho & Silva, 2006) version 3.2, wbo (Manquinho, Martins, & Lynce, 2010) version 1.4 and SAT4J (Berre & Parrain, 2010) version 2.2.1.We have also included the SMT Solver Barcelogic (Bofill, Nieuwenhuis, Oliveras, Rodríguez-Carbonell, & Rubio, 2008) for PB constraints, which couples a SAT solver with a theory solver for PB constraints.
Table 6 shows the number of instances solved by each method.Table 7 shows the average time spent by all these methods.For the SAT encodings, times include both the encoding and SAT solving time.As before, a time limit of 1800 seconds per benchmark was set, and for the average computation, a timeout is counted as 1800 seconds.Both tables include a column VBS (Virtual Best Solver), which represents the best solver in every instance.This gives an idea of which speedup we could obtain with a portfolio approach.
Figure 13 shows the result of the Bergmann-Hommel test: SMT is the best method, whereas Adder, BDD-3 and WD-2 are the worst ones.There are no significant difference between the other methods.The main conclusion we can infer is that BDD encodings are definitely a competitive method.Also, there is no technique that outperforms the others in all benchmark families, and hence portfolio strategies would make a lot of sense in this area, as witnessed by the performance of Borg, which implements such an approach.Finally, we also want to mention that the possible exponential explosion of BDDs rarely occurs in practice and hence, coefficient decomposition does not seem to pay off in practical situations.
Regarding the Best Virtual Solver, SMT contributes to 52% of the problems.In 25% of the cases the best solution was given by a specific PB solver.Among them, Wbo contributes with 10% of the problems and bsolo with 8%.Finally, encoding methods give the best solution in the 23% of the cases: 14% of the times due to Watchdog methods and 8% of the times due to BDD-based methods.

Sharing
One of the possible advantages of using ROBDDs to encode Pseudo-Boolean constraints is that ROBDDs allow one to encode a set of constraints, and not just one.It would seem natural to think that if two constraints are similar enough, the two individual ROBDDs would be similar in structure, and merging them into a single one would result in a ROBDD whose size is smaller than the sum of the two individual ROBDDs.However, the main difficulty is to decide which constraints should be encoded together, since a bad choice could result in a ROBDD whose size is larger than the sum of the ROBDDs for the individual constraints.
We performed initial experiments where the criteria of similarity between constraints only took into account which variables appeared in the constraints.We first fixed an integer k and chose the constraint with the largest set of variables.After that, we looked for a constraint such that all but k variables appeared in the first constraint.The next step was to look for another constraint such that all but k variables appeared in any of the two previous constraints and so on, until reaching a fixpoint.Finally, all selected constraints were encoded together.
We tried this experiment on all benchmarks with different values of k and it rarely gave any advantage.However, we still believe that there could be a way of encoding different constraints into a single ROBDD, but different criteria for selecting the constraints should be studied.We see this as a possible line of future research.

Conclusions and Future Work
Both theoretical and practical contributions have been made.Regarding the theoretical part, we have negatively answered the question of whether all PB constraints admit polynomial BDDs by citing the of Hosaka et al. (1994) which, to the best of our knowledge, is largely unknown in our research community.Moreover, we have given a simpler proof assuming that NP is different from co-NP, which relates the subset sum problem and the ROBDDs' size of PB constraints.
At the practical level, we have introduced a ROBDD-based polynomial and generalized arc-consistent encoding of PB constraints and developed a BDD-based generalized arcconsistent encoding of monotonic functions that only uses two clauses per BDD node.We have also presented an algorithm to efficiently construct all these ROBDDs and proved that the overall method is competitive in practice with state-of-the-art encodings and tools.As future work at the practical level, we plan to study which type of Pseudo-Boolean constraints are likely to produce smaller ROBDDs if encoded together rather than being encoded individually.

Figure 3 :
Figure3: The interval of a node can be computed from its children's intervals.
Such a tuple is returned if it exists, otherwise an empty interval is returned in the first component of the pair.Similarly, we will also use function insert(([β, γ], B), L i ) for insertions.The overall algorithm is detailed in Algorithm 1 and Algorithm 2: Theorem 19.Algorithm 1 runs in O(nm log m) time (where m is the size of the ROBDD) and is correct in the following sense: Algorithm 1 Construction of ROBDD algorithm Require: Constraint C : a 1 x 1 + . . .+ a n x n ≤ K Ensure: returns B the ROBDD of C.

Figure 8 :
Figure 8: Recursive calls to BDDConstruction, with the returned values.

Figure 10 :
Figure 10: Statistical comparison of the results ofTable 3, time spent by the different methods in encoding.

Figure 11 :
Figure 11: Statistical comparison of the results of Table4, number of auxiliary variables used by the different encodings.

Figure 12 :
Figure 12: Statistical comparison of the results of Table 5, number of clauses used by the different methods.

Table 2 :
Number of problems encoded (without timing out) by the different methods.

Table 3 :
Average time spent on the encoding by the different methods.

Table 4 :
Average number of auxiliary variables (in thousands) used.

Table 5 :
Average number of clauses (in thousands) used.
Table 5, number of clauses used by the different methods.

Table 6 :
Number of problems solved by different methods.