finding a matched subset, that meets meets a condition

103 Views Asked by At

Given a finite set $A$ of random $n$-dimensional vectors and a $n$-dimensional vector $\vec v$, how do I find a subset $B \subset A$ whose vectors average deviate least from $\vec v$.

$$B = \left\{ \vec d_1, \vec d_2 \cdots \vec d_n \right\}, \vec d_a = \begin{pmatrix} e_{a1} \\ e_{a2} \\ \cdots \\ e_{am} \end{pmatrix}$$

so that

$$ \lvert \sum_{a=1}^n \frac{d_a}{n} - \vec v \rvert $$

is minimal.

1

There are 1 best solutions below

0
On BEST ANSWER

Because of the fact that each vector has to appear with a weight either 0 or $\frac 1 n$, this makes it hard. Even in dimension 1, this problem is NP-hard : see https://en.wikipedia.org/wiki/Subset_sum_problem.

Of course, if instead of searching for an isobarycenter, you can take any barycentric combination of the vectors (for example $\frac 1 3 \vec d_1 + \frac 1 6 \vec d_2 + \frac 1 2 \vec d_3$), then this just becomes geometry, and solving this becomes an easy problem (though not always fun to code).