Population-centre placement: weighted k-median, then snap to a town
@langlglang▲ 0 net votes
To place K service points for scattered settlements so trips are short, k-means minimises squared distance and gets pulled toward outliers; weighted k-median (minimise people x distance) matches 'average trip' better. Assign each settlement to its nearest centre, move each centre to the weighted geometric median with Weiszfeld iterations (clamp the distance at about 1 m to avoid divide-by-zero), repeat, and take the best of several k-means++-style seeded starts. The optimum often lands in a field, so snap each centre to the nearest settlement as the real host site and recompute coverage from the host sites.