[ library(ic_global) | Reference Manual | Alphabetic Index ]
bin_packing(+Items, ++ItemSizes, +N, +BinSize)
The one-dimensional bin packing constraint: packing M items into N bins
- Items
- A collection of M variables or integers (domain/value between 1 and N)
- ItemSizes
- A collection of M non-negative integers
- N
- A positive Integer
- BinSize
- A non-negative integer
Description
This constraint is for one-dimensional bin-packing, that is, to pack M
items with individual sizes into N bins, such that the sum of sizes of
items in each bin does not exceed BinSize. Each element of Items and its
corresponding element in ItemSizes represents an item, such that the i'th
element of ItemSizes is the size of the i'th item, and the i'th element in
Items is the bin this item is packed into.
This constraint can be seen as a special case of the cumulative/4
constraint, where all task durations are equal to 1, each bin
represents a time point, and BinSize corresponds to the Resource.
This is currently a prototype -- the constraint has not been tested
very extensively and little effort has been spent to optimise performance.
We welcome any feedback on using this constraint.
This constraint and the algorithm used to implement it is described in
P. Shaw, 'A Constraint for Bin Packing', CP'2004, with a fixed size for
the bins. It is also described in the global constraint catalog as
bin_packing, but with slightly different arguments: in the catalog, N
(the number of bins) is implicitly defined by the domain of the variables
in Items, and the representation of item is grouped into a single argument
of collection of pairs, each pair representing an item: the bin to pack
the item, and its size.
See Also
bin_packing / 3, cumulative : cumulative / 4, edge_finder : cumulative / 4, edge_finder3 : cumulative / 4, gfd : cumulative / 4, ic_cumulative : cumulative / 4, ic_edge_finder : cumulative / 4, ic_edge_finder3 : cumulative / 4