# An Adaptive Strategy for Tuning Duplicate Trails in SAT Solvers

^{1}

^{2}

^{3}

^{*}

## Abstract

**:**

## 1. Introduction

## 2. CDCL Algorithm

#### 2.1. CDCL Algorithm

Algorithm 1. Typical CDCL Algorithm |

Input: CNF formula Σ |

Output: SAT or UNSAT |

1 ζ=Φ //ζ is the variable assignment set, Φ is an empty set |

2 Δ=Φ //Δ is the learnt clause database |

3 dl=0 //dl is the decision level |

4 while (true) do |

5 var=pickDecisionVar(Σ) |

6 if (ζ⊨Σ) then |

7 return SAT |

8 else |

9 dl=dl+1 |

10 ζ=ζ∪{selectPhase(var)} |

11 while (UnitPropagation(Σ, ζ)==conflict) do |

12 learntclause=conflictAnalysis(Σ, ζ) |

13 btl=computeBackLevel(learntclause, ζ) |

14 if (btl==0) then return UNSAT |

15 end if |

16 Δ=Δ∪{ learntclause } |

17 if (restart()) then btl=0 |

18 end if |

19 backJump(btl) |

20 dl=btl |

21 end while |

22 if (timeToReduce()) then reduceDB(Δ) |

23 end if |

24 end if |

25 end while |

#### 2.2. Restart Strategies

## 3. Tuning Duplicate Trails Method

#### 3.1. Motivation

_{1}˅x

_{2}˅¬x

_{6}, ¬x

_{1}˅¬x

_{5}, x

_{1}˅x

_{4}, ¬x

_{2}˅¬x

_{7}˅¬x

_{9}, ¬x

_{2}˅x

_{5}˅x

_{6}, x

_{3}˅¬x

_{4}˅¬x

_{7}, ¬x

_{3}˅x

_{8}, ¬x

_{3}˅¬x

_{7}˅x

_{9}

_{i}→x

_{j}” means that variable x

_{i}is a decision variable, and variable x

_{j}is an implied variable. Then, the conflict occurs when x

_{7}is propagated at level 5. Due to first-UIP scheme, we obtained the learnt clause, ¬x

_{2}˅¬x

_{3}˅¬x

_{7}.

_{1}, x

_{5}, x

_{2}, x

_{6}, x

_{4}, x

_{3}, x

_{8}}. As previously mentioned, after restarting, the solver tends to reassign many of the assignment trails; that is to say, the assignment trail is duplicated. To clarify this phenomenon intuitively, we applied the solver, Glucose3.0, to solve an instance: Aaai10-planning-ipc5-pathways-13-step17.cnf, which has been randomly selected from the SAT Competition 2014 Application benchmark, by adopting the Luby restarts strategy and dynamic Glucose-restart strategy, respectively. From Figure 1, the x-axis represents the numbers of restarts, unlike restart schemes that generate different restart numbers. Meanwhile, the y-axis represents the number of the duplicate assignment trails (the denotation of S.size() will be discussed in Section 3.2). It is visually obvious that the overwhelming majority of duplicate assignment trails are made by the solver, regardless of the restart strategy adopted by the solver.

#### 3.2. Duplicate Trails

_{1}, which still has the highest VSIDS score after the restart, is chosen as the decision variable and is assigned as true again at level 1. Consequently, this will cause an implied literal x

_{5}, and it is thus the same before and after the restart. Note that the second decision literal after the restart is x

_{2}and its implied literal is x

_{6}, and it no longer matches the trail before the restart, where the decision literal is x

_{6}and the corresponding implied literal is x

_{2}. In addition, the third decision literal and the fourth decision literal are also the same in both trails (between the two trails). Here, there are two literal assignment trails in the first four levels before and after the restart, that is S

_{before}= {x

_{1}, ¬x

_{5}, x

_{2}, x

_{6}, x

_{4}, x

_{3}, x

_{8}} and S

_{after}= {x

_{1}, ¬x

_{5}, x

_{6}, x

_{2}, x

_{4}, x

_{3}, x

_{8}, x

_{7}}. The two search space, which is determined by the sequence, S

_{before}and S

_{after}, are the same since the search path according to S

_{before}is: x

_{1}= 1˄x

_{5}= 0˄x

_{2}= 1˄x

_{6}= 1˄x

_{4}= 1˄x

_{3}= 1˄x

_{8}= 1, equivalent to x

_{1}= 1˄x

_{5}= 0˄x

_{6}= 1˄x

_{2}= 1˄x

_{4}= 1˄x

_{3}= 1˄x

_{8}= 1, which is the search path of S

_{after}. Therefore, we define a sequence, S, containing those variables (decision variables and propagation variables) that keeps the reduced formula the same before and after the restart, in the above example, as S = {x

_{1}, x

_{5}, x

_{2}, x

_{6}, x

_{4}, x

_{3}, x

_{8}}. Consequently, we checked whether the assignment sequence, S, is the same one as when each restart occurs. Noticeably, S.size() stands for the number of duplicate assignment variables. In the above example, S.size() = 7. The greater the value of S.size(), the greater the number of matching variables. When the value of S.size() remains large over a period of time, it indicates that the search path remains almost constant during this time. Aiming for this situation, the search path should be tuned by a dissimilar decision variable. Here is the sketch of the algorithm of the identification of duplicate trails.

_{next}is the next assigned variable, dl is the current decision level, decisionLevel is the decision level before the restart, trail_order[] presents the variable assignment trail, and trail_order[dl] presents the decision variable of the decision level, dl. The assignment sequence is checked to ascertain whether it is the same after each restart or not; that is, deciding whether those variables, which are ahead of x

_{next}in the assignment sequence before the restart, are the same as those variables, which are ahead of x

_{next}in the assignment sequence after the restart. For another, those variables are sorted by activity in the assignment trail, so only the activity[trail_order[dl]] value and activity[x

_{next}] value need to be judged. If the activity[x

_{next}] is greater than the activity[trail_order[dl]], which shows existing repeated variables, then S.size should be increased. When S.size meets certain conditions, namely, MIN<= S.size <= MAX, then the addition of counter count is needed. If the value of count is greater than a parameter threshold, it indicates that the assignment sequence is always repeated, and the changeTrailOrder() function is used to change the activity value ordering of the variable; if not, the pickDecisionVar function continues to be used. However, the question is how to set the parameter values of the MIN, MAX, and threshold for miscellaneous instances. Different parameters provide different behaviors. It is extremely tough to find a consistent ranking of solvers on the different sets of benchmarks. In the SAT community, experimental evidence is often required for any idea. We now show how we set the parameters of the MIN, MAX, and threshold by observing the performance of Glucose3.0 on the benchmarks, originally from the SAT 2015 Application benchmark only. Additionally, the CPU cutoff used was 1000 s. The Glucose3.0 solver is one of the award-winning SAT solvers in the corresponding competitive events since 2009. Table 4 supplies the number of solved instances when changing the parameters. The parameters, MIN = 20, MAX = 50, and threshold = 10, have the best performance compared to all the other parameters.

Algorithm 2. Identification of duplicate trails |

Input: variable score array activity[] |

Output: call changeTrailOrder() or PickDecisionVar() |

1 count←0 |

2 for dl←1 to decisionLevel |

3 if activity[trail_order[dl]]< activity[x_{next}] |

4 then S.size++ |

5 end if |

6 end for |

7 if MIN<=S.size<=MAX |

8 then count++ |

9 end if |

10 if count>threshold |

11 then changeTrailOrder() |

12 else |

13 pickDecisionVar() |

14 end if |

## 4. Experimental Results

We must also say, as a preliminary, that improving SAT solvers is often a cruel world. To give an idea, improving a solver by solving at least ten more instances (on a fixed set of benchmarks of a competition) is generally showing a critical new feature. In general, the winner of a competition is decided based on a couple of additional solved benchmarks.

## 5. Conclusions

## Author Contributions

## Funding

## Acknowledgments

## Conflicts of Interest

## References

- Barranco, M.; Cook, S.A. The complexity of theorem-proving procedures. In Proceedings of the 3rd Annual ACM Symposium on Theory of Computing, ShakerHeights, OH, USA, 3–5 May 1971; pp. 151–158. [Google Scholar]
- Rintanen, J. Planning as satisfiabiIity: Heuristics. Artif. Intell.
**2012**, 193, 45–86. [Google Scholar] [CrossRef] - Suda, M. Property directed reachability for automated planning. J. Artif. Intell. Res.
**2014**, 50, 265–319. [Google Scholar] [CrossRef] - Konev, B.; Lisitsa, A. A SAT Attack on the Erdős Discrepancy Conjecture. In Proceedings of the Theory and Applications of Satisfiability Testing-SAT 2014, Vienna, Austria, 14–17 July 2014; pp. 219–226. [Google Scholar]
- Gutin, G.; Kratsch, S.; Wahlstrom, M. Polynomial Kernels and User Reductions for the Workflow Satisfiability Problem. In Proceedings of the International Symposium on Parameterized and Exact Computation, Wroclaw, Poland, 10–12 September 2014; pp. 208–220. [Google Scholar]
- Goldberg, A.; Wang, T.C.; Zimmerman, D. Applications of feasible path analysis to program testing. In Proceedings of the ACM Sigsoft International Symposium on Software Testing and Analysis, Seattle, WA, USA, 27–30 May 1994; pp. 80–94. [Google Scholar]
- Davis, M.; Logemann, G.; Loveland, D. A machine program for theorem-proving. Commun. ACM
**1962**, 5, 394–397. [Google Scholar] [CrossRef] - Marques-Silva, J.; Sakallah, K.A. Grasp: A new search algorithm for satisfiability. In Proceedings of the International Conference on Computer-Aided Design, Los Alamitos, CA, USA, 14–18 July 1996; pp. 220–227. [Google Scholar]
- Zhang, H. SATO: An efficient propositional prover. In Proceedings of the 14th International Conference on Automated Deduction, Townsville, Australia, 13–17 July 1997; pp. 272–275. [Google Scholar]
- Moskewiez, M.; Madigan, C. Chaff: Engineering an efficient SAT solver. In Proceedings of the 38th ACM /IEEE Design Automation Conference, Las Vegas, NV, USA, 15–18 June 2001; pp. 530–538. [Google Scholar]
- Goldberg, E.; Novikov, Y. BerkMin: A fast and robust sat-solver. In Proceedings of the Design Automation and Test, Acropolis, Europe, 10–15 September 2002; p. 142. [Google Scholar]
- Mahajan, Y.S.; Fu, Z.; Malik, S. Zchaff2004: An efficient SAT solver. In Proceedings of the 7th International Conference on Theory and Applications of Satisfiability Testing, Vancouver, BC, Canada, 10–13 May 2004; pp. 360–375. [Google Scholar]
- Eén, N.; Sörensson, N. An extensible SAT solver. In Proceedings of the 6th International Conference on the Theory and Applications of Satisfiability Testing, Portofino, Italy, 5–8 May 2005; pp. 502–518. [Google Scholar]
- Audemard, G.; Simon, L. Predicting learnt clauses quality in modern SAT solvers. In Proceedings of the 21st International Joint Conference on Artificial Intelligence, Pasadena, CA, USA, 9–15 July 2009; pp. 399–404. [Google Scholar]
- Biere, A. Lingeling and friends entering the SAT Challenge 2012. In Proceedings of the 15th International Conference on Theory and Applications of Satisfiability Testing, Trento, Italy, 17–20 June 2012; pp. 33–34. [Google Scholar]
- Liang, J.H.; Ganesh, V.; Poupart, P.; Czarnecki, K. Learning rate based branching heuristic for SAT solvers. In Proceedings of the 19th international conference on Theory and applications of satisfiability testing, Bordeaux, France, 5–8 July 2016; pp. 123–140. [Google Scholar]
- Liang, J.H.; Ganesh, V.; Poupart, P.; Czarnecki, K. An empirical study of branching heuristics through the lens of global learning rate. In Proceedings of the 20th International Conference on Theory and Applications of Satisfiability Testing, Melbourne, Australia, 28 August–1 September 2017; pp. 119–135. [Google Scholar]
- Luo, M.; Li, C.M.; Xiao, F.; Manyà, F.; Lü, Z. An Effective Learnt Clause Minimization Approach for CDCL SAT Solvers. In Proceedings of the 26th international joint conference on artificial intelligence, Melbourne, Australia, 19–25 August 2017; pp. 703–711. [Google Scholar]
- Pipatsrisawat, K.; Darwiche, A. A lightweight component caching scheme for satisfiability solvers. In Proceedings of the 10th international conference on Theory and applications of satisfiability testing, Lisbon, Portugal, 28–31 May 2007; pp. 294–299. [Google Scholar]
- Biere, A. Adaptive restart strategies for conflict driven sat solvers. In Proceedings of the 11th international conference on Theory and applications of satisfiability testing, Guangzhou, China, 25–28 August 2008; pp. 28–33. [Google Scholar]
- Ramos, A.; Van der Tak, P.; Heule, M.J.H. Between restarts and backjumps. Lect. Notes Comput. Sci.
**2011**, 6695, 216–229. [Google Scholar] [CrossRef] - Ramos, A.; Van der Tak, P.; Heule, M.J.H. Reusing the assignment trail in CDCL solvers. J. Satisf. Boolean Model. Comput.
**2011**, 5, 133–138. [Google Scholar] - Jiang, C.; Zhang, T. Partial backtracking in cdcl solvers. In Proceedings of the 19th international conference on Logic for Programming, Artificial Intelligence, and Automated Reasoning, Stellenbosch, South Africa, 12–17 December 2013; pp. 490–502. [Google Scholar]
- Shacham, O.; Yorav, K. Adaptive application of SAT solving techniques. Electron. Notes Theor. Comput. Sci.
**2006**, 144, 35–50. [Google Scholar] [CrossRef] - Siddqi, S.; Huang, J. Multi-SAT: An adaptive SAT solver. In Proceedings of the 18th international conference on Theory and applications of satisfiability testing, Austin, TX, USA, 24–27 September 2015. [Google Scholar]
- Zhang, L.; Madigan, C.F.; Moskewicz, M.H.; Malik, S. Efficient conflict driven learning in a boolean satisfiability solver. In Proceedings of the 2001 IEEE/ACM International Conference on Computer-Aided Design, San Jose, CA, USA, 4–8 November 2001; pp. 279–285. [Google Scholar]
- Gomes, C.P.; Selman, B.; Crato, N. Heavy-tailed distributions in combinatorial search. In Proceedings of the International Conference on Principles and Practice of Constraint Programming, Linz, Austria, 4–7 September 1997; pp. 121–135. [Google Scholar]
- Luby, M.; Sinclair, A.; Zuckerman, D. Optimal speedup of las vegas algorithms. Inf. Process. Lett.
**1993**, 47, 128–133. [Google Scholar] [CrossRef] - Pipatsrisawat, K.; Darwiche, A. Rsat 2.0: Sat Solver Description; Technical Report D-153; Automated Reasoning Group, Computer Science Department, UCLA: Los Angeles, CA, USA, 2007. [Google Scholar]
- Audemard, G.; Simon, L. Refining restarts strategies for SAT and UNSAT. In Proceedings of the Principles and Practice of Constraint Programming, Québec City, QC, Canada, 14–18 September 2012; pp. 118–126. [Google Scholar]
- Biere, A.; Fröhlich, A. Evaluating cdcl restarts schemes. In Proceedings of the Sixth Pargmatics of SAT workshop, Austin, TX, USA, 24–27 September 2015. [Google Scholar]
- Nejati, S.; Liang, J.H.; Ganesh, V. Adaptive restart and CEGAR-based solver for inverting cryptographic hash functions. In Proceedings of the Working Conference on Verified Software: Theories, Tools, and Experiments, Heidelberg, Germany, 22–23 July 2017; Springer: Cham, Switzerland; pp. 120–131. [Google Scholar]
- Oh, C. Improving SAT Solvers by Exploiting Empirical Characteristics of CDCL. Ph.D. Dissertation, New York University, New York, NY, USA, 2016. [Google Scholar]

**Figure 2.**The duplicate assignment trails of: (

**a**) Luby restart using the proposed scheme; (

**b**) Glucose-restart using the proposed scheme.

**Figure 6.**Performance of MapleCOMSPS_IDT vs. MapleCOMSPS over: (

**a**) SAT instances; (

**b**) UNSAT instances.

Variable | x_{1} | x_{2} | x_{3} | x_{4} | x_{5} | x_{6} | x_{7} | x_{8} | x_{9} |
---|---|---|---|---|---|---|---|---|---|

activity score | 89.5 | 70.7 | 59.6 | 65.3 | 80.3 | 77.6 | 55.2 | 57.5 | 45.6 |

phase | True | True | True | True | False | True | True | True | False |

Variable | x_{1} | x_{2} | x_{3} | x_{4} | x_{5} | x_{6} | x_{7} | x_{8} | x_{9} |
---|---|---|---|---|---|---|---|---|---|

activity score | 89.5 | 79.8 | 61.4 | 65.3 | 80.3 | 77.6 | 58.6 | 57.5 | 46.8 |

phase | True | True | True | True | False | True | True | True | True |

Decision Level | 1 | 2 | 3 | 4 | 5 |
---|---|---|---|---|---|

trail before restart | x_{1}→¬x_{5} | x_{6}→x_{2} | x_{4} | x_{3}→x_{8} | x_{7}→¬x_{9} |

trail after restart | x_{1}→¬x_{5} | x_{2}→x_{6} | x_{4} | x_{3}→x_{8}, x_{7} | x_{9} |

MIN | MAX | Threshold | Sum |
---|---|---|---|

10 | 30 | 5 | 237 |

20 | 40 | 10 | 241 |

30 | 50 | 15 | 240 |

20 | 50 | 10 | 244 |

10 | 40 | 15 | 239 |

Benchmarks | Status | Glucose_Luby | Glucose_Luby-IDT | Glucose_dyn | Glucose_dyn-IDT |
---|---|---|---|---|---|

Sat2015 (300) | sat | 148 | 149 | 137 | 152 |

unsat | 70 | 72 | 93 | 92 | |

sum | 218 | 221 | 230 | 244 | |

Sat2016 (300) | sat | 58 | 59 | 56 | 62 |

unsat | 62 | 66 | 76 | 76 | |

sum | 120 | 125 | 132 | 138 | |

Sat2017 (350) | sat | 66 | 67 | 72 | 80 |

unsat | 62 | 68 | 69 | 64 | |

sum | 128 | 135 | 141 | 144 | |

Total (950) | sat | 272 | 275 | 265 | 294 |

unsat | 194 | 206 | 238 | 232 | |

sum | 466 | 481 | 503 | 526 |

Benchmarks | Status | MapleCOMSPS | MapleCOMSPS_IDT |
---|---|---|---|

Sat2015(300) | sat | 154 | 155 |

unsat | 102 | 101 | |

sum | 256 | 256 | |

Sat2016(300) | sat | 65 | 78 |

unsat | 78 | 66 | |

sum | 143 | 144 | |

Sat2017(350) | sat | 90 | 86 |

unsat | 68 | 76 | |

sum | 158 | 162 | |

Sat2018(400) | sat | 123 | 110 |

unsat | 89 | 110 | |

sum | 212 | 220 | |

Total(1350) | sat | 432 | 429 |

unsat | 337 | 353 | |

sum | 769 | 782 |

© 2019 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Chang, W.; Xu, Y.; Chen, S.
An Adaptive Strategy for Tuning Duplicate Trails in SAT Solvers. *Symmetry* **2019**, *11*, 197.
https://doi.org/10.3390/sym11020197

**AMA Style**

Chang W, Xu Y, Chen S.
An Adaptive Strategy for Tuning Duplicate Trails in SAT Solvers. *Symmetry*. 2019; 11(2):197.
https://doi.org/10.3390/sym11020197

**Chicago/Turabian Style**

Chang, Wenjing, Yang Xu, and Shuwei Chen.
2019. "An Adaptive Strategy for Tuning Duplicate Trails in SAT Solvers" *Symmetry* 11, no. 2: 197.
https://doi.org/10.3390/sym11020197