Backtracking is for search problems whereas this is for optimization problems.
Instead of testing subproblems for failure, we discard a subproblem when we are sure it leads to solutions with a higher cost than our best known solution.
Start with a problem Pā
Let S = {Pā} be the set of active subproblems
bestsofar = inf
while S is non-empty:
choose a subproblem P ā S and remove it from S
expand it into larger subproblems Pā, Pā, ..., Pā
for each Pįµ¢:
if test(Pįµ¢) is a complete solution with cost < bestsofar:
update bestsofar
else if lowerbound(Pįµ¢) < bestsofar:
add Pįµ¢ to S
return bestsofarHere, we still use the choose, expand, test, framework except we can do something in lowerbound which is a quick lower bound on the cost of any solution that includes .
The algorithm operates as follows:
- Pick a start vertex a
- Subproblem is
- First branch creates subproblems
- Compute the lowerbound for each subproblem and add to S
- Choose one of the new subproblems with the smallest lowerbound to expand next
- Once you complete a tour, update
bestsofarand drop subproblems whose lowerbound is <bestsofarFor graphs, we use the Minimum Spanning Tree to quickly find a lowerbound of a Traveling Salesman Problem of a graph, since the TSP is inherently a spanning tree of the graph.