# Algorithm for k-medians in a convex polygon

Are there any known approximation algorithms or exact solution schemes for the k-medians problem in a convex polygon? That is, placing a collection of points $p_1,\dots,p_k \subset \mathbb{R}^2$ in a convex polygon $C$ so as to minimize $$\iint_C \min_i \|x-p_i\| dx$$

• Nice question! For the ellipse $x^2/a^2 + y^2/b^2 = 1$ and $k=2$, the points are not at the foci. For $a=2$, $b=1$, about $(\pm 0.85,0)$. Commented Dec 21, 2010 at 0:52
• Is there even a nice algorithm for k=1 ? Commented Dec 21, 2010 at 14:00
• @Henrik: Good question! Not generally at the center of gravity... Commented Dec 21, 2010 at 19:32
• For $k=1$, the functional is convex and, if you have any way to compute it in a reasonable time (say, by partitioning into triangles, or so), you can use the standard gradient descent methods. All that fails miserably for larger $k$. The minimum is no longer unique (say for 2 points in an equilateral triangle) and everything becomes a mess. What range of $k$ are you interested in? Commented Dec 22, 2010 at 0:18
• @Joseph: If you square the distance and $k=1$, then it's the center of gravity. Commented Dec 22, 2010 at 22:30

The problem you're asking about (for $k=1$) is called the continuous Fermat-Weber problem. The primary work on this that I'm aware of is the 2003 paper by Fekete, Mitchell and Beurer. While they examine this problem, they focus on the $\ell_1$ plane (the analytics are easier) and also pay more attention to the $k=1$ case, while also discussing some hardness results.

My $.02$ is that there should be some way of getting an approximation by discretizing the region - it's not clear to me that convexity helps a lot though.

• Why? I agree that when the function is just barely convex, you may have headaches with the descent methods but this one has a good a priori bound for the second derivative in every direction, so the most naiive implementations require just logarithm of the precision steps. Commented Dec 22, 2010 at 18:58
• I was referring to convexity in the region, not the function. Commented Dec 23, 2010 at 17:21

A while ago I wrote, but never published, an approximation algorithm for this problem. Using some new results and updating the citations, it looks like I can get the approximation constant down to 9.026 (assuming I didn't make any mistakes). It's not clear to me if that's publication-worthy, but I uploaded a draft to

http://www.tc.umn.edu/~jcarlsso/fermat-weber.pdf

if anyone is interested.

• that is interesting ! thanks for sharing the draft. Commented Dec 26, 2010 at 9:03
• Thanks, I already caught and fixed two typos since posting. Commented Dec 26, 2010 at 20:50
• Update: brought the approximation constant down to 5.02. Commented Jan 3, 2011 at 7:25
• The link in your answer seems to be dead. Is the new link supposed to be this one: www-bcf.usc.edu/~jcarlsso/fermat-weber.pdf (Wayback Machine) Commented Mar 6, 2019 at 12:52

Following Suresh's lead, this problem is known as the multisource Weber problem, and searching that key phrase turns up several papers in the operations research literature. For example:

"Improvement and Comparison of Heuristics for Solving the Uncapacitated Multisource Weber Problem," Operations Research, Vol. 48, No. 3, May-June 2000, pp. 444-460.

"The Multi-Source Weber Problem with Constant Opening Cost," Journal of Operations Research Society, 2004, 55, 640-6.

• juat a clarification though: it seems to me that both links still refer to the discrete setting (i.e the k-median) where the number of "users" is finite. Aside: I didn't know that there's this entire subfield devoted to the k-median under this name. certainly the theoryCS literature doesn't directly mention it, and the OR community appears to return the favor :) Commented Dec 25, 2010 at 17:58
• @Suresh: Yes, you are right, these references are to the discrete version. And it is quite interesting that the two communities are apparently unaware of one another! Maybe this MO question will serve as a start toward bridging that gap. Commented Dec 25, 2010 at 18:41

There's no particular range of $k$ that I'm interested in; actually, I'm just curious if there's already a well-known PTAS or an approximation algorithm, and whether that's considered an "interesting" problem in the geometry community. It seems that the problem becomes easier as $k$ becomes really big, since you just want to scatter the points in as uniform a fashion as possible (like the centers of a hexagonal tiling or something like that).

EDIT: Sorry folks, looks like I replied in the wrong place.