Heuristics Based on Unit Propagation for Satisfiability Problems
Total Page:16
File Type:pdf, Size:1020Kb
Heuristics Based on Unit Propagation for Satis ability Problems Chu Min Li & Anbulagan LaRIA, Univ. de Picardie Jules Verne, 33, Rue St. Leu, 80039 Amiens Cedex, France fax: (33) 3 22 82 75 02, e-mail: [email protected], [email protected] having Maximum Occurrences in clauses of Minimum Abstract [ Size Dub ois et al., 1993; Freeman, 1995; Pretolani, 1993; The pap er studies new unit propagation based ] Crawford and Auton, 1996; Jeroslow and Wang, 1990 . heuristics for Davis-Putnam-Loveland (DPL) Intuitively these variables allowtowell exploit the p ower pro cedure. These are the novel combinations of of unit propagation and to augment the chance to reach unit propagation and the usual "Maximum Oc- an empty clause. Recently another heuristic based on currences in clauses of Minimum Size" heuris- Unit Propagation (UP heuristic) has proven useful and tics. Based on the exp erimental evaluations of allows to exploit yet more the p ower of unit prop- di erent alternatives a new simple unit prop- [ agation Freeman, 1995; Crawford and Auton, 1996; agation based heuristic is put forward. This ] Li, 1996 . Givenavariable x, a UP heuristic examines x compares favorably with the heuristics em- by resp ectively adding the unit clause x andx to F and ployed in the current state-of-the-art DPL im- indep endently makes two unit propagations. The real plementations (C-SAT, Tableau, POSIT). e ect of the unit propagations is then used to weigh x. 1 Intro duction pro cedure DPL(F) Begin Consider a prop ositional formula F in Conjunctive if F is empty, return "satisfiable"; Normal Form (CNF) on a set of Bo olean variables fx ;x ; :::; x g, the satis ability (SAT) problem consists 1 2 n F:=UnitPropagation(F ); If F contains an empty in testing whether clauses in F can all b e satis ed by clause, return "unsatisfiable". some consistent assignment of truth values (1 or 0) to the variables. If it is the case, F is said satis able; oth- /* branching rule */ erwise, F is said unsatis able. If each clause exactly select a variable x in F according to a heuristic contains r literals, the subproblem is called r -SAT prob- H , if the calling of DPL(F [fxg) returns lem. "satisfiable" then return "satisfiable", otherwise SAT problem is fundamental in many elds of com- return the result of calling DPL(F [fx g). puter science, electrical engineering and mathematics. End. [ ] It is the rst NP-Complete problem Co ok, 1971 with 3-SAT as the smallest NP-Complete subproblem. pro cedure UnitPropagation(F) [ The Davis-Putnam-Loveland pro cedure (DPL) Davis Begin ] et al., 1962 is a well known complete metho d to solve While there is no empty clause and a unit clause l SAT problems, roughly sketched in Figure 1. exists in F , assign a truth value to the variable DPL pro cedure essentially constructs a binary search containedin l to satisfy l and simplify F . tree, each recursive call constituting a no de of the tree. Return F . Recall that all leaves (except eventually one for a sat- End. is able problem) of a search tree represent a dead end Figure 1: DPL Pro cedure where an empty clause is found. The branching vari- However, since examining a variable bytwo unit prop- ables are generally selected to allowtoreach as early as agations is time consuming, two ma jor problems remain p ossible a dead end, i.e. to minimize the length of the op en: should one examine all free variables by unit prop- current path in the searchtree. agation at every no de of a search tree? if not, what are The most p opular SAT heuristic actually is Mom's the variables to b e examined at a search tree no de? heuristic, whichinvolves branching next on the variable The essential reason to use UP heuristics instead of In this pap er we try to exp erimentally solve these two Mom's one is that Mom's heuristic may not maximize the problems to obtain an optimal exploitation of UP heuris- e ectiveness of unit propagation, b ecause it only takes tic. We de ne a PROP predicate at a search tree no de binary clauses (if any) into accounttoweigh a variable, whose denotational semantics is the set of variables to b e although some extensions try to also take longer clauses examined at a search tree no de, i.e. x is to b e examined into account with exp onentially smaller weights (e.g. 5 if and only if PROP(x) is true. By appropriately chang- ternary clauses are counted as 1 binary clauses). A UP ing PROP,we exp erimentally analyse the b ehaviour of heuristic allows to take all clauses containing a variable di erent UP heuristics. We write 12 DPL pro cedures and their relations into accountinavery e ectiveway which are di erentonlyinPROP and run these pro- to weigh the variable. As a secondary e ect, it allows cedures on a very large sample of hard random 3-SAT to detect the so-called failedliterals in F whichwhen problems. satis ed falsify F in a single unit propagation. However We b egin in section 2 by describing the 12 DPL pro ce- since examining a variable bytwo unit propagations is dures and summarizing the exp erimental results on these time consuming, it is natural to try to restrict the vari- programs. In section 3 we compare a pure UP heuris- ables to b e examined. For this purp ose weuse PROP tic and a pure Mom's heuristic and show the sup eriority predicate de ned at a searchtreenode. of UP heuristics. In section 4 we study di erent restric- The success of Mom's heuristic suggests that the larger tions of UP heuristics. In section 5 we discuss the related the numb er of binary o ccurrences of a variable is, the work and compare the b est DPL pro cedure in our exp er- higher its probability of b eing a go o d branching vari- imentation with three state-of-the-art DPL pro cedures. able is, implying that if one should restrict UP heuris- Section 6 concludes the pap er. tics by means of PROP, he should restrict UP heuristics to those variables having a sucientnumb er of binary 2 UP Heuristics Driven by PROP o ccurrences. For this reason, all restrictions on PROP Let dif f (F ;F ) b e a function whichgives the number studied in this pap er are de ned according to the number 1 2 of clauses of minimum size in F but not in F ,we show of binary o ccurrences of a variable, so that the resulted 1 2 a generic branching rule in Figure 2, where the equation UP heuristics rely on combinations of unit propagation [ ] de ning H (x) is suggested in Freeman, 1995 and the and Mom's heuristics. weight 5 for uniformizing clauses of di erent length is empirically optimal. PROP21 x such that PROP(x) is For each free variable PROP10 PROP20 PROP31 true do 0 00 F and F be two copies of F let PROP30 PROP41 PROP 42 Begin 0 0 := UnitPropagation(F [fxg); F PROP 00 00 40 := UnitPropagation(F [fx g); F inclusion relation 0 00 If both F and F contain an empty clause then Figure 3: PROP predicate hierarchyby inclusion relation. return "F is unsatisfiable". 0 PROP (x) is true i x has i binary o ccurrences of whichat ij If F contains an empty clause then x := 0, 00 00 least j negativeandj p ositive. F := F else if F contains an empty 0 clause then x := 1, F := F ; 0 00 If neither F nor F contains an empty clause The rst PROP predicate in our exp erimentation is then let w (x) denote the weight of x called PROP and has empty denotational semantics, 0 00 a w (x):=dif f (F ;F) and w (x):=dif f (F ;F) the resulted branching rule using a pure Mom's heuris- End; tic, and the second is called PROP whose denotational 0 If all variables examined above are valued or semantics is the set of all free variables, the resulted UP PROP(x) is false for every x then heuristic is in its pure form and plays its full role: For each free variable x in F do PROP : PROP (x) is false for every free variable x; let r be the length of the clause C a a i i r r i i w (x):= 5 and w (x):= 5 x2C x2C i i PROP : PROP (x) is true for every free variable x. 0 0 For each variable x do Between PROP and PROP , there are manyother a 0 H (x):=w (x) w (x) 1024 + w (x)+ w (x) p ossible PROP predicates. Figure 3 de nes 8 predicates constituting a hierarchyby inclusion relation of their de- Branching on the free variable x such that H (x) is notational semantics. the greatest. PROP is de ned to b e PROP , but for no des 3141 31 under a xed depth of a search tree, it is de ned to b e Figure 2: A Generic Branching Rule Driven by PROP [ also similar to the exp onential factors in C-SAT Dub ois PROP .LetT b e a constant, the last PROP predicate 41 ] et al.,1993 where 5.71 ternary clauses are counted as 1 is named PROP and is de ned to b e the rst of the z binary clause.