Sun Nov 6 12:30:32 2022 tsp_descent_test(): Python version: 3.6.9 Test tsp_descent(). tsp_descent(): Solve a small traveling salesperson problem (TSP) using a descent method, generating reversals and transpositions of a random starting tour. The city-to-city distance matrix D: [[0. 3. 4. 2. 9.] [3. 0. 4. 6. 3.] [4. 4. 0. 5. 8.] [2. 6. 5. 0. 6.] [9. 3. 8. 6. 0.]] Reversal 2: cost = 23 Reversal 3: cost = 19 Number of variations tried was 2000 The best itinerary found: Step From To Distance 1 4 3 6 2 3 0 2 3 0 2 4 4 2 1 4 0 1 4 3 ---- -- -- -------------- cost: 19 tsp_descent(): Solve a small traveling salesperson problem (TSP) using a descent method, generating reversals and transpositions of a random starting tour. The city-to-city distance matrix D: [[ 0. 29. 82. 46. 68. 52. 72. 42. 51. 55. 29. 74. 23. 72. 46.] [29. 0. 55. 46. 42. 43. 43. 23. 23. 31. 41. 51. 11. 52. 21.] [82. 55. 0. 68. 46. 55. 23. 43. 41. 29. 79. 21. 64. 31. 51.] [46. 46. 68. 0. 82. 15. 72. 31. 62. 42. 21. 51. 51. 43. 64.] [68. 42. 46. 82. 0. 74. 23. 52. 21. 46. 82. 58. 46. 65. 23.] [52. 43. 55. 15. 74. 0. 61. 23. 55. 31. 33. 37. 51. 29. 59.] [72. 43. 23. 72. 23. 61. 0. 42. 23. 31. 77. 37. 51. 46. 33.] [42. 23. 43. 31. 52. 23. 42. 0. 33. 15. 37. 33. 33. 31. 37.] [51. 23. 41. 62. 21. 55. 23. 33. 0. 29. 62. 46. 29. 51. 11.] [55. 31. 29. 42. 46. 31. 31. 15. 29. 0. 51. 21. 41. 23. 37.] [29. 41. 79. 21. 82. 33. 77. 37. 62. 51. 0. 65. 42. 59. 61.] [74. 51. 21. 51. 58. 37. 37. 33. 46. 21. 65. 0. 61. 11. 55.] [23. 11. 64. 51. 46. 51. 51. 33. 29. 41. 42. 61. 0. 62. 23.] [72. 52. 31. 43. 65. 29. 46. 31. 51. 23. 59. 11. 62. 0. 59.] [46. 21. 51. 64. 23. 59. 33. 37. 11. 37. 61. 55. 23. 59. 0.]] Reversal 1: cost = 544 Transpose 2: cost = 487 Reversal 2: cost = 467 Reversal 9: cost = 462 Transpose 12: cost = 442 Reversal 12: cost = 427 Reversal 20: cost = 419 Transpose 31: cost = 412 Transpose 32: cost = 410 Transpose 48: cost = 404 Transpose 52: cost = 387 Reversal 60: cost = 375 Reversal 69: cost = 369 Transpose 71: cost = 346 Transpose 81: cost = 326 Reversal 84: cost = 322 Transpose 87: cost = 320 Transpose 105: cost = 291 Number of variations tried was 2000 The best itinerary found: Step From To Distance 1 10 0 29 2 0 12 23 3 12 1 11 4 1 14 21 5 14 8 11 6 8 4 21 7 4 6 23 8 6 2 23 9 2 11 21 10 11 13 11 11 13 9 23 12 9 7 15 13 7 5 23 14 5 3 15 0 3 10 21 ---- -- -- -------------- cost: 291 tsp_descent(): Solve a small traveling salesperson problem (TSP) using a descent method, generating reversals and transpositions of a random starting tour. The city-to-city distance matrix D: [[ 0. 633. 257. 91. 412. 150. 80. 134. 259. 505. 353. 324. 70. 211. 268. 246. 121.] [633. 0. 390. 661. 227. 488. 572. 530. 555. 289. 282. 638. 567. 466. 420. 745. 518.] [257. 390. 0. 228. 169. 112. 196. 154. 372. 262. 110. 437. 191. 74. 53. 472. 142.] [ 91. 661. 228. 0. 383. 120. 77. 105. 175. 476. 324. 240. 27. 182. 239. 237. 84.] [412. 227. 169. 383. 0. 267. 351. 309. 338. 196. 61. 421. 346. 243. 199. 528. 297.] [150. 488. 112. 120. 267. 0. 63. 34. 264. 360. 208. 329. 83. 105. 123. 364. 35.] [ 80. 572. 196. 77. 351. 63. 0. 29. 232. 444. 292. 297. 47. 150. 207. 332. 29.] [134. 530. 154. 105. 309. 34. 29. 0. 249. 402. 250. 314. 68. 108. 165. 349. 36.] [259. 555. 372. 175. 338. 264. 232. 249. 0. 495. 352. 95. 189. 326. 383. 202. 236.] [505. 289. 262. 476. 196. 360. 444. 402. 495. 0. 154. 578. 439. 336. 240. 685. 390.] [353. 282. 110. 324. 61. 208. 292. 250. 352. 154. 0. 435. 287. 184. 140. 542. 238.] [324. 638. 437. 240. 421. 329. 297. 314. 95. 578. 435. 0. 254. 391. 448. 157. 301.] [ 70. 567. 191. 27. 346. 83. 47. 68. 189. 439. 287. 254. 0. 145. 202. 289. 55.] [211. 466. 74. 182. 243. 105. 150. 108. 326. 336. 184. 391. 145. 0. 57. 426. 96.] [268. 420. 53. 239. 199. 123. 207. 165. 383. 240. 140. 448. 202. 57. 0. 483. 153.] [246. 745. 472. 237. 528. 364. 332. 349. 202. 685. 542. 157. 289. 426. 483. 0. 336.] [121. 518. 142. 84. 297. 35. 29. 36. 236. 390. 238. 301. 55. 96. 153. 336. 0.]] Transpose 2: cost = 5007 Reversal 2: cost = 4860 Transpose 3: cost = 4694 Reversal 4: cost = 4568 Reversal 6: cost = 3998 Reversal 7: cost = 3956 Reversal 8: cost = 3650 Transpose 18: cost = 3598 Transpose 20: cost = 3534 Reversal 24: cost = 3269 Transpose 25: cost = 3230 Transpose 27: cost = 3210 Reversal 28: cost = 3006 Reversal 31: cost = 2989 Reversal 33: cost = 2937 Transpose 34: cost = 2920 Transpose 38: cost = 2902 Reversal 43: cost = 2898 Transpose 49: cost = 2770 Reversal 52: cost = 2759 Reversal 54: cost = 2758 Reversal 58: cost = 2757 Reversal 68: cost = 2620 Transpose 73: cost = 2407 Reversal 83: cost = 2387 Transpose 84: cost = 2350 Reversal 95: cost = 2277 Transpose 99: cost = 2275 Reversal 278: cost = 2239 Reversal 360: cost = 2129 Reversal 392: cost = 2095 Number of variations tried was 2000 The best itinerary found: Step From To Distance 1 2 10 110 2 10 9 154 3 9 1 289 4 1 4 227 5 4 8 338 6 8 11 95 7 11 15 157 8 15 0 246 9 0 3 91 10 3 12 27 11 12 6 47 12 6 16 29 13 16 7 36 14 7 5 34 15 5 13 105 16 13 14 57 0 14 2 53 ---- -- -- -------------- cost: 2095 tsp_descent(): Solve a small traveling salesperson problem (TSP) using a descent method, generating reversals and transpositions of a random starting tour. The city-to-city distance matrix D: [[ 0. 4727. 1205. ... 1542. 2379. 3744.] [4727. 0. 3588. ... 5461. 4390. 2088.] [1205. 3588. 0. ... 2023. 1867. 2560.] ... [1542. 5461. 2023. ... 0. 1644. 3928.] [2379. 4390. 1867. ... 1644. 0. 2532.] [3744. 2088. 2560. ... 3928. 2532. 0.]] Transpose 1: cost = 158363 Transpose 2: cost = 147720 Reversal 3: cost = 146116 Reversal 4: cost = 146089 Transpose 5: cost = 145616 Reversal 10: cost = 141054 Transpose 11: cost = 139637 Reversal 12: cost = 138141 Transpose 14: cost = 138103 Transpose 15: cost = 138088 Transpose 17: cost = 136615 Transpose 19: cost = 134217 Transpose 22: cost = 132764 Transpose 23: cost = 130878 Reversal 23: cost = 130252 Transpose 24: cost = 129771 Reversal 26: cost = 128326 Transpose 28: cost = 121766 Reversal 28: cost = 121145 Reversal 29: cost = 119073 Reversal 30: cost = 118964 Transpose 31: cost = 115219 Transpose 32: cost = 115162 Reversal 36: cost = 111493 Reversal 37: cost = 111413 Reversal 47: cost = 109457 Reversal 49: cost = 107114 Reversal 50: cost = 107054 Transpose 51: cost = 106633 Reversal 51: cost = 106053 Transpose 57: cost = 103169 Reversal 58: cost = 102290 Reversal 65: cost = 102027 Transpose 66: cost = 102011 Reversal 67: cost = 101735 Reversal 70: cost = 101502 Reversal 72: cost = 101472 Reversal 74: cost = 101335 Transpose 78: cost = 100580 Reversal 79: cost = 96873 Transpose 84: cost = 96654 Transpose 89: cost = 96194 Reversal 91: cost = 90245 Reversal 92: cost = 89943 Transpose 94: cost = 88277 Reversal 94: cost = 87103 Transpose 97: cost = 86238 Transpose 98: cost = 83173 Transpose 100: cost = 77911 Transpose 105: cost = 76786 Reversal 105: cost = 75325 Reversal 109: cost = 74313 Reversal 114: cost = 73453 Reversal 115: cost = 73322 Transpose 117: cost = 72506 Reversal 118: cost = 71868 Reversal 123: cost = 71017 Transpose 126: cost = 70895 Transpose 127: cost = 70607 Reversal 128: cost = 69735 Reversal 129: cost = 69098 Transpose 136: cost = 69084 Transpose 142: cost = 68960 Reversal 145: cost = 68058 Transpose 147: cost = 66471 Transpose 151: cost = 65338 Transpose 156: cost = 64804 Transpose 157: cost = 64554 Reversal 158: cost = 64022 Transpose 164: cost = 62829 Transpose 166: cost = 62697 Transpose 172: cost = 62223 Reversal 172: cost = 60812 Reversal 175: cost = 59756 Reversal 182: cost = 58799 Reversal 189: cost = 56883 Transpose 197: cost = 55548 Transpose 199: cost = 55229 Transpose 242: cost = 54308 Transpose 255: cost = 52831 Reversal 257: cost = 51219 Transpose 262: cost = 49937 Reversal 275: cost = 49046 Reversal 279: cost = 48886 Transpose 304: cost = 47580 Transpose 310: cost = 46050 Reversal 321: cost = 45806 Transpose 337: cost = 45795 Transpose 344: cost = 44265 Transpose 394: cost = 42868 Transpose 474: cost = 42549 Reversal 477: cost = 42182 Reversal 486: cost = 41522 Transpose 495: cost = 41405 Transpose 500: cost = 40747 Transpose 529: cost = 40687 Transpose 551: cost = 39932 Reversal 553: cost = 39519 Reversal 565: cost = 39186 Reversal 716: cost = 39158 Transpose 742: cost = 38108 Reversal 862: cost = 37413 Number of variations tried was 2000 The best itinerary found: Step From To Distance 1 28 40 1911 2 40 15 1241 3 15 21 442 4 21 7 1175 5 7 0 563 6 0 8 463 7 8 39 676 8 39 10 931 9 10 11 586 10 11 14 406 11 14 30 1204 12 30 37 578 13 37 43 1002 14 43 17 355 15 17 6 168 16 6 27 267 17 27 36 653 18 36 18 132 19 18 5 293 20 5 26 365 21 26 16 370 22 16 42 437 23 42 29 400 24 29 35 735 25 35 45 902 26 45 32 422 27 32 19 654 28 19 46 777 29 46 12 756 30 12 20 730 31 20 24 1062 32 24 13 419 33 13 22 606 34 22 2 828 35 2 33 950 36 33 4 1590 37 4 47 304 38 47 38 1000 39 38 31 533 40 31 23 1687 41 23 9 922 42 9 34 1102 43 34 44 461 44 44 3 1877 45 3 25 320 46 25 41 1363 47 41 1 1591 0 1 28 1204 ---- -- -- -------------- cost: 37413 tsp_descent_test(): Normal end of execution. Sun Nov 6 12:30:33 2022