Problem (hard) Solution CNF Satisfied assignment Encoding FINITE DOMAIN PROBLEM SOLVING Model...
-
Upload
kathryn-flowers -
Category
Documents
-
view
218 -
download
1
Transcript of Problem (hard) Solution CNF Satisfied assignment Encoding FINITE DOMAIN PROBLEM SOLVING Model...
Boolean Equi-propagation for Optimized SAT
EncodingAmit Metodi, Michael Codish, Vitaly Lagoon, and Peter J. Stuckey
Problem(hard)
Solution
CNF
Satisfied assignment
Encoding
FINITE DOMAIN PROBLEM SOLVING
ModelConstraint
Model
Dir
ect
• Constraint / Bits relation lost
• Large CNF
CS
P s
olvi
ng
ModelSolution
Translate Decoding
SA
T s
olv
ing
ConstraintModel
SimplifiedCNF
Encoding CNF
Sim
plif
y
SimplifiedModel
Encoding
OPTIMIZED SAT ENCODING
CNF’’
Problems:• Constraint / Bits
relation lost• Large CNF
CNF’Partial Evaluation
Tools such as: SatELite, ReVivAlBased on Unit Propagation and Resolution.
SimplifiedModel’
EncodingPartial Evaluation using
Equi-Propagation
OUR APPROACH
Constraint( C1, B1 ) …M=
Constraint( C1, B1 )
Constraint( C’3, B‘3 )
Constraint( C’n, B’n )…M= ’
φ=
Sim
plify
CSP techniques
Enc
odin
g
Boolean techniques
Constraint( C2, B2 )
Constraint( C3, B3 )
Constraint( Cn, Bn )
Constraint( C2, B2 )
φ1 φ'3 φ'n…
Equi-Propagation
Standard encodings
OUTLINE
Modeling Finite Domain CSP
Equi-Propagation
Experimentation
Conclusions
MODELING FINITE DOMAIN CSP
representing numbers (integers)
BinaryNumber X with a domain {0,1,2, …, d} will be represented using b= Boolean variables [ x1,x2,…xb]
Number X = k ↔ = k
UnaryNumber X with a domain {0,1,2, …, d} will be represented using n= Boolean variables.
Order encodingxi ↔ (X ≥ i)
(X = 3) = [1,1,1,0,0]
Direct encodingxi ↔ (X = i)
(X = 3) = [0,0,0,1,0,0]
SMALL
WHY ORDER ENCODING ?
Xi jX ≥ i X < j 1 0
good for representing ranges
X u vi
good for arbitrary sets
good for arithmetic operations with constants:
+3 =
*3 = div 3 = aaa bbb ccca cb
a cb
c f
111 cba
cba fed g
a b c d e f g
b=c e=f=g
x= -y, x=y,x=0, x=1
single
EQUI-PROPAGATION
Equi-propagation is the process of inferring new equational consequences from a constraint in the model (and other existing equational information).
x can now be removed from all
constraints.
diff(U1,U2)
U1 { 0..4 } U1 = [x1,x2,x3,x4]U2 { 0..4 } U2 = [y1,y2,y3,y4]Xs = [a,d,b,x3,y2,c,y4]
EQUI-PROPAGATION EXAMPLE
sumBits(Xs)=3Constraints Constraints… …
Sim
plify
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]
Partial Data:
φsumBits([a,b,c])=1φConstraints φConstraints… …
diff(U1,U2)
1≤U1≤3 and U1 ≠ 2 1≤U2≤3 and U2 ≠ 2 d = 1
Learned:
Sim
plify
Sim
plify
Sim
plify
Enc
odin
g
Enc
odin
g
Enc
odin
g
x1=1, x3=x2 , x4=0y1=1, y3=y2 , y4=0d = 1
U1 ≠ U2 (y2= -x2)
…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.
Kakuro
QCP / Sudoku
BIBD
Nonograms
Ben-Gurion-University
Equi-propagation
Encoder
Graph Crossing
N-Queens
Magic Square
MAS
SCM / MCM
SystemDiagnostic
Proteinfolding
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
BIBD <6,10,5,3,2>
b=10
v=6
We can swap between two rows or two columns to generate another valid solution.
BALANCED INCOMPLETE BLOCK DESIGNS (BIBD)
k
r
r-ll
<v, b, r, k, l>
BIBD – BEE VS SUGARSugar (v1.14.7) (SymB) BEE (SymB) instance
SAT(sec.)
CNF size(clauses)
generate(sec.)
SAT(sec.)
CNF size(clauses)
compile(sec.)
8.99 1607830 39.36 1.23 494131 1.34 <7,350,150,3,50>
13.24 2488136 12.01 1.73 698579 1.65 <7,420,180,3,60>
36.43 2753113 11.74 13.60 1211941 3.73 <7,560,240,3,80>
0.01 3716 31.91 0.00 0 0.02 <21,21,5,5,1>
1.87 540089 23.58 0.39 81563 0.56 <15,70,14,3,2>
2.26 623773 64.81 0.56 109442 0.81 <16,80,15,3,2>
0.42 93388 16.02 0.06 24594 0.10 <25,30,6,5,1>
- - ∞ 0.17 113053 0.34 <19,57,9,3,1>
8.52 569007 42.65 1.33 92059 0.64 <25,25,9,9,3>
∞ 466086 4.24 8.46 116016 0.51 <15,45,24,8,12>
(CSP to CNF Encoder)
Faster SAT solving time
Smaller CNF
Faster time to generate CNF
BIBD – BEE VS SATELITESatELite (SymB) BEE (SymB) instance
SAT(sec.)
CNF size(clauses)
preprocs(sec.)
SAT(sec.)
CNF size(clauses)
compile(sec.)
1.65 566191 1.27 1.23 494131 1.34 <7,350,150,3,50>
2.18 802576 1.67 1.73 698579 1.65 <7,420,180,3,60>
5.18 1397188 2.73 13.60 1211941 3.73 <7,560,240,3,80>
0.00 0 0.01 0.00 0 0.02 <21,21,5,5,1>
0.20 79542 1.02 0.39 81563 0.56 <15,70,14,3,2>
0.35 105242 1.14 0.56 109442 0.81 <16,80,15,3,2>
0.05 23828 1.2 0.06 24594 0.10 <25,30,6,5,1>
0.14 111869 10.45 0.17 113053 0.34 <19,57,9,3,1>
8.93 97623 1.01 1.33 92059 0.64 <25,25,9,9,3>
∞ 134146 0.64 8.46 116016 0.51 <15,45,24,8,12>
(CNF-Level preprocessor)
Solving time
About the same size
Preprocess time
CONCLUSIONS 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. Constraint
Model
SimplifiedCNF
Encoding CNF
SimplifiedModel
Encoding
CNF’’
CNF’Partial Evaluation
SimplifiedModel
EncodingPartial Evaluation using Equi-Propagation
Constraint( C1, φ1 ) …M=
Constraint( C1, φ1 )
Constraint( C’3, φ‘3 )
Constraint( C’n, φ’n )…M= ’
Sim
plif
y
CSP techniques Boolean techniques
Constraint( C2, φ2 )
Constraint( C3, φ3 )
Constraint( Cn, φn )
Constraint( C2, φ2 )
Equi-Propagation
Questions?
BIBD – BEE + SATELITESatELite (SymB) BEE (SymB) instance
SAT(sec.)
CNF size(clauses)
preprocs(sec.)
SAT(sec.)
CNF size(clauses)
compile(sec.)
0.83 487523 1.43 1.23 488891 1.34 <7,350,150,3,50>
1.39 690596 1.86 1.73 692361 1.65 <7,420,180,3,60>
4.18 1201439 3.16 13.60 1203758 3.73 <7,560,240,3,80>
0.00 - - 0.00 0 0.02 <21,21,5,5,1>
0.11 62969 0.84 0.39 64968 0.56 <15,70,14,3,2>
0.20 84057 1.00 0.56 87333 0.81 <16,80,15,3,2>
0.05 24007 1.15 0.06 24912 0.10 <25,30,6,5,1>
0.13 107936 11.40 0.17 109121 0.34 <19,57,9,3,1>
1.87 85426 0.92 1.33 86331 0.64 <25,25,9,9,3>
2.31 115341 0.66 8.46 115421 0.51 <15,45,24,8,12>
(CNF-Level preprocessor)
MINION v0.10 BEE (SymB) instance
SymB+(sec.)
SymB(sec.)
[M’06](sec.)
SAT(sec.)
CNF size(clauses)
compile(sec.)
0.38 1.12 0.47 1.23 494131 1.34 <7,350,150,3,50>
0.42 1.36 0.54 1.73 698579 1.65 <7,420,180,3,60>
0.52 1.77 0.66 13.60 1211941 3.73 <7,560,240,3,80>
0.15 0.67 1.26 0.00 0 0.02 <21,21,5,5,1>
0.31 1.42 12.22 0.39 81563 0.56 <15,70,14,3,2>
0.35 13.40 107.43 0.56 109442 0.81 <16,80,15,3,2>
0.31 1.37 ∞ 0.06 24594 0.10 <25,30,6,5,1>
0.35 1.71 ∞ 0.17 113053 0.34 <19,57,9,3,1>
0.92 ∞ ∞ 1.33 92059 0.64 <25,25,9,9,3>
75.87 ∞ ∞ 8.46 116016 0.51 <15,45,24,8,12>
BIBD – BEE VS MINION (Constraint solver)
Modeling control
NONOGRAMSDefinition: 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'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.
5,000 random 30x30 puzzles Selected human puzzles