Exclude worst value from weighted arithmetic mean

63 Views Asked by At

I'm working on a tournament rating, that is calculated as a weighted arithmetic mean, i.e. the formula is: $$ R = \frac{a_1 x_1+a_2 x_2+\cdots+a_n x_n}{a_1+a_2+\cdots+a_n} $$ $a_i$ is a positive tournament weight.
$x_i$ is a non-negative tournament score.

The formula has one particularity, though: one or a few worst results (let's say 10% of them) are excluded from it. In other words, I need to find which values to exclude (i.e. set $a_i=0$) to maximize the $R$ value.

How can I find which values to exclude without brute-force search?