Download presentation
Presentation is loading. Please wait.
1
Running example The 4-houses puzzle:
4 families A, B, C and D live next to each other in houses numbered 1, 2, 3 and 4. D lives in a house with lower number than B, B lives next to A in a house with higher number, There is at least one house between B and C, D does not live in the house with number 2, C does not live in the house with number 4. Which family lives in which house ?
2
Representation: The variables: A, B, C and D
The domains: dA = dB = dC = dD = { 1, 2, 3, 4} Constraints: unary: c(C) = C 4 c(D) = D 2 binary: c(A,B) = B = A + 1 c(A,C) = A C c(B,D) = D B c(A,D) = A D c(B,C) = |B - C| 1 c(C,D) = C D
3
Node-consistency: Or: 1-consistency (only 1 variable is involved)
Unary constraints are eliminated through domain- reductions: c(C) = C 4 dC = { 1, 2, 3} c(D) = D 2 dD = { 1, 3, 4}
4
The constraint network:
B D C B = A + 1 A C D B A D |B - C| 1 C D { 1, 2, 3, 4} { 1, 2, 3} { 1, 3, 4}
5
The example – AC3 (1): First pass (== Look ahead check):
B D C B = A + 1 A C D B A D |B - C| 1 C D { 1, 2, 3, 4} { 1, 2, 3} { 1, 3, 4} A B D C B = A + 1 A C D B A D |B - C| 1 C D { 3, 4} { 1, 2} { 1, 3} { 1, 2, 3} Deletion_occurred := true
6
The example AC3 (2): Second pass: Deletion_occurred := true A B D C
B = A + 1 A C D B A D |B - C| 1 C D { 3, 4} { 1, 2} { 1, 3} { 1, 2, 3} A B D C B = A + 1 A C D B A D |B - C| 1 C D { 3, 4} { 1, 2} { 1, 3} { 2, 3} Deletion_occurred := true
7
The example AC3 (3): Third pass:
B D C B = A + 1 A C D B A D |B - C| 1 C D { 3, 4} { 1, 2} { 1, 3} { 2, 3} Deletion_occurred := false Result: A (2 or 3) , B (3 or 4), C (1 or 2), D (1 or 3) Consistent, but NOT REALLY A SOLUTION !!
8
K-consistency: 1-consistency (node-consistency):
unary constraints (on 1 variable) are consistent 2-consistency (arc-consistency): binary constraints (on 2 variables) are consistent 3-consistency: all constraints involving 3 variables are consistent Eample: A B D C B = A + 1 A C D B A D |B - C| 1 C D { 1, 2, 3, 4} { 1, 2, 3} { 1, 3, 4} A value remains in the domain if there are consistent values in the domains of the 2 other variables (for all connecting constraints)
9
Path consistency Starting with an arc-consistent graph:
B D C B = A + 1 A C D B A D |B - C| 1 C D { 3, 4} { 1, 2} { 1, 3} { 2, 3} Consistent, but NOT REALLY A SOLUTION !! Path-consistency considers all possible paths (triples of variables) AB -> D, AB->C, AC -> D, AC->B, BD->C, BD->A, CD->A, CD->B, etc etc
10
Path consistency <A,B>::[<2,3>, <3,4>] vs D, vs C
B = A + 1 A C D B A D |B - C| 1 C D { 3, 4} { 1, 2} { 1, 3} { 2, 3} <A,B>::[<2,3>, <3,4>] vs D, vs C <A,C>::[<2,1>, <3,1>, <3,2>] vs B, vs D <B,C>::[<3,1>, <4,1>, <4,2>] vs A, vs D <B,D>::[<3,1>, <4,1>, <4,3> ] vs A, vs C …
11
Search: Forward checking at work (starting with 1-consistent network)
3 2 A B C D {1} {1,2,3,4} {1,2,3} {1,3,4} B=A+1 AD AC A B C D {2} {1,2,3,4} {1,2,3} {1,3,4} B=A+1 AD AC A B C D {3} {1,2,3,4} {1,2,3} {1,3,4} B=A+1 AD AC B 3 B 4 B 2 A B C D {2} {3} {1,3} {1,3,4} |B-C|1 D B A B C D {3} {4} {1,2} {1,4} |B-C|1 D B A B C D {1} {2} {2,3} {3,4} |B-C|1 D B C 1 1 C 2 A B C D {3} {4} {1} CD A B C D {3} {4} {2} {1} CD A B C D {2} {3} {1} CD fail fail fail success
12
Lookahead checking at work
B C D {1,2,3,4} {1,2,3} {1,3,4} B=A+1 AD AC D B |B-C|1 CD A B C D {3} {3,4} {1,2} {1,3} B=A+1 AD AC D B |B-C|1 CD 1 A 3 2 A B C D {1} {3,4} {1,2} {1,3} B=A+1 B 4 A B C D {3} {4} {2} {1} D B |B-C|1 CD fail C 2 A B C D {2} {3,4} {1,2} {1,3} B=A+1 AD AC D B |B-C|1 CD A B C D {3} {4} {2} {1} CD fail success
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.