Presentation is loading. Please wait.

Presentation is loading. Please wait.

OUTLINE Boolean Equi-propagation for Optimized SAT Encoding Compiling Finite Domain Constraints to SAT with BEE Encoding process Design choices Compiling.

Similar presentations


Presentation on theme: "OUTLINE Boolean Equi-propagation for Optimized SAT Encoding Compiling Finite Domain Constraints to SAT with BEE Encoding process Design choices Compiling."— Presentation transcript:

1

2 OUTLINE Boolean Equi-propagation for Optimized SAT Encoding Compiling Finite Domain Constraints to SAT with BEE Encoding process Design choices Compiling Model-Based Diagnosis to Boolean Satisfaction using BEE Amit Metodi Michael Codish Vitaly Lagoon Peter J. Stuckey ; CP 2011 Amit Metodi Michael Codish ; TPLP 2012 Amit Metodi Roni Stern Meir Kalech Michael Codish ; AAAI 2012

3 Problem (hard) Solution CNF Satisfied assignment Encoding FINITE DOMAIN PROBLEM SOLVING Model Constraint Model Direct CSP solving Model Solution Translate Decoding SAT solving

4 CNF Constraint Model C1 C2 C3 Cn encode Simplify Tools such as: SatELite, ReVivAl Based on Unit Propagation and Resolution. Problems: Constraint / Bits relation lost Large CNF CNF THE USUAL APPROACH Simplified CNF

5 Constraint Model C1 C2 C3 Cn encode CNF OUR APPROACH simplification propagation

6 Constraint Model C1 C2 C3 encode THE EQUI-PROPAGATION PROCESS Equi-propagation is a process of inferring equational consequences from a Boolean formula and given equational information. of the form X=L where L is a constant or a literal: X=Y, X= -Y, X=0, X=1 such X can be removed from ALL Boolean formulas / constraints. Cn CNF

7 Encoding Constraint Model Equi-propagationPartial evaluation view each single constraint as a Boolean formula

8 CNF BEE PROCESS – BY EXAMPLE Constraint Model C1 C2 C3 Cn encode bool_array_sum_eq( [ A,B,C,D,E,F,G],3) Step 1: Encode each constraint

9 Constraint Model C1 C2 C3 Cn encode BEE PROCESS – BY EXAMPLE encode bool_array_sum_eq( [ A,B,C,D,E,F,G],3) A=1, D= -E CNF Step 2: Apply Equi-Propagation

10 Constraint Model C3 bool_array_sum_eq( [ A,B,C,D,E,F,G],3) C1 C2 Cn encode BEE PROCESS – BY EXAMPLE update encode update encode update encode update bool_array_sum_eq( [ A,B,C,D,E,F,G],3) bool_array_sum_eq( [ 1,B,C,-E,E,F,G],3) A=1, D= -E CNF Step 3: Update the Constraints Model

11 Constraint Model C1 C2 C3 Cn encode BEE PROCESS – BY EXAMPLE update encode update encode update encode update bool_array_sum_eq( [ A,B,C,D,E,F,G],3) bool_array_sum_eq( [ 1,B,C,-E,E,F,G],3) bool_array_sum_eq( [ B,C, F,G],1) A=1, D= -E CNF Step 4: Apply Partial Evaluation

12 Constraint Model C1 C2 C3 Cn encode BEE PROCESS – BY EXAMPLE update encode update encode update encode update bool_array_sum_eq( [ A,B,C,D,E,F,G],3) bool_array_sum_eq( [ 1,B,C,-E,E,F,G],3) bool_array_sum_eq( [ B,C, F,G],1) A=1, D= -E CNF Step 5: Encode with a better encoding

13 Constraint Model C1 C2 C3 Cn encode BEE PROCESS – BY EXAMPLE update encode update encode update encode update bool_array_sum_eq( [ A,B,C,D,E,F,G],3) bool_array_sum_eq( [ 1,B,C,-E,E,F,G],3) bool_array_sum_eq( [ B,C, F,G],1) CNF Step 6: Merge the optimized CNF Optimized CNF merge

14 THE DESIGN CHOICES Representing numbers Implementing Equi-Propagation

15 MODELING FINITE DOMAIN CSP representing numbers (integers) BinaryUnaryOrder encoding x i (X i) (X = 3) = [1,1,1,0,0] Direct encoding x i (X = i) (X = 3) = [0,0,0,1,0,0] SMALL

16 WHY ORDER ENCODING ? X ij X iX < j 1 0 good for representing ranges X u v i good for arbitrary sets ab c d efg b=c e=f=g

17 WHY ORDER ENCODING ? Lots of equi-propagation The Encoding to SAT needs NO clauses. It is obtained by unification.

18 IMPLEMENTING EQUI-PROPAGATION 1.Using BDDs. Prohibitive for global constraints. Complete 2.Using SAT (on small groups of constraints) In practice, surprisingly, not slow Complete 3.Ad-Hoc rules (per constraint type) Fast, precise in practice Incomplete

19 AD-HOC RULES Equi-Propagation Partial Evaluation int_plus(,, ) Example: int_plus(,, ) Example: int_plus(,, )

20 THE IMPACT OF BEE 909 clauses 136 Bits 298 clauses 49 Bits

21 Kakuro QCP / Sudoku BIBD Nonograms Graph Crossing N-Queens Magic Square MAS SCM / MCM Model Based Diagnostic Protein folding

22

23 MODEL BASED DIAGNOSIS An important problem which researched by many researches. There is standard benchmarks. Encoding to SAT is straightforward But previous attempts concluded that SAT isnt competitive with other tools. We show that by using BEE, not only SAT is able to compete with other tools, it is faster. We solve the entire benchmark for the first time.

24 1 Symptom Diagnoses: A B C D E Z1 Z2 Z3 1 0 Observation Full Adder MODEL BASED DIAGNOSIS System (model) 0

25 Diagnoses: A B C D E Z1 Z2 Z3 Full Adder min min-cardinality MODEL BASED DIAGNOSIS We focus on minimal cardinality diagnosis of Boolean Circuits, given a single observation.

26 H -H-H purple means encapsulated with a health variable MODELING MBD: THE WEAK FAULT MODEL (we can assume that) a faulty component flips its output. Introduce health variables:

27 minimize 1 0 A B C D E X1 X2 A2 A1 O1 Z1 Z2 Z Full Adder H1H1 H2H2 H3H3 H4H4 H5H5 sum( [ -H 1, -H 2, -H 3, -H 4, -H 5 ] ) K MODELING MBD: INTRODUCE HEALTH VARIABLES Modeling as CSP where the constraints are: 1. components (logic gates) 2. sum of bits / comparison

28 minimize sum( [ -H 1, -H 2, -H 3, -H 4, -H 5 ] ) 1 Modeling as CSP where the constraints are: 1. components (logic gates) 2. sum of bits / comparison 1 0 A B C D E X1 X2 A2 A1 O Full Adder H1H1 H2H2 H3H3 H4H4 H5H5 green means healthy MODELING MBD: INTRODUCE HEALTH VARIABLES

29 1 0 A B C D E X1 X2 A2 A1 O1 Z1 Z2 Z Full Adder H1H1 H2H2 H3H3 H4H4 H5H5 H -H gray means "melted Z partial evaluation SIMPLIFYING THE ENCODING equi-propagation Z=-H H1 -H3

30 vanillasimplified 330 components 60 x 26 (input/output) 1182 observations Timeout 180sec

31 MBD TO SAT We can go just so far (and not very); We can not push the inputs through the circuit because of the health variables. What can we do ? Better modeling Better preprocessing

32 A B C D E Z1 Z2 Z3 Full Adder dominator BETTER MODELING: CONES Def: gate G dominates gate X, if any path from X to a system output passes through G Def: the cone corresponding to gate G is the set of gates dominated by G

33 BETTER MODELING: CONES these prune the search space break a symmetry claim: A minimal cardinality diagnosis will always indicate at most one unhealthy gate per cone. We can assume w.l.o.g. that this gate is the dominator. (or: in the search for a single minimal cardinality diagnosis, all dominated gates may be assumed healthy)

34 1 0 A B C D E X1 X2 A2 A1 O1 Z Full Adder H1H1 H2H2 H3H3 H4H4 H5H5 sum( [ -H 1, -H 2, -H 3, -H 4, -H 5 ] ) K H1 -H3 a cone THE IMPACT OF CONES

35 1 0 A B C D E X1 X2 A2 A1 O1 Z Full Adder H1H1 H2H2 H3H3 H4H4 H5H5 H1 0 sum( [ -H 1, -H 2, 0, 0, -H 5 ] ) K green means healthy gray means "melted THE IMPACT OF CONES

36 1 0 A B C D E X1 X2 A2 A1 O Full Adder H1H1 H2H2 H3H3 H4H4 H5H5 H1 0 H 1 sum( [ -H 1, -H 2, -H 5 ] ) K THE IMPACT OF CONES

37 sum( [ -H 1, -H 2, H 1 ] ) K 1 0 A B C D E X1 X2 A2 A1 O Full Adder H1H1 H2H2 H3H3 H4H4 H5H5 H1 0 H1=-H5 H1 THE IMPACT OF CONES

38 1 0 A B C D E X1 X2 A2 A1 O Full Adder H1H1 H2H2 H3H3 H4H4 H5H5 sum( [ -H 1, -H 1, H 1 ] ) K H1 0 H1=-H5 H1=H2 THE IMPACT OF CONES

39 1 0 A B C D E X1 X2 A2 A1 O Full Adder H1H1 H2H2 H3H3 H4H4 H5H5 sum( [ -H 1, -H 1, H 1 ] ) K H1 0 H1=-H5 H1=H2 minimize K H 1 =1 THE IMPACT OF CONES

40 1 0 A B C D E X1 X2 A2 A1 O Full Adder H1H1 H2H2 H3H3 H4H4 H5H5 No SAT solving; Diagnostics (min-cardinality) found by: preprocessing(cones) partial evaluation equi-propagation THE IMPACT OF CONES

41 vanillasimplifiedcones

42 Systems Name|C||IN||OUT|Obsrs c c c c c c c c c c There are standard benchmarks for finding a minimal cardinality diagnosis of Boolean Circuits, given a single observation. BENCHMARKS

43 SystemHA*CDA*SAFARISAT Name%Succ.Time%Succ.Time%Succ.Time%Succ.Time (44) (91) (57) c (28) c (7) c (48) c (5) c (17) c (14) c (9) c (9) c (25) c Average time (sec) on those that do not t/o 30 seconds timeout EXPERIMENTS

44 CONCLUSIONS Equi-Propagation process apply powerful reasoning techniques to separate parts of the model and maintain efficient preprocessing. BEE encodes finite domain constraints to CNF uses ad-hoc equi-propagation and partial evaluation rules which keeps compilation times typically small. And the reduction in SAT solving time can be larger in orders of magnitude. By using BEE the user may focus on better modeling which will result better preprocessing and faster solving time. (MBD as an example)

45 FUTURE WORK Other number representations Binary, Mix Radix, RNS, and more… Partition for Complete Equi-Propagation. Additional applications to Model Based Diagnosis.

46 QUESTIONS ?


Download ppt "OUTLINE Boolean Equi-propagation for Optimized SAT Encoding Compiling Finite Domain Constraints to SAT with BEE Encoding process Design choices Compiling."

Similar presentations


Ads by Google