I have stumbled upon the following problem: I have one list of containers with "capacities", and a list of items with quantities. I want to assign those items to the containers. The total capacity of all containers equals the total number of items.
Here is an example. That's the input:
Container A: 50 Container B: 50 Item 1: 30 Item 2: 30 Item 3: 40
Obviously, there are lots of possible solutions to this problem.
One would be a "first-fit" assignment (Container, Item, Amount):
(A, 1, 30), (A, 2, 20), (B, 2, 10), (B, 3, 40)
Another would be a "weighted distribution" assignment (not very exciting in this example, since A and B have the same capacity, but you get the idea):
(A, 1, 15), (B, 1, 15), (A, 2, 15), (B, 2, 15), (A, 3, 20), (B, 3, 20)
Both are (more or less) trivial to implement, and there are multiple other ways to optimize the output (optimize for minimal number of assignments, optimize for "keeping items together", etc.).
I'd like to read more about it, to compare my solution with others. Does this problem have a name, or is it "too simple"? Bin packing is similar, but not the same, since in my case I'm allowed to "split" the objects to be put in the bins.