the*_*the 4 algorithm matrix hungarian-algorithm
我的问题如下:
Given a number of 2n points, I can calculate the distance between all points
and get a symmetrical matrix.
Can you create n pairs of points, so that the sum of the distance of all pairs is
minimal?
EDIT: Every point has to be in one of the pairs. Which means that
every point is only allowed to be in one pair.
Run Code Online (Sandbox Code Playgroud)
我天真地试图使用匈牙利语算法,并希望它可以给我一个作业,以便作业是对称的.但这显然不起作用,因为我没有二分图.
搜索之后,我发现了稳定的室友问题,这似乎与我的问题类似,但不同的是,它只是试图找到一个匹配,但不是试图最小化某种距离.
有谁知道类似的问题甚至解决方案?我错过了什么?问题实际上看起来并不那么困难,但我无法想出最佳解决方案.