Download presentation
Presentation is loading. Please wait.
1
1 Chapter 8 Advanced Consistency Methods Yaling Zheng CSCE 990-06: Advanced Constraint Processing
2
2 Outline: consistency methods Relational consistency (Section 8.1) Relational arc-consistency Relational path-consistency Relational m-consistency Relational (i, m)-consistency Directional relational-consistency (Section 8.2) Global consistency (i.e., BT-free) Domain tightness (Section 8.3.1) Constraint tightness (Section 8.3.2) Special types of networks Boolean theories (Section 8.4) Row convex constraints (Section 8.5) Linear inequalities (Section 8.6)
3
Arc-Consistency & Relational Arc-Consistency Constraint network 1 is arc-consistent iff x is arc-consistent relative to y and y is arc-consistent relative to x. How should we express constraint network 2 is consistent? y x x<y x y z x+y =z 3 Constraint network 1 Constraint network 2
4
Arc-Consistency D x = { 1, 2 } D y = { 1, 2 } R xy : x<y y is arc-consistent relative to x D y = { 2 } X is arc-consistent relative to y D x = { 1 } Arc-consistency: y is arc-consistent relative to x iff for every value in D y there is a value in D x such that C xy is satisfied Update domain using a binary relation y x x<y { 1, 2 } 4
5
Relational Arc-Consistency D x = { 1, 2 } D y = { 1, 2 } D z = { -2, -1, 0, 1, 2, 3, 4, 5 } R xyz : x+y =z R xyz is relational arc-consistent relative to z D z = { 2, 3, 4 } x y Similarly, update domain using one relation Except that relation is not binary, its arity > 2 Relational arc-consistency z {-2, -1, 0, 1, 2, 3, 4, 5} { 1, 2 } 5
6
Notes for Relational arc-consistency Relations not necessarily binary Three levels of relational arc-consistency: 1. A relation (e.g,R xyzt ) is relational arc-consistent relative to a variable x 2. A relation (e.g, R xyzt ) is relational arc-consistent 3. A network is relational arc-consistent 6
7
7 Relational Arc-Consistency Let R be a constraint network over a set of variables X = {x 1, x 2, , x n }, having domains D 1, , D n (A) is the set of all consistent instantiations of the subnetwork defined by A, which is a set of variables Let R s be a relation in R defined over a scope S, e.g. S = {x 2, x 3, x 4 }
8
8 Relational Arc-Consistency R s in R is relational-arc-consistent relative to a variable x S iff any consistent instantiation of the variables in S-{x} has an extension to a value in D x that satisfies R s. That is, iff ( S-{x} ) s-{x} ( R D x ) A relation R s in R is relational-arc-consistent if it is relational arc-consistent relative to every variable in S A network is relational-arc-consistent iff every relation in it is relational-arc-consistent
9
Example of Relational Arc-consistency A network with D x = D y = D z = {(a, b, c)} one constraint R xyz = { (a, a, a), (a, b, c), (b, b, c), (d, a,b)} Question 1. Is relation R xyz relational arc-consistent relative to {x}, {y}, {z} ? 2. If we add a new constraint R yz = {(a, a), (b, c)}, is relation R xyz relational arc-consistent relative to {x} ? 9
10
Example of Relational Arc-consistency A network with D x [-2, 3] D y [-5, 7] R xyz :x+y=z R ztf :z+t=f Question 1. Is this network relational arc-consistent ? 2. What constraints should we add to make this network relational arc-consistent? Hint Consider R xyz should be relational-arc-consistent relative to x, y, z and relation R ztf should be relational-arc-consistent relative to z, t, f 10
11
Solution to Example 8.1.3 To make a network: D x [-2, 3] D y [-5, 7] R xyz :x+y=z R ztf :z+t=f relational arc-consistent, R xyz should be relational arc-consistent relative to x, y, z yz yz ( R xyz D x ) R yz : z – y [-2, 3] xz xz ( R xyz D y ) R xz : z – x [-5, 7] yz xy ( R xyz D z ) R xy : x + y [-7, 10] D z [-7, 10] R ztf should be relational arc-consistent relative to z, t, f tf tf ( R ztf D z ) R tf : f – t [-7, 10] zf zf ( R ztf D t ) zt zt ( R ztf D f ) 11
12
Path Consistency D x = { 0, 1, 2 } D y = { 0, 1, 2 } D z = { 0, 1, 2 } R xy : x< y R yz : y< z R xz is path consistent relative to y R xz : x<z x y z Path of length 2 consistency (Dechter, pp. 72) x, z (R xz ) is path consistent relative to y iff for every pair (a x, a z ) R xz, there is a value a y D y s.t. (a x, a y ) R xy and (a y, a z ) R yz Infer a new relation from 2 existing binary relations < < < 12
13
Relational Path-Consistency D x [-2, 3] D y [-5, 7 ] R xyz : x + y = z R ztf : z + t = f R xyz and R ztf is relational path- consistent to z R xytf : x+y+t=f x y z t f Similarly, infer new relation from 2 existing relations except that relations are not binary, their arity > 2 Relational path-consistency 13
14
14 Relational Path-Consistency Let R be a constraint network over a set of variables X = {x 1, …, x n } having domains D 1, …, D n, Let R S and R T be two constraints in R with A = (S T) – {x} (A) s-{x} ( R S R T D x )
15
15 Relational Path-Consistency R S and R T are relational-path-consistent relative to a variable x S T iff any consistent instantiation of the variables in A has an extension to a value in D x, ( the domain of x) that satisfies R s and R T simultaneously; that is, iff (A) A ( R S R T D x ) A pair of relations R s and R T is relational-path- consistent iff it is relational-path-consistent relative to every variable in S T
16
Example of Relational Path-Consistency A network with A network is relational-path-consistent iff every pair of its relations is relational-path-consistent D x [-2, 3] D y [-5, 7] R xyz :x+y=z R ztf :z+t=f Question 1. Is relation R xyz and R ztf relational-path-consistency relative to z ? 2. What constraints should we added to made R xyz and R ztf relational-path-consistency relative to z ? Hint: xytf xytf ( R xyz R ztf D z ) R xytf : x+y+t = f 16
17
17 Relational –m – consistency Let R be a constraint network over a set of variables X = {x 1, …,x n } having domains D 1, …, D n Let R s1, R s2,…R sm be m distinct relations in R with S i X A = i=1 m S i – {x} (x is a common variable among s 1, … s m ) (A) A ( i=1 m R si D x )
18
18 Relational –m – consistency R s1, …, R sm are relational-m-consistent relative to a variable x i=1 m S i iff any consistent instantiation of the variables in A has an extension to a value in D x, the domain of x, that satisfies R s1, …, R sm simultaneously; that is iff (A) A ( i=1 m R si D x ) A set of relations {R s1, …,R sm } is relational-m-consistent iff it is relational-m-consistent relative to every variable in i=1 m S i A network is relational-m-consistent iff every set of m relations is relational-m-consistent. A network is strongly relational-m-consistent iff it is relational-i - consistent for every i m.
19
Example of Relational-m -consistency Consider the constraint network over the set of variables {x 1, x 2, x 3, x 4, x 5 } with D i = {a, b, c}, 1 i 5, and relations are: R 2,3,4,5 = {(a, a, a, a), (b, a, a, a), (a, b, a, a), (a, a, b, a), (a, a, a, b)} R 1,2,5 = {(b, a, b), (c, b, c), (b, a, c)} Question: Which constraints should be added to make the constraint network strongly relational-2- consistent? 19
20
Solution to Example 8.1.7 For the constraint network over the set of variables {x 1, x 2, x 3, x 4, x 5 } with D i = {a, b, c}, 1 i 5, and relations are: R 2,3,4,5 = {(a, a, a, a), (b, a, a, a), (a, b, a, a), (a, a, b, a), (a, a, a, b)} R 1,2,5 = {(b, a, b), (c, b, c), (b, a, c)} we should guarantee 1. R 2,3,4,5 relational arc-consistent relative to x 2, x 3, x 4, x 5 2. R 1,2,5 relational arc-consistent relative to x 1, x 2, x 5 3. R 2,3,4,5 and R 1,2,5 relational path-consistent relative to x 2, x 5 20
21
Note for Relational-m - consistency For binary constraint, relational-m-consistency is identical to variable-based i –consistency where i =m+1. (Dechter, pp. 77, i-consistency) For general CSPs, 1.Given a set of constraints R s1,…, R sm, enforcing relational-m- consistency relative to a variable x can also be accomplished by enforcing r –consistency (r = | S i |) relative to x (prepocessing is needed here) 2.Enforcing i -consistency may be accomplished by relational- m-consistency where m ranges from 1 to 2 i. 21
22
22 Relational (i, m)- Consistency A set of relations {R s1, …, R sm } is relationally (i, m) - consistent iff for every subset of variables A of size i, A j=1 m S j, any consistent assignment to A can be extended to an assignment to i=1 m S i – A that satisfies R s1, …, R sm simultaneously. A network is relationally (i, m) -consistent iff every set of m relations is relationally (i, m) –consistent A network is strong relational (i, m) -consistent iff it is relational (j, m) -consistent for every j i. Question: relational-m-consistency relational (m-1, m) consistency ?
23
23 Algorithm Relation consistency(R, i, m) (RC(i, m)) Input: a network (X,D,C) Output: a relational-(i,m)- consistent network R‘, equivalent to R 1. Repeat 2. Q R 3. for every m relations R s1,…,R sm Q and every 4. subset A of size i, A i=1 m S i 5. R A R A A ( i=1 m R si ) 6. If is R A the empty relation 7. then exit and return the empty network 8. endif 9. endfor 10. Until Q = R
24
24 Extended composition The extended composition of relation R s1, …, R sm relative to a subset of variables A i=1 m S i, denoted by EC A (R s1, …, R sm ), is defined by EC A (R s1, …, R sm ) = A ( i=1 m R si ) When the operator is applied to m relations, it is called extended m-composition. If the projection is restricted to subsets of sizes i, it is called extended (i, m)-composition.
25
25 Two Practical relational-consistency algorithms Generalized Arc-consistency (RC(1,1)) (a.k.a. domain propagation) if in relational-consistency algorithm, line 5 is replaced with D x x ( R s D x ) Relational Arc-consistency (RC 1 ) if line 5 is replaced with R s– {x} s-{x} ( R s D x )
26
26 Directional-relational-consistency Given a network R an ordering d=(x 1, ,x n ) R is m-directionally relationally consistent iff for every subset of constraints {R s1, , R sm } where the latest variable in any of the constraints’ scopes is X l, and for every A, A {x 1, , x l-1 }, every consistent assignment to A can be extended to X l while simultaneously satisfying all the relevant constraints in {R s1, ,R sm }.
27
Input: a constraint network R=(X,D,C), an ordering d=(x 1,…,x n ) Output: An m-directional-consistent network, along d 1. Build buckets. 2. Looping over buckets from n downto 1 3. Simplify all relations in current bucket 4. Instantiation if current bucket contains a unary constraint with x p =u then instantiate and propagate If no resulting relation is empty, then add them to appropriate bucket else exit and return the empty network 5. else (the general case) j min {number of relations in current bucket, m } apply directional relation consistency If no resulting relation is empty, then add them to appropriate bucket else exit and return the empty network 9. Return all the buckets Algorithm:Directional-Relational-Consistency (DRC m ) 27
28
Example of DRC 2 R {1,2,3,4,5} = {(H,O,S,E,S), (L,A,S,E,R), (S,H,E,E,T), (S,N,A,I,L), (S,T,E,E,R)} R {3,6,9,12} = {(A,L,S,O), (E,A,R,N), (H,I,K,E), (I,R,O,N), (S,A,M,E)} R {5,7,11} = {(E,A,T), (L,E,T), (R,U,N), (S,U,N), (T,E,N), (Y,E,S)} R {8,9,10,11} = {(A,L,S,O), (E,A,R,N), (H,I,K,E), (I,R,O,N), (S,A,M,E)} R {10,13} = {(B,E), (I,T), (N,O), (U,S)} R {12,13} = {(B,E), (I,T), (N,O), (U,S)} 12345 67 891011 1213 28
29
DRC 2 for crossword puzzle with d = (x 13, x 12, , x 1 ) Bucket(x 1 ) R 1,2,3,4,5 Bucket(x 2 ) H 2,3,4,5 Bucket(x 3 ) R 3,6,9,12 H 3,4,5 Bucket(x 4 ) H 4,5,6,9,12 Bucket(x 5 ) R 5,7,11 H 5,6,9,12 Bucket(x 6 ) H 6,7,9,11,12 Bucket(x 7 ) H 7,9,11,12 Bucket(x 8 ) R 8,9,10,11 Bucket(x 9 ) H 9,10,11 H 9,11,12 Bucket(x 10 ) R 10,13 H 10,11,12 Bucket(x 11 ) empty relation exit Bucket(x 12 ) Bucket(x 13 ) 29
30
30 Complexity of directional relational consistency Given a network R, the time complexity and size of the network generated by DRC m along ordering d is O(nm·(2 m k 2 ) (w*(d)+1) ), where w*(d) is induced width along ordering d, and n is the number of variables(a.k.a. number of buckets) Consequently, the time complexity of DRC 2 is O( n (4k 2 ) (w*(d)+1) ) The complexity of DRC 1 is O(n · e 2 · t 2 ) where e is the number of input relations and t bounds the number of tuples in each relation.
31
The number of variables in any bucket is at most w*(d )+1 The number of relations in a bucket is at most 2 w*(d)+1 The number of subsets of size m is at most 2 (w*(d)+1)m The number of subsets of size m in n buckets is at most n 2 (w*(d)+1)m Proof of Complexity of DRC m The number of tuples in each relation is at most k w*(d)+1 Complexity of each join operation O(m k 2(w*(d)+1) ) DRC m complexity = O(nm·(2 m k 2 ) (w*(d)+1) ) join operations over m relations(pair-wise join) Join operation done for every subsets of m in n buckets 31
32
Facts: 1.The number of relations in a bucket is at most e 2. Complexity of simplication is O(e 2 t 2 ) 3. complexity of instantiation is O(t) 4. complexity of “general case” is O(t) 5. The iteration time is n Proof of Complexity of DRC 1 Complexity of DRC 1 is O(n · e 2 · t 2 ) 32
33
Application of crossword puzzles Note: whenever we apply adaptive-consistency to the crossword puzzle, at most two relations will ever reside in a single bucket, no matter what variable ordering is selected. For the crossword puzzles, then, adaptive- consistency(Decther, pp.113 ) coincides with DRC 2. (Proposistion 8.2.5) 1. Crossword puzzles can be made directional backtrack-free by DRC 2 (Decther, pp.113, theorem 4.5.2 ) 2. The complexity of DRC 2 applied to crossword puzzles is O( n·k 2(w*(d)+1) ) 33
34
34 Domain and constraint tightness Theorem 8.3.1 A strong relational 2-consistent constraint network over bi-valued domains is globally consistent. Theorem 8.3.2 (domain tightness and local consistency) A strong relational k-consistent constraint network R=(X, D, C) over domains with at most k values is globally consistent
35
Proof of Theorem 8.3.1 1. We can prove this theorem by proving that all instantation ā i-1 = (a 1, , a i-1 ) (i>1) to variable x 1, , x i-1 can be successfully extended to x i. 2. Assume that there is an instantation ē j-1 = (e 1, , e i-1 ) can not successfully be extended to e j. Let denote A 0 be the constraints violated by (ē j-1, e j = 0) A 1 be the constraints violated by (ē j-1, e j = 1) 3. Let’s pick R 1 A 0, R 2 A 0 4. If R 1 =R 2, which indicates in relation R 1, (x 1, , x j-1 ) can not be successfully extended to x i, contradicting that the network is relational 1- consistent. 5. If R 1 R 2, which also indicates (x 1, , x j-1 ) can not be successfully extended to x i, contradicting that the network is relational 2-consistent. 6. Thus our assumption is wrong. 7. So we can conclude: A strong relational 2-consistent network over bi-valued domains is globally consistent. 35
36
36 m-tight A constraint relation R s of arity r is called m-tight if, for any variable x i S and any instantiation ā of the remaining r 1 variables in S {x i }, either there are at most m extensions of ā to x i that satisfy R s, or there are exactly |D i | such extensions. Note: Constraints having domains of size 2 are 1-tight.
37
Example of m-tight X= (x 1, x 2, x 3, x 4 ) D i = {a, b, c} 1 i 4 R s1 = {(a, a, a), (a, a, c), (a, b, c), (a, c, b), (b, a, c), (b, b, b), (b, c, a), (c, a, b), (c, b, a), (c, c, c)} R s2 = {(a, b), (b, a), (b, c), (c, a), (a, c)} R s3 = {(a, b), (a, c), (b, b), (c, a), (c, b)} Where s 1 ={x 1, x 2, x 3 } s 2 ={x 2, x 4 } s 3 ={x 3, x 4 } All the constraints are 2-tight. 37
38
38 Lemma 8.3.1 constraint-tightness and local consistency Let R s1, …, R sl be l relations that constrain a variable x, let d be the size of the domain of variable x, and let ā be an instantiation of all of the variables except for x that are constrained by the l relations (i.e., ā is an instantiation of the variables in (S 1 … S l ) – x. If 1. Each relation is m-tight, for some 1 m<d, and 2. For every subset of m+1 or fewer relations from {R s1, …, R sl }, there exists at least one extension of ā to x that satisfys each of the relations in the subset, Then there exists at least one extension of ā to x that satisfies all l relations.
39
Proof of lemma 8.3.1 1.Let a 1, a 2, …, a d be the d elements in the domain of x. We say that a relation allows an element a i if the extension (ā, a i ) of ā to x satisfies the relation. 2.Assume to the contrary that an extension of ā to x that satisfies all therelations does not exist. 3.for each element a i in the domain of x there must exist at least one relation that does not allow a i. Let c i denote one of the relations that does not allow a i. By construction. The set c={c 1, c 2, …, c d } is a set of relations for which there does not exist an extension of ā to x that satisfies each of the relations in the set (every candicate a i is ruled out since c i does not allow a i ). For every possible value of m, this leads to a contradiction. Case 1 (m = d 1): The contradiction is immediate as c={c 1, c 2, …, c d } is a set of relations of size m+1 for which there does not exist an extension to x that satisfy every relation in the set. This contradicts condition (2). 39
40
Proof of lemma 8.3.1 (Cont.) Case 2 (m = d 2): The nominal size of the set c={c 1, c 2, …, c d } is m+2. We can prove there must be a repetition in c. Assume to the contrary that c i c j for i j. Recall c i is a relation that does not allow a i, i = 1, …, d and consider {c 1, c 2, …, c d -1 }. This is a set of m+1 relations so by condition (2) there must exist an a i that every relation in the set allows. The only possiblity is a d. Consider {c 1, …, c d –2, c d }. This is a set of m+1 relations so by condition (2) there must exist an a i that every relation in the set allows. The only possiblity is a d –1 Simliar … Continuing in this manner, we an show that relation c 1 must allow a d, a d-1, … a 2 ; that is, c 1 must allow exactly m+1 extensions. This contradicts condition (1). Therefore, our assumption is false. So we can conclude that it must be the case that c i = c j for some i j 40
41
Proof of lemma 8.3.1 (Cont.) case 3 (m = d 3), …, case d 1 (m =1) : The remaining cases are similar. In each case we argue that (A)There are repetitions in the set c={c 1, c 2, … c d ), (B)The true size of the set c is m +1, (C)A contradiction is derived by appealing to condition (2) Thus, there exists at least one extension of ā to x that satisfies all of the relations. 41
42
42 constraint-tightness and local consistency A strongly relationally (m+1)-consistent constraint network that has m-tight constraints, is globally consistent. Reference P.van Beek and R.Dechter. Constraint tightness and looseness versus local and global consistency. Journal of the ACM(in press), in 1997
43
Proof of theorem 8.3.5 Constraint-tightness and local consistency 1.Let X = (x 1, , x k-1 ) be a set of k 1 variables, let ā be an instantation of the variables in X that is consistent with the constraint network, and let X k be an additional variable 2. Using lemma 8.3.1 we show that there exists an extension of ā to x k that is consistent with the constraint network. 3. Let R s1, …, R sl be l relations which are all and only the relations which constraint only x k and a subset of variables from X. To be consistent with the constraint network, the extension of ā to x k must satisfy each of the l relations. 4. Now, condition (1) of Lemma 8.3.1 is satisfied since each of the l relations is m-tight. 5. Further, condition (2) of Lemma 8.3.1 is satisfied since, by definiton, the requirement of strong relational (m+1)-consistency ensures that for any subset of m+1 or fewer relations, there exists an extension of ā to x k that is consistent with the constraint network. 43
44
Questions ? 44
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.