4.2.2.9. Packing constraints
In this section: bin_packing, bin_packing_capa, bin_packing_load, diffn, diffn_k, diffn_nonstrict, diffn_nonstrict_k, geost, geost_bb, geost_nonoverlap_k, geost_smallest_bb, knapsack.
bin_packing
predicate bin_packing(int: c,
array [int] of var int: bin,
array [int] of int: w)

Requires that each item i with weight w[i], be put into bin[i] such that the sum of the weights of the items in each bin does not exceed the capacity c. Assumptions:

bin_packing_capa
predicate bin_packing_capa(array [int] of int: c,
array [int] of var int: bin,
array [int] of int: w)

Requires that each item i with weight w[i], be put into bin[i] such that the sum of the weights of the items in each bin b does not exceed the capacity c[b]. Assumptions:

bin_packing_load
1. predicate bin_packing_load(array [int] of var int: load,
array [int] of var int: bin,
array [int] of int: w)
2. function array [int] of var int: bin_packing_load(array [int] of var int: bin,
array [int] of int: w)


diffn
predicate diffn(array [int] of var int: x,
array [int] of var int: y,
array [int] of var int: dx,
array [int] of var int: dy)

Constrains rectangles i, given by their origins (x[i], y[i]) and sizes (dx[i], dy[i]), to be nonoverlapping. Zerowidth rectangles can still not overlap with any other rectangle. 
diffn_k
predicate diffn_k(array [int,int] of var int: box_posn,
array [int,int] of var int: box_size)

Constrains kdimensional boxes to be nonoverlapping. For each box i and dimension j, box_posn[i, j] is the base position of the box in dimension j, and box_size[i, j] is the size in that dimension. Boxes whose size is 0 in any dimension still cannot overlap with any other box. 
diffn_nonstrict
predicate diffn_nonstrict(array [int] of var int: x,
array [int] of var int: y,
array [int] of var int: dx,
array [int] of var int: dy)

Constrains rectangles i, given by their origins (x[i], y[i]) and sizes (dx[i], dy[i]), to be nonoverlapping. Zerowidth rectangles can be packed anywhere. 
diffn_nonstrict_k
predicate diffn_nonstrict_k(array [int,int] of var int: box_posn,
array [int,int] of var int: box_size)

Constrains kdimensional boxes to be nonoverlapping. For each box i and dimension j, box_posn[i, j] is the base position of the box in dimension j, and box_size[i, j] is the size in that dimension. Boxes whose size is 0 in at least one dimension can be packed anywhere. 
geost
predicate geost(int: k,
array [int,int] of int: rect_size,
array [int,int] of int: rect_offset,
array [int] of set of int: shape,
array [int,int] of var int: x,
array [int] of var int: kind)

A global nonoverlap constraint for k dimensional objects. It enforces that no two objects overlap. Parameters:

geost_bb
predicate geost_bb(int: k,
array [int,int] of int: rect_size,
array [int,int] of int: rect_offset,
array [int] of set of int: shape,
array [int,int] of var int: x,
array [int] of var int: kind,
array [int] of var int: l,
array [int] of var int: u)

A global nonoverlap constraint for k dimensional objects. It enforces that no two objects overlap, and that all objects fit within a global k dimensional bounding box. Parameters:

geost_nonoverlap_k
predicate geost_nonoverlap_k(array [int] of var int: x1,
array [int] of int: w1,
array [int] of var int: x2,
array [int] of int: w2)

A nonoverlap constraint for two k dimensional objects. It enforces that there is at least one dimension where the objects occupy a different space. Parameters:

geost_smallest_bb
predicate geost_smallest_bb(int: k,
array [int,int] of int: rect_size,
array [int,int] of int: rect_offset,
array [int] of set of int: shape,
array [int,int] of var int: x,
array [int] of var int: kind,
array [int] of var int: l,
array [int] of var int: u)

A global nonoverlap constraint for k dimensional objects. It enforces that no two objects overlap, and that all objects fit within a global k dimensional bounding box. In addition, it enforces that the bounding box is the smallest one containing all objects, i.e., each of the 2k boundaries is touched by at least by one object. Parameters:

knapsack
predicate knapsack(array [$$I] of int: w,
array [$$I] of int: p,
array [$$I] of var int: x,
var int: W,
var int: P)

Requires that items are packed in a knapsack with certain weight and profit restrictions. Assumptions:
Parameters:
