I've been looking around for an algorithm that would optimize the distance between 2 list of coordinates and choose which coordinate should go together.Say I have List 1:205|200220|210200|220200|180List 2:210|200207|190230|200234|190Calculated Distance between Coords:205|200 to 210|200 == 5.00205|200 to 207|190 == 10.20205|200 to 230|200 == 25.00205|200 to 234|190 == 30.68220|210 to 210|200 == 14.14220|210 to 207|190 == 23.85220|210 to 230|200 == 14.14220|210 to 234|190 == 24.41200|220 to 210|200 == 22.36200|220 to 207|190 == 30.81200|220 to 230|200 == 36.06200|220 to 234|190 == 45.34200|180 to 210|200 == 22.36200|180 to 207|190 == 12.21200|180 to 230|200 == 36.06200|180 to 234|190 == 35.44This Algorithm would pick:205|200 to 230|200 == 25.00220|210 to 207|190 == 23.85200|220 to 210|200 == 22.36200|180 to 234|190 == 35.44The Algorithm would pick these numbers as they would be the group that would have the littlest variance between the distance.Conditions:A Coordinate may only be used ones from each listIf List 1 or List2 is larger than it still only uses each coordinate once, but it tries to get the smallest distance variance and does nothing with the unused coordinates.If you need more clarification please ask.P.S. I've looked at the Hungarian algorithm and it seems like it will sort of do the job, but not exactly how I was expecting. The Hungarian algorithm will only try and make the least distance from all the coordinates, which can mean the smallest variance, but not every time as variance is more important here then least distance optimization.Additional InformationI will have an array of List1, List2, and then the distances:Distance[List1_item_0][List2_item_0] = 5;Distance[List1_item_0][List2_item_1] = 10.20;Distance[List1_item_0][List2_item_2] = 25.00;Distance[List1_item_0][List2_item_3] = 30.68;Distance[List1_item_1][List2_item_0] = 14.14;Distance[List1_item_1][List2_item_1] = 23.85;Distance[List1_item_1][List2_item_2] = 14.14;Distance[List1_item_1][List2_item_3] = 24.41;Distance[List1_item_2][List2_item_0] = 22.36;Distance[List1_item_2][List2_item_1] = 30.81;Distance[List1_item_2][List2_item_2] = 36.06;Distance[List1_item_2][List2_item_3] = 45.34;Distance[List1_item_3][List2_item_0] = 22.36;Distance[List1_item_3][List2_item_1] = 12.21;Distance[List1_item_3][List2_item_2] = 36.06;Distance[List1_item_3][List2_item_3] = 35.44;From the Distance['List1_item_#] I would need to pick a distance. Once that distance is picked the [List2_item_#] CANNOT be picked by a different [List1_item_#]. The distances picked for each [List1_item_#] element would need to be picked in a way that the variance between them all is minimal. So distance for each [List1_item_#] should be as close as possible to each other without reusing a [List2_item_#] more than once.
Algorithm to minimize distance variance between 2D coordinates
algorithms