[ library(gfd) | Reference Manual | Alphabetic Index ]

bin_packing_md(+Items, ++ItemMDSizes, +N, +BinMDSize)

The multi-dimensional bin packing constraint: packing M L-dimensional items into N L-dimensional bins of size BinMDSize.
Items
A collection of M (domain) variables or integers (domain/value between 1 and N)
ItemMDSizes
A 2-D collection of M*L non-negative integers
N
A positive Integer
BinMDSize
A collection of L non-negative integer

Description

This constraint is for multi-dimensional bin-packing, that is, to pack M L-dimensional items with individual sizes into N L-dimensional bins, such that the sum of sizes of items in each bin does not exceed BinMDSize in any dimension. The constraint is logically equivalent to posting L 1-dimensional bin_packing constraints, one for each dimension, with the additional constraint that the items are placed in the same bin for all the constraints. Items and Bins are L-dimensional, i.e. each Item/Bin has a size/load in each dimension, and in this version of the constraint, all the Bins have the same size, as specified by BinMDSize. Thus,ItemMDSizes is a 2-D collection, i.e. a 2-D matrix or a list of lists, such that each element is itself a collection of L sub-elements.

Each element of Items and its corresponding element in ItemMDSizes 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.

Note that the Gecode implementation of this constraint has index starting from 0, i.e. the numbering for the bins starts from 0. These native indices are mapped to the ECLiPSe indices starting from 1 with an additional dummy zero'th bin that is assigned a dummy item 0.

This constraint is implemented using Gecode's multi-dimensional variant of binpacking() constraint, which requires both the maximum bin size and all the bin loads (as in bin_packing_md/3) to be specified. This gfd version of the constraint constructs the bin loads from BinMDSize.

Examples

[eclipse 4]: bin_packing_md([3,1,3], [[4,1],[3,2],[1,1]], 3, [5,4]).  % Succeed

[eclipse 5]: bin_packing_md([3,3,3], [[4,1],[3,2],[1,1]], 3, [5,4]).  % Fails

See Also

bin_packing_md / 3, bin_packing / 3, bin_packing / 4