xyzst / Pthreads-and-TSP

Parallel Programming: Using POSIX Threads to Improve Efficiency of TSP
0 stars 0 forks source link

input data isn't matrix #1

Open revenn opened 7 years ago

revenn commented 7 years ago

Hi! I don't understand the format of input file. In first line there should be a number of the cities ok, then next two lines contain float numbers. But in TSP as an input data there should be a matrix with values/costs. Could you explain me this? :)

xyzst commented 7 years ago

@revenn Thanks for your interest in this problem/repository.

I completed this as part of a course in parallelization and only wrote the parts of the code where we needed to split up the work evenly amongst a number of pthreads so I will try to be as helpful as I can.

I have uploaded a sample dataset (nrw1379.btsp) that was used to facilitate performance testing. This is a binary file and cannot be viewed/read like a textfile. You are correct that the first line or byte in this file is the number of cities. In the next successive fread() calls, that is where you will find the values/costs. The second fread() call will read in the x-coordinates of the cities, and the third fread() call will read in the y-coordinates of the cities.

So the data for each city is represented in a 2D plane and mapped out like this: posx[city] : posy[city] or px[city] : py[city]