Find Weight for minimum Manhattan Distance

966 Views Asked by At

Let's say, I have three points $(1, 4)$, $(4, 3)$ and $(5, 2)$. I need to find weight $w_1$ and $w_2$ so that the point $(1, 4)$ be the centroid of the points in Manhattan Distance. Actually, the point $(1, 4)$ must have the minimum total distance from others.

How can I weight those X and Y coordinates to minimalize the total distance toward point $(1, 4)$?

2

There are 2 best solutions below

2
On BEST ANSWER

The OP is asking for two parameters (called the wieghts) $\lambda$ and $q$ s.t. the set

$$\mathcal S_{\lambda,q}:=\{(1,4),(4\lambda,3\lambda), (5q,2q) \} $$

has centroid given by $(1,4)$. We need to satisfy the inequalities

$$d_{MH}((1,4),(4\lambda,3\lambda))+d_{MH}((1,4),(5q,2q))\leq d_{MH}((4\lambda,3\lambda),(1,4))+d_{MH}((4\lambda,3\lambda),(5q,2q)),$$ $$d_{MH}((1,4),(4\lambda,3\lambda))+d_{MH}((1,4),(5q,2q))\leq d_{MH}((5q,2,q),(1,4)) +d_{MH}((5q,2q),(4\lambda,3\lambda)),$$

where $d_{MH}(\cdot,\cdot)$ denotes the Manhattan distance. The above inequalities simplify to

$$d_{MH}((1,4),(5q,2q))\leq d_{MH}((4\lambda,3\lambda),(5q,2q)),$$ $$d_{MH}((1,4),(4\lambda,3\lambda))\leq d_{MH}((5q,2q),(4\lambda,3\lambda)),$$

which are equivalent to

$$|5q-1|+|4-2q|\leq|4\lambda-5q|+|3\lambda-2q|, $$ $$|1-4\lambda|+|4-3\lambda|\leq|5q-4\lambda|+|2q-3\lambda|.$$

One can study the locus of points $(\lambda,q)$ satisfying the above inequalities, or directly search for a solution. I found, for example,

$$(\lambda,q)=(\frac{1}{2},2). $$

2
On

Rescale $x$-coordinates with $(2/9)$ and $y$-coordinates with $(8/5)$, giving: $$ \left(\frac{2}{9}\times 4,\frac{8}{5} \times 3 \right) = \left( \frac{8}{9} , \frac{24}{5} \right) \qquad ; \qquad \left(\frac{2}{9}\times 5,\frac{8}{5} \times 2 \right) = \left( \frac{10}{9} , \frac{16}{5} \right) $$ Centroid = $(9/9,20/5)$ .