FINITE DOMAIN Constraint / Bits PROBLEM SOLVING relation lost - - PowerPoint PPT Presentation
FINITE DOMAIN Constraint / Bits PROBLEM SOLVING relation lost - - PowerPoint PPT Presentation
FINITE DOMAIN Constraint / Bits PROBLEM SOLVING relation lost Large CNF Problem Constraint Model Encoding CNF (hard) Model CSP solving SAT solving Direct Model Satisfied Solution Decoding Translate Solution assignment
Problem (hard) Solution CNF Satisfied assignment
Encoding
FINITE DOMAIN PROBLEM SOLVING
Model
Constraint Model
Direct
- Constraint / Bits
relation lost
- Large CNF
CSP solving
Model Solution
Translate Decoding SAT solving
Constraint Model Simplified CNF
Encoding
CNF
Simplify
Simplified Model
Encoding
OPTIMIZED SAT ENCODING
CNF‟‟
Problems:
- Constraint / Bits
relation lost
- Large CNF
CNF‟
Partial Evaluation Tools such as: SatELite, ReVivAl Based on Unit Propagation and Resolution.
Simplified Model‟
Encoding Partial Evaluation using Equi-Propagation
OUR APPROACH
Constraint ( C1, B1 )
…
M =
Constraint ( C1, B1 ) Constraint ( C‟3, B„3 ) Constraint ( C‟n, B‟n )
…
M‟ = φ =
Simplify CSP techniques Encoding 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) Binary Unary Order encoding
xi ↔ (X ≥ i) (X = 3) = [1,1,1,0,0]
Direct encoding
xi ↔ (X = i) (X = 3) = [0,0,0,1,0,0] SMALL
WHY ORDER ENCODING ?
X
i j X ≥ i X < j 1 good for representing ranges
X
u v
i good for arbitrary sets good for arithmetic operations with constants: + 3 = * 3 = div 3 = a a a b b b c c c a c b a c b c f 1 1 1 c b a c b a f e d 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)=3 Constraints Constraints
… …
Simplify
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:
Simplify Simplify Simplify Encoding Encoding Encoding
x1=1, x3=x2 , x4=0 y1=1, y3=y2 , y4=0 d = 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 System Diagnostic Protein folding
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
- bjects occur in each block, and every two distinct objects
- ccur 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-l l <v, b, r, k, l>
BIBD – BEE VS SUGAR
Sugar (v1.14.7) (SymB) BEE (SymB) instance
SAT (sec.) CNF size (clauses) generate (sec.) SAT (sec.) CNF size (clauses) compile (sec.)
- ∞
∞
(CSP to CNF Encoder) Faster SAT solving time Smaller CNF Faster time to generate CNF
BIBD – BEE VS SATELITE
SatELite (SymB) BEE (SymB) instance
SAT (sec.) CNF size (clauses) preprocs (sec.) SAT (sec.) CNF size (clauses) compile (sec.)
∞
(CNF-Level preprocessor) Solving time About the same size Preprocess time
MINION v0.10 BEE (SymB) instance
SymB+ (sec.) SymB (sec.) [M‟06] (sec.) SAT (sec.) CNF size (clauses) compile (sec.)
∞ ∞ ∞ ∞ ∞ ∞
BIBD – BEE VS MINION
(Constraint solver) Modeling control
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
- ptimized CNF which than can be simplify using CNF-Level
simplifications.
Constraint Model Simplified CNF Encoding CNF Simplified Model Encoding CNF‟‟ CNF‟ Partial Evaluation Simplified Model Encoding Partial Evaluation using Equi-PropagationConstraint ( C1, φ1 )
… M =
Constraint ( C1, φ1 ) Constraint ( C‟3, φ„3 ) Constraint ( C‟n, φ‟n )
… M‟ =
Simplify CSP techniques Boolean techniques
Constraint ( C2, φ2 ) Constraint ( C3, φ3 ) Constraint ( Cn, φn ) Constraint ( C2, φ2 )
Equi-Propagation
Questions ?
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'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