1
Consistency algorithms
Chapter 3
Fall 2010
Consistency algorithms Chapter 3 Fall 2010 1 Consistency methods - - PowerPoint PPT Presentation
Consistency algorithms Chapter 3 Fall 2010 1 Consistency methods Approximation of inference: Arc, path and i-consistecy Methods that transform the original network into tighter and tighter representations Fall 2010 2 Arc-consistency X
1
Fall 2010
Fall 2010 2
Fall 2010 3
Fall 2010 4
Fall 2010 5
Click to edit Master text styles Second level
Fall 2010 6
j ij i i i
Fall 2010 7
A matching diagram describing a network of constraints that is not arc-consistent (b) An arc- consistent equivalent network.
Fall 2010 8
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: ) (
3
enk O
) (
2
ek Ω
Fall 2010 9
Complexity: since each arc may be processed in O(2k) Best case O(ek),
3
Fall 2010 10
Fall 2010 11
(Counter is the number of supports to ai in xi from xj. S_(xi,ai) is the set
2
Fall 2010 12
Fall 2010 13
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
j ij i j i
j ij i i i
j i i i j ij i i i
Fall 2010 14
Fall 2010 15
Mackworth and Freuder (1977,1983), Mohr and Anderson, (1985)…
2
Fall 2010 16
Mackworth and Freuder (1977,1983), Mohr and Anderson, (1985)…
3
3
17
→
Arc-consistency
[ 5.... 18] [ 4.... 15] [ 1.... 10 ] B < C A < B B A 2 < C - A < 5 C 2- A: [ 2 .. 10 ] C: [ 6 .. 14 ] 3- B: [ 5 .. 13 ] C: [ 6 .. 15 ] 1- B: [ 5 .. 14 ]
14 13 6 2 14
Fall 2010
Fall 2010 18
Fall 2010 19
Fall 2010 20
Click to edit Master text styles Second level
Fall 2010 21
) (
kj k ik ij ij ij
R D R R R
⊗ ⊗ ∩ ← π
Fall 2010 22
O(n^3) triplets, each take O(k^3) steps O(n^3 k^3) Max number of loops: O(n^2 k^2) .
5 5k
Fall 2010 23
(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))
5 3k
) (
3 3k
n O
Fall 2010 24
PC-1 requires 2 processings of each arc while PC-2 may not Can we do path-consistency distributedly?
Fall 2010 25
PC-1 requires 2 processings of each arc while PC-2 may not Can we do path-consistency distributedly?
Fall 2010 26
5 5k
5 3k
3 3k
Fall 2010 27
Click to edit Master text styles Second level
Fall 2010 28
Click to edit Master text styles Second level
Definition:
Fall 2010 29
i
i
Fall 2010 30
Fall 2010 31
Click to edit Master text styles Second level
Click to edit Master text styles Second level
Fall 2010 32
Click to edit Master text styles Second level
Fall 2010 33
Generalized arc-consistency
Click to edit Master text styles Second level
} {x S S x x x
−
} { } { x S x S x S
− −
Fall 2010 34
Fall 2010 35
Fall 2010 36
Each row, column and major block must be alldifferent “Well posed” if it has unique solution: 27 constraints
2 3 4 6
{1,2,3,4,5,6,7,8,9}
different
Fall 2010 37
A = {3,4,5,6} B = {3,4} C= {2,3,4,5} D= {2,3,4} E = {3,4} F= {1,2,3,4,5,6} Alldiff (A,B,C,D,E} Arc-consistency does nothing Apply GAC to sol(A,B,C,D,E,F)? 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)
Fall 2010 38
Fall 2010 39
Click to edit Master text styles Second level
Fall 2010 40
Click to edit Master text styles Second level
Fall 2010 41
B is arc-consistent relative to A but not vice-versa
res((A V ~B),B) = A
Fall 2010 42
Click to edit Master text styles Second level
Click to edit Master text styles Second level
–– M: The unicorn is mythical – I: The unicorn is immortal – L: The unicorn is mammal – H: The unicorn is horned – G: The unicorn is magical (M → I ) ( ∧ ¬ M → ( ¬ I L)) ((I L) → H) (H → G) ∧ ∧ ∨ ∧ A Logic Puzzle IV
(M → I ) ( ∧ ¬ M → ( ¬ I L)) ((I L) → H) (H → G) ∧ ∧ ∨ ∧ ⊢ ( ¬ M I ) (M ( ∨ ∧ ∨ ¬ I L)) ((I L) → H) (H → G) ∧ ∧ ∨ ∧ ⊢ ( ¬ M I ) (M ∨ ∧ ∨ ¬ I ) (M L) ((I L) → H) (H → G) ∧ ∨ ∧ ∨ ∧ ⊢ (I L) ((I L) → H) (H → G) H G ∨ ∧ ∨ ∧ ⊢ ∧
magical !
Fall 2010 43
Fall 2010 44
Fall 2010 45
Changes in the network graph as a result of arc-consistency, path-consistency and 4- consistency.
Fall 2010 46
Implement AC-1 distributedly. Node x_j sends the message to node x_i Node x_i updates its domain:
Relational and generalized arc-consistency can be implemented distributedly: sending messages between constraints over the dual graph
j ij i j i
j ij i i i
j i i i
) (
} { } { x S x S x S
D R R ⊗ ←
− −
π
Fall 2010 47 A 1 2 3 A C 1 2 3 2 A B 1 2 1 3 2 1 2 3 3 1 3 2 B C F 1 2 3 3 2 1 A B D 1 2 3 1 3 2 2 1 3 2 3 1 3 1 2 3 2 1 D F G 1 2 3 2 1 3
A B C D F G
The message that R2 sends to R1 is R1 updates its relation and domains and sends messages to neighbors
1
R
2
R
4
R
3
R
5
R
6
R
Fall 2010 48
Fall 2010 49 A 1 2 3 A C 1 2 3 2 A B 1 2 1 3 2 1 2 3 3 1 3 2 B C F 1 2 3 3 2 1 A B D 1 2 3 1 3 2 2 1 3 2 3 1 3 1 2 3 2 1 D F G 1 2 3 2 1 3
A AB AC ABD BCF DFG
B
4 5 3 6 2
B D F A A A C
1
1
R
2
R
4
R
3
R
5
R
6
R
Fall 2010 50
Node 6 sends messages Node 5 sends messages Node 4 sends messages Node 3 sends messages Node 2 sends messages
A 1 2 3 A C 1 2 3 2 A B 1 2 1 3 2 1 2 3 3 1 3 2 B C F 1 2 3 3 2 1 A B D 1 2 3 1 3 2 2 1 3 2 3 1 3 1 2 3 2 1 D F G 1 2 3 2 1 3 2 1 3 A 2 1 3 A 2 1 3 A 2 1 3 A 1 3 A 1 2 3 2 1 3 2 3 3 2 B 1 1 A 1 3 B 2 1 3 A 1 3 B 1 2 D 1 2 3 2 1 3 2 3 3 2 B 1 1 A 1 3 F 2 1 3 D 2 C 2 1 3 B 2 C 2 1 3 B 1 3 F
1 3 A 2 1 3 A
Node 1 sends messages
A AB AC ABD BCF DFG
AB
4 5 3 6 2
B D B F A A A A C A
1 3 A 2 1 3 A 1
1
R
2
R
4
R
3
R
5
R
6
R
2 1
h
3 1
h
3 2
h
1 2
h
2 3
h
2 4
h
2 5
h
4 1
h
4 5
h
4 6
h
4 2
h
6 5
h
6 4
h
5 3
h
5 2
h
3 5
h
5 4
h
5 6
h
1 3
h
1 4
h
4 3
h
3 4
h
Fall 2010 51 A 1 3 A C 1 2 3 2 A B 1 3 2 1 2 3 3 1 B C F 1 2 3 3 2 1 A B D 1 3 2 2 3 1 3 1 2 3 2 1 D F G 2 1 3
A AB AC ABD BCF DFG
B
4 5 3 6 2
B D F A A A C
1
Click to edit Master text styles Second level
1
R
2
R
4
R
3
R
5
R
6
R
Fall 2010 52 A 1 3 A C 1 2 3 2 A B 1 3 2 1 2 3 3 1 B C F 1 2 3 3 2 1 A B D 1 3 2 2 3 1 3 1 2 3 2 1 D F G 2 1 3 A 1 3 A 1 3 A 1 2 3 A 1 3 A 1 3 D 2 F 1 3 D 1 2 C 2 B 1 3 C 2 F 1 A 1 2 3 B 1 3 B 1 2 3
A AB AC ABD BCF DFG
B
4 5 3 6 2
B D F A A A C
1
1 3 B
Click to edit Master text styles Second level
2 1
h
3 1
h
1 3
h
1 2
h
1 4
h
3 5
h
2 4
h
2 5
h
4 1
h
4 6
h
4 2
h
6 5
h
6 4
h
5 2
h
5 3
h
5 6
h
1
R
2
R
4
R
3
R
5
R
6
R
Fall 2010 53 A 1 3 A C 1 2 3 2 A B 1 3 3 1 B C F 3 2 1 A B D 1 3 2 3 1 2 D F G 2 1 3
A AB AC ABD BCF DFG
B
4 5 3 6 2
B D F A A A C
1
Click to edit Master text styles Second level
1
R
2
R
4
R
3
R
5
R
6
R
Fall 2010 54 A 1 3 A 1 3 A 1 3 B 3 A 1 3 D 2 F 1 D 2 C 2 B 1 3 C 2 F 1 A 1 3 A 1 3 A 1 3 A C 1 2 3 2 A B 1 3 3 1 B C F 3 2 1 A B D 1 3 2 3 1 2 D F G 2 1 3 B 1 3 B 1 3
A AB AC ABD BCF DFG
B
4 5 3 6 2
B D F A A A C
1
Click to edit Master text styles Second level
2 1
h
3 1
h
1 3
h
1 2
h
1 4
h
3 5
h
2 4
h
2 5
h
4 1
h
4 6
h
4 2
h
6 5
h
6 4
h
5 2
h
5 3
h
5 6
h
1
R
2
R
4
R
3
R
5
R
6
R
Fall 2010 55 A 1 3 A C 1 2 3 2 A B 1 3 B C F 3 2 1 A B D 1 3 2 3 1 2 D F G 2 1 3
A AB AC ABD BCF DFG
B
4 5 3 6 2
B D F A A A C
1
Click to edit Master text styles Second level
1
R
2
R
4
R
3
R
5
R
6
R
Fall 2010 56 A 1 3 A 1 3 A 1 B 3 A 1 3 D 2 F 1 D 2 C 2 B 3 C 2 F 1 A 1 3 A 1 3 A 1 3 A C 1 2 3 2 A B 1 3 B C F 3 2 1 A B D 1 3 2 3 1 2 D F G 2 1 3 B 1 3 B 1 3
A AB AC ABD BCF DFG
B
4 5 3 6 2
B D F A A A C
1
Click to edit Master text styles Second level
2 1
h
3 1
h
1 3
h
1 2
h
1 4
h
3 5
h
2 4
h
2 5
h
4 1
h
4 6
h
4 2
h
6 5
h
6 4
h
5 2
h
5 3
h
5 6
h
1
R
2
R
4
R
3
R
5
R
6
R
Fall 2010 57 A 1 A C 1 2 3 2 A B 1 3 B C F 3 2 1 A B D 1 3 2 D F G 2 1 3
A AB AC ABD BCF DFG
B
4 5 3 6 2
B D F A A A C
1
Click to edit Master text styles Second level
1
R
2
R
4
R
3
R
5
R
6
R
Fall 2010 58 A 1 A 1 A 1 B 3 B 3 B 3 A 1 D 2 F 1 D 2 C 2 B 3 C 2 F 1 A 1 A 1 A 1 A C 1 2 3 2 A B 1 3 B C F 3 2 1 A B D 1 3 2 D F G 2 1 3
A AB AC ABD BCF DFG
B
4 5 3 6 2
B D F A A A C
1
Click to edit Master text styles Second level
2 1
h
3 1
h
1 3
h
1 2
h
1 4
h
3 5
h
2 4
h
2 5
h
4 1
h
4 6
h
4 2
h
6 5
h
6 4
h
5 2
h
5 3
h
5 6
h
1
R
2
R
4
R
3
R
5
R
6
R
Fall 2010 59 A 1 A C 1 2 A B 1 3 B C F 3 2 1 A B D 1 3 2 D F G 2 1 3
A AB AC ABD BCF DFG
B
4 5 3 6 2
B D F A A A C
1
Click to edit Master text styles Second level
1
R
2
R
4
R
3
R
5
R
6
R
Fall 2010 60
Click to edit Master text styles Second level