#*****************************************************************************80 # ## tsp_att48_test() tests tsp_att48(). # # Licensing: # # This code is distributed under the MIT license. # # Modified: # # 26 July 2026 # # Author: # # John Burkardt # cat ( date ( ), "\n" ) cat ( "\n" ) cat ( "tsp_att48_test():\n" ) cat ( " ", version$version.string, "\n" ) cat ( " tsp_att48() returns the 48 cities in the AT&T TSP challenge.\n" ) source ( "/home/john/public_html/r_src/tsp_att48/tsp_att48_order.R" ) source ( "/home/john/public_html/r_src/tsp_att48/tsp_att48_xy.R" ) source ( "/home/john/public_html/r_src/tsp_display/tsp_display.R" ) source ( "/home/john/public_html/r_src/vecnorm/vecnorm.R" ) n <- 48 order <- tsp_att48_order ( ) xy <- tsp_att48_xy ( ) cat ( "\n" ) cat ( " City coordinates:\n" ) cat ( "\n" ) xy cat ( "\n" ) cat ( " Optimal ordering:\n" ) cat ( "\n" ) order # # Print cost of round trip. # cost <- 0.0 from <- order[n] for ( i in 1 : n ) { to <- order[i] cost <- cost + vecnorm ( xy[to,] - xy[from,] ) from <- to } cat ( "\n" ) cat ( " Cost of round trip", cost, "\n" ) # # Plot the data. # xy2 <- xy for ( i in 1 : n ) { xy2[i,1] = xy[order[i],1] xy2[i,2] = xy[order[i],2] } # # Plot the data. # prefix <- "tsp_att48" tsp_display ( prefix, n, xy2 ) # # Terminate. # cat ( "\n" ) cat ( "tsp_att48_test():\n" ) cat ( " Normal end of execution.\n" ) cat ( date ( ), "\n" ) quit ( )