Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find the minimum cost of linking two sets of points

I got two sets of points S and V, both have the size n. I want to link the two sets so that every point in S links to one and only one point in V. The cost to link two points is defined as the Euclidean distance between the two points. There should be n! possible ways to link. So how to find the way of minimum cost? (in an efficient way)

like image 317
kkpattern Avatar asked Apr 16 '12 13:04

kkpattern


1 Answers

This is an assignment problem. You can solve it with the Hungarian Method. There are implementations of this in python. You can also solve the problem with any linear programming solver. The LP formulation will always give you an integer solution.

like image 86
David Nehme Avatar answered Sep 23 '22 18:09

David Nehme