Consecutive ones matrices for multi-dimensional orthogonal packing problems (cid:63)

The multi-dimensional orthogonal packing problem (OPP) is a well studied decisional problem. Given a set of items with rectangular shapes, the problem is to decide whether there is a non-overlapping packing of these items in a rectangular bin. The rotation of items is not allowed. A powerful caracterization of packing conﬁgurations by means of interval graphs was recently introduced. In this paper, we propose a new algorithm using consecutive ones matrices as data structure. This new algorithm is then used to solve the two-dimensional orthogonal knapsack problem. Computational results are reported, which show its effectiveness.

) if there is a tuple of coordinates (x 1 i , . . . , x D i ) ∈ IR + D for every item i ∈ I such that: ∀i ∈ I , ∀d ∈ {1, . . . , D} : We denote by feasible packing, a set of tuple of coordinates of a feasible set of items satisfying the constraints (1) and (2). A feasible packing verifies touching assumption if every item is immediately to the "right" of an other item or touches the "left border" (w.r.t. every dimension): x d i ∈ {0} ∪ x d j + w d j : j ∈ I \ {i} , ∀i ∈ I , d ∈ {1, . . . , D}.
Lemma 1 For every feasible set of items I , there is an associated feasible packing which verifies touching assumption.
Proof Let (x 1 i , . . . , x D i ) i∈I ∈ IR + D be a feasible packing associated to the set of items I , which does not satisfy touching assumption. There is an item i ∈ I and d ∈ {1, . . . , D} such that:  (1) is valid for these new coordinates. It remains to check property (2). ∀i ∈ I (i = i), we have to prove that there is d ∈ {1, . . . , D} such that . ,x D i ) i∈I is a feasible packing associated to I with one item less not satisfying touching assumption than (x 1 i , . . . , x D i ) i∈I . By iterating, we build this way a feasible packing associated to I satisfying touching assumption.
Let G = (V, E) be a simple undirected graph. A stable set of G is a subset of V such that every pair of vertices are not adjacent. For every vertex i ∈ V , let w i ∈ IR be its weight. The weighted stability number α(G, w) of G is the maximal sum of weights of a stable set. Given a finite multi-set of intervals of IR, an interval graph G = (V, E) is an undirected graph such that each interval corresponds to a vertex of the graph, and two vertices are adjacent if and only if the corresponding intervals overlap.
Following Fekete and Schepers [18,19], a packing class is a collection of D graphs G 1 , . . . , G D with (shared) vertex set I and edge sets E(G d ) such that: Figure 2, for an illustration of the relationship between a feasible packing and a packing class.
Packing in a container  Therefore to check whether a set of items is feasible, the algorithm of Fekete and Schepers enumerates all packing classes associated to I . However, in some cases, there are distinct packings of a feasible set of items whose associated packing classes are different (see Figure 3). Hence there are still symmetry issues in this model. Furthermore Ferreira and Oliveira [20] noticed that some so-called degenerated packing classes are unnecessarily enumerated by Fekete and Schepers' algorithm. Let G be a graph with n vertices (V = {1, . . . , n}) and m maximal cliques Q 1 , . . . , Q m . A matrix M ∈ M n,m (IB) is a vertex/clique matrix of G if for every 1 ≤ i ≤ n and 1 ≤ k ≤ m, the vertex i belongs to the maximal clique Q k if and only if M ik = 1 (see Example 3), that is each column is the characteristic vector of a maximal clique.
We are now ready to state Fulkerson and Gross' characterization of interval graphs: Theorem 2 (Fulkerson and Gross (1965)) A graph G is an interval graph if and only if there is a vertex/clique matrix of G which has the consecutive ones property.
Example 3 Let G be the interval graph with the interval graph representation as depicted on the left part of the figure below. Then the matrix as defined on the right part is a vertex/clique matrix of G, which has the consecutive ones property.
-For every pair i, j ∈ I (i = j), there is a dimension d ∈ {1, . . . , D} such that: Figure 4 gives an illustration of a strip decomposition and of cliques widths. We have the following basic Lemma, which is useful for some proofs: Proof For every i ∈ I and d ∈ {1, . . . , D}, let l ∈ {1, . . . , m d } such that i ∈ Q d l and i ∈ Q d l+1 .
We have λ d l = max We now formally establish the link between feasible packings and strip decompositions (see Figure 4 again for an example). Vertices/Cliques matrix

Packing in a container
Cliques width Maximal cliques: Proof By Lemma 1, there is an associated feasible packing ( Since the feasible packing verifies touching assumption, for every Obviously, for every d ∈ {1, . . . , D}, there is a surjective function σ d : -M d has the consecutive ones property. In fact, ∀i ∈ I , let k, l ∈ {1, . . . , . Since the feasible packing verifies touching assumption, let i (resp. i ) ∈ I be an item such that As, the feasible packing verifies touching assumption, we have Let us show by induction that So, ∀d ∈ {1, . . . , D}: We now prove the converse: Lemma 6 If we have a strip decomposition associated to I then there is a feasible packing for I with touching assumption.
. . , D}, ∀i ∈ I . We have to verify that the set of coordinates x d i defines a feasible packing.

The algorithm to check feasibility
Due to Lemmas 5 and 6, to check feasibility, we only have to design an algorithm which returns whether there is a strip decomposition associated to the set of items I . We proceed dimension by dimension, by enumerating all consecutive ones matrices which satisfy the strip decomposition constraints (5), (6), (7) and (8).
The core of the recursion to enumerate consecutive ones matrices is described in Algorithm 1. Notice that the number of columns of a matrix of a strip decomposition is at most n (the number of items), but we do not known it when we are looking for a strip decomposition. Therefore our algorithm enumerates square n × n-matrices, such that there is an index m implying all columns with index at most m are maximal, and the remaining ones are 0 columns.
By applying algorithm 1, we consider at this stage only one dimension, and this is a main point of our approach: almost all the work is done in first dimension.
To ensure that constraint (8), is satisfied, we proceed like this: for every dimension d ∈ {1, . . . , D − 1}, let S d denote the set of all matrices output by Algorithm 1 w.r.t. dimension d. Then for the last dimension d = D, for every (D − 1)tuple of matrices (M 1 , . . . , M D−1 ) ∈ S 1 × . . . × S D−1 , we look for a consecutive ones matrix by using Algorithm 1, such that constraint (8) is satisfied. If any, we have a strip decomposition, and the set of items is feasible. If we fail to find out such a tuple of matrices, the set of items is not feasible.

Early detection of unfeasibility
Let I be a feasible set of items. In this subsection, we exhibit additional constraints which are valid for all strip decompositions associated to I . These constraints are used in the algorithm to reduce the enumeration tree of strip decompositions.
Available width for items which are not packed yet Assume that the first k columns in Algorithm 1 are set. Every item which has only 0 entries in these columns has to be packed in the remaining columns. Therefore, the following constraint is a valid constraint (see Figure 5).
Proof Indeed, ∀d ∈ {1, . . . , D} and k ∈ {1, . . . , m d }, max "Height" of the column In the bi-dimensional case, a maximal clique Q w.r.t. one dimension induces a stable set in the other dimension. Therefore, for every column Q, the sum of weights of the items of Q (the "height" of Q) can not exceed the size of the container in the other dimension. In D dimensions, we have this valid following constraint: Require: (int) n, (bool[n][n]) mat Ensure: print all n × n matrices with consecutive ones property, satisfying strip decompositions constraints (5), (6), and (7), and no 0 row recurse(int row, int column) 1: if column > n + 1 then 2: return 3: end if 4: if row > n + 1 then 5: if ((every column of index at most column is maximal) and (constraints (6) and (7) are satisfied)) then 6: if number of non empty rows = n then 7: print matrix mat 8: Let P, Q and, for every i ∈ I , P i be the multivariate polynomials of IR[X z∈Z ] defined by: and denote by P(λ ) (resp. Q(λ ), P i (λ )) the corresponding value of P (resp. Q, P i for every i ∈ I ). By definition, ∀i, j ∈ I (i = j), ∃d ∈ {1, . . . , D} such that ∀l ∈ {1, . . . , m d }, i ∈ Q d l or j ∈ Q d l . Hence, for every pair of distinct elements i, j ∈ Q d k , we have Z i ∩ Z j = / 0. Hence, the polynomial P is an homogeneous polynomial of degree D − 1 such that all non-zero coefficients are equal to 1. Available volume for items which are not packed yet Assume that the first k columns in Algorithm 1 are set. The sum of all items volume which have only 0 entries in these columns has to be packed in the remaining volume. Therefore, the following constraint is a valid constraint (see Figure 6).
Due to the valid inequality (10), we get Therefore, the inequality (11) is a valid inequality.
Remaining items Notice that the first matrix printed by Algorithm 1 is the biggest matrix satisfying strip decomposition constraints without 0 rows, with respect to the lexicographic order (as defined in Section 1). Hence, if during the recursion, we are able to detect that the packing is feasible, then a solution with biggest lexicographic order should have been already found, in which case we can safely stop it and return that the packing is infeasible.
Let us see a small example: assume that in the enumerating process, we are in step 1 below (the star (resp. −) denotes current position (resp. unset positions)) Then step 2 must have been visited before by the recursion, hence a feasible solution, if any, should have been found before: in this case, there are no feasible solutions.
By detecting such configurations, this is how we handle symmetry issues. This contributed mainly to our algorithm's efficiency. This subsection is devoted to such breaking symmetries procedures.
Such symmetry issues arise naturally when two items are identical (they have same widths w.r.t. all dimensions), since the corresponding rows may be swapped safely. These symmetry issues are easily dealt with.
Let M ∈ M n,m (IB) be a 0/1 matrix. For every 1 ≤ p ≤ m and 1 ≤ q ≤ m − p, we denote by SM p,q (M) the submatrix M of M made of the columns numbered from p to p + q − 1, that is for every 1 ≤ i ≤ n and 1 ≤ j ≤ q, M i, j = M i, j+p−1 .
A submatrix SM p,q (M) is a block of M if for every i, j such that M i, j = 1 and p ≤ j ≤ p + q − 1, we have M i,1 = M i,2 = . . . , M i,p−1 = 0 and M i,p+q = M i,p+q+1 = . . . = M i,m = 0. We denote by B p,q (M) a submatrix SM p,q (M) of M which is a block of M (see Figure 7). Roughly speaking with respect to strip decompositions, every item which belongs to a clique of a block can not belong to the cliques outside of the block.
It is straightforward to check that Hence, due to Lemma 10, we stop the main recursion when there are two blocks which are not in decreasing lexicographic order (right case in Figure 8).
Notice that given a block, it is possible to permute the columns such that the first column is bigger w.r.t. the lexicographic order than the last one (see Figure 9). We are going to push this argument further to a slightly more general structure than blocks.
A submatrix SM p,q (M) is an inner block of M if, for every i, j, such that M i, j = 1 and p ≤ j ≤ p + q − 1, we have  Figure 10). Roughly speaking with respect to strip decompositions, every item which belongs to a clique of an inner block must belong to all cliques of the inner block or can not belong to the cliques outside of the inner block. An inner block According to the proof of Lemma 6, (x 1 i , . . . , x D i ) i∈I is a feasible packing. We are going to build another feasible packing . . , D} (δ = d) and i ∈ I such that the associated strip decomposition, as defined in the proof of Lemma 5, has bigger lexicographic order, with respect to dimension d: -∀i ∈ I such that f d i ≥ p and l d i ≤ p + q − 1, let . Hence, we have: Let us check that inequalities (1) with respect to dimension d of a feasible packing are satisfied : -∀i ∈ I such that f d i ≥ p and l d i ≤ p + q − 1, due to Lemma (4), we have: Let us check that constraints (2) of a feasible packing are satisfied. (2) is satisfied for the pair (i, j)). There are four cases: By definition of an inner block, we have l d j < p. Thus, due to Lemma (4), we have:

Knapsack algorithm
To select a subset of items I among all items, we use a classical branch-and-bound enumeration of the knapsack problem where the knapsack constraint is that the overall area of the selected items is less or equal than the container's area. For a given selected subset of items, we apply some dual feasible functions in order to try to early detect unfeasibility: a function f : [0, 1] → [0, 1] is dual feasible (DFF) [17] if for every finite set S of positive real numbers, we have Carlier and Neron introduced discrete dual feasible functions [9], as follows: let C ∈ EnsR + , a discrete dual feasible function f C is a function f C : [0,C] → [0,C ] (where C = f C (C)) such that for every finite set S of positive real numbers ∀S, ∑ x∈S x ≤ C ⇒ ∑ x∈S f C (x) ≤ f C (C) = C . They proved the following necessary condition for a subset of items to be feasible.

Theorem 12 A subset of items I is feasible, only if for every D-tuple of discrete feasible function
We apply Theorem 12 with the following discrete dual feasible functions (k = 2, 3, 4), for every dimension d: The algorithm to check feasibility and the branch-and-bound procedure have been implemented in Java 6 and tested on a PC with a 3GHz Pentium IV processor. Runtimes reported by Fekete & Schepers in [19] were obtained from a similar PC, but their algorithm was developed in C++.
We used classical 2D-OKP benchmarks from [3,11,19] and the two dimensional guillotine cutting problems benchmarks from [2,12]. All these benchmarks are available at http://www.ibr.cs.tu-bs.de/alg/packlib/instances.shtml Our binaries and the benchmarks files are also available at https://wiki.black.inria.fr/realopt/pmwiki.php/Project/SoftwareAlgoKP In tables 1 and 2, the columns JP (resp. FS, resp BB, resp. A0, A1, A2 and A3) correspond to our algorithm (resp. Fekete & Schepers' algorithm with data reported from [19], resp. Baldacci & Boschetti's algorithm with data reported from [1], resp. Caprara & Monaci's algorithms, as depicted in [8]). Table 1 gives the container sizes, the value of an optimal solution and the number of items of an optimal solution. The number of subset of items to be checked for feasibility (OKP nodes) and the number of effective calls (OPP nodes) to our algorithm to check feasibility (that is after the application of dual feasible functions) are reported. Table 1 shows that the number of the OKP nodes of our algorithm is bigger than the number of OKP nodes of Fekete and Schepers' algorithm. This is due to the fact that our Branch-and-Bound is less sophisticated than Fekete and Schepers' to select a subset of items to be checked for feasibility. In particular, we do not make use of heuristics to try to guess a solution, in contrary to Fekete & Schepers'.
We report in Table 2 the running times of the algorithms. We also report the number of unsolved benchmarks (within the time limit of 1800 seconds) and the average time (computed on the set of instances cgcut, gcut and okp), with the convention that an unsolved benchmark counts for 1800 seconds. For ngcut and hccut instances, every algorithm is fast. cgcut and gcut instances are more difficult to solve, as the size of the container and/or the number of items of an optimal solutions are bigger. On these instances, our algorithm seems to be significantly faster, especially in the case of instances cgcut2, gcut4, gcut8 and gcut12. This seems to indicate that we handle better symmetry issues due to items of same shape.
Results on the five okp instances are less conclusive: Fekete & Schepers' algorithm is faster (with the exception of okp1). Notice that on these instances, the number of calls to the algorithm to check feasibility is far much bigger in our case than in Fekete & Schepers'. Hence, as already noticed, Fekete & Scheper's branch-and-bound algorithm to handle the knapsack problem is more efficient. An explanation of this difference is that some symmetry issues are eliminated more efficiently by Fekete and Schepers' algorithm on these instances.
The instance gcut13 is still open. We were able to provide a feasible solution of value 8647565 (involving 17 items), thus slightly improving Fekete & Schepers's lower bound of value 8622498 [19].
ordering of the maximal cliques of interval graphs. Another matter of investigation is to derive from this algorithm an efficient mixed integer programming formulation for the multi-dimensional orthogonal knapsack problem. At last, this approach is suitable to solve other problems such as the orthogonal packing problem on a torus, by enumerating circulant consecutive-ones matrices.