1. Boolean Equi-propagation for Optimized SAT Encoding AmitMetodi, Michael Codish, Vitaly Lagoon, and Peter J. Stuckey
2.
3. Large CNFProblem (hard) Constraint Model CNF Encoding Model Direct CSP solving SAT solving Solution Satisfied assignment Model Solution Decoding Translate
4.
5. Large CNFConstraint 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
12. 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.
13. 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] 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 U1 ≠ U2 (y2= -x2) diff(U1,U2) sumBits(Xs)=3 Constraints Constraints … … diff(U1,U2) … sumBits([a,b,c])=1 Constraints Encoding Encoding Encoding Simplify Simplify Simplify Simplify φsumBits([a,b,c])=1 φConstraints φConstraints … …
17. 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>
18. We can swap between two rows or two columns to generate another valid solution. Balanced Incomplete Block Designs (BIBD) r k r-l l <v, b, r, k, l>
19. BIBD – BEEvs Sugar (CSP to CNF Encoder) Faster time to generate CNF Smaller CNF Faster SAT solving time
20. BIBD – BEEvsSatELite (CNF-Level preprocessor) Preprocess time About the same size Solving time
21.
22. Apply complete CNF simplification on each constraint is possible in polynomial time.
23. 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 ( C’3, φ‘3 ) Constraint ( C’n, φ’n) Constraint ( C2, φ2 ) … M’ = CNF’’ Simplified Model Encoding Partial Evaluationusing Equi-Propagation Simplified CNF
26. BIBD – BEEvs MINION (Constraint solver) Modeling control
27. 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)
28.
Editor's Notes
In this talk I will present the paper“Boolean Equi-propagation for Optimized SAT Encoding” which is ajoint work of mine with Michal Codish, Vitaly Lagoon, and Peter Stuckey.
Given an hard finite domain problem there are several ways to solve it:Taking the direct approach by writing a dedicated algorithm.Or model the problem as set of constraints and using CSP solver to solve it.In recent years an alternative approach is becoming increasingly popular, solving finite domain constraint model via encoding to SAT.This popularity arise from two aspects:SAT solvers became increasingly stronger. (Modern SAT solvers can handle large size CNF that involving hundreds of thousands of literals and millions of clauses.)encoding techniques become increasingly sophisticated.Two comments on such CNF encodings:When encoding a constraint and modeling finite domain (integer) variables as bits, we lose in the CNF the relation between bits of an individual constraint.The resulting CNF is typically extremely large, often at the limit of what sat solvers can handle.We will focus on Encoding the Constraint Model to CNF and how to optimized it, in practical how to make it smaller.
In order to reduce CNF size we can apply CNF level simplifications on the entire CNF in order to find equivalent literals or assignments.But when trying to apply optimizations on the entire CNF the two comments become problems:The relation between bits of an individual constraint is lost and there might be some relevant information lost with it.The large CNF size prevents the ability to run a complete simplification on the CNF. Therefore we have to use tools such SatELite and ReVivAl which based on Unit Propagation and Resolution in order to reduce CNF size.Another way to optimize CNF is performing partial evaluation on the Constraint Model using CSP techniques in order to receive a Simplified Model before encoding. In this case during the partial evaluation we ignores the literals representation in the CNF.Using those techniques isn’t enough.I will show a new technique for “compile” Constraint Model to CNF which produce a better and smaller CNF by taking advantage of CSP techniques and Boolean techniques.
Our approach is:Given a Constraint Model, for each constraint we keeping two representations : CSP representation (Ci) and Boolean representation (Bi).We simplify the Constraint Model by applying CSP techniques and Boolean techniques on each constraint in the model.The Simplified Constraint Model will contain some of the original constraints, some constraints might been dropped and some constraints might be altered.After receiving a simplified model we generates a CNF formula for the entire problem by encoding each constraint using standard encodings.
Next I will talk about:Modeling Finite Domain Constraint Satisfaction Problem and focus on number representation.Define what is Equi-Propagation and demonstrate how it works.ExperimentationConclusions
When encoding Finite Domain CSP to CNF we have to represent the numbers using Boolean variables.There are two main representations: Binary and Unary.Because we dealing with small Finite Domain Problems, we chose to represent integers using Unary.There are two way to represent a number using Unary: Direct Encoding and the Order Encoding.We, as many before us, chose to represent integers using Order encoding.In this representation the bit in location i represent that the number X is great equals i.
So why Order Encoding ?It is well known that Order Encoding is good for representing ranges – set lower and upper bounds is done by assign the bits outside the range.We saw that Order Encoding is also good for representing arbitrary sets:If we want to set the number X to be different from i , we simply have to unify the ith and the ith+1 bits.Another good feature of Order Encoding is that some arithmetic operations involving constants doesn’t have to be encoded to CNF.Our approach takes advantage of all those features of the order encoding in order to reduce CNF size.
So what is Equi-Propagation:Equi-propagation is the process of inferring new equational consequences (such as x=y) from a single constraint in the model (and other existing equational information).When inferring such equational consequence, x can be removed from all the constraints by replacing x with it’s equivalent.
So how is itworks ?We receives a constraint model. For each variable` in the model we holding its “CSP representation” and “Boolean representation”.Here we will focus on two constraints from a model and the relevant data for those constraints.We start by go over the model and simplify one constraint at the time.Lets assume that during the simplification of the last constraints we learned the following information.The information we learned can be in CSP style or Boolean unifiers.Each time we learning, we update the model accordingly (both representations) – for example if we learned that x1=true we will replace each instance of x1 in the model with true. The boolean variable x1 will be dropped from the model.We will keep go over the model and simplify the constraints until there is nothing more to learn.Here we still have information to learn and when reaching diff(U1,U2) we learns that the only way this constraint can be satisfied is when y2= -x2.We update the data accordingly (replace y2 with –x2) and as we can see it is only effect the “Boolean representation”.We give the diff constraint another look and we see there is no need to keep it or encode it because any satisfied assignment will satisfied the constraint.Therefore it can be dropped from the model.(This couldn’t be done if we where looking on the constraints in CSP style alone)We keep going and getting to sumBits constraint. We looking on the bits participate in the constraints and we see there is true bit, false bit and x2 and –x2. This means the sum of those four bits will always be equals to two. Therefore we can replace the constraint with simpler constraint sumBits=1.After there is no more information to learn we will generate the CNF formula for the constraint model by encoding each constraint in the model.Some constraint will be encoded as they were encoded before the simplify step but some constraint will be encoded differently – more efficiently – in the case, instead of encode normal sum of bits and compare the result to 3, we now encode exactly-one which have more efficient encoding.(If we didn’t kept the constraint information and only the CNF formula for each constraint we couldn’t perform such optimization).
When looking on a valid solution to a problem, we can swap between two rows or two columns to generate another valid solution.We can break symmetry by adding lexical order constraints on the rows and columns.Orwe can do something smarter – assign the first two rows and column as followed…Those assignments gives starting point for the partial evaluation process.
First lets compare BEE to Sugar which is a well known SAT-based constraint solver based on order encoding.We took our model for BIBD which we break symmetry by assignments, and generated CNF using BEE and Sugar. Then solved the generated CNF on the same SAT solver (CryptoMinisat 2.5.1).First we can see that BEE generate a smaller CNF than Sugarwhich effect solving time.We can also see the CNF generating time of BEE is much smaller than Sugar.
Second we compared BEE to SatELite which is a well known CNF-level preprocessor.We took our model and encode it without using Equi-Propagation technique. The generated CNF was preprocessed by SatELite before solving it.We can see the CNF generated by BEE and the simplified CNF generated by SatELite is about the same size.Solving time of BEE is usually betterandsometimes the preprocess of SatELite is extremely long.If we look on the highlighted example we can see SatELite is generate a smaller and faster solved CNF but its preprocess time is extremely long.
CNF IN THIS SLIDE IS AFTER ADDING ANOTHER OPTIMIZATION TO BEE (BEE compile time and solving time is actually better that what written with the new optimization – compile and SAT for BEE copy&paste from previous version – didn’t had time to update).
At last we compared BEE to MINION which is a general-purpose constraint solver.The 2006 paper contains experiments on large scale BIBD instances.We took the model represented in the paper which includes search order.It seems for the large size BIBD, MINION is very fast and scales well as problem size increases but for other hard instances our tool acts better.But that not a fair comparison. Therefore we gave MINION the same model as ours – the results seem to improved compare to MINION model in most cases but in the instances from 2006 paper it was slower.Unlike MINION, We looking on the SAT solver as black box and have no way to effect search order, therefore, our model didn’t contained any information about search order.By adding search order to our model we manage to reduce solving time even more.