Guillotine cutting

Guillotine cutting is the process of producing small rectangular items of fixed dimensions from a given large rectangular sheet, using only guillotine-cuts. A guillotine-cut (also called an edge-to-edge cut) is a straight bisecting line going from one edge of an existing rectangle to the opposite edge, similarly to a paper guillotine.

Guillotine cutting is particularly common in the glass industry. Glass sheets are scored along horizontal and vertical lines, and then broken along these lines to obtain smaller panels. It is also useful for cutting steel plates, cutting of wood sheets to make furniture, and cutting of cardboard into boxes.

There are various optimization problems related to guillotine cutting, such as: maximize the total area of the produced pieces, or their total value; minimize the amount of waste (unused parts) of the large sheet, or the total number of sheets. They have been studied in combinatorial geometry, operations research and industrial engineering.

A related but different problem is guillotine partition. In that problem, the dimensions of the small rectangles are not fixed in advance. The challenge comes from the fact that the original sheet might not be rectangular - it can be any rectilinear polygon. In particular, it might contain holes (representing defects in the raw material). The optimization goal is usually to minimize the number of small rectangles, or minimize the total length of the cuts.

Terminology and assumptions
The following terms and notations are often used in the literature on guillotine cutting.


 * The large rectangle, also called the stock sheet, is the raw rectangular sheet which should be cut. It is characterized by its width W0 and height H0, which are the primary inputs to the problem
 * The small rectangles, also called items, are the required outputs of the cutting. They are characterized by their width wi and height hi and for i in 1,...,m, where m is the number of rectangles. Often, it is allowed to have several rectangles of the same dimensions; in this case, the pair of dimensions (wi,hi) is often called a type.
 * A cutting-pattern, often called just pattern, is an arrangement of small rectangles on the stock sheet. It may be given as a sequence of points (xi,yi), for i in 1,...,m, where (xi,yi) is the bottom-left coordinate of rectangle i. In such a pattern, rectangle i occupies a horizontal segment (xi, xi+wi) and a vertical segment (yi, yi+hi).
 * A build refers to constructing a new rectangle by attaching two smaller rectangles. Due to the guillotine constraint, there are only two types of builds: in a horizontal build the combined rectangle has width wi+wj and height max(hi,hj); in a vertical build the combined rectangle has width max(wi,wj) and height hi+hj. Every pattern can be represented as a recursive sequence of builds. Every recursive sequence of builds corresponds to many different patterns, which have an equivalent combinatorial structure; the set of all patterns corresponding to the same recursive-build is called a guillotine-cutting class.

Some problems accept additional inputs, as explained below. The goal is to cut, from the raw rectangle, some smaller rectangles having the target dimensions. The following assumptions are often made:


 * All cuts have zero width. This does not lose much generality, since if each cut has a fixed width of d>0, then the problem can be reduced to the zero-width variant by just adding d to wi and hi for i in 0,...,m.
 * The target dimensions cannot be rotated, i.e., w-by-h is not the same type as h-by-w. This does not lose much generality, since the variant in which rectangles can be rotated, can be reduced to the non-rotatable variant by adding the rotated patterns explicitly.

Checking a given pattern
In the pattern verification problem, there is a cutting-pattern given as a sequence of points (xi,yi), for i in 1,...,m, where (xi,yi) is the bottom-left coordinate of rectangle i (there is a single rectangle of each target-dimension). The goal is to decide whether this pattern can be implemented using only guillotine cuts, and if so, find a sequence of such cuts.

An obvious necessary condition is that no two input rectangles overlap in both dimensions. Ben Messaoud, Chengbin and Espinouse present a stronger condition, which is both necessary and sufficient. The input rectangles are ordered from left to right, such that x1 ≤ ... ≤ xm. There is a permutation p on the indices such that, with this permutation, the rectangles would be ordered from bottom to top, i.e., yp(1) ≤ ... ≤ yp(m). Given four indices i1 ≤ i2 and j1 ≤ j2, the set E(i1,i2,j1,j2) contains the indices of all rectangles whose bottom-left corner is in the rectangle [xi1,xi2] X [yp(j1),yp(j2)]. A cutting pattern is a guillotine pattern if and only if, for all quadruplets of indices i1 ≤ i2 and j1 ≤ j2, at least one of the following conditions is fulfilled for E(i1,i2,j1,j2):

Condition 2 implies that the rectangles in E(i1,i2,j1,j2) can be separated by a vertical cut (going between the two disjoint horizontal intervals); condition 3 implies the rectangles in E(i1,i2,j1,j2) can be separated by a horizontal cut. All conditions together imply that, if any set of adjacent rectangles contains more than one element, then they can be separated by some guillotine cut.
 * 1) E(i1,i2,j1,j2) contains at most one element;
 * 2) The union of the horizontal segments (xi, xi+wi), over all i in E(i1,i2,j1,j2), is made up of at least two disjoint intervals;
 * 3) The union of the vertical segments (yi, yi+hi), over all i in E(i1,i2,j1,j2), is made up of at least two disjoint intervals.

This condition can be checked by the following algorithm.


 * At each iteration, divide a given pattern, containing at least two rectangles, into two disjoint sub-patterns using a guillotine cut, and recurse on each sub-pattern.
 * Stop when either all subpatterns contain one rectangle (in which case the answer is "yes") or no more guillotine cuts are possible (in which case the answer is "no").

Finding a guillotine cut for a given pattern is done as follows:

The ordering step is done once, and the merging step is done m-1 times. Therefore, the run-time of the entire algorithm is O(m2).
 * Determine the m horizontal intervals, and order them from left to right; determine the m vertical intervals, and order them from bottom to top. This takes O(m log m) time.
 * Merge overlapping horizontal intervals, and merge overlapping vertical intervals. This takes O(m) time.
 * If, after merging, there are at least two disjoint horizontal intervals, then a vertical guillotine cut is possible; if there are at least two disjoint vertical intervals, then a horizontal cut is possible; otherwise, no cut is possible.

When the algorithm returns "yes", it also produces a sequence of guillotine cuts; when it returns "no", it also produces specific subsets of rectangles that cannot be separated by guillotine cuts.

The necessary and sufficient condition can be used to present the guillotine-strip-cutting problem as a mixed integer linear program. Their model has 3n4/4 binary variables and 2n4 constraints, and is considered not practically useful.

Finding an optimal cutting-pattern
These are variants of the two-dimensional cutting stock, bin packing and rectangle packing problems, where the cuts are constrained to be guillotine cuts.


 * In the basic (unweighted) guillotine-cutting problem, the required output is a sequence of guillotine cuts producing pieces of the target dimensions, such that the total area of the produced pieces is maximized (equivalently, the waste from the raw rectangle is minimized).
 * In the weighted variant, for each target dimension i, there is also a value vi. The goal is then to maximize the total value of the produced pieces. The unweighted (waste-minimization) variant can be reduced to the weighted variant by letting the value of each target-dimension equal to its area (vi = hi * wi).
 * In the constrained variant, for each target-dimension i, there is an upper bound bi on the number of pieces that can be produced of that type.
 * In the doubly-constrained variant, for each target-dimension i there is both a lower bound ai and an upper bound bi on the number of produced pieces.
 * The binary variant is a constrained variant in which each target dimension must appear at most once (i.e., the upper bound is 1). This case is associated with a decision problem, where the goal is to decide whether it is possible to produce a single element of each target dimension using guillotine cuts.
 * In the guillotine strip cutting problem, the large rectangle has infinite height (but a fixed width), and the goal is to cut a single rectangle of each type, such that the total material used (equivalently, the total height) is minimized. It is a variant of the two-dimensional Strip packing problem.
 * In the stock minimization problem, there is an infinite number of stock sheets of the same dimensions, and the goal is to cut all required target rectangles using the smallest possible number of sheets. It is a variant of the two-dimensional bin-packing problem.
 * k-staged guillotine cutting is a restricted variant of guillotine cutting where the cutting is made in at most k stages: in the first stage, only horizontal cuts are made; in the second stage, only vertical cuts are made; and so on.
 * In the 2-staged variant, a further distinction is whether all strips resulting from the first stage are cut in the same locations (called "1-group") or on two different locations (called "2-group") or in possibly different locations (called "free").
 * 1-simple guillotine cutting is a restricted variant of guillotine-cutting in which each cut separates a single rectangle.
 * A 2-simple guillotine cutting is a 1-simple pattern such that each part is itself a 1-simple pattern. p-simple cutting patterns can be defined recursively.

Optimization algorithms
The special case in which there is only one type (i.e., all target rectangles are identical and in the same orientation) is called the guillotine pallet loading problem. Tarnowski, Terno and Scheithauer present a polynomial-time algorithm for solving it.

However, when there are two or more types, all optimization problems related to guillotine cutting are NP hard. Due to its practical importance, various exact algorithms and approximation algorithms have been devised.


 * Gilmore and Gomory presented a dynamic programming recursion for both staged and unstaged guillotine cutting. However, it was later shown that both algorithms contained errors. Beasley presented a correct dynamic programming algorithm.
 * Herz and Christofides and Whitlock presented tree-search procedures for unstaged guillotine cutting.
 * Masden and Wang presented heuristic algorithms.
 * Hiffi, M'Hallah and Saadi propose an algorithm for the doubly-constrained guillotine-cutting problem. It is a bottom-up branch and bound algorithm using best-first search.
 * Clautiaux, Jouglet and Moukrim propose an exact algorithm for the decision problem. Their algorithm uses a compact representation of guillotine-cutting-pattern classes, using a directed graph that they call the guillotine graph. Each arc in this graph is colored in one of two colors: "horizontal" or "vertical". Each monochromatic directed cycle in this graph corresponds to a build. By repeatedly contracting monochromatic cycles, one can recover a recursive build-sequence that represents a cutting-pattern class. Every guillotine-graph contains between m and 2m-2 arcs. A special kind of guillotine graphs called normal guillotine graphs have the interesting property of containing a unique Hamiltonian circuit. Sorting the vertices according to this circuit makes the graph a well-sorted normal guillotine graph; there is a one-to-one correspondence between such graphs and cutting-pattern classes. They then solve the optimization problem using constraint programming on the space of well-sorted normal guillotine graphs.
 * Russo, Boccia, Sforza and Sterle review over 90 papers dealing with unstaged constrained guillotine-cutting (with quantity upper-bounds), both weighted and unweighted. There are two main approaches for exact solutions: dynamic programming and tree-search (branch-and-bound). The tree-search approaches are further categorized as bottom-up (starting with single rectangles and using builds to construct the entire sheet) or top-down. In all approaches, it is important to find good lower and upper bounds in order to trim the search-space efficiently. These bounds often come from solutions to related variants, e.g. unconstrained, staged, and non-guillotine variants.
 * Abou Msabah, Slimane, and Ahmed Riadh Baba-Ali. "A new guillotine placement heuristic combined with an improved genetic algorithm for the orthogonal cutting-stock problem." 2011 IEEE International Conference on Industrial Engineering and Engineering Management. IEEE, 2011.
 * Abou-Msabah, Slimane, Ahmed-Riadh Baba-Ali, and Basma Sager. "A Controlled Stability Genetic Algorithm With the New BLF2G Guillotine Placement Heuristic for the Orthogonal Cutting-Stock Problem." International Journal of Cognitive Informatics and Natural Intelligence (IJCINI) 13, no. 4 (2019): 91-111.
 * Abou-Msabah, Slimane, Ahmed-Riadh Baba-Ali, and Basma Sager. "A Controlled Stability Genetic Algorithm With the New BLF2G Guillotine Placement Heuristic for the Orthogonal Cutting-Stock Problem." International Journal of Cognitive Informatics and Natural Intelligence (IJCINI) 13, no. 4 (2019): 91-111.

Implementations

 * McHale and Shah wrote a Prolog program implementing an anytime algorithm: it generates approximately-optimal solutions in a given amount of time, and then improves it if the user allows more time. The program was used by a specialty paper producer, and has cut the time required for sheet layout while reducing waste.

Guillotine separation
Guillotine separation is a related problem in which the input is a collection of n pairwise-disjoint convex objects in the plane, and the goal is to separate them using a sequence of guillotine cuts. Obviously it may not be possible to separate all of them. Jorge Urrutia Galicia asked whether it is possible to separate a constant fraction of them, that is, whether there exists a constant c such that, in any such collection of size n, there is a subset of size cn that are guillotine-separable.

Pach and Tardos  proved:

Abed, Chalermsook, Correa, Karrenbauer, Perez-Lantero, Soto and Wiese proved:
 * If all objects are of a similar size, then a constant fraction of them can be separated. Formally, if all objects contain a circle of radius r and are contained in a circle of radius R, then there is a separable set of size $$\frac{ \pi r^2}{128 R^2}n \approx \frac{1}{40.7 (R/r)^2} n $$. Proof: construct a grid with cell size 8R by 8R. Move the grid uniformly at random. Each object is intersected by a horizontal line with probability 1/4 and with a vertical line with probability 1/4 too, so the expected number of intersected objects is $$n/2 $$. Therefore, there exist grid-lines that intersect at most $$n/2 $$ objects. Since the area of each grid cell is $$(8R)^2 $$ and the area of each object is at least $$\pi r^2 $$, each cell contains at most $$\frac{(8R)^2}{\pi r^2} $$ objects. Pick a single object from each cell, and separate it from the other objects in the same cell. The total number of objects separated in this way is at least  $$\frac{n}{2} / \frac{(8R)^2}{\pi r^2} = \frac{ \pi r^2}{128 R^2}n.  $$  A similar argument for the case of unit squares gives $$\frac{1}{27}n.  $$
 * If the objects are straight line-segments, then in some instances, only at most $$O(n^{\log_3{2}}) \approx O(n^{0.63}) $$ of them can be separated. Particularly, for every positive integer k, there is a family of $$3^k $$ disjoint intervals such that at most $$2^k $$ of them can be separated.
 * In any collection of n convex objects, at least $$\Omega(n^{1/3}) $$ can be separated.
 * In any collection of n straight line segments, at least $$\Omega(n^{1/2}) $$ can be separated. They conjecture that the worst case can be attained by line segments.
 * In any collection of n axes-parallel rectangles, at least $$n / (2 \log{n}) $$ can be separated. They conjecture that $$\Omega(n)  $$ can be separated; this conjecture is still open.
 * In any collection of R-fat objects (the smallest containing disc is at most R times the largest contained disc), at least $$n / (c_R \log{n})  $$ objects can be saved, where $$c_R  $$ is a constant that depends only on R.
 * An analogous theorem is valid in higher dimensions too: the number of separable objects is $$ n / c(R,d) (\log{n})^d  $$.
 * All these separable subfamilies can be constructed in time $$O(n \log{n}) $$. If the objects are polygons with N sides overall, then the separating lines can be computed in time $$O(N + n \log{n})  $$.

Khan and Pittu proved:
 * In any collection of n axes-parallel unit squares, at least n/2 can be separated, and there are instances in which at most n/2 can be separated.
 * In any collection of n axes-parallel squares, at least n/81 can be separated.
 * In any collection of n axes-parallel squares with weights, at least 4/729 of the total weight can be separated.
 * In any collection of n axes-parallel d-dimensional cubes with weights, $$1/2^{O(d)} $$ of the total weight can be separated.
 * Regarding the conjecture that it is possible separate $$\Omega(n) $$ axes-parallel rectangle, while they do not settle it, they show that, if it is correct, then it implies an O(1) approximation algorithm to the problem of maximum disjoint set of axes-parallel rectangles in time $$O(n^5)  $$.


 * With n axes-parallel rectangles, if only $$o(\log\log n) $$ stages are allowed, then it is not possible to separate $$\Omega(n)  $$ rectangles.
 * When the rectangles are weighted, if only $$o(\log{n} / \log\log {n}) $$ stages are allowed, then it is not possible to separate $$\Omega(n)  $$ of the weight.
 * There is a simple 2-stage algorithm that separates $$n / (1+\log_2{n}) $$ rectangles. The algorithm partitions the rectangles into $$1+\log_2{n}  $$ subsets (called "levels"), and chooses the level with the largest number of rectangles. Each level can be separated by two guillotine cuts.  An improved algorithm can separate $$n / \log_3{(n+2)}  $$ rectangles.
 * In any collection of fat rectangles, $$\Omega(n) $$ can be separated.
 * In any collection of n axes-parallel squares, at least n/40 can be separated.
 * In any collection of n axes-parallel squares with weights, at least a fraction 1/80 of the total weight can be separated.

See also:


 * Geometric separator
 * Hyperplane separation theorem

More variants
Some recently-studied variants of the problem include:


 * Guillotine-cutting in three dimensions.
 * Guillotine-cutting when the raw rectangle may have defects, but the produced rectangles must be defect-free.