Optimizing distance and other value for a set of locations and people.

28 Views Asked by At

Suppose you have $n$ locations that can represented by a point $(x, y)$ but they also have some other random weight value associated with it.

There are $m$ people randomly placed on the same plane (but they will never overlap with the locations).

The goal is group locations with people such that each person minimizes total distance to each location, but also have every person has as close to the same amount of total weight value as each other.

Meaning if you had locations $\{A, B, C, D, E\}$ where each location has some weight, and people $\{p_{1}, p_{2} \}$ you want to partition the locations like $p_{1} : \{A, B, C\}$ and $p_{2} : \{D, E\}$ so that the total weight is as close to the same for $p_{1}$ and $p_{2}$ but also minimizes distance to each location.

Grouping them based on just distance isn't an issue, I could do something like produce a voronoi diagram, but the added variable of the weight has me stumped. I have considered starting from the points in each voronoi region then swapping locations near the edge if the total weight in that region is higher than the neighbor, but there are many scenarios that are strange.

What might be a good approach apart from checking every possible combination of the set of locations into $m$ partitions which gets really big really quickly. I am more looking for a point in the right direction. Is this a problem best addressed by graph theory?

One approach that didn't get me too far was representing the locations as 3-dimensional points, and creating a function $f(x, y)$ that returns some value based on the total distance to every single location divided by the distance to every other point. My thinking was that if I could find points that have close the average value (height), I could find the nearest person to that point.