principleMinor
Allocating m rooms of varying capacity to n booking requests of varying sizes
Viewed 0 times
bookingvaryingcapacityroomssizesrequestsallocating
Problem
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 capac
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 capac
Solution
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.
$$\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.
Context
StackExchange Computer Science Q#151634, answer score: 3
Revisions (0)
No revisions yet.