# include # include using namespace std; # include "tsp_dantzig42.hpp" //****************************************************************************80 int *tsp_dantzig42_order ( ) //****************************************************************************80 // // Purpose: // // tsp_dantzig42_order() returns the path for the Dantzig 42 city TSP challenge. // // Licensing: // // This code is distributed under the MIT license. // // Modified: // // 15 July 2026 // // Author: // // John Burkardt // // Output: // // int tsp_dantzig42_order[42]: the 0-based optimal tour order. // { int *dantzig42_order; static int dantzig42_order_save[42] = { 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; int i; int n = 42; dantzig42_order = new int[n]; for ( i = 0; i < n; i++ ) { dantzig42_order[i] = dantzig42_order_save[i]; } return dantzig42_order; } //****************************************************************************80 double *tsp_dantzig42_xy ( ) //****************************************************************************80 // // Purpose: // // tsp_dantzig42_xy() returns the location data for the Dantzig 42 city TSP challenge. // // Discussion: // // The original values // // 147.5, 36.0; // 154.5, 45.0; // // were adjusted to // // 147.0, 36.0; // 154.0, 45.0; // // so that all coordinates are integers. // // Licensing: // // This code is distributed under the MIT license. // // Modified: // // 21 July 2026 // // Author: // // John Burkardt // // Output: // // double tsp_dantzig42_xy[42*2]: the x and y coordinates of the cities. // { double *dantzig42_xy; static double dantzig42_xy_save[42*2] = { 170.0, 85.0, 166.0, 88.0, 133.0, 73.0, 140.0, 70.0, 142.0, 55.0, 126.0, 53.0, 125.0, 60.0, 119.0, 68.0, 117.0, 74.0, 99.0, 83.0, 73.0, 79.0, 72.0, 91.0, 37.0, 94.0, 6.0, 106.0, 3.0, 97.0, 21.0, 82.0, 33.0, 67.0, 4.0, 66.0, 3.0, 42.0, 27.0, 33.0, 52.0, 41.0, 57.0, 59.0, 58.0, 66.0, 88.0, 65.0, 99.0, 67.0, 95.0, 55.0, 89.0, 55.0, 83.0, 38.0, 85.0, 25.0, 104.0, 35.0, 112.0, 37.0, 112.0, 24.0, 113.0, 13.0, 125.0, 30.0, 135.0, 32.0, 147.0, 18.0, 147.0, 36.0, 154.0, 45.0, 157.0, 54.0, 158.0, 61.0, 172.0, 82.0, 174.0, 87.0 }; int i; int n = 42; dantzig42_xy = new double[n * 2]; for ( i = 0; i < n; i++ ) { dantzig42_xy[2*i] = dantzig42_xy_save[2*i]; dantzig42_xy[2*i+1] = dantzig42_xy_save[2*i+1]; } return dantzig42_xy; }