0

I am trying to figure the number ways you can pack K items into N bins where all bins have a uniform capacity of R.

For instance, lets say you have 3 items and 4 bins, where each bin has a capacity of 2.

One possible arrangement shown here

Does anyone know how to calculate this number of combinations? I am familiar with combinations with repetition but I'm not sure about the case where all bins have the same capacity R. I have seen some similar posts but couldn't find any with this problem setup.

RobPratt
  • 45,619
  • 1
    1. Are the K items identical or distinct ? 2. Are the bins numbered or indistinguishable ? – true blue anil Sep 16 '22 at 07:42
  • Assuming that the $K$ items are identical and that the bins are numbered, you are looking for the number of non-negative integer solutions to $x_1 + x_2 + \cdots + x_n = K$, where $x_1,x_2, \cdots,x_n$ are all required to be $\leq R$. Under this interpretation, the posted problem is covered by this answer, which answers a more general question. – user2661923 Sep 16 '22 at 07:47
  • The items are distinct, and the bins are numbered. This is related to a networking problem.

    In this case the K items are each a software program which has a failure probability. Each of the N bins are a server which has some failure probability. Because each entity has its own failure probability, both the items and the bins are distinct.

    – Sterling Sep 16 '22 at 22:28
  • Clarification requested. Given that the both the items and the bins are distinct, suppose that Item-1 and Item-2 both go into Bin-1. Is the case where item-1 goes first and then item-2 goes next considered distinct from the case where item-2 goes first and item-1 goes next? If so, that greatly simplifies the problem, because you can take the enumeration from my first comment and simply apply the (overall) factor of $K!$. If not, then I think that my entire approach is problematic and that (therefore) a different approach is needed. – user2661923 Sep 19 '22 at 06:32
  • Thanks for your input. No, if item-1 and item-2 both go into the same bin, then the order in which they are placed in the bin does not matter, they are not distinct. Yeah it looks like the solution in the link you posted will work. – Sterling Sep 19 '22 at 15:55

1 Answers1

0

There would need to be a listing of patterns possible, multiplied by their permutations and placement choices, e.g. for $6$ distinct items in $5$ distinct bins with a maximum of $2$ in a bin,

  • possible patterns are $22200\;22110\;21111$
  • their permutations are $\large\frac{5!}{3!2!}\, \large\frac{5!}{2!2!1!} \;and\; \large\frac{5!}{1!4!}$
  • and placements are $\large\frac{6!}{2!2!2!}\,, \large\frac{6!}{2!2!}\;and\; \large\frac{6!}{2!}$
  • Final results $10\cdot90+30\cdot180+5\cdot360$

The computations, of course, can be merged, have been shown separately for clarity.