For the next problem, I wonder if an already known algorithm exists, since I don't want to reinvent the wheel.
In this case, this applies to hotel rooms, but I think it does not matter:
name | max guests | min guests 1p | 1 | 1 2p | 2 | 2 3p | 3 | 2 4p | 4 | 3
I am trying to distribute a certain number of guests according to the available rooms, but the distribution should satisfy the criteria of "minimum guests" in the rooms. In addition, the rooms must be used as efficiently as possible.
Let them take, for example, 7 guests. I would not want this combination:
3 x 3p ( 1 x 3 guests, 2 x 2 guests )
.. this will meet the minimum criteria, but will be ineffective. Rather, I am looking for combinations such as:
1 x 3p and 1 x 4p 3 x 2p and 1 x 1p etc...
I would think this is a familiar problem. Is there any known algorithm to solve this problem?
To clarify:
Effectively, I mean distributing the guests in such a way that the rooms are filled as much as possible (the preferences of the guests here are secondary and not important for the algorithm I'm looking for).
I do want all permutations that satisfy these performance criteria. So in the above example, 7 x 1p would also be fine.
So, in the summary:
Is there a well-known algorithm that can efficiently distribute elements among slots with a capacity of min and max that always satisfy the criteria of min and try to satisfy max as much as possible.