Question

10. Consider the Traveling Salesperson problem (a) Write the brute-force algorithm for this proble that considers (b) Implement the algorithm and use it to solve instances of size 6, 7, (c) Compare the performance of this algorithm to that of Algorithm all possible tours 8, 9, 10, 15, and 20 6.3 using the instances developed in (b) Algorithm 6.3 The Best-First Search with Branch-and-Bound Pruning Algorithm for the Traveling Salesperson problem Problem: Determine an optimal tour in a weighted, directed graph. The weights are egative numbers. Inputs: a weighted, directed graph, and n, the number of vertices in the graph. The graph is represented by a two-dimensional array W, which has both its rows and columns indexed from 1 to n, where W ¡ is the weight on the edge from the ith vertex to the jth vertex Outputs: variable minlength, whose value is the length of an optimal tour, and variable opttour, whose value is an optimal tour void travel2 (int n const number W ordered-set& opttour, number& minlength) priority queue of node PQ node u. v initializ e (PQ): u.leuel = 0 u, path = 11 v. bound - bound(v); minlength0 insert (PQ,v) while empty (PQ)) /Initialize PQ to be empty Make first vertex the // starting one Remove node with best bound remove (PQ, v); if (. bound<minlength) / Set u to a child of v. u. level-.level + 1: for (all such that 2 < i < n&& i is not in v.path) ti . path u,path; put at the end of u. path; if (u. leveln 2) Check f next vertex //completes a tour put ndex of only vertex not in u.path at the end of u.path put at the end of u.path Make first vertex last one if (length(u) < minlength) //Function length computes the minlength-length (u): opttourpath //length of the tour else u, bound- bound (u); if (u. bound <minlength)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

220 15 35 Travelhing Salesman poblem (Tsp Salesnman poobleTSP This poolem defines a set of Gties and a each i o you on sy iveBut hi wh ich wl take min stwe to troole each vester at once wow genesatea pesmutation to Ceves adll vestezes Nou tve neeol t

Add a comment
Know the answer?
Add Answer to:
10. Consider the Traveling Salesperson problem (a) Write the brute-force algorithm for this proble that considers...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT