Err.. welcome to the realm of NP hard problems!
Without going into pages about complexity theory and dynamic programming, let's just say if you find an *exact* (exact being the key there) quick way to do it then you're heading on the way to be famous and write a huge amount of mathematical papers on the subject!
There are some approaches you can take though that solve it exactly sometimes and solve it close most other times - they usually fall into the realm of dynamic programming though.
If you want to do further research it's the knapsack problem you're looking at (Knapsack problem - Wikipedia, the free encyclopedia
), so that might help you if you want to Google around some more!