CP 2011
Upcoming SlideShare
Loading in...5
×
 

CP 2011

on

  • 341 views

Boolean Equi-Propagation for Optimized SAT Encoding

Boolean Equi-Propagation for Optimized SAT Encoding

Statistics

Views

Total Views
341
Slideshare-icon Views on SlideShare
340
Embed Views
1

Actions

Likes
0
Downloads
1
Comments
0

1 Embed 1

https://duckduckgo.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • 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.

CP 2011 CP 2011 Presentation Transcript

  • 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
    Encoding
    Model
    Direct
    CSP solving
    SAT solving
    Solution
    Satisfied assignment
    Model
    Solution
    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
    ( C’3, B‘3 )
    Constraint
    ( C’n, B’n)
    Constraint
    ( C2, B2 )

    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=log𝑑Boolean variables [ x1,x2,…xb]
    Number X = k ↔ 𝑖=1𝑏2𝑥𝑖 = 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
    a
    a
    b
    b
    b
    c
    c
    c
    a
    c
    b
    a
    c
    b
    c
    f
    1
    1
    1
    c
    b
    a
    div 3 =
    c
    b
    a
    f
    e
    d
    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]
    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


  • 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>
  • 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>
  • 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
    ( C’3, φ‘3 )
    Constraint
    ( C’n, φ’n)
    Constraint
    ( C2, φ2 )

    M’ =
    CNF’’
    Simplified
    Model
    Encoding
    Partial Evaluationusing Equi-Propagation
    Simplified
    CNF
  • Questions ?
  • 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