400 likes | 561 Views
REFORMULATION. Non-binary constraints Dual & Hidden Variable Encodings. REFORMULATION. From non-binary to binary. Binary decomposable constraints. aka network decomposable. allDiff(x,y,z) x ≠ y, x ≠ z, y ≠ z monotone(x,y,z) x < y, y < z even(x + y +z) no way.
E N D
REFORMULATION Non-binary constraints Dual & Hidden Variable Encodings
REFORMULATION From non-binary to binary
Binary decomposable constraints aka network decomposable • allDiff(x,y,z) • x ≠ y, x ≠ z, y ≠ z • monotone(x,y,z) • x < y, y < z • even(x + y +z) • no way
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)
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>) R21: (<0,0,1>,<1,1,0>) VC2: (<0,1>,<1,0>) Dual Variables C1 = <*A> C2 = <A,*>
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>) R21: (<0,0,1>,<1,1,0>) VC2: (<0,1>,<1,0>) Dual Variables match on y C1 = <*A> C2 = <A,*>
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>) R21: (<0,0,1>,<1,1,0>) VC2: (<0,1>,<1,0>) Dual Variables match on y C1 = <*A> C2 = <A,*>
Dual Variables Another example Due to Stergiou & Walsh
Dual Variables x2 x1 x3 x6 x4 x5 The hypergraph
Hyper Graph Hidden Variable Encoding Dual Variable
Dual Variables x2 x1 x3 x6 x4 x5 Have a C variable for each constraint, with domain the set of allowed tuples Have constraints Rij between those C variables that share variables in the original model to ensure compatible pairs of tuples in positions i and j
Dual Variables R21 & R33 VC4 (0,0,0) (0,1,1) (1,0,1) VC1 (0,0,1) (0,1,0) (1,0,0) R33 R22 & R33 R11 VC2 (0,0,1) (1,0,0) (1,1,1) VC3 (0,1,0) (1,0,0) (1,1,0) (1,1,1) R31 Have a C variable for each constraint, with domain the set of allowed tuples Have constraints Rij between those C variables that share variables in the original model to ensure compatible pairs of tuples in positions i and j respectively
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
W x y z Hidden Variables Introduce an additional hidden variable, and use the originals Add 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>} Cxw: W = <1,*,*> x = 1 Cyw: Y = <*,1,*> y = 1 Czw: W = <*,*,1> z = 1
Hidden Variables VC4 (0,0,0) (0,1,1) (1,0,1) VC1 (0,0,1) (0,1,0) (1,0,0) r24 r64 r11 r54 r21 r61 v1 v2 v3 v4 v5 v6 r63 r12 r32 r53 r43 r42 VC2 (0,0,1) (1,0,0) (1,1,1) VC3 (0,1,0) (1,0,0) (1,1,0) (1,1,1) 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 ensure Compatibility between dual and original variables
Upside Downside Variables have domains O(mk) Higher level of consistency (GAC)
Hidden variable encoding AC on hidden variable encoding is equivalent to GAC on original problem
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
An example 1 2 3 4 5 6 7 4 Given the above grid and a dictionary, fill it. Then go get the clues (not my problem)
Original, non-binary, Encoding 1 2 3 4 5 6 A variable for each square Domain of each variable is {a .. z} 7 4 • Constraints are k-ary • For 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
The Dual Encoding 1 2 3 4 5 6 7 1A 4D 4 4A 2D Variables 1A 1 across 4D 4 down 2D 2 down 4A 4 across 7D 7 down 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 7D
The Dual Encoding 1 2 3 4 5 6 7 1A 4D 4 4A 2D 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 7D Binary Constraints