18.4. Bin Packing Problems
There is a set of math problems called bin packing problems that relate to the real world. Imagine that you have a bunch of items that you have to put into a box to ship. Each item has a size or shipping weight expressed as an integer and the box has a capacity expressed by another integer in the same units.
I take the box and start filling it. My goal is either to fill the box to capacity or to get as many single items as I can in the box (perhaps without filling it all the way). A more complex version also assigns value and item weight to each item; a very lightweight box can have a great value—a few grams of diamonds are worth more than a ton of sand. Another version has more than one box; another can have restrictions ...
Get Joe Celko's Thinking in Sets: Auxiliary, Temporal, and Virtual Tables in SQL now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.