Software & Finance Forums

### Author Topic: Travelling Salesman Problem (TSP)  (Read 1429 times)

#### skyblue2779

• Newbie
• Posts: 1
##### Travelling Salesman Problem (TSP)
« on: August 20, 2011, 03:50:49 am »
Write a C program to solve the instance of Travelling Salesman Problem (TSP) as
shown Table 1.
Measure the time taken to execute this algorithm and plot a time versus n
cities; from n = 2 until 14. Iteratively increase the number of cities by
following alphabetical order.

**Can i hv somebody to help me solved this prob out..

 Alor Setar Ipoh JB Kelantan Kuatan KL Melaka Mersing Penang Perlis Seremban SG Terengganu Temerloh Alor Setar 0 235 771 356 636 432 576 702 112 74 509 790 498 555 Ipoh 235 0 541 342 405 202 346 562 153 303 279 560 481 325 JB 771 541 0 787 360 336 221 131 691 841 272 21 536 462 Kelantan 356 342 787 0 365 461 592 598 339 425 525 806 206 410 Kuantan 636 405 360 365 0 254 256 197 592 742 318 379 177 140 KL 432 202 336 461 254 0 136 356 353 502 68 350 414 136 Melaka 576 346 221 592 256 136 0 231 495 645 75 230 430 167 Mersing 792 562 131 598 197 356 231 0 711 881 292 148 411 313 Penang 112 153 691 339 592 353 495 711 0 183 430 711 483 474 Perlis 74 303 841 425 742 502 645 861 183 0 579 860 568 624 Seremban 509 279 272 525 318 68 75 292 430 579 0 294 476 200 SG 790 560 21 806 379 350 230 148 711 860 294 0 554 481 Terengganu 498 481 536 206 177 414 430 411 483 568 476 554 0 301 Temerloh 555 325 462 410 140 136 167 313 474 624 200 481 301 0

#### kathir

• Sr. Member
• Posts: 283
##### Re: Travelling Salesman Problem (TSP)
« Reply #1 on: August 25, 2011, 07:34:53 am »
Hi,

The following solution is the fastest solution, would take less than a second to come up with the solution. However it may not be the efficient solution.

http://www.softwareandfinance.com/Visual_CPP/Travelling_Salesman_Solution.html

- Kathir

Write a C program to solve the instance of Travelling Salesman Problem (TSP) as
shown Table 1.
Measure the time taken to execute this algorithm and plot a time versus n
cities; from n = 2 until 14. Iteratively increase the number of cities by
following alphabetical order.

**Can i hv somebody to help me solved this prob out..

 Alor Setar Ipoh JB Kelantan Kuatan KL Melaka Mersing Penang Perlis Seremban SG Terengganu Temerloh Alor Setar 0 235 771 356 636 432 576 702 112 74 509 790 498 555 Ipoh 235 0 541 342 405 202 346 562 153 303 279 560 481 325 JB 771 541 0 787 360 336 221 131 691 841 272 21 536 462 Kelantan 356 342 787 0 365 461 592 598 339 425 525 806 206 410 Kuantan 636 405 360 365 0 254 256 197 592 742 318 379 177 140 KL 432 202 336 461 254 0 136 356 353 502 68 350 414 136 Melaka 576 346 221 592 256 136 0 231 495 645 75 230 430 167 Mersing 792 562 131 598 197 356 231 0 711 881 292 148 411 313 Penang 112 153 691 339 592 353 495 711 0 183 430 711 483 474 Perlis 74 303 841 425 742 502 645 861 183 0 579 860 568 624 Seremban 509 279 272 525 318 68 75 292 430 579 0 294 476 200 SG 790 560 21 806 379 350 230 148 711 860 294 0 554 481 Terengganu 498 481 536 206 177 414 430 411 483 568 476 554 0 301 Temerloh 555 325 462 410 140 136 167 313 474 624 200 481 301 0

Disclaimer: This web site is for educational and informational purposes only. Click here to read the Disclaimer.