[R] ATSP to TSP reformulation

Ian Deters iandeters at iandeters.com
Mon Aug 29 21:13:21 CEST 2011


Greetings, 

I am having trouble getting the function reformulate_ATSP_as_TSP to work for
me.  I have provided a simple example of some of the code I've been using. 
In particular, I'm not sure why I'm getting the error 

"Error in dimnames(tsp) <- list(lab, lab) : 
  length of 'dimnames' [1] not equal to array extent" 

since I created the object ATSP with a valid square matrix.  Is there
something simple I'm missing?  The code is below.  Thank you for your time. 

>x = array(0, dim=c(4,4)) 
> fix(x) 
> x 
     col1 col2 col3 col4 
[1,]    0    1    2    3 
[2,]    1    0   11    5 
[3,]    2    4    0    6 
[4,]    3    5    6    0 
> library(TSP) 
> example = ATSP(x) 
> example2 = reformulate_ATSP_as_TSP(example, infeasible = 1000, cheap =
> .0001) 
Error in dimnames(tsp) <- list(lab, lab) : 
  length of 'dimnames' [1] not equal to array extent

--
View this message in context: http://r.789695.n4.nabble.com/ATSP-to-TSP-reformulation-tp3777105p3777105.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list