0

I have two point set

SeedRandom[1]
pts1 = RandomReal[1, {10, 2}];
pts2 = RandomReal[1, {10, 2}];
Graphics[{PointSize[Medium], Red, Point[pts1], Blue, Point[pts2]}]

I want to get a match for every point,If I use Transpose directly,the total distance will very big like

pairs = Transpose[{pts1, pts2}];
totalDist = Total[EuclideanDistance @@@ pairs]

5.29783

How to get such pairs with smallest total distance in a high effciency method?

yode
  • 26,686
  • 4
  • 62
  • 167

0 Answers0