# Order encoding x i ↔ (X ≥ i)(X = 3) = [1,1,1,0,0] Problem (hard) Problem (hard) Solution CNF Encoding Finite Domain Problem Solving Model Constraint Model.

## Presentation on theme: "Order encoding x i ↔ (X ≥ i)(X = 3) = [1,1,1,0,0] Problem (hard) Problem (hard) Solution CNF Encoding Finite Domain Problem Solving Model Constraint Model."— Presentation transcript:

Order encoding x i ↔ (X ≥ i)(X = 3) = [1,1,1,0,0] Problem (hard) Problem (hard) Solution CNF Encoding Finite Domain Problem Solving Model Constraint Model Constraint Model Direct CSP solving Model Solution Model Solution Translate Decoding SAT solving Constraint Model Constraint Model Simplified CNF Simplified CNF Encoding CNF Simplified Model Simplified Model Encoding Optimized SAT Encoding CNF’’ CNF’ Partial Evaluation CNF preprocessors such: SatELite, ReVivAl Based on Unit Propagation and Resolution. CNF preprocessors such: SatELite, ReVivAl Based on Unit Propagation and Resolution. Simplified Model’ Simplified Model’ Encoding Partial Evaluation using Equi-Propagation Problems: Constraint / Bits connection lost Large CNF Problems: Constraint / Bits connection lost Large CNF Constraint ( C1, φ 1 ) Constraint ( C1, φ 1 ) … M = Constraint ( C1, φ 1 ) Constraint ( C1, φ 1 ) Constraint ( C’3, φ‘ 3 ) Constraint ( C’3, φ‘ 3 ) Constraint ( C’n, φ’ n ) Constraint ( C’n, φ’ n ) … M’ = φ = Simplify CSP techniques Boolean techniques Constraint ( C2, φ 2 ) Constraint ( C2, φ 2 ) Constraint ( C3, φ 3 ) Constraint ( C3, φ 3 ) Constraint ( Cn, φ n ) Constraint ( Cn, φ n ) Constraint ( C2, φ 2 ) Constraint ( C2, φ 2 ) φ1φ1 φ1φ1 φ' 3 φ' n … Equi-Propagation Standard encodings Modeling Finite Domain CSP representing numbers (integers) Binary Unary Direct encoding x i ↔ (X = i) (X = 3) = [0,0,0,1,0,0] x i ↔ (X = i) (X = 3) = [0,0,0,1,0,0] X ij X ≥ iX < j 1 1 0 0 good for representing ranges X u u v v i good for arbitrary sets good for arithmetic operations with constants: + 3 = * 3 = div 3 = a a a a a a b b b b b b c c c c c c a a c c b b a a c c b b c c f f 1 1 1 1 1 1 c c b b a a c c b b a a f f e e d d g g a a b b c c d d e e f f g g b=c e=f=g x= -y, x=y, x=0, x=1 x= -y, x=y, x=0, x=1 Equi-Propagation Equi-propagation is the process of inferring new equational consequences from a single constraint in the model (and other existing equational information). When inferring such equational consequence, x can be removed from the model by replacing x with its equivalent in all the constraints in the model. MINION v0.10SatELite (SymB)Sugar (v1.14.7) (SymB)BEE (SymB)instance SymB+ (sec.) SymB (sec.) [M’06] (sec.) SAT (sec.) CNF size (clauses) preproc (sec.) SAT (sec.) CNF size (clauses) generate (sec.) SAT (sec.) CNF size (clauses) compile (sec.) 0.381.120.471.655661911.278.99160783039.361.234941311.34 0.421.360.542.188025761.6713.24248813612.011.736985791.65 0.521.770.665.1813971882.7336.43275311311.7413.6012119413.73 0.150.671.260.0000.01 371631.910.0000.02 0.311.4212.220.20795421.021.8754008923.580.39815630.56 0.3513.40107.430.351052421.142.2662377364.810.561094420.81 0.311.37∞0.05238281.20.429338816.020.06245940.10 0.351.71∞0.1411186910.45--∞0.171130530.34 0.92∞∞8.93976231.018.5256900742.651.33920590.64 75.87∞∞∞1341460.64∞4660864.248.461160160.51 Balanced Incomplete Block Designs Definition: a 5-tuple of positive integers 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: B 11, …, B bv Domains: B ij {0,1} Constraints: each row constraint: sum(B i1,…,B iv ) = r each column constraint: sum(B 1i,…,B bi ) = k each two rows constraint: sum(B i1 *B j1, …,B iv *B jv )= l BIBD Satisfied assignment Encoding Our Approach 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: B 11, …, B nm R 11,…R 1k,…,R m1,…R mp C 11,…C 1q,…,C n1,…,C nr Domains: B ij {0,1} R mo ϵ{0,..,n} C no ϵ{0,..,m} Constraints: block constraint: block(R ij,R ij +,[B 1i,…,B ni ]) space constraint: block(R ij +,R ij+1,[-B 1i,…,-B ni ]) no overlap constraint: leq(R ij + +1, R ij+1 ) Time (sec.)Solver 60.0030.0010.001.000.500.20 497649744952484047824635Wolter 49954989497848713161279BGU 5000 4994487813BEE 5,000 random 30x30 puzzles There are dedicates solvers such as Jan Wolter's pbnsolve (http://webpbn.com/pbnsolve.html)http://webpbn.com/pbnsolve.html Ben-Gurion University Solver (http://www.cs.bgu.ac.il/~benr/nonograms/)http://www.cs.bgu.ac.il/~benr/nonograms/ BEE is faster than the dedicated solvers on the hard puzzles. Walt.BGUBEEInstance SAT (sec.) CNF size (clauses) compile (sec.) sizeid ∞∞124.43144960.13(30x30)9717 ∞∞40.66443360.28(50x40)10000 ∞∞0.44309800.57(45x65)9892 0.4015.850.0028700.13(63x52)2556 0.080.271.26784820.64(63x52)10088 4.955.980.92433500.31(47x47)2712 0.170.52.861561381.11(80x80)6727 8.63209.540.0632960.02(19x19)8098 2.9437.560.0374260.10(25x25)6574 Selected human puzzles Experiments  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.  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.  By using the Equi-Propagation technique we generates a small optimized CNF. diff(U1={ 0..4 }=[x1,x2,x3,x4], U2={ 0..4 }=[y1,y2,y3,y4]) sumBits(a,d,b,x3,y2,c,y4)=3 Constraints … …… diff(U1={ 1,3 }=[1,x2,x2,0], U2={ 1,3 }=[1,y2,y2,0]) sumBits(a,1,b,x2,y2,c,0)=3 Constraints … …… diff(U1={ 1,3 }=[1,x2,x2,0], U2={ 1,3 }=[1,-x2,-x2,0]) sumBits(a,1,b,x2,-x2,c,0)=3 Constraints … …… diff(U1={ 1,3 }=[1,x2,x2,0], U2={ 1,3 }=[1,-x2,-x2,0]) sumBits(a,b,c)=1 Constraints … …… U1 ≠ U2 (y2= -x2) U1 0, U1 ≠ 3 (x1=1, x2=x3, x4=0) d=1 U1 0, U1 ≠ 3 (x1=1, x2=x3, x4=0) d=1 Equi-Propagation Example M = M’ = Simplify

Similar presentations