I'd start by sorting the list by distance from ideal ratio
sqrt( (carbs-60)^2 + (protein-20)^2 + (fats-20)^2 )
... no I wouldn't. How about this:
Step 1: I'd start by sorting the list by weight and add 1 unit of lowest weight product to my bag.
Step 2: Then I'd look at the ratio of all the products in the bag and add 1 unit of the lowest weight that steers the ratio in the right direction.
Repeat step 2 until the bag is full. With or without replacement, according to taste.
Interesting problem. You should consult a nutritionist before starting this diet!
Craige