AddNoOverlap2D for Bin-Packing in Time and Space
Model 2D non-overlap of rectangles using the AddNoOverlap2D global constraint. Apply it to 2D bin packing and to scheduling problems where tasks need both a time interval and a contiguous block of resource slots.
Tutorial
The AddNoOverlap2D Constraint
A rectangle in a constraint-programming model is a pair of intervals , where
are its projections onto the - and -axes. The rectangle covers the region in the plane.
The AddNoOverlap2D constraint requires that for every pair of distinct rectangles ,
Equivalently: two rectangles overlap in 2D iff both projections overlap in 1D.
Following the half-open scheduling convention, two 1D intervals and overlap iff
Touching endpoints (e.g. and ) do not count as an overlap.
For instance, take
- :
- :
The -projections overlap on , but the -projections are disjoint since . One projection disjoint AddNoOverlap2D is satisfied.