ATSP                   package:TSP                   R Documentation

_C_l_a_s_s _A_T_S_P - _A_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 the  asymmetric traveling
     salesperson problem (ATSP) and  some auxiliary methods.

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

     ## constructor
     ATSP(x, labels = NULL)

     ## coercion
     as.ATSP(object)

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

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

x, object: an object (a square matrix) to be converted into an 'ATSP'
          or, for the methods,  an object of class 'ATSP'.

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

     col: color scheme for image. 

   order: order of cities 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 'ATSP' are internally represented by a matrix 
     (use 'as.matrix()' to get just the matrix).

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

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

     '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 <- matrix(runif(10^2), ncol = 10, dimnames = list(1:10, 1:10))

     atsp <- ATSP(data)
     atsp

     ## use some methods
     n_of_cities(atsp)
     labels(atsp)

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

     tour_length(atsp)
     tour_length(atsp, tour)

     image(atsp, tour)

