compare all possible set combinations -
10-13-2003
, 01:11 PM
I have been asked to find a solution to this problem:
Given a number of entities in a table as follows:
ID | $Amount | Percent | Category
1 500 67 4
2 250 33 2
3 456 55 3
....
possibly with several hundred records...
Categories are assigned to a range of percents, e.g. 4 to
percents 65-100.
Question: If any number of sets can be formed containing
any number of members, is it possible to test all
combinations to see that the maximum $Amount is included
in the highest possible category based on the AVG percent
of the set members. The $Amount does not carry weight in
the calculation, so that a low percent that drags down the
average for a set might be worth the 'cost' due to a high
$Amount.
Ideas? Approaches? Solutions?
Thanks. |