TOUR                   package:TSP                   R Documentation

_C_l_a_s_s _T_O_U_R - _S_o_l_u_t_i_o_n _t_o _a _t_r_a_v_e_l_i_n_g _s_a_l_e_s_p_e_r_s_o_n _p_r_o_b_l_e_m

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

     Class to store the solution of a TSP. Objects of this class are
     returned by TSP solvers in this package.  Essentially, an object
     of class 'TOUR' is a permutation vector containing the order of
     cities to visit.

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

     ## conctructor
     TOUR(x)

     ## coercion
     as.TOUR(object)

     ## methods
     ## S3 method for class 'TOUR':
     print(x, ...)

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

       x: an integer permutation vector or, for the methods  an object
          of class 'TOUR'

  object: data (an integer vector) which can be coerced to 'TOUR'.

     ...: further arguments are passed on.

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

     Since an object of class 'TOUR' is an integer vector, it can be
     subsetted as an ordinary vector or coerced to an integer vector
     using 'as.integer()'. It also contains the names of the objects as
     labels. Additionally, 'TOUR' has the following attributes: 
     '"method"', '"tour_length"'.

     For most functions, e.g., 'tour_length' or 'image', the 'TSP/ATSP'
     object used to find the tour is still needed, since the tour does
     not contain the distance information.

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

     'TSP', 'ATSP', 'tour_length', 'image'.

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

     data("USCA50")

     ## calculate a tour
     tour <- solve_TSP(USCA50)
     tour

     ## get permutation vector
     as.integer(tour)

     ## show labels
     labels(tour)

