View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Harlan Grove
 
Posts: n/a
Default select numbers from a list and add to optimise result

"DT" wrote...
I have a list of lengths of material and a set available length I can
purchase I need to create a solution to pick data from the list and sum
them
together to optimise material usage can anyone help


You'd need costs too to really optimize this. E.g., if you needed 12 6'
lengths and 12' and 18' stock were available, you could buy either 6 12'
lengths or 4 18' lengths, but if the 18' lengths cost less than 1.5 times
the 12' lengths, you'd always want to buy the 18' lengths. With costs per
stock item, you'd optimize for cost by starting with the cheapest stock item
per unit of length, then move to the next cheapest, and so on.

This is a variation on the knapsack problem, so the optimal answer requires
checking all possible combinations, and the number of combinations grows
hypergeometrically with the number of different lengths. If you needed more
than 50 pieces of material at desired lengths, it could take a VERY, VERY
LONG TIME for any software to find the optimal stock lengths. Better (i.e.,
faster) to handle this sort of thing the old fashioned way and risk perhaps
paying 1-2% more than optimal in order to avoid days of calculation time (if
you don't run out of memory first).