| TSPLIB {TSP} | R Documentation |
Reads and writes TSPLIB format files. TSPLIB files can be used by most TSP solvers. Sample instances for the TSP in TSPLIB format are available on the TSPLIB homepage (see references).
write_TSPLIB(x, file, precision = 6, inf = NULL, neg_inf = NULL)
read_TSPLIB(file, precision = 0)
x |
an object of class |
file |
file name or a |
precision |
controls the number of decimal places used to represent
distances (see details). If |
inf |
replacement value for |
neg_inf |
replacement value for |
In the TSPLIB format distances are represented by integer values. Therefore, if
x contains double values (which is normal in R) the values given
in x are multiplied by 10^{precision} before coercion to
integer. Note that therefore all results produced by programs using the
TSPLIB file as input need to be divided by 10^{precision} (i.e., the
decimal point has to be shifted precision placed to the left).
Currently only EDGE\_WEIGHT\_TYPE EXPLICIT is implemented!
read_TSPLIB returns an object of class TSP or ATSP.
TSPLIB home page, http://www.iwr.uni-heidelberg.de/groups/comopt/software/TSPLIB95/