Say you're shopping for some ingredients which come in standard pack sizes of either 100g, 250g or 500g, having prices $0.40, $0.75 and $1.00 respectively.
Depending on the exact quantity you need, you can choose to optimise your choice of pack purchases according to price or minimum wastage, or perhaps some combination of the two.
For example if you need 350g, you could buy 1 x 500g pack for $1.00, and waste 150g, or buy 1 x 250g + 1x100g at a cost of $1.15 and have no wastage.
Given the quantity you need, how could you optimise your pack selection mathematically? (a) for minimum cost, and (b) for minimum wastage?
ie some function(quantity needed) gives the pack sizes and quantities to buy, eg:
f_mincost(350) outputs 1 x 500g
f_minwaste(350) outputs 1 x 250g, 1 x 100g
Here is a spreadsheet with some more examples: