tour_length               package:TSP               R Documentation

_C_a_l_c_u_l_a_t_e _t_h_e _l_e_n_g_t_h _o_f _a _t_o_u_r

_D_e_s_c_r_i_p_t_i_o_n:

     Calculate the length of a tour given a TSP and an order.

_U_s_a_g_e:

     tour_length(x, order)

_A_r_g_u_m_e_n_t_s:

       x: an object of class 'TSP' or 'ATSP'.

   order: optional order of the visited cities as a integer vector or
          an object of class 'TOUR'.  If no order is given, the cities
          are visited in the original order in 'x'. 

_D_e_t_a_i_l_s:

     If a distance in the tour is infinite, the result is also
     infinite. If  the tour contains positive and negative infinite
     distances the method returns 'NA'.

_S_e_e _A_l_s_o:

     'TSP', 'ATSP', 'TOUR'.

_E_x_a_m_p_l_e_s:

     data("USCA50")

     ## original order
     tour_length(USCA50)

     ## random tour
     tour_length(USCA50, sample(1:n_of_cities(USCA50)))

