TSP                   package:TSP                   R Documentation

_C_l_a_s_s _T_S_P - _S_y_m_m_e_t_r_i_c _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:

     Constructor to create an instance of a symmetric traveling
     salesperson problem (TSP) and some auxiliary methods.

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

     ## constructor
     TSP(x, labels = NULL)

     ## coercion
     as.TSP(object)

     ## methods
     ## S3 method for class 'TSP':
     n_of_cities(x)
     ## S3 method for class 'TSP':
     image(x, order, col = gray.colors(64), ...)
     ## S3 method for class 'TSP':
     labels(object, ...)
     ## S3 method for class 'TSP':
     print(x, ...)

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

x, object: an object (currently 'dist' or a symmetric matrix) to be
          converted into a 'TSP' or, for the methods,  an object of
          class 'TSP'.

  labels: optional city labels. If not given, labels are taken  from
          'x'.

     col: color scheme for image. 

   order: order of cities for the image as an integer vector or an
          object of class 'TOUR'.

     ...: further arguments are passed on.

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

     Objects of class 'TSP' are internally represented as 'dist'
     objects (use 'as.dist()' to get the 'dist' object).

_V_a_l_u_e:

     'TSP()' returns 'x' as an object of class 'TSP'.

     'n_of_cities()' returns the number of cities in 'x'.

     'labels()' returns a vector with the names of the cities in 'x'.

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

     'TOUR', 'insert_dummy', 'tour_length', 'solve_TSP'.

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

     data("iris")
     d <- dist(iris[-5])

     ## create a TSP
     tsp <- TSP(d)
     tsp

     ## use some methods 
     n_of_cities(tsp)
     labels(tsp)
     image(tsp)

