mhahsler / TSP

Traveling Salesperson Problem - R package
63 stars 13 forks source link

Issue with using Concorde in R #12

Closed sarwanpasha closed 4 years ago

sarwanpasha commented 4 years ago

I am trying to apply Concorde on the distance matrix. Here is my code

dataset is simply the text file containing edgelistof a graph

arr=dataset nodelist = unique(as.vector(as.matrix(arr))) arr_mat2 = matrix(0,length(nodelist),length(nodelist)) for (i in 1:length(arr[,1])){ arr_mat2[arr[i,1],arr[i,2]] = 1 } arr_mat_new2 = arr_mat2 for(i in 1:length(arr_mat2[,1])){ arr_mat_new2[i,which(arr_mat2[i,]==0)] = 2 }

d2 <- as.dist(arr_mat_new2) # ASymmetric atsp <- ATSP(d2) # ASymmetric tsp<-reformulate_ATSP_as_TSP(atsp, cheap = 0) o <- solve_TSP(tsp, method="concorde",rep=10, control = list(clo = "-V"))

I get the following output

Used control parameters: clo = -V exe = E:\Concorde_Code/concorde precision = 6 verbose = TRUE keep_files = FALSE /Concorde_Code/concorde -x -V -o file1de811447e4a.sol file1de811447e4a.dat Host: Pasha Current process id: 977 Using random seed 1586825616 FATAL ERROR - received signal SIGSEGV (11/11) Problem Name: TSP Generated by write_TSPLIB (R-package TSP) Problem Type: TSP Number of Nodes: 132 Explicit Lengths (CC_MATRIXNORM) sleeping 1 more hours to permit debugger access

Can anyone tell me what am I doing wring here?

mhahsler commented 4 years ago

Hi, I just saw your question on StackOverflow.

https://stackoverflow.com/questions/61162790/problem-in-r-studio-while-solving-traveling-salesman-problem-tsp-using-concord

I will answer there.

sarwanpasha commented 4 years ago

Thank you for your response. Can you please answer as soon as possible? I am working on a project and badly stuck right now.

On Tue, Apr 14, 2020 at 6:24 PM Michael Hahsler notifications@github.com wrote:

Hi, I just saw your question on StackOverflow.

https://stackoverflow.com/questions/61162790/problem-in-r-studio-while-solving-traveling-salesman-problem-tsp-using-concord

I will answer there.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mhahsler/TSP/issues/12#issuecomment-613440135, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB7WA4FMSHOHNUOBH3LVZPTRMRPXVANCNFSM4MHK66IA .

-- Regards Sarwan ali (sarwanpasha@gmail.com)

sarwanpasha commented 4 years ago

Hey, I have included the dataset and sessioninfo detail in the question on StackOverflow. Please check it.

sarwanpasha commented 4 years ago

Hey, I have included the detail for the questions on StackOverflow. Could you please check that what is wrong with the code?

Here are the URLs https://stackoverflow.com/questions/61162790/problem-in-r-studio-while-solving-traveling-salesman-problem-tsp-using-concord

https://stackoverflow.com/questions/61206986/rstudio-error-overflow-in-ccbigguy-addmult-4-bigguy-errors-are-fatal

On Tue, Apr 14, 2020 at 6:24 PM Michael Hahsler notifications@github.com wrote:

Hi, I just saw your question on StackOverflow.

https://stackoverflow.com/questions/61162790/problem-in-r-studio-while-solving-traveling-salesman-problem-tsp-using-concord

I will answer there.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mhahsler/TSP/issues/12#issuecomment-613440135, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB7WA4FMSHOHNUOBH3LVZPTRMRPXVANCNFSM4MHK66IA .

-- Regards Sarwan ali (sarwanpasha@gmail.com)

mhahsler commented 4 years ago

Concorde likes similarities converted to dissimilarities using d = 1/(1+s) and has issues with the distances you create. The other heuristics in TSP can handle your distances.