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:

  • forall i, w[i] >=0

  • c >=0

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:

  • forall i, w[i] >=0

  • forall b, c[b] >=0

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)
  1. 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 is equal to load[b].

    Assumptions:

    • forall i, w[i] >=0

  2. Returns the load of each bin resulting from packing each item i with weight w[i] into bin[i], where the load is defined as the sum of the weights of the items in each bin.

    Assumptions:

    • forall i, w[i] >=0

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 non-overlapping. Zero-width 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 k-dimensional boxes to be non-overlapping. 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 non-overlapping. Zero-width 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 k-dimensional boxes to be non-overlapping. 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 non-overlap constraint for k dimensional objects. It enforces that no two objects overlap.

Parameters:

  • k: the number of dimensions

  • rect_size: the size of each box in k dimensions

  • rect_offset: the offset of each box from the base position in k dimensions

  • shape: the set of rectangles defining the i-th shape.

  • x: the base position of each object. x[i,j] is the position of object i in. dimension j.

  • kind: the shape used by each object.

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 non-overlap 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:

  • k: the number of dimensions

  • rect_size: the size of each box in k dimensions

  • rect_offset: the offset of each box from the base position in k dimensions

  • shape: the set of rectangles defining the i-th shape.

  • x: the base position of each object. x[i,j] is the position of object i in dimension j.

  • kind: the shape used by each object.

  • l: is an array of lower bounds, l[i] is the minimum bounding box for all objects in dimension i.

  • u: is an array of upper bounds, u[i] is the maximum bounding box for all objects in dimension i.

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 non-overlap constraint for two k dimensional objects. It enforces that there is at least one dimension where the objects occupy a different space.

Parameters:

  • x1: coordinate of each dimension for the first object

  • w1: width of each dimension for the first object

  • x2: coordinate of each dimension for the second object

  • w2: width of each dimension for the second object

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 non-overlap 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:

  • k: the number of dimensions

  • rect_size: the size of each box in k dimensions

  • rect_offset: the offset of each box from the base position in k dimensions

  • shape: the set of rectangles defining the i-th shape.

  • x: the base position of each object. x[i,j] is the position of object i in dimension j.

  • kind: the shape used by each object.

  • l: is an array of lower bounds, l[i] is the minimum bounding box for all objects in dimension i.

  • u: is an array of upper bounds, u[i] is the maximum bounding box for all objects in dimension i.

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:

  • Weights w and profits p must be non-negative

  • w, p and x must have the same index sets

Parameters:

  • w: weight of each type of item

  • p: profit of each type of item

  • x: number of items of each type that are packed

  • W: sum of sizes of all items in the knapsack

  • P: sum of profits of all items in the knapsack