Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The input line contains n + 1 lines. The first line contains one integer n, which is the number of cities. The remaining lines
The input line contains n + 1 lines. The first line contains one integer n, which is the number of cities. The remaining lines represent a point (xi, yi) where xi and yi are coordinates of a city i. Input format: 21 x03-0 xl yl xn-1 yn-1 The output contains a solution and is made of two lines. The first line contains the objective value obj. This is the length of the tsp cycle. The next line is a list of n values, one for each of the vi variables. This line encodes the solution. Output Format: obj v0 v1 v2 vn-1 It is essential that the value order in the solution output matches the value order of the input. Otherwise the grader will misinterpret the output. Examples (based on the figure) Input: 5 00 0 0.5 01 11 10 Output: 5.2 04132 This output represents the following cycle: 041 3 2 0 Implement the function/method.
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