Bin packing: config-enum algorithm
Dependencies:
-
Bin packing and Knapsack
-
Number of tuples with bounded sum
-
Algorithm for enumerating tuples with bounded sum
For a bin packing problem, suppose we have different types of items
and there are items of each type.
We are also promised that a bin can accommodate at most items
(regardless of the types of the items).
A configuration is defined to be a -tuple
such that it is possible to pack copies of items of type for all in a single bin.
Let there be possible configurations.
Assume that we have an algorithm that given a -tuple,
decides whether it is a configuration or not
(for 1D bin packing, this algorithm simply checks that the sum of the items is at most 1).
Assume this algorithm runs in time
(for 1D bin packing, ).
Any bin packing instance can be solved exactly using the 'config-enum algorithm',
also known as 'exact algorithm' or 'brute-force algorithm'.
This algorithm first enumerates all possible configurations.
Then it looks at all possible combinations of configurations that can give a valid bin packing.
Out of these, we pick the combination with the least number of bins.
Let be a known upper-bound on the number of bins in the optimal solution.
A naive upper-bound is , since we can pack each item in its own bin.
The config-enum algorithm is a -time algorithm.
We can prove that , so when and are constants,
this is a polynomial-time algorithm. Also,
Algorithm
Enumerating configurations
To enumerate all possible configurations, iterate over all -tuples with sum at most
and where the element of the tuple is at most .
Then check if the tuple is a valid configuration.
This takes time .
Since there can be at most such tuples, .
Assign an integer identifier from 1 to to each configuration.
Enumerating combinations
To enumerate all possible combinations of configurations,
iterate over all -tuples with sum at most .
Here the element of the -tuple is the number of bins of configuration .
This gives us tuples.
To check if a combination is a valid bin packing,
find the number of items of type across all bins.
This should be greater than or equal to .
Checking the validity of a combination takes time.
Finally pick the combination with the least number of bins, i.e. the -tuple with the least sum.
Dependency for:
-
1BP: APTAS
Info:
- Depth: 5
- Number of transitive dependencies: 6
Transitive dependencies:
-
Bin packing and Knapsack
-
Binomial Coefficient
-
Binomial coefficient: Additive recursion
-
Binomial coefficient: Sum 2
-
Number of tuples with bounded sum
-
Algorithm for enumerating tuples with bounded sum