2

Say I have a number of customers in a geographical area, marked "c":

enter image description here

Each customer has a Lat/Long. I would like to find x number of points, in the same space, that best serve the customers, ie. they are closest to the customers.

Its easy to do when x = 1, because that is the geographical center of gravity, and there are a few ways to find that out. However I am struggling to think of how I would approach this problem if x > 1

Say x = 2, then I would like to know, where would I place the two points so the distances to customers are minimised, how would I even approach this problem?

I would eventually try and solve this using a programming language, so I am not after a purely mathematical formula, even though that would help.

2
  • Sorry, probably totally offtopic and maybe even a little out of line, but red Cs on a green background are really hard to read, even if you're not colorblind (no, I'm not colorblind). Is there a reason why you chose those colors?
    – Nzall
    Commented Nov 7, 2015 at 23:49
  • @NateKerkhofs Sorry the green seemed like a good color for land, and the red, well that was for no particular reason.
    – sprocket12
    Commented Nov 8, 2015 at 7:12

2 Answers 2

5

You should have a look at the K-means clustering algorithm, which produces what you are looking for.

0

Approximate solution. Cover area by regularly spaced points. Go through every combination of thrm by 2 ( itertools can be handy) computing total of distances to nearest of 2. Pick pair with min total.

1
  • Go through every combination by 2? Sorry I do not understand.
    – sprocket12
    Commented Nov 8, 2015 at 7:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.