I'm currently thinking about a problem I'd like to manage in one of my applications.
There is a set of objects $\{A, B, C, D, \ldots\}$. Every object has the same attributes with different values. For example, $A$'s attribute $a_1$ has the value $A(a_1)$, $B$'s attribute $a_1$ has the value $B(a_1)$ and so on.
Now I want to pass a number $x$ which represents the maximum number of objects to selected from the set. For example, $x = 2$ would mean that any combination of at most 2 objects are allowed to be selected from the set.
Given this table of attributes and the number $x$, the algorithm should return at most $x$ objects which, in summation, own the largest attributes. Only the greater one counts.
For example: $A,B,C$ with attributes $a_1,a_2,a_3$ and $x = 2$:
$\begin{array}{|c|c|c|c|} & a_1 & a_2 & a_3\\\hline A & 1 & -100 & -1\\\hline B & -2 & 2 & -200\\\hline C & -20 & -10 & 10\\\hline \end{array}$
The algorithm should return $A$ and $B$ since $A(a_1) + A(a_2) + B(a_3)$ serve the maximum when at most 2 objects from the set are allowed to be selected.
If I'd use brute-force, I simply would test all $\binom{n}{x}$ combinations and calculate the overall sum.
Is there a faster way to do this?
Thanks!