18.04.2013 Views

The.Algorithm.Design.Manual.Springer-Verlag.1998

The.Algorithm.Design.Manual.Springer-Verlag.1998

The.Algorithm.Design.Manual.Springer-Verlag.1998

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Search Pruning<br />

Next: Bandwidth Minimization Up: Combinatorial Search and Heuristic Previous: Constructing All<br />

Paths in<br />

Search Pruning<br />

Backtracking ensures correctness by enumerating all possibilities. For example, a correct algorithm to<br />

find the optimal traveling salesman tour could enumerate all n! permutations of n vertices of the graph<br />

and selecting the best one. For each permutation, we could check whether each of the n edges implied in<br />

the tour really exists in the graph G, and if so, sum the weights of these edges together.<br />

For most graphs, however, it would be pointless to construct all the permutations first and then analyze<br />

them later. Suppose we started our search from vertex , and it happened that edge was not in G.<br />

Enumerating all the (n-2)! permutations beginning with would be a complete waste of effort. Much<br />

better would be to prune the search after and continue next with . By carefully restricting the<br />

set of next elements to reflect only the moves that are legal from the current partial configuration, we<br />

reduce the search complexity significantly.<br />

Pruning is the technique of cutting off search the instant we have established that this partial solution<br />

cannot be extended into the solution that we want. For example, in our traveling salesman search<br />

program, we seek the cheapest tour that visits all vertices before returning to its starting position.<br />

Suppose that in the course of our search we find a tour t whose cost is . As the search continues,<br />

perhaps we will find a partial solution , where k < n and the sum of the edges on this partial tour<br />

is . Can there be any reason to continue exploring this node any further? No, assuming all edges<br />

have positive cost, because any tour with the prefix will have cost greater than tour t, and hence<br />

is doomed to be non-optimal. Cutting away such failed partial tours as soon as possible can have an<br />

enormous impact on running time.<br />

Exploiting symmetry is a third avenue for reducing combinatorial search. It is clearly wasteful to<br />

evaluate the same candidate solution more than once, because we will get the exact same answer each<br />

time we consider it. Pruning away partial solutions identical to those previously considered requires<br />

recognizing underlying symmetries in the search space. For example, consider the state of our search for<br />

an optimal TSP tour after we have tried all partial positions beginning with . Can it pay to continue the<br />

search with partial solutions beginning with ? No. Any tour starting and ending at can be viewed as<br />

starting and ending at or any other vertex, for these tours are cycles. <strong>The</strong>re are thus only (n-1)! distinct<br />

tours on n vertices, not n!. By restricting the first element of the tour to always be , we save a factor of<br />

n in time without missing any interesting solutions. Detecting such symmetries can be subtle, but once<br />

identified they can usually be easily exploited by a search program.<br />

file:///E|/BOOK/BOOK2/NODE88.HTM (1 of 2) [19/1/2003 1:29:27]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!