given a set of coordinates and the following function:
cost = $\sum \sqrt{(x_i−X)^2+(y_i−Y)^2}w_i$ I would like to find the point (X, Y) for which this function is minimal.
A simple example shows that the weighted average of the coordinates does not deliver the desired output: P1:{0, 0}, P2:{3, 0}, w1=1, w2=3 would result in {2, 0}, with a cost of 4, while the optimal solution is {3, 0} with a cost of 3.
I have a good (although bit rusty) knowledge of math, but my attempt to derive this function resulted in something to complex for me. I suspect there is some kind of trick that would simplify everything, but I cannot seem to find it.