Problem description The binpacking problem consists of the task to distribute a given set of items with nonnegative size to a minimal number of bins, all of the same capacity . As example consider 9 items with sizes: 2, 1, 2, 1, 1, 2, 3, 2, and 1 and a bin capacity of of 4. The following pictures show a feasible solution which needs 5 bins. The minimum number of bins needed for that example is 3. This problem can be formulated as a set covering problem as discussed by Gilmore and Gomory in the following two classical papers:
We introduce a binary variable for each feasible packing . A packing is an assignment vector which states the items belonging to that packing. It is feasible, if and only if the total size of the items contained in this assignment is not greater than the given capacity . Let be the set of all feasible packing, this measns:
An integer program can be formulated as follows:
This means we are searching for a set of packings such that each item is contained in at least one of the selected packings. Since the objective is to minimize the number of used packings, each optimal solution to the above problem can be transformed into a solution where each item is packed exactly once with the same cost. Since can be of exponential size, we are using a column generation approach to solve this problem. We initialize the (master) problem with a set of variables representing packings of a single item per bin. Now, we have to iteratively search for variables representing "better" packings, i.e., a packing pattern which reduces the overall cost. For a given solution of the (restricted) dual linear program, we have to find a variable/packing for which the reduced costs is negative. This means:
Since all variables have an objective coefficient the above condition is equivalent to
To find such a variable/packing we solve the following integer program:
where for are binary variables and given by the dual solution of the restricted master problem. The above problem is a knapsack problem which can be solved via dynamic programming or by solving the above integer program. In this example we implemented a pricer which solves the integer program. |