-1

I'm designing a program where each of N agents is assigned a value K. There are N fixed locations, each with coordinates (x,y), and each location is assigned one agent.

What algorithm could I use to distribute all agents among the locations such that the linear distance between the agents with the highest values of K is maximized? (Specifically between the agents in the highest quintile of K values.)

If it matters, N will likely fall in the range of 10-30.

lhammer
  • 1
  • 1

1 Answers1

0

Google tells me that (30 choose 6) = 593775 so if you can work out a formula that tells you how good each possible choice of K fixed locations from N is, you can probably afford to evaluate it for all possible choices.

Here is a heuristic for larger parameter values. Calculate all distances between pairs of points and sort them into increasing order. Read out pairs from this in order and merge groups of points linked by each pair, using Union-Find to keep track of the groups of points created in this way. Stop when one of the groups reaches the required size, and that group is your answer.

mcdowella
  • 18,736
  • 2
  • 17
  • 24