2423, 7: 39.8
IN PYTHON:
given the data set where the key: value pair is key = item id and value = volume
articles = {0: 54.9763980770002, 1: 45.0029239348998, 2: 61.3426025372739, 3: 80.0, 4: 77.6012305922644, 5: 78.2923783726743, 6: 23.3518777532423, 7: 39.8208126512123, 8: 68.94959337016, 9: 10.4524154059541, 10: 60.4772617438057, 11: 10.0, 12: 79.4241251161082, 13: 50.5316063003593, 14: 10.0, 15: 44.5526777152254, 16: 72.8685047807319, 17: 10.0, 18: 10.0, 19: 46.3487596059364, 20: 10.0, 21: 73.0560543111617}
bin_cap = 100 (each bin has the same cap)
write a function
def binpack(articles,bin_cap):
bin_contents= []
that returns bin_contents: A list of lists, where each sub-list indicates the dictionary keys for the items assigned to each bin. Each sublist contains the item id numbers (integers) for the items contained in that bin. The integers refer to keys in the items dictionary.

Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images









