Question: Step by step help or with example how to run binary search with budget b on Traveling Sales problem graph. like I have a solution
Step by step help or with example how to run binary search with budget b on Traveling Sales problem graph. like I have a solution for a problem ( NP-Complete Reduction from TSP-OPT to TSP)which states like this. we will show that TSP-OPT reduces to TSP in polynomial time. The idea of this reduction is to use binary search with the b input for TSP to nd the length of the shortest tour (then TSP will nd the shortest tour itself). Let the distance matrix be denoted D. First, we need to nd an upper bound B for the length of the shortest path. We can set B to be the sum of all distances in the distance matrix (so B =Pi,j Di,j). Then, we run TSP with inputs D and B/2. If this nds a tour with length at most B/2, then we know the shortest tour has length in the range [0,B/2]. Otherwise, the shortest tour has length in the range [B/2,B]. Here is where we can apply binary search; for each successive iteration, run TSP on the midpoint of the remaining range for the length of the shortest path, then eliminate half of the range based on whether TSP nds a tour. Continue this recursive process until the range is narrowed to a single integer number, then return the path found by TSP on this integer. TSP will be run O(logB) times (since this is a binary search from 0 to B). The input size of TSP-OPT must be of length (logB), since B was the sum of all the distances in D. Therefore, this reduction is polynomial, and if TSP can be solved in polynomial time, then so can TSP-OPT.
but having hard time understanding this solution. any example may help.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
