Allocating items to a table
Posted on 2011-04-22
I need to allocate a fixed number of items to be placed on a variable number of tables. The number of tables is to be determined by the number of items, with these caveats:
1) There will always be at least 3 items. If there are fewer than 3 items, we cannot proceed
2) There can be no more than 6 items on any one table.
3) We wish to balance the number of items on a table. For example:
7 Items = 4 on one table, 3 on another
8 items = 4 on each table
9 items = 5 on one table, 4 on another
10 items = 5 on each
11 items = 6 on one table, 5 on another
12 items 6 on each table
And the issue would start back over at 13 only this time with 3 tables. We'd want something like 4 + 4 + 5.
Any suggestions on an algorithm, or coding for this? I can hard code it, and just build a matrix that supplies those values, but wondered if anyone had ideas on doing this a little differently.