Question
In C using recursion: In this program you will take a small Traveling Saleperson Problem (TSP) and generate an optimal solution for that input data.
In C using recursion:
In this program you will take a small Traveling Saleperson Problem (TSP) and generate an optimal solution for that input data. When I say a small data set I mean a TSP for 13 or fewer cities. The ONLY way you can guarantee an optimal solution is to generate all possible tours, evaluate the value (sum of all the weights on the edges included in the tour) and remember the smallest such value. I strongly suggest that you use recursion to generate all tours, both because it will help strengthen you recursive program techniques AND because its easier. To make the task easier, each TSP input file will be a complete graph, meaning that is it has 10 cities, each of the 10 will have an edge to each of the other 9 cities.
If you look at the directory you'll find different sized input files and a correct output for each such file. Of course, input10 shows just one set of edge weights for a 10-city problem, and we'll change those edge weights in the examples we use to test your program.
You can use either C or C++ for your program as long as it runs correctly on the CSE machines. You WILL use redirected input to test access data in your program. So, if you have a tsp.cpp file as your program, we'll compile it as
g++ *.cpp
./a.out < input12 (or some other input file) and your program needs to compile and run without error in that format.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started