3

I am developing a system which performs automated room allotment. We have finite number of rooms, each with varying capacity. Each booking request is also of varying size. The goal here is to minimize number of rooms used and minimize room capacity wasted. The only reason why we want to minimize number of rooms used is to prevent booking requests being split into too many rooms. For example, Allocating (d,e) is better than allocating (a,b,c,d). The primary goal is to minimize wasted capacity.

I hope the following example will help you to understand the above narrative. Let say we have 6 rooms with the following capacities:

a b c d e f
1 2 3 4 6 14

avg. room capacity = 5

Let say we have two booking requests with following group sizes (# of people): 7, 10

r1 r2
7 10

Assuming processing booking requests in the descending order of their size may lead to optimal solution, we start with r2 (size 10).

Option 1:

We can see that we could use rooms (a,b,c,d) or (d,e) or just (f). With (a,b,c,d) option we use 4 rooms with 0 wasted capacity. With (d,e) option we use 2 rooms with 0 wasted capacity. Hence (d,e) is better than (a,b,c,d). If we go with (d,e), the only option for r2 is room f, in which case we would have used 3 rooms with wasted room capacity of 7.

Option 2:

Now if we go with just room f, we use 1 room with 4 (14-10) wasted capacity. However, r2 can be fulfilled with either (c,d) or (a,e) with 0 wasted capacity. Total 3 rooms used and wasted room capacity is 4.

Option 2 is better.

Tie breaker (not claiming it is correct or logical) Let say we arrive at multiple solutions. For example, if we have to decide between 2 room 7 wasted capacity and 3 rooms 4 wasted capacity, then we can take avg room capacity (in this case 5) as 1 room equivalent. 3 rooms 4 wasted capacity can be considered equivalent to 2 rooms 9 (4 + 5) wasted capacity. So 2 room 7 wasted capacity is better. We can also tweak this room equivalent parameter (c). Default it to avg. room capacity. If we want to go ahead with minimum wasted capacity only, we can set c to 0. With c = 0, 3 rooms 4 wasted capacity option would be better.

This narrative and examples show the problem at hand and also the attempts I have made to solve them.

Objective Function The "goodness" of the allocation may be measured by the following expression: (r*c)+u, where r is total number of rooms used, c is a constant (c>=0) and u = unutilized or wasted capacity. The less the better. The optimum allocation can be determined by the least value of the goodness factor. The constant c may be 0 if we only want to optimize for capacity regardless of number of rooms used.

Update I initially wrote that "Assume bookings cannot share rooms." But we need to solve this for shared rooms scenarios as well. We can use unoccupied capacity for allocation. For example, room f (14 capacity) will have unused capacity of 4 after allocating r2. This should be considered while allocating r1. Updated table will look like this:

a b c d e f (updated)
1 2 3 4 6 4

I need your help to answer the following:

  1. Is there any well known algorithm to solve this problem. Knapsack and Bin packing come close but don't fit the problem completely.
  2. If not, how to efficiently allocate rooms? Please provide algorithm with time complexity analysis.
Ravi M Patel
  • 131
  • 3

1 Answers1

3

One plausible approach is to use integer linear programming. Introduce 0-or-1 variables $x_{q,r}$, where $x_{q,r}=1$ means that room $r$ is assigned to request $q$. Then you can write down linear inequalities that characterize the properties of a valid solution: e.g., $\sum_r \text{capacity}(r) x_{q,r} \ge \text{size}(q)$ for all $q$, $\sum_q x_{q,r} \le 1$ for all $r$, etc. Then you are trying to minimize $$\sum_{q,r} x_{q,r} + \sum_q (\sum_r \text{capacity}(r) x_{q,r} - \text{size}(q)).$$ This can be solved with an off-the-shelf ILP solver.

D.W.
  • 167,959
  • 22
  • 232
  • 500