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

bin_packing_md(+Items, ++ItemMDSizes, +BinMDLoads)

The multi-dimensional bin packing constraint with loads: packing M L-Dimensional items into N L-Dimensional bins, each bin having a load in each dimension
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
BinMDLoads
A 2-D collection of N*L (domai) variables or non-negative integers

Description

This constraint is for multi-dimensional bin-packing, that is, to pack M L-dimensional items with individual sizes in each dimension into N L-dimensional bins, such that the sum of sizes of items in each dimension of each bin equals the load for that dimension of that bin, as specified in BinMDLoads. 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. Thus,ItemMDSizes and BinMDLoads are 2-D collections, 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 ItemMDSizes is the size of the i'th item, and the i'th element of Item is the bin this item is packed into. BinMDLoads represent the loads of each bin, i.e. the sum of the sizes of items (in each dimension) assigned to that bin, with the j'th element representing the load for bin j. An (integer finite domain) variable for the load in each dimension allows a constraint on the load to be specified, such as a minimum and/or maximum load for the bin in that dimension.

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 (as in bin_packing_md/4) and all the bin loads to be specified. This gfd version of the constraint deduces the maximum bin size from BinMDLoads.

Examples

[eclipse 2]: bin_packing_md([3,1,3], [[4,2], [3,0], [1,3]], [[L11,L12],[L21,L22],[L31,L32]]).

L11 = 3
L12 = 0
L21 = 0
L22 = 0
L31 = 5
L32 = 5

See Also

bin_packing_md / 4, bin_packing / 4, bin_packing / 3