210 likes | 390 Views
Boolean Equi -propagation for Optimized SAT Encoding. Amit Metodi , Michael Codish , Vitaly Lagoon, and Peter J. Stuckey. Finite Domain Problem Solving. Constraint / Bits relation lost Large CNF. Problem (hard). Constraint Model. CNF. Model. Encoding. Direct. CSP solving.
E N D
Boolean Equi-propagation for Optimized SAT Encoding AmitMetodi, Michael Codish, Vitaly Lagoon, and Peter J. Stuckey
Finite Domain Problem Solving • Constraint / Bits relation lost • Large CNF Problem (hard) Constraint Model CNF Model Encoding Direct CSP solving SAT solving Solution Model Solution Satisfied assignment Decoding Translate
Optimized SAT Encoding • Problems: • Constraint / Bits relation lost • Large CNF Constraint Model Encoding CNF Simplify CNF’ Simplified Model Encoding Partial Evaluation CNF’’ Simplified Model’ Encoding Partial Evaluationusing Equi-Propagation Tools such as: SatELite, ReVivAl Based on Unit Propagation and Resolution. Simplified CNF
Our Approach Constraint ( C2, B2 ) Constraint ( C3, B3 ) Constraint ( Cn, Bn ) Constraint ( C1, B1 ) … M = Simplify Boolean techniques CSP techniques Equi-Propagation Constraint ( C1, B1 ) Constraint ( C2, B2 ) Constraint ( C’3, B‘3 ) Constraint ( C’n, B’n) … M’ = Encoding Standard encodings φ1 φ'3 φ'n … φ =
Outline • Modeling Finite Domain CSP • Equi-Propagation • Experimentation • Conclusions
small Modeling Finite Domain CSP representing numbers (integers) Binary Unary Order encoding Direct encoding Number Xwith a domain {0,1,2, …, d} will be represented using b=Boolean variables [ x1,x2,…xb] Number X = k ↔ = k Number Xwith a domain {0,1,2, …, d} will be represented using n=Boolean variables. xi ↔ (X ≥ i) (X = 3) = [1,1,1,0,0] xi ↔ (X = i) (X = 3) = [0,0,0,1,0,0]
Why Order Encoding ? • good for representing ranges X 1 0 X ≥ i X < j i j • good for arbitrary sets X v u i b=c e=f=g a b d c e f g • good for arithmetic operations with constants: + 3 = * 3 = a 1 a 1 a a c 1 a b b f b a b c b c c b c c c div 3 = a b c d e f g
Equi-Propagation • Equi-propagation is the process of inferring new equationalconsequences from a constraint in the model (and other existing equational information). x= -y, x=y, x=0, x=1 single x can now be removed from all constraints.
Equi-Propagation Example Learned: Partial Data: U1 { 0..4 } U1 = [x1,x2,x3,x4] U2 { 0..4 } U2 = [y1,y2,y3,y4] Xs = [a,d,b,x3,y2,c,y4] U1 { 1,3 } U1 = [1,x2,x2,0] U2 { 1,3 } U2 = [1,y2,y2,0] Xs = [a,1,b,x2,y2,c,0] U1 { 1,3 } U1 = [1,x2,x2,0] U2 { 1,3 } U2 = [1,-x2,-x2,0] Xs = [a,1,b,x2,-x2,c,0] U1 ≠ U2 (y2= -x2) 1≤U1≤3 and U1 ≠ 2 1≤U2≤3 and U2 ≠ 2 d = 1 x1=1, x3=x2 , x4=0 y1=1, y3=y2 , y4=0 d = 1 Constraints … diff(U1,U2) diff(U1,U2) … sumBits([a,b,c])=1 sumBits(Xs)=3 … Constraints Constraints Encoding Encoding Encoding Simplify Simplify Simplify Simplify φConstraints … φsumBits([a,b,c])=1 … φConstraints
Equi-Propagation • A complete equi-propagator for a constraint can be implemented using binary decision diagrams (BDDs) and can be evaluate in polynomial time.When C(X1,…,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 allDiff) 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.
Graph Crossing BIBD MAS Ben-Gurion-UniversityEqui-propagationEncoder Kakuro Protein folding N-Queens System Diagnostic Magic Square SCM / MCM QCP / Sudoku Nonograms
balanced incomplete block designs (BIBD) • 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: B11, …, Bbv • Domains:Bijϵ{0,1} • Constraints: • each row constraint: sum(Bi1,…,Biv) = r • each column constraint: sum(B1i,…,Bbi) = k • each two rows constraint: sum(Bi1*Bj1, …,Biv*Bjv)= l b=10 v=6 BIBD <6,10,5,3,2>
Balanced Incomplete Block Designs (BIBD) • We can swap between two rows or two columns to generate another valid solution. r k l r-l <v, b, r, k, l>
BIBD – BEEvs Sugar (CSP to CNF Encoder) Faster time to generate CNF Smaller CNF Faster SAT solving time
BIBD – BEEvsSatELite (CNF-Level preprocessor) Preprocess time About the same size Solving time
Conclusions Constraint ( C2, φ2 ) Constraint ( C3, φ3 ) Constraint ( Cn, φn ) Constraint ( C1, φ1 ) … M = Constraint Model Encoding CNF • 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. • Apply complete CNF simplification on each constraint is possible in polynomial time. • By using the Equi-Propagation technique we generates a small optimized CNF which than can be simplify using CNF-Level simplifications. Simplify CNF’ Simplified Model Encoding Boolean techniques CSP techniques Equi-Propagation Partial Evaluation Constraint ( C1, φ1 ) Constraint ( C2, φ2 ) Constraint ( C’3, φ‘3 ) Constraint ( C’n, φ’n) … M’ = CNF’’ Simplified Model Encoding Partial Evaluationusing Equi-Propagation Simplified CNF
BIBD – BEE + SatELite (CNF-Level preprocessor)
BIBD – BEEvs MINION (Constraint solver) Modeling control
Nonograms • Definition: an nXm 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: B11, …, Bnm • R11,…R1k,…,Rm1,…Rmp • C11,…C1q,…,Cn1,…,Cnr • Domains:Bijϵ{0,1} Rmoϵ{0,..,n} Cnoϵ{0,..,m} • Constraints: • block constraint: block(Rij,Rij+<ij size>,[B1i,…,Bni]) • space constraint: block(Rij+<ij size>,Rij+1,[-B1i,…,-Bni]) • no overlap constraint: leq(Rij+<ij size>+1, Rij+1)
Nonograms • There are dedicates solvers such as • Jan Wolter'spbnsolve • (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. 5,000 random 30x30 puzzles Selected human puzzles