Trying Come Java Code Traveling Salesman Problem Guidelines Start City 0 Given Symmetric M Q37083586

I am trying to come up with java code for the traveling salesmanproblem. My guidelines are, I start at city 0 in a given symmetricmatrix, I must go to each city only once, and end up back at thestarting city 0. I must output the cost as well as the path itwent.

I have obtained the correct cost, but I am having troubleoutputting the correct path.

This is my code:

package exacttsp;

import java.io.File;
import java.io.FileNotFoundException;
import static java.lang.Integer.MAX_VALUE;
import java.util.Arrays;
import java.util.Scanner;

class ExactTSP {

public static int Cost(int matrix[][], int index, int dim){
int[] array = new int[dim];
int[] bestPath = new int[dim];
for (int i = 0; i < dim;

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.