Presentation is loading. Please wait.

Presentation is loading. Please wait.

Boolean Satisfiability Solvers Wonhong Nam

Similar presentations


Presentation on theme: "Boolean Satisfiability Solvers Wonhong Nam"— Presentation transcript:

1 Boolean Satisfiability Solvers Wonhong Nam wnam@cis.upenn.edu

2 2002-11-19CIS6402 Satisfiability Boolean formula: f(v 1, v 2, v 3, … ) Find an assignment to variables such that f(t 1, t 2, t 3, … ) = T Or show that there is no such an assignment: f(v 1, v 2, v 3, … ) = F NP-complete problem Applications EDA(Electronic Design Automation) AI Bound Model Checking Tools GRASP, SATO, Chaff and so on.

3 2002-11-19CIS6403 Outline Introduction The Basic DPLL Framework Branching Heuristics Deduction Algorithm Conflict Analysis and Learning Performance Comparison Conclusion

4 2002-11-19CIS6404 Introduction Formula specified in CNF. f(v 1, v 2, v 3 ) = (v 1 + v 2 + ¬ v 3 ) & (v 1 + ¬ v 2 ) & ( ¬ v 1 ) Advantages In order to satisfy a formula, all of the clauses must be satisfied. In order to satisfy each clause, at least one of the literals must be satisfied. This example is satisfiable with v 1 = F, v 2 = F, v 3 = F Deduce (v 1 + v 2 + ¬ v 3 ), v 1 = F, v 2 = F  v 3 = F Conflict (v 1 + v 2 + ¬ v 3 ) & (V 3 ), v 1 = F, v 2 = F  conflict

5 2002-11-19CIS6405 The Basic DPLL Framework (1/2) DPLL(formula, assignment) { necessary = deduction(formula, assignment); new_asgnmnt = union(necessary, assignment); if(is_satisfied(formula, new_asgnmnt)) return SATISFIABLE; else if(is_conflicting(formula, new_asgnmnt)) return CONFLICT; var = choose_free_variable(formula, new_asgnmnt); asgn1 = union(new_asgnmnt, assign(var, 1)); if(DPLL(formula, asgn1)==SATISFIABLE) return SATISFIABLE; else { asgn2 = union(new_asgnmnt, assign(var, 0)); return DPLL(formula, asgn2); }

6 2002-11-19CIS6406 The Basic DPLL Framework (2/2) status = preprocess(); if(status!=UNKNOWN) return status; while(1){ decide_next_branch(); while(1){ status = deduce(); if(status == CONFLICT){ blevel = analyze_conflict(); if(blevel == 0) return UNSATISFIABLE; else backtrack(blevel); } else if (status == SATISFIABLE){ return SATISFIABLE; } else break; }

7 2002-11-19CIS6407 Branching Heuristics A lack of clear statistical evidence Some common strategies RAND The maximization of some complex functions of the current variable state and the clause. (BOHM and MOMs heuristics) DLIS(Dynamic Largest Individual Sum) heuristic to select the literal that appears most frequently in unresolved clauses. How to evaluate strategies. No clear answer. Chaff: VSIDS(Variable State Independent Decaying Sum)

8 2002-11-19CIS6408 VSIDS Observation The conflict clauses primarily make the search process to be difficult problems. Strategy Each variable in each polarity has a counter, initialized to 0. When a conflict clause is occurred, the counter associated with each literal in the clause is incremented. The variable and polarity with the highest counter is chosen at each decision. It has low overhead since the statistics are only updated when there is a new conflict clause.

9 2002-11-19CIS6409 The Basic DPLL Framework status = preprocess(); if(status!=UNKNOWN) return status; while(1){ decide_next_branch(); while(1){ status = deduce(); if(status == CONFLICT){ blevel = analyze_conflict(); if(blevel == 0) return UNSATISFIABLE; else backtrack(blevel); } else if (status == SATISFIABLE){ return SATISFIABLE; } else break; }

10 2002-11-19CIS64010 Deduction Algorithm(BCP) Most of SAT solver spent about 80% of running time in deduce(). Unit clause ( v 1 + v 2 + ¬ v 3 ), v 1 =F, v 2 =F  v 3 = F When can it occur? All-but-one literals in a clause are assigned to 0 BCP(Boolean Constraint Propagation) How implement? Keeping counters for each clause. GRASP, rel_sat, satz etc. GRASP - Each clause keeps two counters. For the number of value 1 literals in the clause. For the number of value 0 literals in the clause. if(# of literals - # of 0 literals == 1) unit clause.

11 2002-11-19CIS64011 BCP (1/3) SATO – head/tail pointers. Each clause has two pointers. The head points to the first free literal of the clause. The tail points to the last free literal of the clause. Advantage over counter method Only when the literals pointed by the head or the tail are assigned to 0, the pointer moves. When the variable is assigned value 1, the clauses that contain the positive literal will not be visited at all and vice- versa.

12 2002-11-19CIS64012 BCP (2/3) Chaff – watched literals. Observation – Undoing during backtracking has some computation that can be reduced. Two watched literal pointers. There is no imposed order on the two pointers within a clause. Each of the pointers can move in either direction. Advantage The same advantage as the head/tail mechanism compared with the counting scheme. Undoing takes less time because the watched literal pointers do not need to move.

13 2002-11-19CIS64013 BCP (3/3)

14 2002-11-19CIS64014 The Basic DPLL Framework status = preprocess(); if(status!=UNKNOWN) return status; while(1){ decide_next_branch(); while(1){ status = deduce(); if(status == CONFLICT){ blevel = analyze_conflict(); if(blevel == 0) return UNSATISFIABLE; else backtrack(blevel); } else if (status == SATISFIABLE){ return SATISFIABLE; } else break; }

15 2002-11-19CIS64015 Conflict Analysis and Learning (1/3) When a conflicting clause occurs, The solver needs to backtrack and undo the decisions. Chronological backtracking The solver keeps a flag indicating whether it has been tried in both phases or not. When a conflicting clause occurs, The solver looks for the decision variable with the latest decision level that has not been flipped, marks it flipped, undoes all the assignments between that decision level and current decision level, and then tries the other phase for the decision variable. v 1 = T, v 2 = F, v 3 = T, v 3 = F.

16 2002-11-19CIS64016 Conflict Analysis and Learning (2/3) Non-chronological backtracking Backtrack to an earlier decision level than the last unflipped decision. Conflict-directed learning The information about the current conflict may be added to the original formula. GRASP, rel_sat, SATO and Chaff Resolution To generate a clause from two clauses like the process of consensus in the logic optimization domain. ( x + y ) & ( ¬ y + z) ≡ ( x + y ) & ( ¬ y + z) & ( x + z ) Resolvent ( x + y ) & ( ¬ y + z)  ( x + z ) Redundant Adding the resolvent does not change the satisfiability of the original formula.

17 2002-11-19CIS64017 Conflict Analysis and Learning (3/3) Learning The conflict analysis will add some clauses to the original formula. The redundant resolvent avoids making the same mistake in the future search. F = (a+b) & ( ¬ a+ ¬ b+ ¬ c) & ( ¬ b+c) & … Pick “ a=true ”, no deduction. Pick “ b=true ”. Conflict occurs between ( ¬ a+ ¬ b+ ¬ c) and ( ¬ b+c). Resolvent: ( ¬ a+ ¬ b)

18 2002-11-19CIS64018 Performance Comparison

19 2002-11-19CIS64019 Conclusion Techniques employed in modern Boolean Satisfiability solvers. DPLL search algorithm Branching Heuristics Deduction Algorithm Conflict Analysis and Learning Currently, zChaff is best SAT solver in both industrial and handmade benchmarks.


Download ppt "Boolean Satisfiability Solvers Wonhong Nam"

Similar presentations


Ads by Google