[R] ATSP to TSP reformulation

Michael Hahsler mhahsler at lyle.smu.edu
Tue Aug 30 20:10:39 CEST 2011


Hi Ian,

I checked your example again and found the problem in tsp. fix(x) seems 
to create column names but not row names which exposes a bug in as.ATSP 
in tsp.

This code replicates your error message:

library(TSP)
x <- rbind(c(1,2,3,4), c(1,0,11,5), c(2,4,0,6), c(3,5,6,0))
colnames(x) <- 1:4
#rownames(x) <- 1:4
atsp <- ATSP(x)
tsp <- reformulate_ATSP_as_TSP(atsp)

if you uncomment the rownames line then it works. I already fixed the 
code in tsp to check for missing col/row names in the matrix. This fix 
will be part of the next release. For now please just add row names to 
the matrix.

Thanks for the bug report!

-Michael

-- 
   Dr. Michael Hahsler, Visiting Assistant Professor
   Department of Computer Science and Engineering
   Lyle School of Engineering
   Southern Methodist University, Dallas, Texas

   (214) 768-8878 * mhahsler at lyle.smu.edu * http://lyle.smu.edu/~mhahsler



More information about the R-help mailing list