Abstract
We propose two new online methods for estimating the size of a backtracking search tree. The first method is based on a weighted sample of the branches visited by chronological backtracking. The second is a recursive method based on assuming that the unexplored part of the search tree will be similar to the part we have so far explored. We compare these methods against an old method due to Knuth based on random probing. We show that these methods can reliably estimate the size of search trees explored by both optimization and decision procedures. We also demonstrate that these methods for estimating search tree size can be used to select the algorithm likely to perform best on a particular problem instance.
Introduction
Presented at AAAI 2006, this research addresses a fundamental challenge in computer science: the inherent unpredictability of backtracking search. Backtracking is the core engine for solving NP-hard problems such as Boolean Satisfiability (SAT), the Traveling Salesperson Problem (TSP), and various logic puzzles. However, these searches are often "heavy-tailed," meaning a small fraction of problem instances can take orders of magnitude longer to solve than others of the same size. Predicting this runtime is crucial for resource management and algorithm selection.
Existing estimation techniques, most notably Knuth’s 1975 random probing method, are primarily "offline"—they require pausing the actual search to run separate probes. Moreover, Knuth’s method suffers from extreme variance; a single probe hitting a deep branch in an unbalanced tree can cause the estimate to explode. This paper introduces "online" estimators that provide real-time feedback with minimal overhead by leveraging the data already being generated during the search process.
Online Estimation Methods
The authors propose two primary estimators designed to be more robust and practical than traditional probing:
- Weighted Backtrack Estimator (WBE): Inspired by Knuth's work, WBE calculates a weighted sum of the branches visited during chronological backtracking. By weighting each branch by the probability that a random probe would have visited it, WBE handles "tall, skinny" (highly unbalanced) trees far more effectively than random probing.
- Recursive Estimator: This method operates on a simple, intuitive assumption: the unexplored "right" side of a search node is likely similar in size to the already explored "left" side. It uses the exact node count from the finished left subtree to estimate the size of the pending right subtree.
To demonstrate a practical application, the authors developed ShuffleSatz, a meta-algorithm that runs a SAT solver with ten different variable orderings for a short duration (50 backtracks each). It uses the new estimators to predict which ordering will yield the smallest tree and then commits to that strategy.
Experimental Evaluation
The estimators were evaluated on several classic benchmarks, including unsatisfiable and satisfiable 3-SAT, structured SAT problems (like the pigeon-hole problem), and TSP optimization problems.
As shown in the results for unsatisfiable 3-SAT problems, both WBE and the Recursive estimator converge toward the true tree size (a ratio of 1.0) much more reliably as the search progresses. A key finding is that these estimators are excellent at "midpoint prediction," accurately flagging when a search has reached approximately the 50% mark.
In optimization contexts like the TSP, the performance gap is even more pronounced. While Knuth's method significantly underestimates the actual tree size, the WBE and Recursive methods provide much more accurate tracking. For algorithm selection, the authors note that an estimator doesn't need to be perfectly accurate; it only needs to be consistently biased to correctly rank different algorithmic choices. In practice, using these estimators in ShuffleSatz reduced backtracking by 15% to 22% compared to standard solvers on difficult SAT instances.
Conclusion and Future Work
While these methods significantly improve search tree size estimation, they face challenges with satisfiable problems. Because the search terminates as soon as a solution is found, the estimators naturally tend to overestimate the size of the full tree that would have existed. Future research may explore more sophisticated functions for the Recursive estimator, potentially using machine learning or domain-specific features to better predict the size of unexplored subtrees.
Summary updated