Optimized SAT Encoding Finite Domain Problem Solving Problem
Optimized SAT Encoding Finite Domain Problem Solving Problem (hard) Constraint Model CNF Encoding Constraint Model Simplified Model SAT solving CSP solving Partial Evaluation using Equi-Propagation Modeling Finite Domain CSP representing numbers (integers) CNF Encoding Partial Evaluation Direct Problems: • Constraint / Bits connection lost • Large CNF’’ Encoding Direct encoding CNF preprocessors such: Sat. ELite, Re. Viv. Al Based on Unit Propagation and Resolution. Solution Model Solution Translate Simplified CNF M= Simplify Constraint ( C 2, φ2 ) CSP techniques φ= Equi-Propagation … Constraint ( C 2, φ2 ) Constraint ( C’ 3, φ‘ 3 ) Constraint ( Cn, φn ) Boolean techniques Equi-Propagation Encoding M’ = Constraint ( C 1, φ1 ) Constraint ( C 3, φ3 ) … Constraint ( C’n, φ’n ) φ'3 … xi ↔ (X ≥ i) (X = 3) = [1, 1, 1, 0, 0] ü good for representing ranges Equi-propagation is the process of inferring new equational consequences x= -y, x=0, x=1 from a single constraint in the model (and other existing equational information). X 1 0 X≥i i j X<j ü good for arbitrary sets X uv b=c i e=f=g a b c d e f g When inferring such equational consequence, x can be removed from the model by replacing x with its equivalent in all the constraints in the model. Standard encodings φ1 (X = 3) = [0, 0, 0, 1, 0, 0] Order encoding Our Approach Constraint ( C 1, φ1 ) xi ↔ (X = i) Satisfied assignment Decoding CNF’ Encoding Simplified Model’ Unary Binary ü good for arithmetic operations with constants: ab c +3= 1 1 1 a b c ab c *3= a a abbb c c c φ'n a b c d e f g div 3 = c f Equi-Propagation Example M= Constraints … diff(U 1={ 0. . 4 }=[x 1, x 2, x 3, x 4] , U 2={ 0. . 4 }=[y 1, y 2, y 3, y 4]) … … sum. Bits(a, d, b, x 3, y 2, c, y 4)=3 Ø When encoding CSP model to SAT holding both representation for each constraint gives the ability to apply simplify techniques from both worlds on each constraint. Ø A complete equi-propagator for a constraint can be implemented using binary decision diagrams (BDDs) and can be evaluate in polynomial time. § When C(X 1, …, Xk) a constraint about (fixed) “k” integers with n bits each, the BDD representing it is of size O(n^k). Ø Global constraints (such as all. Diff) implemented using Ad-Hoc rules. Ø There is a strong connection between Simplify and Encoding because Simplify done on the “encoding bits” and might change the encoding accordingly. Ø By using the Equi-Propagation technique we generates a small optimized CNF. Constraints Simplify U 1 < 4 , U 1 > 0 , U 1 ≠ 3 (x 1=1 , x 2=x 3 , x 4=0) d=1 M’ = Constraints … diff(U 1={ 1, 3 }=[1, x 2, 0] , U 2={ 1, 3 }=[1, y 2, 0]) … sum. Bits(a, 1, b, x 2, y 2, c, 0)=3 … Constraints U 1 ≠ U 2 (y 2= -x 2) Constraints … diff(U 1={ 1, 3 }=[1, x 2, 0] , U 2={ 1, 3 }=[1, -x 2, 0]) … sum. Bits(a, 1, b, x 2, -x 2, c, 0)=3 … Constraints … diff(U 1={ 1, 3 }=[1, x 2, 0] , U 2={ 1, 3 }=[1, -x 2, 0]) … sum. Bits(a, b, c)=1 … Constraints Experiments Balanced Incomplete Block Designs Definition: a 5 -tuple of positive integers <v, b, r, k, l> and require to partition v distinct objects into b blocks such that each block contains k different objects, exactly r objects occur in each block, and every two distinct objects occur in exactly l blocks. Variables: B 11, …, Bbv Domains: Bijϵ{0, 1} Constraints: each row constraint: sum(Bi 1, …, Biv) = r each column constraint: sum(B 1 i, …, Bbi) = k each two rows constraint: sum(Bi 1*Bj 1, …, Biv*Bjv)= l BIBD <6, 10, 5, 3, 2> instance <7, 350, 150, 3, 50> <7, 420, 180, 3, 60> <7, 560, 240, 3, 80> <21, 5, 5, 1> <15, 70, 14, 3, 2> <16, 80, 15, 3, 2> <25, 30, 6, 5, 1> <19, 57, 9, 3, 1> <25, 9, 9, 3> <15, 45, 24, 8, 12> BEE (Sym. B) compile CNF size (sec. ) (clauses) 1. 34 1. 65 3. 73 0. 02 0. 56 0. 81 0. 10 0. 34 0. 64 0. 51 494131 698579 1211941 0 81563 109442 24594 113053 92059 116016 SAT (sec. ) 1. 23 1. 73 13. 60 0. 00 0. 39 0. 56 0. 06 0. 17 1. 33 8. 46 Sugar (v 1. 14. 7) (Sym. B) generate CNF size SAT (sec. ) (clauses) (sec. ) 39. 36 12. 01 11. 74 31. 91 23. 58 64. 81 16. 02 ∞ 42. 65 4. 24 1607830 2488136 2753113 3716 540089 623773 93388 569007 466086 Nonograms Definition: an n. Xm board of cells to color black or white and given clues per row and column of a board. A clue is a number sequence indicating blocks of cells to be colored black. Variables: B 11, …, Bnm R 11, …R 1 k, …, Rm 1, …Rmp C 11, …C 1 q, …, Cn 1, …, Cnr Domains: Bijϵ{0, 1} Rmoϵ{0, . . , n} Cnoϵ{0, . . , m} Constraints: block constraint: block(Rij, Rij+<ij size>, [B 1 i, …, Bni]) space constraint: block(Rij+<ij size>, Rij+1, [-B 1 i, …, -Bni]) no overlap constraint: leq(Rij+<ij size>+1, Rij+1) 8. 99 13. 24 36. 43 0. 01 1. 87 2. 26 0. 42 8. 52 ∞ Sat. ELite (Sym. B) preproc CNF size SAT (sec. ) (clauses) (sec. ) 1. 27 1. 67 2. 73 0. 01 1. 02 1. 14 1. 2 10. 45 1. 01 0. 64 566191 802576 1397188 0 79542 105242 23828 111869 97623 134146 Instance id size There are dedicates solvers such as • Jan Wolter's pbnsolve (http: //webpbn. com/pbnsolve. html) • Ben-Gurion University Solver (http: //www. cs. bgu. ac. il/~benr/nonograms/) BEE is faster than the dedicated solvers on the hard puzzles. Solver Wolter BGU BEE 0. 20 4635 279 13 0. 50 4782 3161 4878 Time (sec. ) 1. 00 10. 00 4840 4952 4871 4978 4994 5000 5, 000 random 30 x 30 puzzles 30. 00 4974 4989 5000 60. 00 4976 4995 5000 9717 10000 9892 2556 10088 2712 6727 8098 6574 (30 x 30) (50 x 40) (45 x 65) (63 x 52) (47 x 47) (80 x 80) (19 x 19) (25 x 25) 1. 65 2. 18 5. 18 0. 00 0. 20 0. 35 0. 05 0. 14 8. 93 ∞ MINION v 0. 10 [M’ 06] Sym. B+ (sec. ) 0. 47 0. 54 0. 66 1. 26 12. 22 107. 43 ∞ ∞ BEE compile CNF size SAT (sec. ) (clauses) (sec. ) 0. 13 0. 28 0. 57 0. 13 0. 64 0. 31 1. 11 0. 02 0. 10 1. 12 1. 36 1. 77 0. 67 1. 42 13. 40 1. 37 1. 71 ∞ ∞ BGU 14496 124. 43 ∞ 44336 40. 66 ∞ 30980 0. 44 ∞ 2870 0. 00 15. 85 78482 1. 26 0. 27 43350 0. 92 5. 98 156138 2. 86 0. 5 3296 0. 06 209. 54 7426 0. 03 37. 56 Selected human puzzles 0. 38 0. 42 0. 52 0. 15 0. 31 0. 35 0. 92 75. 87 Walt. ∞ ∞ ∞ 0. 40 0. 08 4. 95 0. 17 8. 63 2. 94
- Slides: 1