Skip to main content
Tweeted twitter.com/StackMma/status/1036811546125627392
added 4 characters in body
Source Link
kirma
  • 19.1k
  • 1
  • 55
  • 95

FindShortestTourFindShortestTour behaves erratically. It should return a {distance, ordering}{distance, ordering} pair, and it does this for most values of its second argument. But for two cases shown below, it returns an empty list. There is no mention of this possibility in the Mathematica documentation. There is no apparent reason for this behaviour. There are no errors or messages thrown during execution.

places = {{-0.16799965940098155`, 
0.24175153562415813`}, {-0.2486071472529178`, 
0.20618977684683304`}, {-0.14076440088637684`, \
-0.24171243009574903`}, {-0.6251900796628861`, -0.9717675903858705`}, \
{-0.17963581832506564`, -0.5233794053664629`}, {0.266014045257439`, \
-0.2574537949317151`}, {0.43866600854230675`, -0.3502551214679294`}, \
{0.8152887752208928`, -0.152895668542801`}, {0.0849331507331597`, \
-0.09587917268794487`}};

Array[FindShortestTour[places,#,9]&,8]

If you copy and paste and execute this code, you will see that the 3rd and 6th entries are empty. Why?

FindShortestTour behaves erratically. It should return a {distance, ordering} pair, and it does this for most values of its second argument. But for two cases shown below, it returns an empty list. There is no mention of this possibility in the Mathematica documentation. There is no apparent reason for this behaviour. There are no errors or messages thrown during execution.

places = {{-0.16799965940098155`, 
0.24175153562415813`}, {-0.2486071472529178`, 
0.20618977684683304`}, {-0.14076440088637684`, \
-0.24171243009574903`}, {-0.6251900796628861`, -0.9717675903858705`}, \
{-0.17963581832506564`, -0.5233794053664629`}, {0.266014045257439`, \
-0.2574537949317151`}, {0.43866600854230675`, -0.3502551214679294`}, \
{0.8152887752208928`, -0.152895668542801`}, {0.0849331507331597`, \
-0.09587917268794487`}};

Array[FindShortestTour[places,#,9]&,8]

If you copy and paste and execute this code, you will see that the 3rd and 6th entries are empty. Why?

FindShortestTour behaves erratically. It should return a {distance, ordering} pair, and it does this for most values of its second argument. But for two cases shown below, it returns an empty list. There is no mention of this possibility in the Mathematica documentation. There is no apparent reason for this behaviour. There are no errors or messages thrown during execution.

places = {{-0.16799965940098155`, 
0.24175153562415813`}, {-0.2486071472529178`, 
0.20618977684683304`}, {-0.14076440088637684`, \
-0.24171243009574903`}, {-0.6251900796628861`, -0.9717675903858705`}, \
{-0.17963581832506564`, -0.5233794053664629`}, {0.266014045257439`, \
-0.2574537949317151`}, {0.43866600854230675`, -0.3502551214679294`}, \
{0.8152887752208928`, -0.152895668542801`}, {0.0849331507331597`, \
-0.09587917268794487`}};

Array[FindShortestTour[places,#,9]&,8]

If you copy and paste and execute this code, you will see that the 3rd and 6th entries are empty. Why?

Source Link
Carib John
  • 181
  • 1
  • 4

FindShortestTour shows erratic behaviour wrt 2nd argument

FindShortestTour behaves erratically. It should return a {distance, ordering} pair, and it does this for most values of its second argument. But for two cases shown below, it returns an empty list. There is no mention of this possibility in the Mathematica documentation. There is no apparent reason for this behaviour. There are no errors or messages thrown during execution.

places = {{-0.16799965940098155`, 
0.24175153562415813`}, {-0.2486071472529178`, 
0.20618977684683304`}, {-0.14076440088637684`, \
-0.24171243009574903`}, {-0.6251900796628861`, -0.9717675903858705`}, \
{-0.17963581832506564`, -0.5233794053664629`}, {0.266014045257439`, \
-0.2574537949317151`}, {0.43866600854230675`, -0.3502551214679294`}, \
{0.8152887752208928`, -0.152895668542801`}, {0.0849331507331597`, \
-0.09587917268794487`}};

Array[FindShortestTour[places,#,9]&,8]

If you copy and paste and execute this code, you will see that the 3rd and 6th entries are empty. Why?