code: def cal_total_distance(routine):
      (num_points,) = routine.shape
      return sum(
          [
              distance_matrix[
                  routine[i % num_points], routine[(i + 1) % num_points]
              ]
              for i in range(num_points)
          ]
      )
  
imports: import numpy
  from scipy import spatial
  import pandas
  import matplotlib.pyplot
  from sko.ACA import ACA_TSP
label_desc: Use image node_id 1 for calling a global function with example usage: cal_total_distance(routine) and returns: sum