Exploring Directional Path-Consistency for Solving Constraint Networks

Exploring Directional Path-Consistency for Solving Constraint Networks Abstract Among the local consistency techniques used for solving constraint networks, path-consistency (PC) has received a great deal of attention. However, enforcing PC is computationally expensive and sometimes unnecessary. Directional PC (DPC) is a weaker notion of PC that considers a given variable ordering and can thus be enforced more efficiently than PC. This paper shows that (the DPC enforcing algorithm of Dechter and Pearl) decides the constraint satisfaction problem (CSP) of a constraint language if it is complete and has the variable elimination property (VEP). However, we also show that no complete VEP constraint language can have a domain with more than two values. We then present a simple variant of the algorithm, called, and show that the CSP of a constraint language can be decided by if it is closed under a majority operation. In fact, is sufficient for guaranteeing backtrack-free search for such constraint networks. Examples of majority-closed constraint classes include the classes of connected row-convex constraints and tree-preserving constraints, which have found applications in various domains, such as scene labeling, temporal reasoning, geometric reasoning and logical filtering. Our experimental evaluations show that significantly outperforms the state-of-the-art algorithms for solving majority-closed constraints. 1. INTRODUCTION Many artificial intelligence tasks can be formulated as constraint networks [1], such as natural language parsing [2], temporal reasoning [3, 4] and spatial reasoning [5]. A constraint network comprises a set of variables ranging over some domain of possible values, and a set of constraints that specify allowed value combinations for these variables. Solving a constraint network amounts to assigning values to its variables such that its constraints are satisfied. Backtracking search is the principal mechanism for solving a constraint network; it assigns values to variables in a depth-first manner, and backtracks to the previous variable assignment if there are no consistent values for the variable at hand. Local consistency techniques are commonly used to reduce the size of the search space before commencing search. However, searching for a complete solution for a constraint network is still hard. In fact, even deciding whether the constraint network has a solution is NP-complete in general. Therefore, given a particular form of local consistency, a crucial task is to determine problems that can be solved by backtrack-free search using that local consistency [6]. This paper considers a particular form of local consistency, called path-consistency (PC), which is one of the most important and heavily studied local consistencies in the literature (see e.g. [7–11]). Recently, it was shown that PC can be used to decide the satisfiability of a problem if and only if the problem does not have the ability to count [12, 13]; however, it remains unclear whether backtrack-free search can be used to extract a solution for such a problem after enforcing PC. Directional PC (DPC) [14] is a weaker notion of PC that considers a given variable ordering and can thus be enforced more efficiently than PC. The DPC enforcing algorithm of Dechter and Pearl [14], denoted by DPC, has been used to efficiently solve reasoning problems in temporal reasoning [3, 4] and spatial reasoning [15]. It is then natural to ask what binary constraint networks with finite domains can be solved by DPC. Dechter and Pearl [14] showed that DPC is sufficient for enabling backtrack-free search for a network with a constraint graph of regular width 2, i.e. there exists a width 2 ordering of the constraint graph which remains width 2 after applying DPC. We consider the aforementioned question in the context of constraint languages, which is a widely adopted approach in the study of tractability of constraint satisfaction problems [16]. Specifically, we are interested in finding all binary constraint languages Γ such that the consistency of any constraint network defined over Γ can be decided by DPC. To this end, we first exploit the close connection between DPC and variable elimination by defining constraint languages that have the (weak) variable elimination property (VEP) (which will become clear in Definition 4.2). We call a constraint language Γcomplete if it contains all relations that are definable in Γ (in the sense of Definition 2.3). Then, we show that the constraint satisfaction problem (CSP) of a constraint language Γ can be decided by DPC if it is complete and has VEP, which is shown to be equivalent to the Helly property. However, we also show that no complete VEP constraint language can have a domain with more than two values. We then present a simple variant of the algorithm DPC, called DPC*, and show that the consistency of a constraint network can be decided by DPC* if it is defined over any majority-closed constraint language. In fact, we show that DPC* is sufficient for guaranteeing backtrack-free search for such constraint networks. Several important constraint classes have been found to be majority-closed. The most well-known one is the class of connected row-convex (CRC) constraints [17], which is further generalized to a larger class of tree-preserving constraints [18]. The class of CRC constraints has been successfully applied to temporal reasoning [19], logical filtering [20] and geometric reasoning [21], and the class of tree-preserving constraints can model a large subclass of the scene labeling problem [18]. We also conduct experimental evaluations to compare DPC* to the state-of-the-art algorithms for solving majority-closed constraints, and show that DPC* significantly outperforms the latter algorithms. The remainder of this paper is organized as follows. In Section 2, we introduce basic notions and results that will be used throughout the paper. In Section 3, we present the DPC algorithm, and in Section 4 we discuss the connection between DPC and variable elimination. In Section 5, we prove that a complete constraint language Γ has weak VEP if and only if Γ is majority-closed. We then present in Section 6, our variable elimination algorithm DPC*, and empirically evaluate DPC* in Section 7. Finally, Section 8 concludes the paper. 2. PRELIMINARIES This section recalls necessary notions and results. Definition 2.1 A binary constraint network (BCN) Nis a triple ⟨V,𝒟,C⟩, where V={v1,…,vn}is a nonempty finite set of variables; 𝒟={D1,…,Dn}, where Diis the domain of vi; C={(sp,Rp)∣1≤p≤m}is a set of binary constraints, where sp=(vi,vj)(i≠j) (called the scope of (sp,Rp)) is a pair of variables in Vand Rp (called the constraint relation of (sp,Rp)) is a subset of Di×Dj. Given a BCN N=⟨V,𝒟,C⟩ and any pair of variables (vi,vj) with vi,vj∈V and vi≠vj, we assume that there exists at most one constraint between the pair. For simplicity, we will often denote the constraint between vi and vj by Rij. Further, we assume Rij=Rji−1, which is the inverse of Rji. We write Rij∈C throughout the paper to state that a constraint with scope (vi,vj) is in C. Usual operations on relations such as intersection ( ∩), composition ( ◦), and inverse ( −1) are also assumed. A partial solution of N w.r.t. a subset V′ of V is an assignment of values to variables in V′ such that all of the constraints Rij with vi,vj∈V′ are satisfied. A partial solution w.r.t. V is called a solution of N. We say that N is consistent or satisfiable if it admits a solution, and inconsistent or unsatisfiable otherwise. A BCN N=⟨V,𝒟,C⟩ is said to be globally consistent if every partial solution w.r.t. V′⊆V can be consistently extended to a solution w.r.t. V. Further, N is said to be trivially inconsistent if C contains an empty constraint or 𝒟 contains an empty domain. Two BCNs are equivalent if they have the same set of solutions. Example 1 Consider a BCN N=⟨V,𝒟,C⟩, where V={v1,v2,v3,v4}; Di={a,b,c} for i=1,2,3,4; C={R12,R23,R34,R24} where R12=111110100,R34=111100100, and R32=R24=111011001. We use Boolean matrices to represent binary relations. For example, R12 represents the relation {⟨a,a⟩,⟨a,b⟩,⟨a,c⟩,⟨b,a⟩,⟨b,b⟩,⟨c,a⟩} between v1 and v2, where the values in both D1 and D2 are ordered as a≺b≺c. It is easy to check that σ=⟨a,a,a,a⟩ is a solution of N. The constraint graph GN of N=⟨V,𝒟,C⟩ is the undirected graph (V,E), where eij∈E iff Rij∈C. We assume eij is always labeled with its corresponding constraint Rij. Figure 1 shows the constraint graph of the BCN in Example 1. FIGURE 1. View largeDownload slide The constraint graph GN of the BCN in Example 1. Note that ⟨v1,v2,v3,v4⟩ is a PEO in GN, whereas ⟨v2,v1,v3,v4⟩ is not. FIGURE 1. View largeDownload slide The constraint graph GN of the BCN in Example 1. Note that ⟨v1,v2,v3,v4⟩ is a PEO in GN, whereas ⟨v2,v1,v3,v4⟩ is not. An undirected graph G is triangulated or chordal if every cycle of length >3 has a chord, i.e. an edge connecting two non-consecutive vertices of the cycle. The constraint graph GN of a network N=⟨V,𝒟,C⟩ can be completed or triangulated by adding new edges eij labeled with the universal constraint Di×Dj. Triangulated constraint graphs play a key role in efficiently solving large sparse constraint networks [4, 10, 15]. A constraint graph G is triangulated iff it admits a perfect elimination ordering (PEO) [22]. An ordering ≺ of the vertices of a constraint graph G=(V,E) is a PEO if Fv≔{w∣evw∈E,v≺w} (i.e. the set of successors of v in the ordering) induces a complete subgraph of G for all v∈V, (see Fig. 1 for an example). Note that given a constraint graph G=(V,E) and an ordering ≺ of variables in V, we call variable w a successor of variable v if it occurs after v in ≺ and evw∈E. A variable vi is arc-consistent (AC) relative to a variable vj (or Rij) if for any a∈Di we have some b∈Dj such that ⟨a,b⟩∈Rij. Given a constraint graph GN=(V,E), an edge eij of GN is AC if vi is AC relative to vj. Let π=(v1,⋯,vi,⋯,vk) be a path in GN with e1k∈E. We say that π is path-consistent (PC) if for all ⟨c1,ck⟩∈R1k we can find values for all intermediate variables vi(1<i<k) such that all the constraints Ri,i+1(1≤i<k) are satisfied. See Fig. 2 for an illustration. In particular, (v1,v3) is PC relative to a third vertex v2 if e12,e23, and e13 are all in E and the path π=(v1,v2,v3) is PC. A constraint graph GN is AC (respective PC) iff all edges (respective paths) in GN are AC (respective PC); GN is strongly PC iff it is both AC and PC. A constraint network N is AC if GN is AC and N is PC if the completion of GN is PC [10]. Figure 2. View largeDownload slide Path-Consistency [10]. Figure 2. View largeDownload slide Path-Consistency [10]. Consider the BCN N in Example 1. We can see that every edge in GN is AC, but the path π=(v3,v2,v4) is not PC as R34 is not contained in R32◦R24. In this paper, we are concerned with BCNs defined over a particular constraint language and we use constraint languages, constraint classes and sets of relations interchangeably. Definition 2.2 [23] Let 𝒟={D1,…,Dn}be a set of domains. An n-ary relation Rover 𝒟is a subset of D1×…×Dn. For any tuple t∈Rand any 1≤i≤n, we denote by t[i]the value in the ith coordinate position of tand write tas ⟨t[1],…,t[n]⟩. Definition 2.3 ([23]). Given a set of binary relations Γ, we write Γ+for the set of relations that can be obtained from Γusing some sequence of the following operations: Cartesian product, i.e. for R1,R2∈Γ,R1×R2={⟨t1,t2⟩∣t1∈R1,t2∈R2}, Equality selection, i.e. for R∈Γ,τi=j(R)={t∈R∣t[i]=t[j]}and Projection, i.e. for R∈Γ,πi1,⋯,ik(R)={⟨t[i1],⋯,t[ik]⟩∣t∈R}. A relation Ris said to be definable in Γif R∈Γ+, and a set of binary relations Γis said to be complete if every binary relation definable in Γis also contained in Γ. The completion of Γ, written as Γc, is the set of all binary relations contained in Γ+. The following lemma asserts that a complete set of binary relations is closed under the operations that are used to achieve PC. Lemma 2.1 ([24]). Let Γbe a complete set of binary relations over a domain D. Suppose R,Sare binary relations in Γ. Then R∩S and R◦Sare also in Γ. Let Γ be a set of binary relations. A BCN N=⟨V,𝒟,C⟩ is defined over (or, simply, over) Γ if R∈Γ for every constraint (s,R) in C. The constraint satisfaction problem (CSP) of Γ, denoted by CSP(Γ), is the problem of deciding the consistency of BCNs defined over Γ. CSP(Γ+) is log-space reducible to CSP(Γ) [24]. A set of binary relations Γ is weakly closed under singletons, if {⟨a,b⟩}∈Γ+ for any R∈Γ and any ⟨a,b⟩∈R. In this paper, we often assume that the constraint languages are complete and weakly closed under singletons. We will see that this is not very restrictive as, for any set Γ of binary relations that is closed under a majority operation φ, the completion Γc of Γ is also closed under φ [23] and weakly closed under singletons (cf. Proposition 5.1). Algorithm 1 DPC Algorithm 1 DPC 3. THE STRONG DPC ALGORITHM This section recalls the notions of directional arc-consistency (DAC) and DPC, and the strong DPC enforcing algorithm of Dechter [25]. Definition 3.1 [25] Let N=⟨V,𝒟,C⟩be a BCN and ≺=(v1,…,vn)an ordering of the variables in V. We say that Nis directionally arc-consistent (DAC) relative to ≺if viis arc-consistent relative to vkfor all k>iwith Rik∈C. Similarly, Nis DPC relative to ≺if, for any i≠j, (vi,vj)is PC relative to vkfor all k>i,j whenever Rik,Rjk∈C. Meanwhile, Nis strongly DPC relative to ≺if it is both DAC and DPC relative to ≺. The strong DPC algorithm is presented as Algorithm 1. In comparison with traditional PC algorithms [11], a novelty of this single pass algorithm is its explicit reference to the constraint graph of the input constraint network. As only Line 8 may require extra working space, Algorithm 1 has a very low space complexity in practice. Further, Algorithm 1 runs in O(w*(≺)·e·(α+β)) time [25], where e is the number of edges of the output constraint graph, w*(≺) is the induced width [25] of the ordered graph along ≺, and α,β are the runtimes of relational intersection and composition respectively. Note that w*(≺)≤n and α,β are bounded by O(d2) and O(d3), respectively, where d is the largest domain size. Proposition 3.1 ([25]). Let (N,≺)be an input to Algorithm1, where ≺=(v1,…,vn). Suppose N′=⟨V,𝒟′,C′⟩is the output. Then GN′is triangulated and ≺−1, the inverse of ≺, is a PEO of GN′; N′is equivalent to Nand strongly DPC relative to ≺. Let Γ be a set of binary relations. We say that Algorithm 1decides CSP(Γ) if, for any given BCN N in CSP(Γ) and any ordering ≺ of variables of N, Algorithm 1 returns ‘Inconsistent’ iff N is inconsistent. The following corollary follows directly from Proposition 3.1. Corollary 3.1 Let Γbe a complete set of binary relations. Then the following two conditions are equivalent: Algorithm1decides CSP(Γ). Let Nbe any not trivially inconsistent BCN in CSP(Γ). Suppose N’s constraint graph GNis triangulated and let ≺−1=(vn,…,v1)be a PEO of it. Then Nis consistent if Nis strongly DPC relative to ≺. Example 2 The graph coloring problem N with domains {red,blue} depicted in Fig. 3 is taken from [25] and can be decided by Algorithm 1. After applying Algorithm 1 to (N,≺), where ≺=(v1,v2,v3,v4), a solution can be obtained along ≺ in a backtrack-free manner (see Fig. 3b). FIGURE 3. View largeDownload slide A graph coloring problem with domain Di={red,blue} for i=1,2,3,4 [25]. (a) The constraint graph GN of a graph coloring problem N and (b) the constraint graph obtained by applying Algorithm 1 to (N,≺) where ≺=(v1,v2,v3,v4). FIGURE 3. View largeDownload slide A graph coloring problem with domain Di={red,blue} for i=1,2,3,4 [25]. (a) The constraint graph GN of a graph coloring problem N and (b) the constraint graph obtained by applying Algorithm 1 to (N,≺) where ≺=(v1,v2,v3,v4). 4. DIRECTIONAL PC AND VARIABLE ELIMINATION This section characterizes the binary constraint languages Γ such that CSP(Γ) can be decided by DPC. We observe that DPC achieves (strong) DPC using the idea of variable elimination [25]: it iterates variables along the ordering ≺−1, and propagates the constraints of a variable vk to subsequent variables in the ordering with the update rule Rij←Rij∩(Rik◦Rkj), as if vk is ‘eliminated’. The following definition formalizes the process of elimination. Definition 4.1 Let N=⟨V,𝒟,C⟩be a BCN with V={v1,…,vn}and 𝒟={D1,…,Dn}. For a variable vx in V, let Ex={Rix∣Rix∈C}. The network obtained after vxis eliminated from N, written as N−x=⟨V⧹{vx},{D1′,…,Dx−1′,Dx+1′,…,Dn′},C′⟩,is defined as follows: If Ex={Rix}, we set C′=C⧹Exand let Dj′=Di∩Rxi(Dx),ifj=iDj,otherwise (1) If ∣Ex∣≠1, we set Dj′=Djfor all j≠x, and let C′=(C⧹Ex)∪{(Rix◦Rxj)∩Rij∣Rjx,Rix∈Ex,i≠j}. Rij is assumed to be Di×Dj if Rij∉C. Figure 4 illustrates the elimination process. Definition 4.2 A BCN N=⟨V,𝒟,C⟩is said to have the VEP, if, for any vxin V, every solution of N−xcan be extended to a solution of N. Nis said to have weak VEP, if, for any vxin Vsuch that vxis AC relative to all relations in Ex, every solution of N−xcan be extended to a solution of N. A set of binary relations Γis said to have (weak) VEP if every BCN in CSP(Γ)has (weak) VEP. Such a set of binary relations Γis also called a (weak) VEP class. FIGURE 4. View largeDownload slide Two binary constraint networks N and N−4. FIGURE 4. View largeDownload slide Two binary constraint networks N and N−4. It is easy to see that, if a BCN (a set of binary relations) has VEP, then it also has weak VEP. The following example explains why we should take special care when eliminating variables with only one successor in Equation (1). Example 3 Let N=⟨V,𝒟,C⟩ be a BCN defined by V={v1,v2,v3}, D1=D2=D3={0,1}, and C={((v3,v2),R), ((v2,v1),R)} with R={(1,0)} (see Fig. 5). Suppose we do not have the operation specified in Equation (1) and ≺=(v3,v2,v1) is the variable elimination ordering. Let N−3 be the restriction of N to {v1,v2}. Then N−3 has a unique solution σ but it cannot be extended to a solution of N. Proposition 4.1 Let Γbe a complete set of binary relations that is weakly closed under singletons. Then DPCdecides CSP(Γ)iff Γhas VEP. Proof We address the ‘if’ part first. Assume that Γ has VEP, and let N=⟨V,𝒟,C⟩ be a network in CSP(Γ) that is not trivially inconsistent and strongly DPC relative to ≺=(v1,…,vn), where GN is triangulated and ≺−1 is a PEO of it. We show that N is consistent. Let Vi={v1,…,vi} and N∣Vi be the restriction of N to Vi. We claim that N∣Vi is consistent for k=1,…,n and prove the claim by induction on k. First, since N is not trivially inconsistent, D1 is not empty and there is an a1∈D1. Then, N∣V1 is consistent and has a solution σ1=⟨a1⟩. Further, suppose that N∣Vi is consistent and σi=⟨a1,a2,…,ai⟩ is a solution of N∣Vi. We show that σi can be extended to a solution σi+1=⟨a1,…,ai,ai+1⟩ of N∣Vi+1. Since Γ has VEP and N∣Vi is indeed the same network as the one obtained by eliminating vi+1 from N∣Vi+1, by Definition 4.2, σi can be extended to a solution σi+1 of N∣Vi+1. Thus, by induction, N is consistent. By Corollary 3.1, DPC decides CSP(Γ). Next, we address the ‘only if’ part. Assume that DPC decides CSP(Γ). We show that Γ has VEP. Let N=⟨V,𝒟,C⟩ be a not trivially inconsistent network in CSP(Γ). Given vx∈V, we show that every solution of N−x can be extended to N. Without loss of generality, we assume that x=n. Let σ=⟨a1,…,an−1⟩ be a solution of N−n, and En={Rin∣Rin∈C}. By the definition of N−n, for any Rin,Rjn∈En(i≠j), we have ⟨ai,aj⟩∈(Rin◦Rnj)∩Rij. We then construct a new problem N′=⟨V,𝒟′,C′⟩ in CSP(Γ), where 𝒟′={D1′,…,Dn−1′,Dn} with Di′={ai} for 1≤i<n and C′={{⟨ai,aj⟩}∣1≤i≠j<n}∪En. Clearly, σ is also a solution of N−n′ and N−n′ is strongly PC and, hence, strongly DPC relative to the ordering (v1,…,vn−1). Further, since ⟨ai,aj⟩∈(Rin◦Rnj)∩Rij for any Rin,Rjn∈En(i≠j), we have that N′ is strong DPC relative to ≺=(v1,…,vn). As GN−n′ is a complete graph, GN′ is triangulated with ≺−1 being a PEO of it. As DPC decides CSP(Γ) and N′∈CSP(Γ), by Corollary 3.1, N′ is consistent and has a solution that extends σ and is also a solution of N. This shows that N is consistent and, hence, Γ has VEP.□ FIGURE 5. View largeDownload slide A constraint graph that is a chain. FIGURE 5. View largeDownload slide A constraint graph that is a chain. Therefore, if N=⟨V,𝒟,C⟩ is defined over a complete VEP class, then DPC can decide it. Note that in the above proposition we require Γ to be complete. This is important; for example, every row-convex constraint [26] network has VEP (cf. the proof of [27, Theorem 1]) and, hence, the class of row-convex constraints has VEP. However, DPC does not decide the consistency problem over the row-convex constraint class because it was shown to be NP-complete (cf. e.g. [28]). VEP is closely related to the Helly property. For example, any set of intervals on the real line satisfies the Helly property, because the intersection of all intervals is not empty if every pair of intervals intersects. We give the formal definition as follows. Definition 4.3 A set Γof binary relations over 𝒟={D1,…,Dn}is said to have the Helly property if for any k>2binary relations, Ri⊆Dui×Du0(1≤i≤k,1≤ui≠u0≤n), in Γ, and for any kvalues, ai∈Dui(1≤i≤k), such that Ri(ai)={b∈Du0∣⟨ai,b⟩∈Ri}is nonempty, we have ⋂i=1kRi(ai)≠∅iff Ri(ai)∩Rj(aj)≠∅for any 1≤i≠j≤k. Example 4 Let Du0={a,b,c,d},Du1={e},Du2={f},Du3={g} and R1={⟨e,a⟩,⟨e,b⟩,⟨e,c⟩},R2={⟨f,b⟩,⟨f,c⟩,⟨f,d⟩},R3={⟨g,c⟩,⟨g,d⟩,⟨g,a⟩}. See Fig. 6 for an illustration. Then Γ={R1,R2,R3} over 𝒟={Du0,Du1,Du2,Du3} has the Helly property. Theorem 4.1 A set of binary relations Γover 𝒟={D1,…,Dn}has VEP iff it has the Helly property. Proof Suppose Γ has VEP. We show that Γ has the Helly property. Let 𝒟={D1,…,Dn} be the set of domains related to relations in Γ. Suppose Ri⊆Dui×Du0 ( 1≤i≤k, 1≤ui≠u0≤n) are k>2 binary relations in Γ and ai∈Dui ( 1≤i≤k) are values such that ∅≠Ri(ai)⊆Du0. Suppose Ri(ai)∩Rj(aj) is nonempty for any i,j with 1≤i≠j≤k. We show that ⋂i=1kRi(ai) is nonempty. To this end, we construct a BCN N=⟨V,𝒟′,C⟩ over Γ with V={v1,…,vk,vk+1}, 𝒟′={Du1,…,Duk,Du0}, and C={Ri,k+1∣1≤i≤k}, where Ri,k+1=Ri. Consider N−(k+1). As Ri(ai)∩Rj(aj)≠∅, we have ⟨ai,aj⟩∈Ri,k+1◦Rk+1,j. This shows that σ=⟨a1,…,ak⟩ is a solution of N−(k+1). Since Γ and, hence, N have VEP, N has a solution that extends σ. Hence there exists a∈Du0 such that a∈Ri,k+1(ai) for every 1≤i≤k. Thus ⋂i=1kRi(ai)≠∅. This proves that Γ has the Helly property. Suppose Γ over 𝒟={D1,…,Dn} has the Helly property. We show that Γ has VEP. Let N=⟨V,𝒟,C⟩ be a not trivially inconsistent BCN defined over Γ with V={v1,v2,…,vn} and C is a set of binary constraints ((vi,vj),R) with R∈Γ. Let En={Rin∣Rin∈C}. Assume σ=⟨a1,a2,…,an−1⟩ is a solution of, say, N−n. We show that there exists an∈Dn such that ⟨a1,…,an−1,an⟩ is a solution of N. If En is empty, we can take any an from Dn which is nonempty since N is not trivially inconsistent; if En contains only one constraint, say, ((vi,vn),Rin), by ai∈Di′=Di∩Rni(Dn), there exists an∈Dn such that ⟨ai,an⟩∈Rin; if En contains k≥2 constraints and let them be ((vui,vn),Ruin)(1≤i≤k), we have ⟨aui,auj⟩∈Ruiuj∩(Ruin◦Rnuj) for 1≤i≠j≤k. Therefore, we have Ruin(ai)∩Rujn(aj)≠∅ for 1≤i≠j≤k. By the Helly property of Γ, we have ⋂i=1kRuin(ai)≠∅. So we can take any an∈⋂i=1kRuin(ai) so that ⟨a1,…,an−1,an⟩ is a solution of N. Therefore, Γ has VEP.□ FIGURE 6. View largeDownload slide An illustration of Example 4. FIGURE 6. View largeDownload slide An illustration of Example 4. The class of row-convex constraints [26] and the class of tree-convex constraints [29] have the Helly property and, thus, they have VEP by Theorem 4.1. Proposition 4.1 only concerns a complete set of binary relations that has VEP. The following proposition, viz., Proposition 4.2, does not require a set of binary relations to be complete. However, we also note that PC operations can destroy the Helly property; this suggests that Proposition 4.2 is only useful when N happens to have the Helly property after enforcing DPC. Proposition 4.2 Suppose Γis a set of binary relations that has the Helly property. Let N∈CSP(Γ). Suppose Nis not trivially inconsistent and GNis triangulated with ≺−1=(vn,…,v1)as a PEO of it. Then Nis consistent if it is strongly DPC relative to ≺. Proof Let N∈CSP(Γ). Suppose N=⟨V,𝒟,C⟩ is not trivially inconsistent and GN is triangulated with ≺−1=(vn,…,v1) being a PEO of it. Suppose N is strongly DPC relative to ≺. We show that N is consistent. Let Vk={v1,…,vk} and Nk be the restriction of N to Vk. Since N is not trivially inconsistent, we have that N1 is consistent. Suppose Nk is consistent, we show that Nk+1 is consistent. Let σ=⟨a1,…,ak⟩ be a solution of Nk. Let Ek+1={Ri,k+1∣Ri,k+1∈C,i≤k}. Since GN is triangulated and ≺−1=(vn,…,v1) is a PEO of it, for any two different constraints Ri,k+1,Rj,k+1∈Ek+1, we have Rij∈C. Further, since N is strongly DPC relative to ≺, we have ⟨ai,aj⟩∈(Ri,k+1◦Rk+1,j)∩Rij. Thus, we have Ri,k+1(ai)∩Rj,k+1(aj)≠∅ for any two different constraints Ri,k+1,Rj,k+1∈Ek+1. Since Γ has the Helly property, we have ⋂Ri,k+1∈Ek+1Ri,k+1(ai)≠∅. Therefore, σ can be extended to a solution of Nk+1 and Nk+1 is consistent. By induction on k, we have that N is consistent.□ 5. MAJORITY-CLOSED CONSTRAINT LANGUAGES In this section, we characterize weak VEP classes. We will show that a complete set of binary relations Γ has weak VEP iff all relations in Γ are closed under a majority operation, which is defined as follows. Definition 5.1 ([30]). Let 𝒟={D1,…,Dn}be a set of domains. A multi-sorted majority operation φon 𝒟is a set {φ1,…,φn}, where φiis a one-sorted majority operation on Di, i.e. a mapping from Di3to Disuch that φi(e,d,d)=φi(d,e,d)=φi(d,d,e)=dfor all d,e in Di. An m-ary relation R⊆Di1×⋯×Dimwith i1,…,im∈{1,2,…,n}is said to be closed under φif φ(t1,t2,t3)=⟨φi1(t1[1],t2[1],t3[1]),…,φim(t1[m],t2[m],t3[m])⟩is in Rfor any t1,t2,t3∈R. A set of relations Γis said to be closed under φif every R∈Γis closed under φ. A set of relations Γ is called a majority-closed language if there exists a (multi-sorted) majority operation φ such that every relation in Γ is closed under φ. 5.1. Tree-preserving constraints The class of tree-preserving constraints is majority-closed. Definition 5.2 [31] An undirected graph structure can be associated to a finite domain Dsuch that there is a bijection between the vertices in the graph and the values in D. If the graph is connected and acyclic, i.e. a tree, then we say it is a tree domain, denoted by T=(D,E)where Eis a set of edges. A constraint Rijover tree domains Ti=(Di,Ei)and Tj=(Dj,Ej)is called tree-preserving if the image of every subtree in Tiis a subtree in Tj. An example of tree-preserving constraint is shown in Fig. 7. A CRC constraint is a special tree-preserving constraint where related tree domains are chains [31]. Definition 5.3 Let Tibe a nonempty tree domain for a variable vi. The standard majority operation mion Tiis defined as: (∀a,b,c∈Ti)mi(a,b,c)=πa,b∩πb,c∩πa,c,where a,b,care not necessarily distinct and πu,vdenotes the unique path from uto vin Ti. The following result establishes the connection between tree-preserving constraints and majority-closed constraints. Theorem 5.1 [31] Let Tiand Tjbe two nonempty tree domains and miand mjtheir standard majority operations. Suppose Rij⊆Ti×Tjis a nonempty constraint such that both Rijand Rjiare arc-consistent. Then Rijis closed under {mi,mj}iff both Rijand Rjiare tree-preserving w.r.t. Tiand Tj. FIGURE 7. View largeDownload slide An example of tree-preserving constraint Rij with Di={a,b} and Dj={e,f,g,h}, where a dashed arrow from a node u in Ti to a node v in Tj indicates that ⟨u,v⟩∈Rij. FIGURE 7. View largeDownload slide An example of tree-preserving constraint Rij with Di={a,b} and Dj={e,f,g,h}, where a dashed arrow from a node u in Ti to a node v in Tj indicates that ⟨u,v⟩∈Rij. 5.2. Weak VEP classes and majority-closed classes We first study a few properties of majority-closed classes. Proposition 5.1 Let Γbe the set of binary relations that is closed under a multi-sorted majority operation φ={φ1,…,φn}on 𝒟={D1,…,Dn}. Then Γis weakly closed under singletons. Proof Suppose R is a relation in Γ and ⟨a,b⟩∈R⊆Di×Dj. We show that {⟨a,b⟩} is closed under φ. For any t1,t2,t3∈{⟨a,b⟩}, we have t1=t2=t3=⟨a,b⟩, and, hence, φ(t1,t2,t3)=⟨φi(a,a,a),φj(b,b,b)⟩=⟨a,b⟩. This shows that {⟨a,b⟩} is closed under φ and, hence, a relation in Γ.□ Majority-closed relations are decomposable. Intuitively, a relation R is r-decomposable if it is representable by a r-ary constraint network, i.e. there exists a r-ary constraint network such that its set of solutions is exactly R. In the following, given an m-ary relation R, a m-tuple t, and a set of indices I={i1,…,ik}, we use πI(t) and πI(R) to denote ⟨t[i1],…,t[ik]⟩ and {⟨t[i1],…,t[ik]⟩∣t∈R}, respectively. Definition 5.4 [23] Let Rbe an m-ary relation and Ir={I∣I⊆{1,…,m},∣I∣≤r}. Ris said to be r-decomposable if, for all m-tuples t, we have t∈Rif πI(t)∈πI(R)for all I∈Ir. Definition 5.5 A constraint network Nis said to be globally consistent if any partial solution of Ncan be extended to a solution of N. Theorem 5.2 ([23]). Let Γbe a set of binary relations over a set of finite domains 𝒟={D1,…,Dn}. The following statements are equivalent: Γis a majority-closed constraint language. Every R∈Γ+ is 2-decomposable. For every N∈CSP(Γ), establishing strong PC in Nensures global consistency. Finally, we show that complete weak VEP classes are majority-closed classes. Theorem 5.3 Let Γbe a complete set of binary relations over a set of finite domains 𝒟={D1,…, Dn}. Then Γhas weak VEP iff it is a majority-closed class. Proof We first deal with the ‘only if’ part. Suppose that Γ is a complete set of binary relations that has weak VEP. By Theorem 5.2, we only need to show that for every BCN in CSP(Γ), establishing strong PC ensures global consistency. Let N0 be a network in CSP(Γ) and suppose N=⟨V,𝒟,C⟩ is the network obtained by enforcing strong PC on N0. Since Γ is complete and hence closed under operations for achieving PC by Lemma 2.1, N is also a problem in CSP(Γ). Suppose N is not trivially inconsistent. We show that any partial solution of N can be extended to a solution of N. Suppose V′={v1,…,vm−1}⊂V and σ=⟨a1,…,am−1⟩ is a solution of N∣V′, which is the restriction of N to V′. Assume further that vm∉V′ is a new variable and let V″=V′∪{vm}. We show that σ can be consistently extended to N∣V″, the restriction of N to V″. Because N is strongly PC, N∣V″ is strongly PC as well. In particular, vi is AC relative to vm for any Rim in C, and Rij is PC relative to vm (i.e. Rij⊆Rim◦Rmj) for any i≠j such that both Rim and Rjm are in C. By Definition 4.1, N∣V′ is the same as (N∣V″)−m, viz., the network obtained by eliminating vm from N∣V″. Moreover, since N and, hence, N∣V″ are AC, vm is AC relative to all constraints Rim that are in C. By the assumption that Γ has weak VEP, σ can be consistently extended to vm. Following this reasoning, we will find a solution of N that extends σ. Next, we consider the ‘if’ part. Suppose that Γ is a complete set of binary relations that is closed under some multi-sorted majority operation φ={φ1,…,φn} on 𝒟. Let N=⟨V,𝒟,C⟩ be a problem in CSP(Γ) and vx a variable in V. Let Ex={Rix∣Rix∈C}, and N−x=⟨V⧹{vx},𝒟,C′⟩, where C′=(C∪{(Rix◦Rxj)∩Rij∣Rjx,Rix∈Ex})⧹Ex. Suppose that vx is AC relative to all relations in Ex. We only need to show that any solution of N−x can be extended to a solution of N. We prove this by contradiction. Let σ be a solution of N−x. Assume that σ cannot be extended to a solution of N. Therefore, Ex cannot be empty, otherwise σ can be trivially extended to a solution of N. The case where Ex={Rix} is a singleton is also impossible, as by Equation (1), vi is AC relative to Rix and we could extend σ to a solution of N by assigning any valid value to vx. Suppose that Ex has q≥2 constraints and let them be ((v1,vx),R1), …, ((vq,vx),Rq). We define a new problem N′=⟨V,𝒟,Ex⟩ as illustrated in Fig. 8. Since vx is AC relative to all relations in Ex, it is easy to verify that N′ has a solution. For example, one can construct a solution of N′ by simply picking a value from Dx for vx and then extending that valuation to v1,…,vq. Now, we construct a q-ary relation R={⟨γ(v1),…,γ(vq)⟩∣γ is a solution of N′}. The solution set S of N′ can be obtained by using a sequence of the Cartesian product, equality selection, and projection operations [23]. Therefore, S∈Γ+. Since R=πv1,…,vq(S), we have R∈Γ+. By Theorem 5.2, R should be 2-decomposable; however, in the sequel we show that it is not, which is a contradiction. Let t=⟨σ(v1),…,σ(vq)⟩, where σ is a solution of N−x. It is clear that t is a solution of N′∣{v1,…,vq}. For any list of indices I chosen from {1,…,q}, with ∣I∣≤2, we claim that πI(t)∈πI(R). We recall that, for any two relations Rix,Rjx∈Ex, the relation between vi and vj in N−x is Rij∩(Rix◦Rxj). Therefore, any partial solution ⟨σ(vi),σ(vj)⟩(1≤i,j≤q) of N′ can be consistently extended to vx and, by the construction of N′, further consistently extended to a solution of N′. Thus, πI(t) is in πI(R) for any list of indices I chosen from {1,…,q}, with ∣I∣≤2. However, t∉R because σ cannot be extended to a solution of N′, which implies that R is not 2-decomposable.□ FIGURE 8. View largeDownload slide Illustration of proof of Theorem 5.3. FIGURE 8. View largeDownload slide Illustration of proof of Theorem 5.3. 6. THE VARIABLE ELIMINATION ALGORITHM DPC* This section presents a variant of DPC for solving BCNs defined over any weak VEP class. The new algorithm, called DPC* and presented as Algorithm 2, can solve problems that are not solvable by DPC (cf. Example 5 and Proposition 6.2). Compared with the variable elimination algorithm for solving CRC constraints [27], DPC* enforces a weaker AC condition instead of full AC. We first justify the correctness of Algorithm 2. Theorem 6.1 Let Γbe a complete weak VEP class. Suppose Nis a BCN defined over Γand ≺=(v1,…,vn)any ordering of the variables of N. Then, given Nand ≺, Algorithm2does not return ‘Inconsistent’ iff Nis consistent. Algorithm 2 DPC* Algorithm 2 DPC* Proof Suppose the input network N is consistent. Since DPC* only prunes off certain infeasible domain values or relation tuples, the algorithm does not find any empty domains or relations in Lines 4, 9 and 17. Thus, it does not return ‘Inconsistent’. Suppose the algorithm does not return ‘Inconsistent’ and let N′=⟨V,𝒟′,C′⟩ be the output network, where 𝒟′={D1′,…,Dn′}. We show that N′ is consistent. Write M(0) for N and write M(i) for the result of the ith loop in the call of DPC* on input N and ≺=(v1,v2,…,vn). Then N′=M(n−1) and all M(i)(0≤i<n) are equivalent to N. Let Qi be the restriction of M(i) to {v1,v2,…,vn−i} ( 0≤i<n). In essence, Qi is obtained by eliminating vn−i+1 from Qi−1 (Lines 2–5 or Lines 11–18), while also enforcing AC (Lines 7–10) for vn−i+1 relative to all its successors if it has more than one successor. Since Γ is a complete weak VEP class, every BCN defined over Γ has weak VEP. In particular, each Qi(0≤i<n) is defined over Γ and has weak VEP. This implies that every solution of Qi+1 can be extended to a solution of Q1. Since no inconsistency is detected in the process, we have D1′≠∅ and thus Qn−1 is consistent. By the above analysis, this implies that Qn−2,…,Q1,Q0=M(0)=N are all consistent.□ The preceding proof also gives a way to generate all solutions of a consistent input network backtrack-free by appropriately instantiating the variables along the input ordering ≺. Indeed, for all 1≤k<n, a solution ⟨a1,…,ak⟩ of Nk′ can be extended to a solution ⟨a1,…,ak+1⟩ of Nk+1′ by choosing an element ak+1 from the intersection of all Ri,k+1(ai) with i≤k and Ri,k+1∈C′, which is always nonempty as shown in the preceding proof. As we know that if Γ is majority-closed, the completion of Γ is also majority-closed [23], and that complete majority-closed classes and complete weak VEP classes are equivalent by Theorem 5.3, this also proves the following result: Definition 6.1 A constraint network Nis decomposable relative to a variable ordering ≺=(v1,…,vn)if any partial solution of Non {v1,…,vk}for any 1≤k<ncan be extended to a solution of N. Proposition 6.1 Suppose Nis a consistent BCN defined over a majority-closed class and ≺=(v1,…,vn)an ordering of variables of N. Then, given Nand ≺, Algorithm2returns an equivalent subnetwork N′that is decomposable relative to ≺. Note that Lines 2–10 in DPC* do not achieve DAC of input networks. Therefore, DPC*does not achieve strong DPC. Since the overall runtime of Lines 2–10 is the same as enforcing DAC, this places DPC* in the same time complexity class as DPC, which is O(w*(≺)ed3), where w*(≺) is the induced width of the ordered constraint graph along the input variable ordering ≺. The following example, however, gives a BCN that can be solved by DPC* but not by DPC, which shows that the loop in Lines 7–10 is necessary. Example 5 Let D={a,b,c} and φ be the majority operation on D such that for all i,j,k∈D, φ(i,j,k)=a if i≠j, j≠k, and i≠k, and φ(i,j,k)=r otherwise, where r is the repeated value (e.g. φ(b,c,b)=b). Let Γ={R1,R2,R3,R4,R5,R6}, where R1={⟨a,a⟩,⟨a,c⟩}, R2={⟨c,c⟩,⟨c,b⟩}, R3={⟨b,b⟩,⟨b,a⟩}, R4={⟨a,c⟩}, R5={⟨c,b⟩} and R6={⟨a,b⟩}. Every R∈Γ is closed under the majority operation φ on D. Now, consider the constraint network N∈CSP(Γ) as presented in Fig. 9. Since Rxw◦Rwz=R6, Rxw◦Rwy=R4, and Ryw◦Rwz=R5, the eliminated network N−w is the same as the restriction of N to the set of variables {vx,vy,vz}. Let σ(vx)=a,σ(vy)=c,σ(vz)=b. Then σ is a solution of N−w, but σ cannot be extended to a solution of N. Thus, N and hence Γ do not have VEP. By Theorem 4.1, DPC does not decide CSP(Γ). On the other hand, since Γ is majority-closed, by Proposition 6.1, DPC* can correctly decide the consistency of N. This observation is confirmed by calling the two algorithms on N. Take the PEO ≺=(w,x,y,z) as an example; the other PEOs are analogous. Let (N,≺) be an input to DPC. After processing w, we have Dx={a},Dy={c},Dz={b} and Rxy={⟨a,c⟩}, Rxz={⟨a,b⟩}, Rzy={b,c}. We can observe that ⟨x=a,y=c,z=b⟩ is a solution to the eliminated subnetwork. Thus, if we keep running DPC, it will not detect inconsistency. On the other hand, for DPC*, when eliminating w, DPC* makes w AC relative to its neighbors. Note that DPC does not perform this operation. After that, Dw is empty, and the algorithm will stop and output ‘Inconsistent’. Proposition 6.2 Let φ={φ1,…,φn}be a majority operation on 𝒟={D1,…,Dn}. If there exists a domain Diin 𝒟that contains more than two elements, then the set Γφof binary relations that are closed under φhas neither the Helly property nor VEP. Proof Suppose a,b,c are three different values from Di. It is easy to see that the relations R1={⟨a,a⟩,⟨a,b⟩}, R2={⟨a,b⟩,⟨a,c⟩}, and R3={⟨a,a⟩,⟨a,c⟩} are all closed under φ. Therefore, R1, R2, and R3 are all in Γφ. Because any two of R1(a),R2(a),R3(a) have a common element but R1(a)∩R2(a)∩R3(a)=∅, this shows that Γφ does not have the Helly Property and, hence by Theorem 4.1, does not have VEP.□ FIGURE 9. View largeDownload slide A constraint network N and its elimination N−w. FIGURE 9. View largeDownload slide A constraint network N and its elimination N−w. This result shows that no complete VEP class could have a domain with three or more values. Therefore, there are no interesting complete constraint languages except the Boolean ones that can be decided by DPC (cf. Proposition 4.1), while all binary majority-closed classes (including CRC and tree-preserving constraints) can be decided by DPC* (cf. Proposition 6.1). DPC* can also be used to solve majority-closed constraints of higher arities. This is because, by Theorem 5.2, every relation definable in a majority-closed language is 2-decomposable. Therefore, for each majority relation R of arity m>2, if a constraint c=((y1,…,ym),R) appears in a constraint network N, we could replace c with a set of binary constraints cij=((yi,yj)∣πij(R))(1≤i<j≤m), where πij(R)={⟨t[yi],t[yj]⟩∣t∈R}. 7. EVALUATIONS In this section, we compare algorithm 𝒟𝖯𝖢* against the state-of-the-art algorithms for solving majority-closed constraint networks. These are SAC3-SDS [32] and PC2001 [33]. SAC3-SDS is currently the best singleton arc-consistency (SAC) enforcing algorithm [34]. Enforcing either SAC or PC correctly decides the consistency of a majority-closed constraint network [23, 35]. Note that singleton linear arc-consistency (SLAC) is an alternative consistency notion that can be enforced to solve majority-closed constraint networks [36], but, to the best of our knowledge, no practical SLAC algorithms have been made available so far. Comparison of time complexities among the three algorithms is presented in Table 1. TABLE 1. Comparison of time complexities among state-of-the-art algorithms for solving majority-closed constraint networks. Algorithm DPC* PC2001 SAC3-SDS Time O(w*(≺)ed3) O(n3d3) O(ned3) Algorithm DPC* PC2001 SAC3-SDS Time O(w*(≺)ed3) O(n3d3) O(ned3) View Large TABLE 1. Comparison of time complexities among state-of-the-art algorithms for solving majority-closed constraint networks. Algorithm DPC* PC2001 SAC3-SDS Time O(w*(≺)ed3) O(n3d3) O(ned3) Algorithm DPC* PC2001 SAC3-SDS Time O(w*(≺)ed3) O(n3d3) O(ned3) View Large Two different sets of data are considered for experiments, which are described as follows: Tree-preserving constraint networks. These networks are randomly generated using the random tree-preserving constraint generator detailed in [31]. Random majority-closed constraint networks. These can be used to test the average performance of different algorithms. To generate such networks, we need to generate random majority-closed constraint languages as follows: Randomly define a majority operation ⊗i:Di3→Di for each domain Di∈𝒟 as follows: for any x,y,z∈Di, ⊗i(x,y,z)=anyv∈Di,ifx,y,zarealldifferent,anyrepeatedvalueofx,y,z,otherwise. Note that v is chosen randomly for each triple ⟨x,y,z⟩, and it is a random choice in Di. Randomly generate constraints Rij⊆Di×Dj and test whether {⟨⊗i(tx[1],ty[1],tz[1]),⊗j(tx[2],ty[2],tz[2])⟩∣tx,ty,tz∈Rij}⊆Rij (2) holds. By definition, Rij is majority-closed under (⊗i,⊗j) iff (2) holds. We used the model in [10, 17] to generate random consistent constraint networks for experiments. These constraint networks were generated by varying four parameters: (i) the number of variables n, (ii) the size of the domains d, (iii) the density of the constraint networks ρ (i.e. the ratio of non-universal constraints to n2) and (4) the looseness of constraints l (i.e. the ratio of the number of allowed tuples to d2). We fix three of the four parameters and vary the remaining parameter. All algorithms were implemented taking equal care and using Python 3.6. Experiments were carried out on a computer with an Intel Core i5-4570 processor (3.2 GHz frequency per CPU core) and 4 GB of memory. The graphs in Figs 10 and 11 illustrate the experimental comparisons among algorithms DPC*, SAC3-SDS and PC2001 for solving tree-preserving and random majority-closed constraint networks respectively. The data points in each graph are CPU times averaged over 20 instances. FIGURE 10. View largeDownload slide Performance comparisons among DPC*, SAC3-SDS and PC2001 for solving tree-preserving constraint networks. (a) Evaluations in the number n of variables. We set ρ=0.5, l=0.3, d=100, (b) evaluations in the size d of domains. We set ρ=0.5, l=0.3, n=100, (c) evaluations in the density ρ of networks. We set l=0.3, d=100, n=100 and (d) evaluations in the looseness l of constraints. We set ρ=0.5, d=100, n=100. FIGURE 10. View largeDownload slide Performance comparisons among DPC*, SAC3-SDS and PC2001 for solving tree-preserving constraint networks. (a) Evaluations in the number n of variables. We set ρ=0.5, l=0.3, d=100, (b) evaluations in the size d of domains. We set ρ=0.5, l=0.3, n=100, (c) evaluations in the density ρ of networks. We set l=0.3, d=100, n=100 and (d) evaluations in the looseness l of constraints. We set ρ=0.5, d=100, n=100. FIGURE 11. View largeDownload slide Performance comparisons among DPC*, SAC3-SDS and PC2001 for solving random majority-closed constraint networks. (a) Evaluations in the number n of variables. We set ρ=0.5, l=0.3, d=100, (b) evaluations in the size d of domains. We set ρ=0.5, l=0.3, n=100, (c) evaluations in the density ρ of networks. We set l=0.3, d=100, n=100 and (d) evaluations in the looseness l of constraints. We set ρ=0.5, d=100, n=100. FIGURE 11. View largeDownload slide Performance comparisons among DPC*, SAC3-SDS and PC2001 for solving random majority-closed constraint networks. (a) Evaluations in the number n of variables. We set ρ=0.5, l=0.3, d=100, (b) evaluations in the size d of domains. We set ρ=0.5, l=0.3, n=100, (c) evaluations in the density ρ of networks. We set l=0.3, d=100, n=100 and (d) evaluations in the looseness l of constraints. We set ρ=0.5, d=100, n=100. From Figs 10 and 11, we observe that the corresponding results regarding tree-preserving and random majority-closed constraint networks are qualitatively similar. Therefore, our analysis only focuses on Fig. 10 and the results are applicable to Fig. 11 as well. We observe in Fig. 10a and b that all algorithms approximately show linear time behaviors with respect to n and d. On the other hand, Fig. 10c shows that PC2001 is not sensitive to the density of networks whereas DPC* and SAC3-SDSperform better when the density of networks is lower. Figure 10d shows that the CPU time for DPC* remains almost unchanged when increasing the looseness of constraints. However, the CPU times for PC2001 and SAC3-SDS both go up and then drop down when increasing the looseness of constraints. Finally, we also observe in all the graphs in Fig. 10 that the performance differences among DPC*, PC2001, and SAC3-SDS are remarkable. In particular, DPC* is up to seven times and five times faster than PC2001 and SAC3-SDS, respectively. This is mainly due to the fact that DPC* is a single pass algorithm over the ordered input constraint networks and, hence, very scalable compared to PC2001 and SAC3-SDS. 8. CONCLUSION This paper investigated which constraint satisfaction problems can be efficiently decided by enforcing DPC. Given a complete binary constraint language Γ, it turns out that DPC can decide CSP(Γ) if Γ is defined over domains with less than three values. For a possibly incomplete binary constraint language Γ, we proved that Γ has the Helly property if, and only if, for any not trivially inconsistent and triangulated binary constraint network N over Γ, N is consistent if it is strongly DPC relative to the inverse ordering of some PEO of the constraint graph of N. The classes of row-convex [26] and tree-convex [29] constraints are examples of constraint classes which have the Helly property. More importantly, we presented the algorithm DPC*, a simple variant of DPC, which can decide the CSP of any majority-closed constraint language, and is sufficient for guaranteeing backtrack-free search for majority-closed constraint networks, which have found applications in various domains, such as scene labeling, temporal reasoning, geometric reasoning, and logical filtering. Our evaluations also show that DPC* significantly outperforms the state-of-the-art algorithms for solving majority-closed constraint networks. FUNDING The work of S.L. was partially supported by NSFC (No. 11671244). M.S. acknowledges support from the European-funded H2020 project MoveCare (ID: 732158). REFERENCES 1 Montanari , U. ( 1974 ) Networks of constraints: fundamental properties and applications to picture processing . Inf. Sci. , 7 , 95 – 132 . Google Scholar CrossRef Search ADS 2 Maruyama , H. ( 1990 ) Structural Disambiguation with Constraint Propagation. Proc. 28th Annual Meeting of the Association for Computational Linguistics, University of Pittsburgh, Pittsburgh, Pennsylvania, USA, June 6–9, pp. 31–38. ACL, Stroudsburg. 3 Dechter , R. , Meiri , I. and Pearl , J. ( 1991 ) Temporal constraint networks . Artif. Intell. , 49 , 61 – 95 . Google Scholar CrossRef Search ADS 4 Planken , L. , de Weerdt , M. and van der Krogt , R. ( 2008 ) P3C: A New Algorithm for the Simple Temporal Problem. Proc. Eighteenth Int. Conf. Automated Planning and Scheduling, Sydney, Australia, September 14–18, pp. 256–263. AAAI, Palo Alto. 5 Li , S. , Liu , W. and Wang , S. ( 2013 ) Qualitative constraint satisfaction problems: an extended framework with landmarks . Artif. Intell. , 201 , 32 – 58 . Google Scholar CrossRef Search ADS 6 Freuder , E.C. ( 1982 ) A sufficient condition for backtrack-free search . J. ACM , 29 , 24 – 32 . Google Scholar CrossRef Search ADS 7 Mackworth , A.K. ( 1977 ) Consistency in networks of relations . Artif. Intell. , 8 , 99 – 118 . Google Scholar CrossRef Search ADS 8 Han , C.-C. and Lee , C.-H. ( 1988 ) Comments on mohr and henderson’s path consistency algorithm . Artif. Intell. , 36 , 125 – 130 . Google Scholar CrossRef Search ADS 9 Singh , M. ( 1996 ) Path consistency revisited . Int. J. Artif. Intell. Tools , 5 , 127 – 142 . Google Scholar CrossRef Search ADS 10 Bliek , C. and Sam-Haroud , D. ( 1999 ) Path Consistency on Triangulated Constraint Graphs. Proc. Sixteenth Int. Joint Conf. Artificial Intelligence, Stockholm, Sweden, 31 July–6 August, pp. 456–461. Morgan Kaufmann, Burlingto. 11 Chmeiss , A. and Jégou , P. ( 1998 ) Efficient path-consistency propagation . Int. J. Artif. Intell. Tools , 7 , 121 – 142 . Google Scholar CrossRef Search ADS 12 Barto , L. and Kozik , M. ( 2014 ) Constraint satisfaction problems solvable by local consistency methods . J. ACM , 61 , 3:1 – 3:19 . Google Scholar CrossRef Search ADS 13 Barto , L. ( 2016 ) The collapse of the bounded width hierarchy . J. Logic Comput. , 26 , 923 – 943 . Google Scholar CrossRef Search ADS 14 Dechter , R. and Pearl , J. ( 1987 ) Network-based heuristics for constraint-satisfaction problems . Artif. Intell. , 34 , 1 – 38 . Google Scholar CrossRef Search ADS 15 Sioutis , M. , Long , Z. and Li , S. ( 2016 ) Efficiently Reasoning about Qualitative Constraints through Variable Elimination. Proc. 9th Hellenic Conf. Artificial Intelligence, Thessaloniki, Greece, May 18–20, pp. 1: 1–1:10. ACM, New York. 16 Carbonnel , C. and Cooper , M.C. ( 2016 ) Tractability in constraint satisfaction problems: A survey . Constraints , 21 , 115 – 144 . Google Scholar CrossRef Search ADS 17 Deville , Y. , Barette , O. and van Hentenryck , P. ( 1999 ) Constraint satisfaction over connected row convex constraints . Artif. Intell. , 109 , 243 – 271 . Google Scholar CrossRef Search ADS 18 Kong , S. , Li , S. , Li , Y. and Long , Z. ( 2015 ) On Tree-preserving Constraints. Proc. 21st Int. Conf. Principles and Practice of Constraint Programming, Cork, Ireland, 31 August–4 September, pp. 244–261. Springer, Berlin. 19 Kumar , T.K.S. ( 2005 ) On the Tractability of Restricted Disjunctive Temporal Problems. Proc. 15th Int. Conf. Automated Planning and Scheduling, Monterey, California, USA, June 5–10, pp. 110–119. AAAI, Palo Alto. 20 Kumar , T.K.S. and Russell , S.J. ( 2006 ) On Some Tractable Cases of Logical Filtering. Proc. 16th Int. Conf. Automated Planning and Scheduling, Cumbria, UK, June 6–10, pp. 83–92. AAAI, Palo Alto. 21 Kumar , T.K.S. ( 2004 ) On geometric CSPs with (near)-linear domains and max-distance constraints. Workshop on Modelling and Solving Problems with Constraints, pp. 125–138. 22 Fulkerson , D. and Gross , O. ( 1965 ) Incidence matrices and interval graphs . Pac. J. Math. , 15 , 835 – 855 . Google Scholar CrossRef Search ADS 23 Jeavons , P. , Cohen , D. and Cooper , M.C. ( 1998 ) Constraints, consistency and closure . Artif. Intell. , 101 , 251 – 265 . Google Scholar CrossRef Search ADS 24 Cohen , D. and Jeavons , P. ( 2006 ) The complexity of constraint languages. In Rossi , F. , van Beek , P. and Walsh , T. (eds.) Handbook of Constraint Programming , pp. 245 – 280 . Elsevier , Amsterdam . 25 Dechter , R. ( 2003 ) Constraint Processing. . Morgan Kaufmann , Burlington . 26 van Beek , P. and Dechter , R. ( 1995 ) On the minimality and global consistency of row-convex constraint networks . J. ACM , 42 , 543 – 561 . Google Scholar CrossRef Search ADS 27 Zhang , Y. and Marisetti , S. ( 2009 ) Solving connected row convex constraints by variable elimination . Artif. Intell. , 173 , 1204 – 1219 . Google Scholar CrossRef Search ADS 28 Jeavons , P.G. and Cooper , M.C. ( 1995 ) Tractable constraints on ordered domains . Artif. Intell. , 79 , 327 – 339 . Google Scholar CrossRef Search ADS 29 Zhang , Y. and Yap , R.H.C. ( 2003 ) Consistency and Set Intersection. Proc. Eighteenth Int. Joint Conf. Artificial Intelligence, Acapulco, Mexico, August 9–15, pp. 263–270. Morgan Kaufmann, Burlington. 30 Bulatov , A.A. and Jeavons , P. ( 2003 ) An Algebraic Approach to Multi-sorted Constraints. Proc. 9th Int. Conf. Principles and Practice of Constraint Programming, Kinsale, Ireland, September 29–October 3, pp. 183–198. Springer, Berlin. 31 Kong , S. , Li , S. , Li , Y. and Long , Z. ( 2017 ) On tree-preserving constraints . Ann. Math. Artif. Intell. , 81 , 241 – 271 . Google Scholar CrossRef Search ADS 32 Bessière , C. , Cardon , S. , Debruyne , R. and Lecoutre , C. ( 2011 ) Efficient algorithms for singleton arc consistency . Constraints , 16 , 25 – 53 . Google Scholar CrossRef Search ADS 33 Bessière , C. , Régin , J.-C. , Yap , R.H. and Zhang , Y. ( 2005 ) An optimal coarse-grained arc consistency algorithm . Artif. Intell. , 165 , 165 – 185 . Google Scholar CrossRef Search ADS 34 Debruyne , R. and Bessière , C. ( 1997 ) Some Practicable Filtering Techniques for the Constraint Satisfaction Problem. Proc. Fifteenth Int. Joint Conf. Artificial Intelligence, Nagoya, Japan, August 23–29, pp. 412–417. Morgan Kaufmann, Burlington. 35 Chen , H. , Dalmau , V. and Grußien , B. ( 2011 ) Arc consistency and friends . J. Logic Comput. , 23 , 87 – 108 . Google Scholar CrossRef Search ADS 36 Kozik , M. ( 2016 ) Weak Consistency Notions for all the CSPs of Bounded Width. Proc. 31st Annual ACM/IEEE Symposium on Logic in Computer Science, New York, USA, pp. 633–641. ACM, New York. © The British Computer Society 2017. All rights reserved. For permissions, please e-mail: journals.permissions@oup.com This article is published and distributed under the terms of the Oxford University Press, Standard Journals Publication Model (https://academic.oup.com/journals/pages/open_access/funder_policies/chorus/standard_publication_model) http://www.deepdyve.com/assets/images/DeepDyve-Logo-lg.png The Computer Journal Oxford University Press

Exploring Directional Path-Consistency for Solving Constraint Networks

Loading next page...
 
/lp/ou_press/exploring-directional-path-consistency-for-solving-constraint-networks-GhjoQaCNYX
Publisher
Oxford University Press
Copyright
© The British Computer Society 2017. All rights reserved. For permissions, please e-mail: journals.permissions@oup.com
ISSN
0010-4620
eISSN
1460-2067
D.O.I.
10.1093/comjnl/bxx122
Publisher site
See Article on Publisher Site

Abstract

Abstract Among the local consistency techniques used for solving constraint networks, path-consistency (PC) has received a great deal of attention. However, enforcing PC is computationally expensive and sometimes unnecessary. Directional PC (DPC) is a weaker notion of PC that considers a given variable ordering and can thus be enforced more efficiently than PC. This paper shows that (the DPC enforcing algorithm of Dechter and Pearl) decides the constraint satisfaction problem (CSP) of a constraint language if it is complete and has the variable elimination property (VEP). However, we also show that no complete VEP constraint language can have a domain with more than two values. We then present a simple variant of the algorithm, called, and show that the CSP of a constraint language can be decided by if it is closed under a majority operation. In fact, is sufficient for guaranteeing backtrack-free search for such constraint networks. Examples of majority-closed constraint classes include the classes of connected row-convex constraints and tree-preserving constraints, which have found applications in various domains, such as scene labeling, temporal reasoning, geometric reasoning and logical filtering. Our experimental evaluations show that significantly outperforms the state-of-the-art algorithms for solving majority-closed constraints. 1. INTRODUCTION Many artificial intelligence tasks can be formulated as constraint networks [1], such as natural language parsing [2], temporal reasoning [3, 4] and spatial reasoning [5]. A constraint network comprises a set of variables ranging over some domain of possible values, and a set of constraints that specify allowed value combinations for these variables. Solving a constraint network amounts to assigning values to its variables such that its constraints are satisfied. Backtracking search is the principal mechanism for solving a constraint network; it assigns values to variables in a depth-first manner, and backtracks to the previous variable assignment if there are no consistent values for the variable at hand. Local consistency techniques are commonly used to reduce the size of the search space before commencing search. However, searching for a complete solution for a constraint network is still hard. In fact, even deciding whether the constraint network has a solution is NP-complete in general. Therefore, given a particular form of local consistency, a crucial task is to determine problems that can be solved by backtrack-free search using that local consistency [6]. This paper considers a particular form of local consistency, called path-consistency (PC), which is one of the most important and heavily studied local consistencies in the literature (see e.g. [7–11]). Recently, it was shown that PC can be used to decide the satisfiability of a problem if and only if the problem does not have the ability to count [12, 13]; however, it remains unclear whether backtrack-free search can be used to extract a solution for such a problem after enforcing PC. Directional PC (DPC) [14] is a weaker notion of PC that considers a given variable ordering and can thus be enforced more efficiently than PC. The DPC enforcing algorithm of Dechter and Pearl [14], denoted by DPC, has been used to efficiently solve reasoning problems in temporal reasoning [3, 4] and spatial reasoning [15]. It is then natural to ask what binary constraint networks with finite domains can be solved by DPC. Dechter and Pearl [14] showed that DPC is sufficient for enabling backtrack-free search for a network with a constraint graph of regular width 2, i.e. there exists a width 2 ordering of the constraint graph which remains width 2 after applying DPC. We consider the aforementioned question in the context of constraint languages, which is a widely adopted approach in the study of tractability of constraint satisfaction problems [16]. Specifically, we are interested in finding all binary constraint languages Γ such that the consistency of any constraint network defined over Γ can be decided by DPC. To this end, we first exploit the close connection between DPC and variable elimination by defining constraint languages that have the (weak) variable elimination property (VEP) (which will become clear in Definition 4.2). We call a constraint language Γcomplete if it contains all relations that are definable in Γ (in the sense of Definition 2.3). Then, we show that the constraint satisfaction problem (CSP) of a constraint language Γ can be decided by DPC if it is complete and has VEP, which is shown to be equivalent to the Helly property. However, we also show that no complete VEP constraint language can have a domain with more than two values. We then present a simple variant of the algorithm DPC, called DPC*, and show that the consistency of a constraint network can be decided by DPC* if it is defined over any majority-closed constraint language. In fact, we show that DPC* is sufficient for guaranteeing backtrack-free search for such constraint networks. Several important constraint classes have been found to be majority-closed. The most well-known one is the class of connected row-convex (CRC) constraints [17], which is further generalized to a larger class of tree-preserving constraints [18]. The class of CRC constraints has been successfully applied to temporal reasoning [19], logical filtering [20] and geometric reasoning [21], and the class of tree-preserving constraints can model a large subclass of the scene labeling problem [18]. We also conduct experimental evaluations to compare DPC* to the state-of-the-art algorithms for solving majority-closed constraints, and show that DPC* significantly outperforms the latter algorithms. The remainder of this paper is organized as follows. In Section 2, we introduce basic notions and results that will be used throughout the paper. In Section 3, we present the DPC algorithm, and in Section 4 we discuss the connection between DPC and variable elimination. In Section 5, we prove that a complete constraint language Γ has weak VEP if and only if Γ is majority-closed. We then present in Section 6, our variable elimination algorithm DPC*, and empirically evaluate DPC* in Section 7. Finally, Section 8 concludes the paper. 2. PRELIMINARIES This section recalls necessary notions and results. Definition 2.1 A binary constraint network (BCN) Nis a triple ⟨V,𝒟,C⟩, where V={v1,…,vn}is a nonempty finite set of variables; 𝒟={D1,…,Dn}, where Diis the domain of vi; C={(sp,Rp)∣1≤p≤m}is a set of binary constraints, where sp=(vi,vj)(i≠j) (called the scope of (sp,Rp)) is a pair of variables in Vand Rp (called the constraint relation of (sp,Rp)) is a subset of Di×Dj. Given a BCN N=⟨V,𝒟,C⟩ and any pair of variables (vi,vj) with vi,vj∈V and vi≠vj, we assume that there exists at most one constraint between the pair. For simplicity, we will often denote the constraint between vi and vj by Rij. Further, we assume Rij=Rji−1, which is the inverse of Rji. We write Rij∈C throughout the paper to state that a constraint with scope (vi,vj) is in C. Usual operations on relations such as intersection ( ∩), composition ( ◦), and inverse ( −1) are also assumed. A partial solution of N w.r.t. a subset V′ of V is an assignment of values to variables in V′ such that all of the constraints Rij with vi,vj∈V′ are satisfied. A partial solution w.r.t. V is called a solution of N. We say that N is consistent or satisfiable if it admits a solution, and inconsistent or unsatisfiable otherwise. A BCN N=⟨V,𝒟,C⟩ is said to be globally consistent if every partial solution w.r.t. V′⊆V can be consistently extended to a solution w.r.t. V. Further, N is said to be trivially inconsistent if C contains an empty constraint or 𝒟 contains an empty domain. Two BCNs are equivalent if they have the same set of solutions. Example 1 Consider a BCN N=⟨V,𝒟,C⟩, where V={v1,v2,v3,v4}; Di={a,b,c} for i=1,2,3,4; C={R12,R23,R34,R24} where R12=111110100,R34=111100100, and R32=R24=111011001. We use Boolean matrices to represent binary relations. For example, R12 represents the relation {⟨a,a⟩,⟨a,b⟩,⟨a,c⟩,⟨b,a⟩,⟨b,b⟩,⟨c,a⟩} between v1 and v2, where the values in both D1 and D2 are ordered as a≺b≺c. It is easy to check that σ=⟨a,a,a,a⟩ is a solution of N. The constraint graph GN of N=⟨V,𝒟,C⟩ is the undirected graph (V,E), where eij∈E iff Rij∈C. We assume eij is always labeled with its corresponding constraint Rij. Figure 1 shows the constraint graph of the BCN in Example 1. FIGURE 1. View largeDownload slide The constraint graph GN of the BCN in Example 1. Note that ⟨v1,v2,v3,v4⟩ is a PEO in GN, whereas ⟨v2,v1,v3,v4⟩ is not. FIGURE 1. View largeDownload slide The constraint graph GN of the BCN in Example 1. Note that ⟨v1,v2,v3,v4⟩ is a PEO in GN, whereas ⟨v2,v1,v3,v4⟩ is not. An undirected graph G is triangulated or chordal if every cycle of length >3 has a chord, i.e. an edge connecting two non-consecutive vertices of the cycle. The constraint graph GN of a network N=⟨V,𝒟,C⟩ can be completed or triangulated by adding new edges eij labeled with the universal constraint Di×Dj. Triangulated constraint graphs play a key role in efficiently solving large sparse constraint networks [4, 10, 15]. A constraint graph G is triangulated iff it admits a perfect elimination ordering (PEO) [22]. An ordering ≺ of the vertices of a constraint graph G=(V,E) is a PEO if Fv≔{w∣evw∈E,v≺w} (i.e. the set of successors of v in the ordering) induces a complete subgraph of G for all v∈V, (see Fig. 1 for an example). Note that given a constraint graph G=(V,E) and an ordering ≺ of variables in V, we call variable w a successor of variable v if it occurs after v in ≺ and evw∈E. A variable vi is arc-consistent (AC) relative to a variable vj (or Rij) if for any a∈Di we have some b∈Dj such that ⟨a,b⟩∈Rij. Given a constraint graph GN=(V,E), an edge eij of GN is AC if vi is AC relative to vj. Let π=(v1,⋯,vi,⋯,vk) be a path in GN with e1k∈E. We say that π is path-consistent (PC) if for all ⟨c1,ck⟩∈R1k we can find values for all intermediate variables vi(1<i<k) such that all the constraints Ri,i+1(1≤i<k) are satisfied. See Fig. 2 for an illustration. In particular, (v1,v3) is PC relative to a third vertex v2 if e12,e23, and e13 are all in E and the path π=(v1,v2,v3) is PC. A constraint graph GN is AC (respective PC) iff all edges (respective paths) in GN are AC (respective PC); GN is strongly PC iff it is both AC and PC. A constraint network N is AC if GN is AC and N is PC if the completion of GN is PC [10]. Figure 2. View largeDownload slide Path-Consistency [10]. Figure 2. View largeDownload slide Path-Consistency [10]. Consider the BCN N in Example 1. We can see that every edge in GN is AC, but the path π=(v3,v2,v4) is not PC as R34 is not contained in R32◦R24. In this paper, we are concerned with BCNs defined over a particular constraint language and we use constraint languages, constraint classes and sets of relations interchangeably. Definition 2.2 [23] Let 𝒟={D1,…,Dn}be a set of domains. An n-ary relation Rover 𝒟is a subset of D1×…×Dn. For any tuple t∈Rand any 1≤i≤n, we denote by t[i]the value in the ith coordinate position of tand write tas ⟨t[1],…,t[n]⟩. Definition 2.3 ([23]). Given a set of binary relations Γ, we write Γ+for the set of relations that can be obtained from Γusing some sequence of the following operations: Cartesian product, i.e. for R1,R2∈Γ,R1×R2={⟨t1,t2⟩∣t1∈R1,t2∈R2}, Equality selection, i.e. for R∈Γ,τi=j(R)={t∈R∣t[i]=t[j]}and Projection, i.e. for R∈Γ,πi1,⋯,ik(R)={⟨t[i1],⋯,t[ik]⟩∣t∈R}. A relation Ris said to be definable in Γif R∈Γ+, and a set of binary relations Γis said to be complete if every binary relation definable in Γis also contained in Γ. The completion of Γ, written as Γc, is the set of all binary relations contained in Γ+. The following lemma asserts that a complete set of binary relations is closed under the operations that are used to achieve PC. Lemma 2.1 ([24]). Let Γbe a complete set of binary relations over a domain D. Suppose R,Sare binary relations in Γ. Then R∩S and R◦Sare also in Γ. Let Γ be a set of binary relations. A BCN N=⟨V,𝒟,C⟩ is defined over (or, simply, over) Γ if R∈Γ for every constraint (s,R) in C. The constraint satisfaction problem (CSP) of Γ, denoted by CSP(Γ), is the problem of deciding the consistency of BCNs defined over Γ. CSP(Γ+) is log-space reducible to CSP(Γ) [24]. A set of binary relations Γ is weakly closed under singletons, if {⟨a,b⟩}∈Γ+ for any R∈Γ and any ⟨a,b⟩∈R. In this paper, we often assume that the constraint languages are complete and weakly closed under singletons. We will see that this is not very restrictive as, for any set Γ of binary relations that is closed under a majority operation φ, the completion Γc of Γ is also closed under φ [23] and weakly closed under singletons (cf. Proposition 5.1). Algorithm 1 DPC Algorithm 1 DPC 3. THE STRONG DPC ALGORITHM This section recalls the notions of directional arc-consistency (DAC) and DPC, and the strong DPC enforcing algorithm of Dechter [25]. Definition 3.1 [25] Let N=⟨V,𝒟,C⟩be a BCN and ≺=(v1,…,vn)an ordering of the variables in V. We say that Nis directionally arc-consistent (DAC) relative to ≺if viis arc-consistent relative to vkfor all k>iwith Rik∈C. Similarly, Nis DPC relative to ≺if, for any i≠j, (vi,vj)is PC relative to vkfor all k>i,j whenever Rik,Rjk∈C. Meanwhile, Nis strongly DPC relative to ≺if it is both DAC and DPC relative to ≺. The strong DPC algorithm is presented as Algorithm 1. In comparison with traditional PC algorithms [11], a novelty of this single pass algorithm is its explicit reference to the constraint graph of the input constraint network. As only Line 8 may require extra working space, Algorithm 1 has a very low space complexity in practice. Further, Algorithm 1 runs in O(w*(≺)·e·(α+β)) time [25], where e is the number of edges of the output constraint graph, w*(≺) is the induced width [25] of the ordered graph along ≺, and α,β are the runtimes of relational intersection and composition respectively. Note that w*(≺)≤n and α,β are bounded by O(d2) and O(d3), respectively, where d is the largest domain size. Proposition 3.1 ([25]). Let (N,≺)be an input to Algorithm1, where ≺=(v1,…,vn). Suppose N′=⟨V,𝒟′,C′⟩is the output. Then GN′is triangulated and ≺−1, the inverse of ≺, is a PEO of GN′; N′is equivalent to Nand strongly DPC relative to ≺. Let Γ be a set of binary relations. We say that Algorithm 1decides CSP(Γ) if, for any given BCN N in CSP(Γ) and any ordering ≺ of variables of N, Algorithm 1 returns ‘Inconsistent’ iff N is inconsistent. The following corollary follows directly from Proposition 3.1. Corollary 3.1 Let Γbe a complete set of binary relations. Then the following two conditions are equivalent: Algorithm1decides CSP(Γ). Let Nbe any not trivially inconsistent BCN in CSP(Γ). Suppose N’s constraint graph GNis triangulated and let ≺−1=(vn,…,v1)be a PEO of it. Then Nis consistent if Nis strongly DPC relative to ≺. Example 2 The graph coloring problem N with domains {red,blue} depicted in Fig. 3 is taken from [25] and can be decided by Algorithm 1. After applying Algorithm 1 to (N,≺), where ≺=(v1,v2,v3,v4), a solution can be obtained along ≺ in a backtrack-free manner (see Fig. 3b). FIGURE 3. View largeDownload slide A graph coloring problem with domain Di={red,blue} for i=1,2,3,4 [25]. (a) The constraint graph GN of a graph coloring problem N and (b) the constraint graph obtained by applying Algorithm 1 to (N,≺) where ≺=(v1,v2,v3,v4). FIGURE 3. View largeDownload slide A graph coloring problem with domain Di={red,blue} for i=1,2,3,4 [25]. (a) The constraint graph GN of a graph coloring problem N and (b) the constraint graph obtained by applying Algorithm 1 to (N,≺) where ≺=(v1,v2,v3,v4). 4. DIRECTIONAL PC AND VARIABLE ELIMINATION This section characterizes the binary constraint languages Γ such that CSP(Γ) can be decided by DPC. We observe that DPC achieves (strong) DPC using the idea of variable elimination [25]: it iterates variables along the ordering ≺−1, and propagates the constraints of a variable vk to subsequent variables in the ordering with the update rule Rij←Rij∩(Rik◦Rkj), as if vk is ‘eliminated’. The following definition formalizes the process of elimination. Definition 4.1 Let N=⟨V,𝒟,C⟩be a BCN with V={v1,…,vn}and 𝒟={D1,…,Dn}. For a variable vx in V, let Ex={Rix∣Rix∈C}. The network obtained after vxis eliminated from N, written as N−x=⟨V⧹{vx},{D1′,…,Dx−1′,Dx+1′,…,Dn′},C′⟩,is defined as follows: If Ex={Rix}, we set C′=C⧹Exand let Dj′=Di∩Rxi(Dx),ifj=iDj,otherwise (1) If ∣Ex∣≠1, we set Dj′=Djfor all j≠x, and let C′=(C⧹Ex)∪{(Rix◦Rxj)∩Rij∣Rjx,Rix∈Ex,i≠j}. Rij is assumed to be Di×Dj if Rij∉C. Figure 4 illustrates the elimination process. Definition 4.2 A BCN N=⟨V,𝒟,C⟩is said to have the VEP, if, for any vxin V, every solution of N−xcan be extended to a solution of N. Nis said to have weak VEP, if, for any vxin Vsuch that vxis AC relative to all relations in Ex, every solution of N−xcan be extended to a solution of N. A set of binary relations Γis said to have (weak) VEP if every BCN in CSP(Γ)has (weak) VEP. Such a set of binary relations Γis also called a (weak) VEP class. FIGURE 4. View largeDownload slide Two binary constraint networks N and N−4. FIGURE 4. View largeDownload slide Two binary constraint networks N and N−4. It is easy to see that, if a BCN (a set of binary relations) has VEP, then it also has weak VEP. The following example explains why we should take special care when eliminating variables with only one successor in Equation (1). Example 3 Let N=⟨V,𝒟,C⟩ be a BCN defined by V={v1,v2,v3}, D1=D2=D3={0,1}, and C={((v3,v2),R), ((v2,v1),R)} with R={(1,0)} (see Fig. 5). Suppose we do not have the operation specified in Equation (1) and ≺=(v3,v2,v1) is the variable elimination ordering. Let N−3 be the restriction of N to {v1,v2}. Then N−3 has a unique solution σ but it cannot be extended to a solution of N. Proposition 4.1 Let Γbe a complete set of binary relations that is weakly closed under singletons. Then DPCdecides CSP(Γ)iff Γhas VEP. Proof We address the ‘if’ part first. Assume that Γ has VEP, and let N=⟨V,𝒟,C⟩ be a network in CSP(Γ) that is not trivially inconsistent and strongly DPC relative to ≺=(v1,…,vn), where GN is triangulated and ≺−1 is a PEO of it. We show that N is consistent. Let Vi={v1,…,vi} and N∣Vi be the restriction of N to Vi. We claim that N∣Vi is consistent for k=1,…,n and prove the claim by induction on k. First, since N is not trivially inconsistent, D1 is not empty and there is an a1∈D1. Then, N∣V1 is consistent and has a solution σ1=⟨a1⟩. Further, suppose that N∣Vi is consistent and σi=⟨a1,a2,…,ai⟩ is a solution of N∣Vi. We show that σi can be extended to a solution σi+1=⟨a1,…,ai,ai+1⟩ of N∣Vi+1. Since Γ has VEP and N∣Vi is indeed the same network as the one obtained by eliminating vi+1 from N∣Vi+1, by Definition 4.2, σi can be extended to a solution σi+1 of N∣Vi+1. Thus, by induction, N is consistent. By Corollary 3.1, DPC decides CSP(Γ). Next, we address the ‘only if’ part. Assume that DPC decides CSP(Γ). We show that Γ has VEP. Let N=⟨V,𝒟,C⟩ be a not trivially inconsistent network in CSP(Γ). Given vx∈V, we show that every solution of N−x can be extended to N. Without loss of generality, we assume that x=n. Let σ=⟨a1,…,an−1⟩ be a solution of N−n, and En={Rin∣Rin∈C}. By the definition of N−n, for any Rin,Rjn∈En(i≠j), we have ⟨ai,aj⟩∈(Rin◦Rnj)∩Rij. We then construct a new problem N′=⟨V,𝒟′,C′⟩ in CSP(Γ), where 𝒟′={D1′,…,Dn−1′,Dn} with Di′={ai} for 1≤i<n and C′={{⟨ai,aj⟩}∣1≤i≠j<n}∪En. Clearly, σ is also a solution of N−n′ and N−n′ is strongly PC and, hence, strongly DPC relative to the ordering (v1,…,vn−1). Further, since ⟨ai,aj⟩∈(Rin◦Rnj)∩Rij for any Rin,Rjn∈En(i≠j), we have that N′ is strong DPC relative to ≺=(v1,…,vn). As GN−n′ is a complete graph, GN′ is triangulated with ≺−1 being a PEO of it. As DPC decides CSP(Γ) and N′∈CSP(Γ), by Corollary 3.1, N′ is consistent and has a solution that extends σ and is also a solution of N. This shows that N is consistent and, hence, Γ has VEP.□ FIGURE 5. View largeDownload slide A constraint graph that is a chain. FIGURE 5. View largeDownload slide A constraint graph that is a chain. Therefore, if N=⟨V,𝒟,C⟩ is defined over a complete VEP class, then DPC can decide it. Note that in the above proposition we require Γ to be complete. This is important; for example, every row-convex constraint [26] network has VEP (cf. the proof of [27, Theorem 1]) and, hence, the class of row-convex constraints has VEP. However, DPC does not decide the consistency problem over the row-convex constraint class because it was shown to be NP-complete (cf. e.g. [28]). VEP is closely related to the Helly property. For example, any set of intervals on the real line satisfies the Helly property, because the intersection of all intervals is not empty if every pair of intervals intersects. We give the formal definition as follows. Definition 4.3 A set Γof binary relations over 𝒟={D1,…,Dn}is said to have the Helly property if for any k>2binary relations, Ri⊆Dui×Du0(1≤i≤k,1≤ui≠u0≤n), in Γ, and for any kvalues, ai∈Dui(1≤i≤k), such that Ri(ai)={b∈Du0∣⟨ai,b⟩∈Ri}is nonempty, we have ⋂i=1kRi(ai)≠∅iff Ri(ai)∩Rj(aj)≠∅for any 1≤i≠j≤k. Example 4 Let Du0={a,b,c,d},Du1={e},Du2={f},Du3={g} and R1={⟨e,a⟩,⟨e,b⟩,⟨e,c⟩},R2={⟨f,b⟩,⟨f,c⟩,⟨f,d⟩},R3={⟨g,c⟩,⟨g,d⟩,⟨g,a⟩}. See Fig. 6 for an illustration. Then Γ={R1,R2,R3} over 𝒟={Du0,Du1,Du2,Du3} has the Helly property. Theorem 4.1 A set of binary relations Γover 𝒟={D1,…,Dn}has VEP iff it has the Helly property. Proof Suppose Γ has VEP. We show that Γ has the Helly property. Let 𝒟={D1,…,Dn} be the set of domains related to relations in Γ. Suppose Ri⊆Dui×Du0 ( 1≤i≤k, 1≤ui≠u0≤n) are k>2 binary relations in Γ and ai∈Dui ( 1≤i≤k) are values such that ∅≠Ri(ai)⊆Du0. Suppose Ri(ai)∩Rj(aj) is nonempty for any i,j with 1≤i≠j≤k. We show that ⋂i=1kRi(ai) is nonempty. To this end, we construct a BCN N=⟨V,𝒟′,C⟩ over Γ with V={v1,…,vk,vk+1}, 𝒟′={Du1,…,Duk,Du0}, and C={Ri,k+1∣1≤i≤k}, where Ri,k+1=Ri. Consider N−(k+1). As Ri(ai)∩Rj(aj)≠∅, we have ⟨ai,aj⟩∈Ri,k+1◦Rk+1,j. This shows that σ=⟨a1,…,ak⟩ is a solution of N−(k+1). Since Γ and, hence, N have VEP, N has a solution that extends σ. Hence there exists a∈Du0 such that a∈Ri,k+1(ai) for every 1≤i≤k. Thus ⋂i=1kRi(ai)≠∅. This proves that Γ has the Helly property. Suppose Γ over 𝒟={D1,…,Dn} has the Helly property. We show that Γ has VEP. Let N=⟨V,𝒟,C⟩ be a not trivially inconsistent BCN defined over Γ with V={v1,v2,…,vn} and C is a set of binary constraints ((vi,vj),R) with R∈Γ. Let En={Rin∣Rin∈C}. Assume σ=⟨a1,a2,…,an−1⟩ is a solution of, say, N−n. We show that there exists an∈Dn such that ⟨a1,…,an−1,an⟩ is a solution of N. If En is empty, we can take any an from Dn which is nonempty since N is not trivially inconsistent; if En contains only one constraint, say, ((vi,vn),Rin), by ai∈Di′=Di∩Rni(Dn), there exists an∈Dn such that ⟨ai,an⟩∈Rin; if En contains k≥2 constraints and let them be ((vui,vn),Ruin)(1≤i≤k), we have ⟨aui,auj⟩∈Ruiuj∩(Ruin◦Rnuj) for 1≤i≠j≤k. Therefore, we have Ruin(ai)∩Rujn(aj)≠∅ for 1≤i≠j≤k. By the Helly property of Γ, we have ⋂i=1kRuin(ai)≠∅. So we can take any an∈⋂i=1kRuin(ai) so that ⟨a1,…,an−1,an⟩ is a solution of N. Therefore, Γ has VEP.□ FIGURE 6. View largeDownload slide An illustration of Example 4. FIGURE 6. View largeDownload slide An illustration of Example 4. The class of row-convex constraints [26] and the class of tree-convex constraints [29] have the Helly property and, thus, they have VEP by Theorem 4.1. Proposition 4.1 only concerns a complete set of binary relations that has VEP. The following proposition, viz., Proposition 4.2, does not require a set of binary relations to be complete. However, we also note that PC operations can destroy the Helly property; this suggests that Proposition 4.2 is only useful when N happens to have the Helly property after enforcing DPC. Proposition 4.2 Suppose Γis a set of binary relations that has the Helly property. Let N∈CSP(Γ). Suppose Nis not trivially inconsistent and GNis triangulated with ≺−1=(vn,…,v1)as a PEO of it. Then Nis consistent if it is strongly DPC relative to ≺. Proof Let N∈CSP(Γ). Suppose N=⟨V,𝒟,C⟩ is not trivially inconsistent and GN is triangulated with ≺−1=(vn,…,v1) being a PEO of it. Suppose N is strongly DPC relative to ≺. We show that N is consistent. Let Vk={v1,…,vk} and Nk be the restriction of N to Vk. Since N is not trivially inconsistent, we have that N1 is consistent. Suppose Nk is consistent, we show that Nk+1 is consistent. Let σ=⟨a1,…,ak⟩ be a solution of Nk. Let Ek+1={Ri,k+1∣Ri,k+1∈C,i≤k}. Since GN is triangulated and ≺−1=(vn,…,v1) is a PEO of it, for any two different constraints Ri,k+1,Rj,k+1∈Ek+1, we have Rij∈C. Further, since N is strongly DPC relative to ≺, we have ⟨ai,aj⟩∈(Ri,k+1◦Rk+1,j)∩Rij. Thus, we have Ri,k+1(ai)∩Rj,k+1(aj)≠∅ for any two different constraints Ri,k+1,Rj,k+1∈Ek+1. Since Γ has the Helly property, we have ⋂Ri,k+1∈Ek+1Ri,k+1(ai)≠∅. Therefore, σ can be extended to a solution of Nk+1 and Nk+1 is consistent. By induction on k, we have that N is consistent.□ 5. MAJORITY-CLOSED CONSTRAINT LANGUAGES In this section, we characterize weak VEP classes. We will show that a complete set of binary relations Γ has weak VEP iff all relations in Γ are closed under a majority operation, which is defined as follows. Definition 5.1 ([30]). Let 𝒟={D1,…,Dn}be a set of domains. A multi-sorted majority operation φon 𝒟is a set {φ1,…,φn}, where φiis a one-sorted majority operation on Di, i.e. a mapping from Di3to Disuch that φi(e,d,d)=φi(d,e,d)=φi(d,d,e)=dfor all d,e in Di. An m-ary relation R⊆Di1×⋯×Dimwith i1,…,im∈{1,2,…,n}is said to be closed under φif φ(t1,t2,t3)=⟨φi1(t1[1],t2[1],t3[1]),…,φim(t1[m],t2[m],t3[m])⟩is in Rfor any t1,t2,t3∈R. A set of relations Γis said to be closed under φif every R∈Γis closed under φ. A set of relations Γ is called a majority-closed language if there exists a (multi-sorted) majority operation φ such that every relation in Γ is closed under φ. 5.1. Tree-preserving constraints The class of tree-preserving constraints is majority-closed. Definition 5.2 [31] An undirected graph structure can be associated to a finite domain Dsuch that there is a bijection between the vertices in the graph and the values in D. If the graph is connected and acyclic, i.e. a tree, then we say it is a tree domain, denoted by T=(D,E)where Eis a set of edges. A constraint Rijover tree domains Ti=(Di,Ei)and Tj=(Dj,Ej)is called tree-preserving if the image of every subtree in Tiis a subtree in Tj. An example of tree-preserving constraint is shown in Fig. 7. A CRC constraint is a special tree-preserving constraint where related tree domains are chains [31]. Definition 5.3 Let Tibe a nonempty tree domain for a variable vi. The standard majority operation mion Tiis defined as: (∀a,b,c∈Ti)mi(a,b,c)=πa,b∩πb,c∩πa,c,where a,b,care not necessarily distinct and πu,vdenotes the unique path from uto vin Ti. The following result establishes the connection between tree-preserving constraints and majority-closed constraints. Theorem 5.1 [31] Let Tiand Tjbe two nonempty tree domains and miand mjtheir standard majority operations. Suppose Rij⊆Ti×Tjis a nonempty constraint such that both Rijand Rjiare arc-consistent. Then Rijis closed under {mi,mj}iff both Rijand Rjiare tree-preserving w.r.t. Tiand Tj. FIGURE 7. View largeDownload slide An example of tree-preserving constraint Rij with Di={a,b} and Dj={e,f,g,h}, where a dashed arrow from a node u in Ti to a node v in Tj indicates that ⟨u,v⟩∈Rij. FIGURE 7. View largeDownload slide An example of tree-preserving constraint Rij with Di={a,b} and Dj={e,f,g,h}, where a dashed arrow from a node u in Ti to a node v in Tj indicates that ⟨u,v⟩∈Rij. 5.2. Weak VEP classes and majority-closed classes We first study a few properties of majority-closed classes. Proposition 5.1 Let Γbe the set of binary relations that is closed under a multi-sorted majority operation φ={φ1,…,φn}on 𝒟={D1,…,Dn}. Then Γis weakly closed under singletons. Proof Suppose R is a relation in Γ and ⟨a,b⟩∈R⊆Di×Dj. We show that {⟨a,b⟩} is closed under φ. For any t1,t2,t3∈{⟨a,b⟩}, we have t1=t2=t3=⟨a,b⟩, and, hence, φ(t1,t2,t3)=⟨φi(a,a,a),φj(b,b,b)⟩=⟨a,b⟩. This shows that {⟨a,b⟩} is closed under φ and, hence, a relation in Γ.□ Majority-closed relations are decomposable. Intuitively, a relation R is r-decomposable if it is representable by a r-ary constraint network, i.e. there exists a r-ary constraint network such that its set of solutions is exactly R. In the following, given an m-ary relation R, a m-tuple t, and a set of indices I={i1,…,ik}, we use πI(t) and πI(R) to denote ⟨t[i1],…,t[ik]⟩ and {⟨t[i1],…,t[ik]⟩∣t∈R}, respectively. Definition 5.4 [23] Let Rbe an m-ary relation and Ir={I∣I⊆{1,…,m},∣I∣≤r}. Ris said to be r-decomposable if, for all m-tuples t, we have t∈Rif πI(t)∈πI(R)for all I∈Ir. Definition 5.5 A constraint network Nis said to be globally consistent if any partial solution of Ncan be extended to a solution of N. Theorem 5.2 ([23]). Let Γbe a set of binary relations over a set of finite domains 𝒟={D1,…,Dn}. The following statements are equivalent: Γis a majority-closed constraint language. Every R∈Γ+ is 2-decomposable. For every N∈CSP(Γ), establishing strong PC in Nensures global consistency. Finally, we show that complete weak VEP classes are majority-closed classes. Theorem 5.3 Let Γbe a complete set of binary relations over a set of finite domains 𝒟={D1,…, Dn}. Then Γhas weak VEP iff it is a majority-closed class. Proof We first deal with the ‘only if’ part. Suppose that Γ is a complete set of binary relations that has weak VEP. By Theorem 5.2, we only need to show that for every BCN in CSP(Γ), establishing strong PC ensures global consistency. Let N0 be a network in CSP(Γ) and suppose N=⟨V,𝒟,C⟩ is the network obtained by enforcing strong PC on N0. Since Γ is complete and hence closed under operations for achieving PC by Lemma 2.1, N is also a problem in CSP(Γ). Suppose N is not trivially inconsistent. We show that any partial solution of N can be extended to a solution of N. Suppose V′={v1,…,vm−1}⊂V and σ=⟨a1,…,am−1⟩ is a solution of N∣V′, which is the restriction of N to V′. Assume further that vm∉V′ is a new variable and let V″=V′∪{vm}. We show that σ can be consistently extended to N∣V″, the restriction of N to V″. Because N is strongly PC, N∣V″ is strongly PC as well. In particular, vi is AC relative to vm for any Rim in C, and Rij is PC relative to vm (i.e. Rij⊆Rim◦Rmj) for any i≠j such that both Rim and Rjm are in C. By Definition 4.1, N∣V′ is the same as (N∣V″)−m, viz., the network obtained by eliminating vm from N∣V″. Moreover, since N and, hence, N∣V″ are AC, vm is AC relative to all constraints Rim that are in C. By the assumption that Γ has weak VEP, σ can be consistently extended to vm. Following this reasoning, we will find a solution of N that extends σ. Next, we consider the ‘if’ part. Suppose that Γ is a complete set of binary relations that is closed under some multi-sorted majority operation φ={φ1,…,φn} on 𝒟. Let N=⟨V,𝒟,C⟩ be a problem in CSP(Γ) and vx a variable in V. Let Ex={Rix∣Rix∈C}, and N−x=⟨V⧹{vx},𝒟,C′⟩, where C′=(C∪{(Rix◦Rxj)∩Rij∣Rjx,Rix∈Ex})⧹Ex. Suppose that vx is AC relative to all relations in Ex. We only need to show that any solution of N−x can be extended to a solution of N. We prove this by contradiction. Let σ be a solution of N−x. Assume that σ cannot be extended to a solution of N. Therefore, Ex cannot be empty, otherwise σ can be trivially extended to a solution of N. The case where Ex={Rix} is a singleton is also impossible, as by Equation (1), vi is AC relative to Rix and we could extend σ to a solution of N by assigning any valid value to vx. Suppose that Ex has q≥2 constraints and let them be ((v1,vx),R1), …, ((vq,vx),Rq). We define a new problem N′=⟨V,𝒟,Ex⟩ as illustrated in Fig. 8. Since vx is AC relative to all relations in Ex, it is easy to verify that N′ has a solution. For example, one can construct a solution of N′ by simply picking a value from Dx for vx and then extending that valuation to v1,…,vq. Now, we construct a q-ary relation R={⟨γ(v1),…,γ(vq)⟩∣γ is a solution of N′}. The solution set S of N′ can be obtained by using a sequence of the Cartesian product, equality selection, and projection operations [23]. Therefore, S∈Γ+. Since R=πv1,…,vq(S), we have R∈Γ+. By Theorem 5.2, R should be 2-decomposable; however, in the sequel we show that it is not, which is a contradiction. Let t=⟨σ(v1),…,σ(vq)⟩, where σ is a solution of N−x. It is clear that t is a solution of N′∣{v1,…,vq}. For any list of indices I chosen from {1,…,q}, with ∣I∣≤2, we claim that πI(t)∈πI(R). We recall that, for any two relations Rix,Rjx∈Ex, the relation between vi and vj in N−x is Rij∩(Rix◦Rxj). Therefore, any partial solution ⟨σ(vi),σ(vj)⟩(1≤i,j≤q) of N′ can be consistently extended to vx and, by the construction of N′, further consistently extended to a solution of N′. Thus, πI(t) is in πI(R) for any list of indices I chosen from {1,…,q}, with ∣I∣≤2. However, t∉R because σ cannot be extended to a solution of N′, which implies that R is not 2-decomposable.□ FIGURE 8. View largeDownload slide Illustration of proof of Theorem 5.3. FIGURE 8. View largeDownload slide Illustration of proof of Theorem 5.3. 6. THE VARIABLE ELIMINATION ALGORITHM DPC* This section presents a variant of DPC for solving BCNs defined over any weak VEP class. The new algorithm, called DPC* and presented as Algorithm 2, can solve problems that are not solvable by DPC (cf. Example 5 and Proposition 6.2). Compared with the variable elimination algorithm for solving CRC constraints [27], DPC* enforces a weaker AC condition instead of full AC. We first justify the correctness of Algorithm 2. Theorem 6.1 Let Γbe a complete weak VEP class. Suppose Nis a BCN defined over Γand ≺=(v1,…,vn)any ordering of the variables of N. Then, given Nand ≺, Algorithm2does not return ‘Inconsistent’ iff Nis consistent. Algorithm 2 DPC* Algorithm 2 DPC* Proof Suppose the input network N is consistent. Since DPC* only prunes off certain infeasible domain values or relation tuples, the algorithm does not find any empty domains or relations in Lines 4, 9 and 17. Thus, it does not return ‘Inconsistent’. Suppose the algorithm does not return ‘Inconsistent’ and let N′=⟨V,𝒟′,C′⟩ be the output network, where 𝒟′={D1′,…,Dn′}. We show that N′ is consistent. Write M(0) for N and write M(i) for the result of the ith loop in the call of DPC* on input N and ≺=(v1,v2,…,vn). Then N′=M(n−1) and all M(i)(0≤i<n) are equivalent to N. Let Qi be the restriction of M(i) to {v1,v2,…,vn−i} ( 0≤i<n). In essence, Qi is obtained by eliminating vn−i+1 from Qi−1 (Lines 2–5 or Lines 11–18), while also enforcing AC (Lines 7–10) for vn−i+1 relative to all its successors if it has more than one successor. Since Γ is a complete weak VEP class, every BCN defined over Γ has weak VEP. In particular, each Qi(0≤i<n) is defined over Γ and has weak VEP. This implies that every solution of Qi+1 can be extended to a solution of Q1. Since no inconsistency is detected in the process, we have D1′≠∅ and thus Qn−1 is consistent. By the above analysis, this implies that Qn−2,…,Q1,Q0=M(0)=N are all consistent.□ The preceding proof also gives a way to generate all solutions of a consistent input network backtrack-free by appropriately instantiating the variables along the input ordering ≺. Indeed, for all 1≤k<n, a solution ⟨a1,…,ak⟩ of Nk′ can be extended to a solution ⟨a1,…,ak+1⟩ of Nk+1′ by choosing an element ak+1 from the intersection of all Ri,k+1(ai) with i≤k and Ri,k+1∈C′, which is always nonempty as shown in the preceding proof. As we know that if Γ is majority-closed, the completion of Γ is also majority-closed [23], and that complete majority-closed classes and complete weak VEP classes are equivalent by Theorem 5.3, this also proves the following result: Definition 6.1 A constraint network Nis decomposable relative to a variable ordering ≺=(v1,…,vn)if any partial solution of Non {v1,…,vk}for any 1≤k<ncan be extended to a solution of N. Proposition 6.1 Suppose Nis a consistent BCN defined over a majority-closed class and ≺=(v1,…,vn)an ordering of variables of N. Then, given Nand ≺, Algorithm2returns an equivalent subnetwork N′that is decomposable relative to ≺. Note that Lines 2–10 in DPC* do not achieve DAC of input networks. Therefore, DPC*does not achieve strong DPC. Since the overall runtime of Lines 2–10 is the same as enforcing DAC, this places DPC* in the same time complexity class as DPC, which is O(w*(≺)ed3), where w*(≺) is the induced width of the ordered constraint graph along the input variable ordering ≺. The following example, however, gives a BCN that can be solved by DPC* but not by DPC, which shows that the loop in Lines 7–10 is necessary. Example 5 Let D={a,b,c} and φ be the majority operation on D such that for all i,j,k∈D, φ(i,j,k)=a if i≠j, j≠k, and i≠k, and φ(i,j,k)=r otherwise, where r is the repeated value (e.g. φ(b,c,b)=b). Let Γ={R1,R2,R3,R4,R5,R6}, where R1={⟨a,a⟩,⟨a,c⟩}, R2={⟨c,c⟩,⟨c,b⟩}, R3={⟨b,b⟩,⟨b,a⟩}, R4={⟨a,c⟩}, R5={⟨c,b⟩} and R6={⟨a,b⟩}. Every R∈Γ is closed under the majority operation φ on D. Now, consider the constraint network N∈CSP(Γ) as presented in Fig. 9. Since Rxw◦Rwz=R6, Rxw◦Rwy=R4, and Ryw◦Rwz=R5, the eliminated network N−w is the same as the restriction of N to the set of variables {vx,vy,vz}. Let σ(vx)=a,σ(vy)=c,σ(vz)=b. Then σ is a solution of N−w, but σ cannot be extended to a solution of N. Thus, N and hence Γ do not have VEP. By Theorem 4.1, DPC does not decide CSP(Γ). On the other hand, since Γ is majority-closed, by Proposition 6.1, DPC* can correctly decide the consistency of N. This observation is confirmed by calling the two algorithms on N. Take the PEO ≺=(w,x,y,z) as an example; the other PEOs are analogous. Let (N,≺) be an input to DPC. After processing w, we have Dx={a},Dy={c},Dz={b} and Rxy={⟨a,c⟩}, Rxz={⟨a,b⟩}, Rzy={b,c}. We can observe that ⟨x=a,y=c,z=b⟩ is a solution to the eliminated subnetwork. Thus, if we keep running DPC, it will not detect inconsistency. On the other hand, for DPC*, when eliminating w, DPC* makes w AC relative to its neighbors. Note that DPC does not perform this operation. After that, Dw is empty, and the algorithm will stop and output ‘Inconsistent’. Proposition 6.2 Let φ={φ1,…,φn}be a majority operation on 𝒟={D1,…,Dn}. If there exists a domain Diin 𝒟that contains more than two elements, then the set Γφof binary relations that are closed under φhas neither the Helly property nor VEP. Proof Suppose a,b,c are three different values from Di. It is easy to see that the relations R1={⟨a,a⟩,⟨a,b⟩}, R2={⟨a,b⟩,⟨a,c⟩}, and R3={⟨a,a⟩,⟨a,c⟩} are all closed under φ. Therefore, R1, R2, and R3 are all in Γφ. Because any two of R1(a),R2(a),R3(a) have a common element but R1(a)∩R2(a)∩R3(a)=∅, this shows that Γφ does not have the Helly Property and, hence by Theorem 4.1, does not have VEP.□ FIGURE 9. View largeDownload slide A constraint network N and its elimination N−w. FIGURE 9. View largeDownload slide A constraint network N and its elimination N−w. This result shows that no complete VEP class could have a domain with three or more values. Therefore, there are no interesting complete constraint languages except the Boolean ones that can be decided by DPC (cf. Proposition 4.1), while all binary majority-closed classes (including CRC and tree-preserving constraints) can be decided by DPC* (cf. Proposition 6.1). DPC* can also be used to solve majority-closed constraints of higher arities. This is because, by Theorem 5.2, every relation definable in a majority-closed language is 2-decomposable. Therefore, for each majority relation R of arity m>2, if a constraint c=((y1,…,ym),R) appears in a constraint network N, we could replace c with a set of binary constraints cij=((yi,yj)∣πij(R))(1≤i<j≤m), where πij(R)={⟨t[yi],t[yj]⟩∣t∈R}. 7. EVALUATIONS In this section, we compare algorithm 𝒟𝖯𝖢* against the state-of-the-art algorithms for solving majority-closed constraint networks. These are SAC3-SDS [32] and PC2001 [33]. SAC3-SDS is currently the best singleton arc-consistency (SAC) enforcing algorithm [34]. Enforcing either SAC or PC correctly decides the consistency of a majority-closed constraint network [23, 35]. Note that singleton linear arc-consistency (SLAC) is an alternative consistency notion that can be enforced to solve majority-closed constraint networks [36], but, to the best of our knowledge, no practical SLAC algorithms have been made available so far. Comparison of time complexities among the three algorithms is presented in Table 1. TABLE 1. Comparison of time complexities among state-of-the-art algorithms for solving majority-closed constraint networks. Algorithm DPC* PC2001 SAC3-SDS Time O(w*(≺)ed3) O(n3d3) O(ned3) Algorithm DPC* PC2001 SAC3-SDS Time O(w*(≺)ed3) O(n3d3) O(ned3) View Large TABLE 1. Comparison of time complexities among state-of-the-art algorithms for solving majority-closed constraint networks. Algorithm DPC* PC2001 SAC3-SDS Time O(w*(≺)ed3) O(n3d3) O(ned3) Algorithm DPC* PC2001 SAC3-SDS Time O(w*(≺)ed3) O(n3d3) O(ned3) View Large Two different sets of data are considered for experiments, which are described as follows: Tree-preserving constraint networks. These networks are randomly generated using the random tree-preserving constraint generator detailed in [31]. Random majority-closed constraint networks. These can be used to test the average performance of different algorithms. To generate such networks, we need to generate random majority-closed constraint languages as follows: Randomly define a majority operation ⊗i:Di3→Di for each domain Di∈𝒟 as follows: for any x,y,z∈Di, ⊗i(x,y,z)=anyv∈Di,ifx,y,zarealldifferent,anyrepeatedvalueofx,y,z,otherwise. Note that v is chosen randomly for each triple ⟨x,y,z⟩, and it is a random choice in Di. Randomly generate constraints Rij⊆Di×Dj and test whether {⟨⊗i(tx[1],ty[1],tz[1]),⊗j(tx[2],ty[2],tz[2])⟩∣tx,ty,tz∈Rij}⊆Rij (2) holds. By definition, Rij is majority-closed under (⊗i,⊗j) iff (2) holds. We used the model in [10, 17] to generate random consistent constraint networks for experiments. These constraint networks were generated by varying four parameters: (i) the number of variables n, (ii) the size of the domains d, (iii) the density of the constraint networks ρ (i.e. the ratio of non-universal constraints to n2) and (4) the looseness of constraints l (i.e. the ratio of the number of allowed tuples to d2). We fix three of the four parameters and vary the remaining parameter. All algorithms were implemented taking equal care and using Python 3.6. Experiments were carried out on a computer with an Intel Core i5-4570 processor (3.2 GHz frequency per CPU core) and 4 GB of memory. The graphs in Figs 10 and 11 illustrate the experimental comparisons among algorithms DPC*, SAC3-SDS and PC2001 for solving tree-preserving and random majority-closed constraint networks respectively. The data points in each graph are CPU times averaged over 20 instances. FIGURE 10. View largeDownload slide Performance comparisons among DPC*, SAC3-SDS and PC2001 for solving tree-preserving constraint networks. (a) Evaluations in the number n of variables. We set ρ=0.5, l=0.3, d=100, (b) evaluations in the size d of domains. We set ρ=0.5, l=0.3, n=100, (c) evaluations in the density ρ of networks. We set l=0.3, d=100, n=100 and (d) evaluations in the looseness l of constraints. We set ρ=0.5, d=100, n=100. FIGURE 10. View largeDownload slide Performance comparisons among DPC*, SAC3-SDS and PC2001 for solving tree-preserving constraint networks. (a) Evaluations in the number n of variables. We set ρ=0.5, l=0.3, d=100, (b) evaluations in the size d of domains. We set ρ=0.5, l=0.3, n=100, (c) evaluations in the density ρ of networks. We set l=0.3, d=100, n=100 and (d) evaluations in the looseness l of constraints. We set ρ=0.5, d=100, n=100. FIGURE 11. View largeDownload slide Performance comparisons among DPC*, SAC3-SDS and PC2001 for solving random majority-closed constraint networks. (a) Evaluations in the number n of variables. We set ρ=0.5, l=0.3, d=100, (b) evaluations in the size d of domains. We set ρ=0.5, l=0.3, n=100, (c) evaluations in the density ρ of networks. We set l=0.3, d=100, n=100 and (d) evaluations in the looseness l of constraints. We set ρ=0.5, d=100, n=100. FIGURE 11. View largeDownload slide Performance comparisons among DPC*, SAC3-SDS and PC2001 for solving random majority-closed constraint networks. (a) Evaluations in the number n of variables. We set ρ=0.5, l=0.3, d=100, (b) evaluations in the size d of domains. We set ρ=0.5, l=0.3, n=100, (c) evaluations in the density ρ of networks. We set l=0.3, d=100, n=100 and (d) evaluations in the looseness l of constraints. We set ρ=0.5, d=100, n=100. From Figs 10 and 11, we observe that the corresponding results regarding tree-preserving and random majority-closed constraint networks are qualitatively similar. Therefore, our analysis only focuses on Fig. 10 and the results are applicable to Fig. 11 as well. We observe in Fig. 10a and b that all algorithms approximately show linear time behaviors with respect to n and d. On the other hand, Fig. 10c shows that PC2001 is not sensitive to the density of networks whereas DPC* and SAC3-SDSperform better when the density of networks is lower. Figure 10d shows that the CPU time for DPC* remains almost unchanged when increasing the looseness of constraints. However, the CPU times for PC2001 and SAC3-SDS both go up and then drop down when increasing the looseness of constraints. Finally, we also observe in all the graphs in Fig. 10 that the performance differences among DPC*, PC2001, and SAC3-SDS are remarkable. In particular, DPC* is up to seven times and five times faster than PC2001 and SAC3-SDS, respectively. This is mainly due to the fact that DPC* is a single pass algorithm over the ordered input constraint networks and, hence, very scalable compared to PC2001 and SAC3-SDS. 8. CONCLUSION This paper investigated which constraint satisfaction problems can be efficiently decided by enforcing DPC. Given a complete binary constraint language Γ, it turns out that DPC can decide CSP(Γ) if Γ is defined over domains with less than three values. For a possibly incomplete binary constraint language Γ, we proved that Γ has the Helly property if, and only if, for any not trivially inconsistent and triangulated binary constraint network N over Γ, N is consistent if it is strongly DPC relative to the inverse ordering of some PEO of the constraint graph of N. The classes of row-convex [26] and tree-convex [29] constraints are examples of constraint classes which have the Helly property. More importantly, we presented the algorithm DPC*, a simple variant of DPC, which can decide the CSP of any majority-closed constraint language, and is sufficient for guaranteeing backtrack-free search for majority-closed constraint networks, which have found applications in various domains, such as scene labeling, temporal reasoning, geometric reasoning, and logical filtering. Our evaluations also show that DPC* significantly outperforms the state-of-the-art algorithms for solving majority-closed constraint networks. FUNDING The work of S.L. was partially supported by NSFC (No. 11671244). M.S. acknowledges support from the European-funded H2020 project MoveCare (ID: 732158). REFERENCES 1 Montanari , U. ( 1974 ) Networks of constraints: fundamental properties and applications to picture processing . Inf. Sci. , 7 , 95 – 132 . Google Scholar CrossRef Search ADS 2 Maruyama , H. ( 1990 ) Structural Disambiguation with Constraint Propagation. Proc. 28th Annual Meeting of the Association for Computational Linguistics, University of Pittsburgh, Pittsburgh, Pennsylvania, USA, June 6–9, pp. 31–38. ACL, Stroudsburg. 3 Dechter , R. , Meiri , I. and Pearl , J. ( 1991 ) Temporal constraint networks . Artif. Intell. , 49 , 61 – 95 . Google Scholar CrossRef Search ADS 4 Planken , L. , de Weerdt , M. and van der Krogt , R. ( 2008 ) P3C: A New Algorithm for the Simple Temporal Problem. Proc. Eighteenth Int. Conf. Automated Planning and Scheduling, Sydney, Australia, September 14–18, pp. 256–263. AAAI, Palo Alto. 5 Li , S. , Liu , W. and Wang , S. ( 2013 ) Qualitative constraint satisfaction problems: an extended framework with landmarks . Artif. Intell. , 201 , 32 – 58 . Google Scholar CrossRef Search ADS 6 Freuder , E.C. ( 1982 ) A sufficient condition for backtrack-free search . J. ACM , 29 , 24 – 32 . Google Scholar CrossRef Search ADS 7 Mackworth , A.K. ( 1977 ) Consistency in networks of relations . Artif. Intell. , 8 , 99 – 118 . Google Scholar CrossRef Search ADS 8 Han , C.-C. and Lee , C.-H. ( 1988 ) Comments on mohr and henderson’s path consistency algorithm . Artif. Intell. , 36 , 125 – 130 . Google Scholar CrossRef Search ADS 9 Singh , M. ( 1996 ) Path consistency revisited . Int. J. Artif. Intell. Tools , 5 , 127 – 142 . Google Scholar CrossRef Search ADS 10 Bliek , C. and Sam-Haroud , D. ( 1999 ) Path Consistency on Triangulated Constraint Graphs. Proc. Sixteenth Int. Joint Conf. Artificial Intelligence, Stockholm, Sweden, 31 July–6 August, pp. 456–461. Morgan Kaufmann, Burlingto. 11 Chmeiss , A. and Jégou , P. ( 1998 ) Efficient path-consistency propagation . Int. J. Artif. Intell. Tools , 7 , 121 – 142 . Google Scholar CrossRef Search ADS 12 Barto , L. and Kozik , M. ( 2014 ) Constraint satisfaction problems solvable by local consistency methods . J. ACM , 61 , 3:1 – 3:19 . Google Scholar CrossRef Search ADS 13 Barto , L. ( 2016 ) The collapse of the bounded width hierarchy . J. Logic Comput. , 26 , 923 – 943 . Google Scholar CrossRef Search ADS 14 Dechter , R. and Pearl , J. ( 1987 ) Network-based heuristics for constraint-satisfaction problems . Artif. Intell. , 34 , 1 – 38 . Google Scholar CrossRef Search ADS 15 Sioutis , M. , Long , Z. and Li , S. ( 2016 ) Efficiently Reasoning about Qualitative Constraints through Variable Elimination. Proc. 9th Hellenic Conf. Artificial Intelligence, Thessaloniki, Greece, May 18–20, pp. 1: 1–1:10. ACM, New York. 16 Carbonnel , C. and Cooper , M.C. ( 2016 ) Tractability in constraint satisfaction problems: A survey . Constraints , 21 , 115 – 144 . Google Scholar CrossRef Search ADS 17 Deville , Y. , Barette , O. and van Hentenryck , P. ( 1999 ) Constraint satisfaction over connected row convex constraints . Artif. Intell. , 109 , 243 – 271 . Google Scholar CrossRef Search ADS 18 Kong , S. , Li , S. , Li , Y. and Long , Z. ( 2015 ) On Tree-preserving Constraints. Proc. 21st Int. Conf. Principles and Practice of Constraint Programming, Cork, Ireland, 31 August–4 September, pp. 244–261. Springer, Berlin. 19 Kumar , T.K.S. ( 2005 ) On the Tractability of Restricted Disjunctive Temporal Problems. Proc. 15th Int. Conf. Automated Planning and Scheduling, Monterey, California, USA, June 5–10, pp. 110–119. AAAI, Palo Alto. 20 Kumar , T.K.S. and Russell , S.J. ( 2006 ) On Some Tractable Cases of Logical Filtering. Proc. 16th Int. Conf. Automated Planning and Scheduling, Cumbria, UK, June 6–10, pp. 83–92. AAAI, Palo Alto. 21 Kumar , T.K.S. ( 2004 ) On geometric CSPs with (near)-linear domains and max-distance constraints. Workshop on Modelling and Solving Problems with Constraints, pp. 125–138. 22 Fulkerson , D. and Gross , O. ( 1965 ) Incidence matrices and interval graphs . Pac. J. Math. , 15 , 835 – 855 . Google Scholar CrossRef Search ADS 23 Jeavons , P. , Cohen , D. and Cooper , M.C. ( 1998 ) Constraints, consistency and closure . Artif. Intell. , 101 , 251 – 265 . Google Scholar CrossRef Search ADS 24 Cohen , D. and Jeavons , P. ( 2006 ) The complexity of constraint languages. In Rossi , F. , van Beek , P. and Walsh , T. (eds.) Handbook of Constraint Programming , pp. 245 – 280 . Elsevier , Amsterdam . 25 Dechter , R. ( 2003 ) Constraint Processing. . Morgan Kaufmann , Burlington . 26 van Beek , P. and Dechter , R. ( 1995 ) On the minimality and global consistency of row-convex constraint networks . J. ACM , 42 , 543 – 561 . Google Scholar CrossRef Search ADS 27 Zhang , Y. and Marisetti , S. ( 2009 ) Solving connected row convex constraints by variable elimination . Artif. Intell. , 173 , 1204 – 1219 . Google Scholar CrossRef Search ADS 28 Jeavons , P.G. and Cooper , M.C. ( 1995 ) Tractable constraints on ordered domains . Artif. Intell. , 79 , 327 – 339 . Google Scholar CrossRef Search ADS 29 Zhang , Y. and Yap , R.H.C. ( 2003 ) Consistency and Set Intersection. Proc. Eighteenth Int. Joint Conf. Artificial Intelligence, Acapulco, Mexico, August 9–15, pp. 263–270. Morgan Kaufmann, Burlington. 30 Bulatov , A.A. and Jeavons , P. ( 2003 ) An Algebraic Approach to Multi-sorted Constraints. Proc. 9th Int. Conf. Principles and Practice of Constraint Programming, Kinsale, Ireland, September 29–October 3, pp. 183–198. Springer, Berlin. 31 Kong , S. , Li , S. , Li , Y. and Long , Z. ( 2017 ) On tree-preserving constraints . Ann. Math. Artif. Intell. , 81 , 241 – 271 . Google Scholar CrossRef Search ADS 32 Bessière , C. , Cardon , S. , Debruyne , R. and Lecoutre , C. ( 2011 ) Efficient algorithms for singleton arc consistency . Constraints , 16 , 25 – 53 . Google Scholar CrossRef Search ADS 33 Bessière , C. , Régin , J.-C. , Yap , R.H. and Zhang , Y. ( 2005 ) An optimal coarse-grained arc consistency algorithm . Artif. Intell. , 165 , 165 – 185 . Google Scholar CrossRef Search ADS 34 Debruyne , R. and Bessière , C. ( 1997 ) Some Practicable Filtering Techniques for the Constraint Satisfaction Problem. Proc. Fifteenth Int. Joint Conf. Artificial Intelligence, Nagoya, Japan, August 23–29, pp. 412–417. Morgan Kaufmann, Burlington. 35 Chen , H. , Dalmau , V. and Grußien , B. ( 2011 ) Arc consistency and friends . J. Logic Comput. , 23 , 87 – 108 . Google Scholar CrossRef Search ADS 36 Kozik , M. ( 2016 ) Weak Consistency Notions for all the CSPs of Bounded Width. Proc. 31st Annual ACM/IEEE Symposium on Logic in Computer Science, New York, USA, pp. 633–641. ACM, New York. © The British Computer Society 2017. All rights reserved. For permissions, please e-mail: journals.permissions@oup.com This article is published and distributed under the terms of the Oxford University Press, Standard Journals Publication Model (https://academic.oup.com/journals/pages/open_access/funder_policies/chorus/standard_publication_model)

Journal

The Computer JournalOxford University Press

Published: Sep 1, 2018

There are no references for this article.

You’re reading a free preview. Subscribe to read the entire article.


DeepDyve is your
personal research library

It’s your single place to instantly
discover and read the research
that matters to you.

Enjoy affordable access to
over 18 million articles from more than
15,000 peer-reviewed journals.

All for just $49/month

Explore the DeepDyve Library

Search

Query the DeepDyve database, plus search all of PubMed and Google Scholar seamlessly

Organize

Save any article or search result from DeepDyve, PubMed, and Google Scholar... all in one place.

Access

Get unlimited, online access to over 18 million full-text articles from more than 15,000 scientific journals.

Your journals are on DeepDyve

Read from thousands of the leading scholarly journals from SpringerNature, Elsevier, Wiley-Blackwell, Oxford University Press and more.

All the latest content is available, no embargo periods.

See the journals in your area

DeepDyve

Freelancer

DeepDyve

Pro

Price

FREE

$49/month
$360/year

Save searches from
Google Scholar,
PubMed

Create lists to
organize your research

Export lists, citations

Read DeepDyve articles

Abstract access only

Unlimited access to over
18 million full-text articles

Print

20 pages / month

PDF Discount

20% off