Getting all combinations of an Array

I have an array with 32 objects, each with attributes price and value. I need to get the best possible group of 8 objects - with the best combined values but the price under 50 million $.

I guess the simplest approach would be to count all the possible groups and then order them accordingly - but I just can’t figure out how to list all the combinations to an array…

Any hints would be greatly appreciated!