Non-binary constraints Dual & Hidden Variable Encodings REFORMULATION.
-
Upload
salma-mclaughlin -
Category
Documents
-
view
229 -
download
0
Transcript of Non-binary constraints Dual & Hidden Variable Encodings REFORMULATION.
Binary decomposable constraints
• allDiff(x,y,z)• x ≠ y, x ≠ z, y ≠ z
• monotone(x,y,z)• x < y, y < z
• even(x + y +z)• no way
aka network decomposable
Dual Variables
Consider the two constraints C1 and C2
• C1: even(x + y)• C2: odd(y+z)• x,y,z in {0,1}
• introduce variables VC1 and VC2• domain of VC1 is set of allowed tuples for x and y in constraint C1• domain of VC2 is set of allowed tuples for y and z in constraint C2• introduce a constraint relation R21 where
• domain of R21 is allowed tuples between VC1 and VC2• position 2 in tuples in VC1 (agrees in y)• position 1 in tuples in VC2 (agrees in y)
Dual Variables Consider the two constraints C1 and C2
• C1: even(x + y)• C2: odd(y+z)• x,y,z in {0,1}
VC1: (<0,0>,<1,1>)
VC2: (<0,1>,<1,0>)
R21: (<0,0,1>,<1,1,0>)C1 = <*A> C2 = <A,*>
Dual Variables Consider the two constraints C1 and C2
• C1: even(x + y)• C2: odd(y+z)• x,y,z in {0,1}
VC1: (<0,0>,<1,1>)
VC2: (<0,1>,<1,0>)
R21: (<0,0,1>,<1,1,0>)C1 = <*A> C2 = <A,*>match on y
Dual Variables Consider the two constraints C1 and C2
• C1: even(x + y)• C2: odd(y+z)• x,y,z in {0,1}
VC1: (<0,0>,<1,1>)
VC2: (<0,1>,<1,0>)
R21: (<0,0,1>,<1,1,0>)C1 = <*A> C2 = <A,*>match on y
Dual Variables Another example
Due to Stergiou & Walsh
0
1
1
1
}1,0{
652
654
431
621
xxx
xxx
xxx
xxx
xi
Dual Variables
0
1
1
1
}1,0{
652
654
431
621
xxx
xxx
xxx
xxx
xi
x1
x6
x2
x5
x4
x3
Have a C variable for each constraint, with domain the set of allowed tuples
Have constraints Rij between those C variables that share variablesin the original model to ensure compatible pairs of tuples in positions i and j
Dual Variables
0:
1:
1:
1:
}1,0{
6524
6543
4312
6211
xxxC
xxxC
xxxC
xxxC
xi
Have a C variable for each constraint, with domain the set of allowed tuples
Have constraints Rij between those C variables that share variablesin the original model to ensure compatible pairs of tuples in positions i and j respectively
VC4(0,0,0) (0,1,1)
(1,0,1)
VC1(0,0,1) (0,1,0)
(1,0,0)
VC2(0,0,1) (1,0,0)
(1,1,1)
VC3(0,1,0) (1,0,0)(1,1,0) (1,1,1)
R11
R33
R21 & R33
R31
R22 & R33
Dual Variables
(you could) Try this
• u,v,w,x, y, and z, in {0,1}• C1: oddSum(x,y,z)• C2: notSame(u,v,w)• C3: evenSum(w,x,y)
Hidden Variable
Introduces dual variables as before (representing allowed tuples for constraints)
Additional “hidden” variables binary constraints from the dual to original variables
Hidden Variables
Introduce an additional hidden variable, and use the originalsAdd k binary constraints from originals to hidden variable
Example• x,y,z in {0,1}• notSame(x,y,z)
Allowed tuples are {<0,0,1>,<0,1,0>,<0,1,1>,<1,0,0>,<1,0,1>,<1,1,0>}
W is in {<0,0,1>,<0,1,0>,<0,1,1>,<1,0,0>,<1,0,1>,<1,1,0>}
W
x y z
Cxw: W = <1,*,*> x = 1Cyw: Y = <*,1,*> y = 1Czw: W = <*,*,1> z = 1
Hidden Variables
0:
1:
1:
1:
}1,0{
6524
6543
4312
6211
xxxC
xxxC
xxxC
xxxC
xi
Have a C variable for each constraint, with domain the set of allowed tuples (as before)
Have constraints rij between variable vi and dual variable VCJ to ensureCompatibility between dual and original variables
VC4(0,0,0) (0,1,1)
(1,0,1)
VC1(0,0,1) (0,1,0)
(1,0,0)
VC2(0,0,1) (1,0,0)
(1,1,1)
VC3(0,1,0) (1,0,0)(1,1,0) (1,1,1)
v1 v2 v3 v4 v6v5
r11
r12
r21r24
r32r42
r43 r53
r54r61
r63
r64
Dual variable encoding
AC on dual encoding is stronger than GAC on original encoding
AC on dual encoding is stronger than AC on hidden variable encoding
1 2 3 4 5 6
4
7
An example
Given the above grid and a dictionary, fill it.
Then go get the clues (not my problem)
1 2 3 4 5 6
4
7
Original, non-binary, Encoding
A variable for each squareDomain of each variable is {a .. z}
Constraints are k-aryFor example,
• 1-across is set of 6-tuples• 2-down is set of 7 tuples• Tuples on 1-across and 2-down must be consistent
Variables
1A 1 across
4D 4 down
2D 2 down
4A 4 across
7D 7 down
1 2 3 4 5 6
4
71A 4D
2D
7D
4A
The Dual Encoding
Domains
1A: any 6 letter word
4A: any 8 letter word
4D: any 5 letter word
2D: any 7 letter word
7D: any 3 letter word
1 2 3 4 5 6
4
71A 4D
2D
7D
4A
1A-4D: 4th of 1A equals 1st of 4D
1A-2D: 2nd of 1A equals 1st of 2D
2D-4A: 4th of 2D equals 2nd of4D
4D-4A: 4th of 4A equals 4th of 4D
4A-7D: 7th of 4A equals 2nd of 7D
Binary Constraints
The Dual Encoding