mhahsler / TSP

Traveling Salesperson Problem - R package
63 stars 13 forks source link

Strange warning about distances #8

Closed tamas-ferenci closed 5 years ago

tamas-ferenci commented 5 years ago

Consider the following example:

solve_TSP( as.ATSP( matrix( runif(2000*2000), nc = 2000 ) ),
           method = "concorde", as_TSP = TRUE )

This gives a warning of

Warning in tsp_concorde(x_, control = control) :
  Concorde can only handle distances < 2^31. Reducing precision for Concorde to 5

Although it is only a warning, it is nevertheless strange as all distances are between 0 and 1.

mhahsler commented 5 years ago

This is a good question. Concorde only accepts 32-bit integers as distance values (in some cases even only 16-bit integers). solve_TSP tries to convert your distances into the appropriate range using a specified precision value in write_TSPLIB. The default precision is 6 and the warning just informs you that save_TSP had to reduce precision to 5 to stay within the range that Concord can handle. I will improve the manual page to talk about this.

tamas-ferenci commented 5 years ago

Thanks @mhahsler for the answer! That clarified wording would be indeed nice here. (I actually had the feeling that only the message about too high distances is misleading, and not the program itself has any bug.)