人工知能学会研究会資料 SIG-FPAI-B502-08 Introducing Pure Literal Elimination into CDCL Algorithm Aolong Zha1∗ Miyuki Koshimura2 Hiroshi Fujita2 1,2 Graduate School and Faculty of Information Science and Electrical Engineering, Kyushu University Abstract: Unlike unit propagation, pure literal elimination (PLE) has been adopt in few CDCLtype SAT solvers because it may not bring any significant efficiency. In this paper, we reconsider a role of pure literals in solving process. Although we introduce an algorithm that can extract the pure literals within linear time in number of variables, a high execution frequency of it will still lead to an excessive computing cost. For solving this problem, we give a dynamic evaluation and adjustment approach that can optimize the execution frequency of our algorithm. 1 Introduction A literal a is pure in a CNF formula F if ¬a does not occur in F . Pure literals can always be set to true without affecting satisfiability, which amounts to the same as removing classes containing them. Since this can lead to other literals be coming pure, the process needs to be iterated to obtain a satisfiability equivalent formula without any pure literals. This process is known as pure literal elimination (PLE) [4]. The elimination of pure literals is a common heuristic used in many satisfiability algorithms. It was part of the original DLL algorithm (Davis et al., 1962), and it is still employed by those DLL-type backtracking algorithms that achieve the best theoretical worst-case upper bounds for 3-SAT (Kullmann, 1999; Schiermeyer, 1996) [2]. The currently most efficient implementations of CDCL-type SAT solvers use a data structure that is optimized for unit propagation, and therefore sacrifice the pure literal heuristic, while there are few modern solvers still use the heuristic only in their preprocessing phase. In this paper, we present will a pure literal extraction algorithm and evaluate it. We also give a dynamic evaluation and adjustment approach to optimize the execution frequency of the algorithm. Finally, we present the experimental evaluation. 2 Pure Literal Elimination MiniSat [3] is a minimalistic, open-source CDCL-type SAT solver that has achieved numerous excellent performance in past SAT Competition. In the major solving procedure of MiniSat based solvers, variable assignment essentially happens in two different situations: the one is consists of the identification of ∗ Contact address: Aolong Zha, Graduate School and Faculty of Information Science and Electrical Engineering, Kyushu University, 744, motooka, nishi-ku, Fukuoka-city 819-0395 E-mail: [email protected] +81-80-3542-7034 unit clauses and the creation of the associated implications which carries out Boolean Constraint Propagation (BCP); the other one is decision assignment which picks a unassigned literal by a decision strategy, called Variable State Independent Decaying Sum (VSIDS) heuristic [5]. With defining p() as the priority evaluation of variable assignment, we can obviously know that p(BCP) > p(VSIDS). In this paper, we consider that PLE as the third situation of variable assignment which has a higher priority than decision assignment, but lower than BCP. In general, we have p(BCP) > p(PLE) > p(VSIDS). 2.1 Pure Literal Extraction With a standard structure of occurrence vector for each literal, which is recorded by the ID of clauses where the literal occurs, we introduce an algorithm that can be easily implemented to extract the pure literals within linear time in number of variables. The pseudo-code is described in Algorithm 1. We perform pure literal extraction for variable decision. If we succeed in extracting pure literals, we manipulate them as decision variables and give each literal a value of 1. 2.2 Evaluating Pure Literal Extraction Algorithm We introduce our algorithm into MiniSat2.2.0. The extended solver carries out PLE by setting a new decision level for each of extracted pure literals, then skip the VSIDS heuristic and run the decision assignment. However, we are well aware of that pure literal extraction will keep a high execution frequency in solving process, which might reduce the efficiency of solving. Therefore, in order to find a balance of the execution frequency of our algorithm, we try to set several constant frequencies for it, and test them. The test questions are all of the 300 instances from the crafted benchmark of SAT Competition 2014. The − 23 − The pseudo-code of pure literal extraction algorithm Algorithm 1. Pure literal extraction algorithm in Solver.cc 1: vec<int> pureLiteralList; //declared in Solver.h 2: vec<int> pureLiteralExtraction() { 3: initialize indexCid2Lit; 4: eliminatedClauseList = new bool[nClaused]; 5: eliminatedClauseList.clear; 6: for (int i=0; i<trail.size; i++) { 7: for (int j=0; j<indexCid2Lit[trail[i]].size; j++) { 8: eliminatedClauseList[indexCid2Lit[trail[i]][j]] = true; 9: } 10: } 11: for (int i=0; i<nVars; i++) { 12: bool noPositiveLit = false; 13: bool noNegativeLit = false; 14: if (assigns[i]==l Undef) { 15: for (int j=0; j<indexCid2Lit[2∗i].size; j++) { 16: if (!eliminatedClauseList[indexCid2Lit[2∗i][j]]) break; 17: else if (j == indexCid2Lit[2∗i].size−1) noPositiveLit = true; 18: } 19: for (int j=0; j<indexCid2Lit[2∗i+1].size; j++) { 20: if (!eliminatedClauseList[indexCid2Lit[2∗i+1][j]]) break; 21: else if (j == indexCid2Lit[2∗i+1].size−1) noNegativeLit = true; 22: } 23: if ((noPositiveLit && !noNegativeLit) || (!noPositiveLit && noNegativeLit)) { 24: if (noPositiveLit) pureLiteralList.push(2∗i+1); 25: else pureLiteralList.push(2∗i); 26: } 27: } 28: } 29: return pureLiteralList; 30: } The structure and initialization of occurrence vector for each literal Table 1: The result of comparison test org org+ple org+ple org+ple @frq≤10 @frq≤100 SAT 70 43 57 56 UNSAT 28 3 18 20 time out 202 254 225 224 1: indexCid2Lit = new vec<int>[2∗nVars]; 2: for (int i=0; i<clauses.size; i++) { 3: for (int j=0; j<ca[clauses[i]].size; j++) { 4: indexCid2Lit[ca[clauses[i]][j]].push(i); 5: } 6: } time to solve each instance was limited to 1800 seconds. The test result1 is shown in Table 1 (e.g., in the result of ‘org’, there are 202 instances suffering time out and 98 solved instances which include 70 SAT instances and 28 UNSAT instances). In addition, ‘org+ple’ means that the extended PLE solver always checks whether exist any pure literal at the end of BCP, while ‘org+ple@frq=10’ only checks at most 10 times per second. It is evident that implemented PLE cannot improved MiniSat2.2.0 even though we set the constant frequencies for it. With analyzing the log file of comparison test, we found a major reason of reducing solving efficiency is that the learnt clause management of 1 The frequency ∈ {5, 10, 50, 100} has been tested respectively, though the best two results are listed in Table 1. MiniSat2.2.02 [3] is not suitable for PLE. Therefore, we decided to use ROKK solver [6] which adds a new learnt clause management strategies to MiniSat2.2.0. ROKK uses Periodic ReduceDB strategy to manage number of learnt clause and compare learnt clauses using Linear Activity and TrueLBD which is a kind of Literal Blocks Distance (LBD) [1]. This management is suitable for PLE. 2.3 Dynamic Evaluation and Adjustment Approach As has been noticed in test result, a high execution frequency of pure literal extraction algorithm still lead 2 Remove half of the learnt clauses minus some locked clauses. A locked clause is a clause that is reason to current assignment. Clauses below a certain lower bound activity are also be removed. − 24 − to an excessive computing cost, especially burdened with the instances that have a huge number of variables and clauses. If we find an approach that can effectively utilize the features of instance and current states to set an optimal frequency, the PLE solvers should get a better performance. Assume that in unit time (∆time) the Decision Level increases (∆DecisionLvl) by 100, without considering the circumstances under backtracking [2], we should make the extraction frequency is less or equal to 100. We let the Difficulty Coefficient be (nVars ∗ nClauses), and let the Computing Coefficient be (∆propagation / ∆time). Furthermore, we give a penalty in order to dynamically adjust extraction frequency in current states, which will freeze pure literal extraction in a period of time, according to three different situations of ∆processEstimate. The dynamic evaluation and adjustment approach sets an optimal frequency as follows: (∆nP ureLits is the increasing number of extracted pure literals within a ∆time) f requency = Computing Coefficient Difficulty Coefficient ∗ (∆DecisionLvl − ∆nP ureLits) + penalty (∆propagation/∆time) (nV ars ∗ nClauses) ∗ (∆DecisionLvl − ∆nP ureLits) + penalty−1 The pseudo-code of updating penalty 1: 2: 3: 4: 5: 6: 7: 8: 3 other two solvers. The PLE row in Table 3 shows that we extracted pure literals form only about 51% of 300 instances (e.g., in the experiment of ‘org+ple@p=0.1’, there are 152 instances from which the pure literals were extracted, including 62 SAT results, 49 UNSAT results and 41 time out results). Table 3: The comparison of experimental results org org+ple org+ple oracle3 @p=0.01 @p=0.1 PLE − 154 152 − SAT 136 135 (61) 135 (62) 140 UNSAT 95 97 (47) 96 (49) 100 time out 69 68 (46) 69 (41) 60 For comparing the runtime of each instance in different solvers, the scatter plots (in Figure 1 ∼ 3) illustrates that both of the three solvers have their own odds for some instances. It is difficult to assess their pros and cons, since this irregularity. In Figure 4, we compares the runtime cumulative distribution function (CDF) of org, org+ple@p=0.01, org+ple@p=0.1 and oracle. With most of the interlacing functions, org+ple@p=0.01 is slightly worse than org and org+ple@p=0.1, while oracle clearly outperforms others. −1 = Table 2: The experiment environment Processor Intel Core i7-2860QM @ 2.50GHz Memory 7.7 GB OS ubuntu 12.04 LTS 64-bit GCC gcc version 5.0.0 initialize double penaltyTimeLimit; double penalty = ∆processEstimate; if (penalty < 0) penalty = penaltyTimeLimit; if else (penalty > penaltyTimeLimit) penalty = 0; else penalty = penaltyTimeLimit − penalty; Conclusion Experiment To demonstrate and assess the effectiveness of our improvement, we introduce PLE into ROKK1.0.1 and initialize penaltyTimeLimit to two different values: 0.1, 0.01 respectively, which become two versions of experimented solver. Including the original ROKK, we use these three solvers to solve all of the 300 instances from the main track benchmarks of SAT Race 2015. The time to solve each instance was limited to 3600 seconds. The experiment environment is described in Table 2. Experimental results indicate that three solvers show almost the same performance though the version ‘org+ple@p=0.01’ solved one more instance than the In this paper, we initially tried to introduce PLE into MiniSat2.2.0 solver by using an algorithm that can extract the pure literals within linear time in number of variables. However, it suffers from a problem of the unsuitable learnt clause management. Therefore, we decided to use ROKK solver replaced MiniSat. In addition, we presented a dynamic evaluation and adjustment approach instead of setting a constant frequency, which can optimize the execution frequency of our algorithm. With comparing the experimental results, one version of our extended solvers achieved the best result by a slight advantage. Although this is a small improvement, the good performance of oracle may provide a perspective of parallel algorithms. 3 Oracle provides an upper bound on the performance that could be achieved by org(+ple@p∈{0.01, 0.1}): its runtime is that of a hypothetical version that makes every selection in an optimal fashion. Essentially, oracle thus indicates the performance that would be achieved by only running the most suitable version for each single instance. − 25 − Scatter Plot Scatter Plot 4,000 Runtime for org+ple@p=0.01 Runtime for org+ple@p=0.01 4,000 3,000 2,000 1,000 0 0 1,000 2,000 3,000 3,000 2,000 1,000 0 0 4,000 1,000 Figure 1: The comparison of the runtime of each instance between org and org+ple@p=0.01 Line Chart 4,000 3,000 3,000 Runtime Runtime for org+ple@p=0.1 4,000 2,000 1,000 0 0 3,000 org p=0.1 p=0.01 oracle 2,000 1,000 2,000 4,000 Figure 3: The comparison of the runtime of each instance between org+ple@p=0.1 and org+ple@p=0.01 Scatter Plot 1,000 3,000 Runtime for org+ple@p=0.1 Runtime for org 0 2,000 0 4,000 50 100 150 200 250 300 Number of being solved instances Runtime for org Figure 2: The comparison of the runtime of each instance between org and org+ple@p=0.1 Figure 4: The comparison of the runtime cumulative distribution function (CDF) − 26 − References [1] Gilles Audemard and Laurent Simon. Predicting learnt clauses quality in modern sat solvers. In IJCAI, volume 9, pages 399–404, 2009. [2] Armin Biere, Marijn Heule, and Hans van Maaren. Handbook of satisfiability, volume 185. ios press, 2009. [3] Niklas Eén and Niklas Sörensson. An extensible sat-solver. In Theory and applications of satisfiability testing, pages 502–518. Springer, 2004. [4] Jan Johannsen. The complexity of pure literal elimination. In SAT 2005, pages 89–95. Springer, 2006. [5] Matthew W Moskewicz, Conor F Madigan, Ying Zhao, Lintao Zhang, and Sharad Malik. Chaff: Engineering an efficient sat solver. In Proceedings of the 38th annual Design Automation Conference, pages 530–535. ACM, 2001. [6] Takeru Yasumoto and Takumi Okugawa. Rokk1.0.1. In Proceedings of SAT Competition 2014: Solver and Benchmark Descriptions, page 70. Department of Computer Science Series of Publications, 2014. − 27 −
© Copyright 2025 Paperzz