Bin Packing with Multiple Bin Sizes
Here is a brute force approach to selecting the optimal set of bins to meet an order when there are multiple stock sizes available. Source on Github Practical Bin Packing ¶ This was motivated by a desire to buy just enough materials to get the job done. In this case the job was a chicken coop I was building. I can buy lumber in standard lengths of 12, 10, 8 or 6 feet at my local building supply store. So what is the lowest cost combination of stock boards that fills the need? In my research I found lots of examples of bin packing with a single size of bin but nothing that fit my situation and limited appetite for in depth study. This code uses a brute force approach to the problem. It enumerates all permutations, discards any that don't meet the bare minimum length then checks each remaining permutation for feasilbility. The feasible options are sorted to find the minmum cost option. In the example below, I first define the stock lengths and their rates . Then I li...