Download presentation
Presentation is loading. Please wait.
1
Consistency algorithms
Chapter 3 SQ 2009
2
Consistency methods Approximation of inference:
Arc, path and i-consistecy Methods that transform the original network into a tighter and tighter representations SQ 2009
3
Arc-consistency = X Y 1, 2, 3 1, 2, 3 1 X, Y, Z, T 3 X Y
T Z X T = 1, 2, 3 1, 2, 3 T Z SQ 2009
4
Arc-consistency = X Y 1 3 2 1 X, Y, Z, T 3 X Y Y = Z T Z
X T = T Z SQ 2009
5
Arc-consistency SQ 2009
6
Revise for arc-consistency
SQ 2009
7
A matching diagram describing a network of constraints that is not arc-consistent (b) An arc-consistent equivalent network. SQ 2009
8
AC-1 Complexity (Mackworth and Freuder, 1986):
e = number of arcs, n variables, k values (ek^2, each loop, nk number of loops), best-case = ek, Arc-consistency is: SQ 2009
9
AC-3 Complexity: Best case O(ek), since each arc may be processed in O(2k) SQ 2009
10
Example: A 3 variables network with 2 constraints: z divides x and z divides y (a) before and (b) after AC-3 is applied. SQ 2009
11
AC-4 Complexity: (Counter is the number of supports to ai in xi from xj. S_(xi,ai) is the set of pairs that (xi,ai) supports) SQ 2009
12
Example applying AC-4 SQ 2009
13
Distributed arc-consistency (Constraint propagation)
Implement AC-1 distributedly. Node x_j sends the message to node x_i Node x_i updates its domain: Messages can be sent asynchronously or scheduled in a topological order SQ 2009
14
Exercise: make the following network arc-consistent
Draw the network’s primal and dual constraint graph Network = Domains {1,2,3,4} Constraints: y < x, z < y, t < z, f<t, x<=t+1, Y<f+2 SQ 2009
15
Arc-consistency Algorithms
AC-1: brute-force, distributed AC-3, queue-based AC-4, context-based, optimal AC-5,6,7,…. Good in special cases Important: applied at every node of search (n number of variables, e=#constraints, k=domain size) Mackworth and Freuder (1977,1983), Mohr and Anderson, (1985)… SQ 2009
16
Using constraint tightness in analysis t = number of tuples bounding a constraint
AC-1: brute-force, AC-3, queue-based AC-4, context-based, optimal AC-5,6,7,…. Good in special cases Important: applied at every node of search (n number of variables, e=#constraints, k=domain size) Mackworth and Freuder (1977,1983), Mohr and Anderson, (1985)… SQ 2009
17
Constraint checking Arc-consistency B C: [ 6 .. 15 ] 1- B: [ 5 .. 14 ]
13 C: [ ] 1- B: [ ] A < B 14 A [ ] 2 2- A: [ ] C: [ ] B < C [ ] 2 < C - A < 5 3- B: [ ] 6 14 [ ] C Overview 1
18
Is arc-consistency enough?
Example: a triangle graph-coloring with 2 values. Is it arc-consistent? Is it consistent? It is not path, or 3-consistent. SQ 2009
19
Path-consistency SQ 2009
20
Path-consistency SQ 2009
21
Revise-3 Complexity: O(k^3) Best-case: O(t) Worst-case O(tk) SQ 2009
22
PC-1 Complexity: O(n^3) triplets, each take O(k^3) steps O(n^3 k^3)
Max number of loops: O(n^2 k^2) . SQ 2009
23
PC-2 Complexity: Optimal PC-4:
(each pair deleted may add: 2n-1 triplets, number of pairs: O(n^2 k^2) size of Q is O(n^3 k^2), processing is O(k^3)) SQ 2009
24
Example: before and after path-consistency
PC-1 requires 2 processings of each arc while PC-2 may not Can we do path-consistency distributedly? SQ 2009
25
Path-consistency Algorithms
Apply Revise-3 (O(k^3)) until no change Path-consistency (3-consistency) adds binary constraints. PC-1: PC-2: PC-4 optimal: SQ 2009
26
I-consistency SQ 2009
27
Higher levels of consistency, global-consistency
SQ 2009
28
Revise-i Complexity: for binary constraints For arbitrary constraints:
SQ 2009
29
4-queen example SQ 2009
30
I-consistency SQ 2009
31
Arc-consistency for non-binary constraints: Generalized arc-consistency
Complexity: O(t k), t bounds number of tuples. Relational arc-consistency: SQ 2009
32
Examples of generalized arc-consistency
x+y+z <= 15 and z >= 13 implies x<=2, y<=2 Example of relational arc-consistency SQ 2009
33
More arc-based consistency
Global constraints: e.g., all-different constraints Special semantic constraints that appears often in practice and a specialized constraint propagation. Used in constraint programming. Bounds-consistency: pruning the boundaries of domains SQ 2009
34
Example for alldiff A = {3,4,5,6} B = {3,4} C= {2,3,4,5} D= {2,3,4}
Alldiff (A,B,C,D,E} Arc-consistency does nothing Apply GAC to sol(A,B,C,D,E)? A = {6}, F = {1}…. Alg: bipartite matching kn^1.5 (Lopez-Ortiz, et. Al, IJCAI-03 pp 245 (A fast and simple algorithm for bounds consistency of alldifferent constraint) SQ 2009
35
Global constraints Alldifferent
Sum constraint (variable equal the sum of others) Global cardinality constraint (a value can be assigned a bounded number of times to a set of variables) The cummulative constraint (related to scheduling tasks) SQ 2009
36
Bounds consistency SQ 2009
37
Bounds consistency for Alldifferent constraints
SQ 2009
38
Boolean constraint propagation
(A V ~B) and (B) B is arc-consistent relative to A but not vice-versa Arc-consistency by resolution: res((A V ~B),B) = A Given also (B V C), path-consistency: Res((A V ~B),(B V C) = (A V C) What will generalized arc-consistency can do to cnfs? Relational arc-consistency rule = unit-resolution SQ 2009
39
Boolean constraint propagation
Example: party problem If Alex goes, then Becky goes: If Chris goes, then Alex goes: Query: Is it possible that Chris goes to the party but Becky does not? SQ 2009
40
Gausian and Boolean propagation
Linear inequalities Boolean constraint propagation SQ 2009
41
Constraint propagation for Boolean constraints: Unit propagation
SQ 2009
42
Consistency for numeric constraints
SQ 2009
43
Tractable classes SQ 2009
44
Changes in the network graph as a result of arc-consistency, path-consistency and 4-consistency.
SQ 2009
45
Distributed arc-consistency (Constraint propagation)
Implement AC-1 distributedly. Node x_j sends the message to node x_i Node x_i updates its domain: Generalized arc-consistency can be implemented distributedly: sending messages between constraints over the dual graph: SQ 2009
46
Distributed Arc-Consistency
Arc-consistency can be formulated as a distributed algorithm: A B C D F G a Constraint network SQ 2009
47
Relational Arc-consistency
B 1 2 3 A 1 2 3 A The message that R2 sends to R1 is R1 updates its relation and domains and sends messages to neighbors A C 1 2 3 B C D F B C F 1 2 3 A B D 1 2 3 G D F G 1 2 3 SQ 2009
48
DRAC on the dual join-graph
1 2 3 A B 1 2 3 A AB AC ABD BCF DFG B 4 5 3 6 2 D F C 1 A C 1 2 3 A B D 1 2 3 B C F 1 2 3 D F G 1 2 3 SQ 2009
49
Distributed Relational Arc-Consistency
DRAC can be applied to the dual problem of any constraint network: SQ 2009
50
Iteration 1 Node 1 sends messages Node 3 sends messages
2 1 3 A 1 3 A 2 1 3 A Node 1 sends messages Node 3 sends messages Node 6 sends messages Node 5 sends messages Node 4 sends messages Node 2 sends messages A 1 2 3 1 3 B 1 2 3 B A 1 3 A 2 1 3 A A B 1 2 3 1 2 1 3 A 2 1 3 A 2 1 3 A 2 C A A C 1 2 3 2 A A 3 AB A AC A A AB C 1 2 D 1 3 B 1 3 A 1 2 3 B A 2 1 3 A B 2 1 3 B 2 C 2 1 3 B 1 3 F 4 5 A B D 1 2 3 ABD B BCF B C F 1 2 3 6 D F DFG 2 1 3 D 1 3 F D F G 1 2 3 SQ 2009
51
Iteration 1 A 1 3 A B 1 3 2 4 5 3 6 2 1 A C 1 2 3 A B D 1 3 2 B C F 1
DFG B 4 5 3 6 2 D F C 1 A C 1 2 3 A B D 1 3 2 B C F 1 2 3 D F G 2 1 3 SQ 2009
52
Iteration 2 A 1 3 A 1 2 3 A 1 3 A 1 2 3 1 3 B B 1 2 3 A 1 3 A B 1 3 2 A AB AC ABD BCF DFG B 4 5 3 6 2 D F C 1 A C 1 2 3 A 1 3 C 2 D 2 B 1 3 A 1 3 A B D 1 3 2 B C F 1 2 3 B 1 3 C 2 F 1 D F G 2 1 3 D 1 2 F 1 3 SQ 2009
53
Iteration 2 A 1 3 A B 1 3 4 5 3 6 2 1 A C 1 2 3 A B D 1 3 2 B C F 3 2
DFG B 4 5 3 6 2 D F C 1 A C 1 2 3 A B D 1 3 2 B C F 3 2 1 D F G 2 1 3 SQ 2009
54
Iteration 3 A 1 3 A 1 3 A 1 3 A 1 3 B 3 B 1 3 A 1 3 A B 1 3 A AB AC ABD BCF DFG B 4 5 3 6 2 D F C 1 A C 1 2 3 A 1 3 C 2 D 2 B 1 3 A 1 3 A B D 1 3 2 B C F 3 2 1 B 1 3 C 2 F 1 D F G 2 1 3 D 2 F 1 SQ 2009
55
Iteration 3 A 1 3 A B 1 3 4 5 3 6 2 1 A C 1 2 3 A B D 1 3 2 B C F 3 2
DFG B 4 5 3 6 2 D F C 1 A C 1 2 3 A B D 1 3 2 B C F 3 2 1 D F G 2 1 3 SQ 2009
56
Iteration 4 A 1 3 A 1 A 1 3 A 1 3 B 3 B 1 3 A 1 3 A B 1 3 A AB AC ABD BCF DFG B 4 5 3 6 2 D F C 1 A C 1 2 3 A 1 3 C 2 D 2 B 1 3 A 1 3 A B D 1 3 2 B C F 3 2 1 B 3 C 2 F 1 D F G 2 1 3 D 2 F 1 SQ 2009
57
Iteration 4 A 1 A B 1 3 4 5 3 6 2 1 A C 1 2 3 A B D 1 3 2 B C F 3 2 1
DFG B 4 5 3 6 2 D F C 1 A C 1 2 3 A B D 1 3 2 B C F 3 2 1 D F G 2 1 3 SQ 2009
58
Iteration 5 A 1 A 1 A 1 A 1 B 3 B 3 A 1 A B 1 3 4 5 3 6 2 1 A C 1 2 3
ABD BCF DFG B 4 5 3 6 2 D F C 1 A C 1 2 3 A 1 C 2 D 2 B 3 A 1 A B D 1 3 2 B C F 3 2 1 B 3 C 2 F 1 D F G 2 1 3 D 2 F 1 SQ 2009
59
Iteration 5 A 1 A B 1 3 4 5 3 6 2 1 A C 1 2 A B D 1 3 2 B C F 3 2 1 D
DFG B 4 5 3 6 2 D F C 1 A C 1 2 A B D 1 3 2 B C F 3 2 1 D F G 2 1 3 SQ 2009
60
What is SAT? Given a sentence:
Sentence: conjunction of clauses Clause: disjunction of literals Literal: a term or its negation Term: Boolean variable Question: Find an assignment of truth values to the Boolean variables such the sentence is satisfied. Overview 1
61
CSP is NP-Complete Verifying that an assignment for all variables is a solution Provided constraints can be checked in polynomial time Reduction from 3SAT to CSP Many such reductions exist in the literature (perhaps 7 of them) Overview 1
62
Problem reduction Example: CSP into SAT (proves nothing, just an exercise) Notation: variable-value pair = vvp vvp term V1 = {a, b, c, d} yields x1 = (V1, a), x2 = (V1, b), x3 = (V1, c), x4 = (V1, d), V2 = {a, b, c} yields x5 = (V2, a), x6 = (V2, b), x7 = (V2,c). The vvp’s of a variable disjunction of terms V1 = {a, b, c, d} yields (Optional) At most one VVP per variable Overview 1
63
CSP into SAT (cont.) Constraint:
Way 1: Each inconsistent tuple one disjunctive clause For example: how many? Way 2: Consistent tuple conjunction of terms Each constraint disjunction of these conjunctions transform into conjunctive normal form (CNF) Question: find a truth assignment of the Boolean variables such that the sentence is satisfied Overview 1
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.