A HEURISTIC FOR THE MINIMIZATION OF OPEN STACKS PROBLEM

It is suggested here a fast and easy to implement heuristic for the minimization of open stacks problem (MOSP). The problem is modeled as a traversing problem in a graph (Gmosp) with a special structure (Yanasse, 1997b). It was observed in Ashikaga (2001) that, in the mean experimental case, Gmosp has large cliques and high edge density. This information was used to implement a heuristic based on the extension-rotation algorithm of Pósa (1976) for approximation of Hamiltonian Circuits. Additionally, an initial path for Pósa’s algorithm is derived from the vertices of an ideally maximum clique in order to accelerate the process. Extensive computational tests show that the resulting simple approach dominates in time and mean error the fast actually know Yuen (1991 and 1995) heuristic to the problem.


Introduction
The Minimization of Open Stacks Problem (MOSP) is defined by a set of pieces Π = {1,… n} and a set Λ = {P 1 ,… P m } of patterns, each P j , j = 1, …, m, is formed by a non-empty subset of pieces from Π. Any piece ρ Π ∈ is processed by a single machine (M) and it remains around M in an open stack of pieces of the same ρ type until its demand is fulfilled, the stack is considered closed when all patterns P j containing the piece ρ are cut. The objective of the problem is to schedule the order in which M will process the patterns such that the maximum number of open stacks is minimized. The MOSP appears, e.g., in the context of wood cutting where there is a limited storage space around a saw machine and stacks of panels being cut have to be removed only after their orders are completed. Figure 1   The MOSP models a variety of industrial situations, such as VLSI design (Ferreira & Song, 1992), wood and glass cutting (Yanasse, 1997a;Yuen, 1991 and. Additionally, the problem is also known to be NP-Hard (Linhares & Yanasse, 2002) and therefore, difficult to be solved exactly. In Becceneri et al. (2004) it is presented the best heuristic, up to now, in terms of the quantity of open stacks, despite a much worst running time than Yuen (1995) and our new heuristic presented here. Metaheuristics solutions for the MOSP were also suggested (Faggioli & Bentivoglio, 1998;Fink & Voss, 1999).
The suggested approach to our heuristic is focused on the study of typical practical instances and it was possible to derive many interesting structural information for the problem when its modeling is viewed as a search in a graph. For instance, an associated graph for the problem, G mosp , has very large cliques and high edge density; and this information is used to implement the heuristic for the problem. It will be shown that a solution for MOSP is related to determining a sequence of the vertices (with no repetitions) in that associated G mosp . The general idea of the algorithm consists on finding a large clique in the graph, ideally a maximum one, and from it to detect a Hamiltonian circuit to the induced sub graph via the extension-rotation approximation algorithm (Pósa, 1976). With the path of vertices obtained then both the pieces and patterns lists are generated. The next sections are organized as follows: in Section 2 we present the major idea of the well known Yuen (1995) algorithm for MOSP, in Section 3 the algorithm suggested here is given in details. In Section 4 the computational experiments are presented and the conclusions are given in Section 5.

The Yuen heuristic
In Yuen (1995) five heuristics for solving the MOSP are suggested and the third one, Yuen3, is considered as the best one so far to the problem in terms of the tradeoff between computational time and mean error (Yuen, 1995;Becceneri, 1999). The idea behind Yuen3 is to select a pattern that shares the largest number of common pieces with the current open stacks and it is based on the following three metrics: C j is the number of piece types common to pattern j and the current open stacks; N j is the number of different pieces in pattern j not included in the current open stacks and M j is defined as the number of piece types common to pattern j and the current open stacks less the number of new piece types or potential stacks contained in that pattern. This difference, M j = C j -N j tries to appraise the impact that a given choice of pattern j to be cut has in relation with the pieces contained in it. Therefore, this local information is used as a guide to the search of smaller quantities of different new stacks. The criterion to select a pattern to be sequenced is dictated by non-increasing values of M j . A tie is broken in favor of a pattern with the lowest N j value and if it still persists the one with lowest index j is chosen. This heuristic has a straightforward implementation and its running time is bounded by O(n 3 ).

The new Ashikaga Soma (AS) heuristic
The graph model for the MOSP used here was introduced in Yanasse (1997a) and the idea is to associate a vertex to a piece and a clique to a pattern, an edge represents two pieces present in a same pattern. Moreover, parallel arcs are counted and represented as a single one. In Ashikaga (2001) it was shown that, in general, a MOSP graph has very large maximum cliques in comparison with those randomly generated ones; i.e. it has large deviations from expected clique values (Bollobás, 2001).
The new traversing problem in this MOSP graph is presented in Yanasse (1997b), "follow the sequence of the arcs and sequence a pattern P j when, for the first time, all the vertices corresponding to all the pieces types in P j are open". An arc indicates that the corresponding vertices associated with pieces belong to at least a pattern P j . By sequencing all the vertices of the graph that are connected via arcs corresponds to a general and broad policy. The sequence of arcs in this traversing problem is also used by the present suggested approach. Figure 2 shows how a MOSP graph is generated from a matrix of patterns, e.g., pattern P 5 has 4 types of pieces: 3, 6, 7 and 10.
A different example is given in Figure 3 that illustrates the complete process of construction of a MOSP graph by a union of cliques formed by pieces of each Pattern. Still in Figure 3, Pattern P 1 generates a triangle that is formed by pieces 1, 4 and 5; Pattern P 5 generates another triangle whose vertices are 4, 5 and 6. Parallel arcs connecting pieces 4 and 5 are counted as a single one since the indication adopted by the heuristic needs just to know if two pieces belong or not to at least one Pattern.  It is well known that finding a maximum clique is NP-Hard (Garey & Johnson, 1979). However, for dense graphs, as it is the case for the MOSP, in the mean experimental case, greedy algorithms for finding a clique cannot generate bad results (Homer & Peinado, 1996;Kučera, 1995).
A graph is complete, denoted by K n , if all of their n vertices are mutually adjacent. A clique is a subset of K n . A complement graph G' of G is such that the vertices are the same in both graphs and an edge belongs to G' if and only if it is not present in G. A clique number of a graph G, denoted by ω(G), is the maximal number of vertices of a clique in G (Bollobás, 1998).
Notice now that if G mosp = K n then the optimal solution is trivially found and even if this is not the case, any clique of G mosp can be scheduled immediately, since, the associated number of open stacks is clearly ω(G mosp ). Therefore, a natural idea to obtain an initial solution to the problem would be to try to find a clique (ideally any maximum one) with very few remaining vertices yet to be sequenced (n -ω(G mosp ))/n << 1.
The independent set problem is that of finding a mutually non-adjacent vertices set of a graph. A clique is its dual problem and it consists of detecting a set of adjacent vertices. Therefore, if S is a maximal independent set in a given graph it also is a maximal clique in its complement graph. In order to obtain an approximation of maximum clique we used the complement graph and the Minimum Degree Greedy heuristic for independent sets, which performs well in sparse graphs (original complement graphs are dense), cf. Halldórsson & Radhakrishnan (1994).

Minimum Degree Greedy heuristic (MDGh)
For the example of Figure 2, a maximum clique is obtained and S = {6,7,3,2,1}. Recall that a vertex in S corresponds to a piece to be cut by the saw machine and since S is an ordered set, the order in which the pieces have to be cut is dictated also by S. Moreover, from that set it is immediate to determine the sequence of patterns (Spa) to be processed and in a time bounded by O(n 2 ). Figure 4 illustrates the process of MDGh in MOSP graph of Figure 3. The vertices in S, after MDGh, are considered as initial path for the Extension Rotation heuristic (Erh), presented next. In this sense, Erh extends the set S, i.e. more vertices will be included in that set or what it is the same, more pieces are scheduled to be cut and any piece appears just once in S.
Extension Rotation heuristic (Erh) Input: MOSP Graph G mosp and S generated by the MDGh. Output: Extended S, via a Hamiltonian path. Initialize x k and j properly; j =´ some neighbor of the last vertex in the current path´; if j ≠ ∅ create_another_path_with_the_same_vertex_set; // revert the orientation of the subpath between j and last vertex } } Return S; Figure 5 shows that MDGh returns an initial S = {6, 7, 3, 1, 2}. An initial path given by vertices 6-7-3-1-2 has no further vertex to extend (Figure 5a). Since there is an arc between vertices 3 and 2, a rotation follows, modifying thus the path to 6-7-3-2-1 (Figure 5b). After that it is possible to further perform 5 more extensions (Figure 5c) and S = {6, 7, 3, 2, 1, 4, 9, 10, 5, 8}, the given solution is optimal to this example.  Figure 6 gives an idea of how Erh works: the left side depicts the sequence of pieces to be cut, given by the extended set S = {6, 7, 3, 2, 1, 4, 9, 10, 5, 8} (the example is the same as in Figure 2). Related to this sequence of pieces the sequence of patterns is given by: Spa = {9, 10, 3, 2, 8, 4, 7, 5, 1, 6} and it will open a maximum of 5 stacks during the cutting process. This latter sequence is obtained; cf. Figure 6, in the following manner: S is traversed from the right to the left including a pattern that contains the incumbent piece in that sequence. In the same Figure 6, piece 8 appears in the last position in S, hence, pattern P 6 that contains that piece is the last one to be processed. The shaded areas in that figure indicate open stacks during the cutting process too. An experimental determined limit of two rotations was imposed to Erh. This constraint implies that, in principle, not all vertices (pieces) will be traversed (sequenced) since a Hamiltonian path may not be found. For the eventuality of existence of vertices yet to be sequenced some of them can be neighbors to the ones generated after MDGh and Erh. To this case such a vertex is called a conjugated and the others as remaining. At this point set Π is partitioned into three subsets: Π = S ∪ Conj ∪ Rem, where S is given by the execution of MDGh and Erh, Conj by the conjugated and Rem by the remaining vertices. For ease of comprehension suppose that the example of Figure 2 has three additional vertices, C1, C2 and R as given in Figure 7. A solution for this problem given by MDGh and Erh and presented in Figures 5  and 6 implies that C1 and C2 belong to the set Conj while vertex R belongs to the set Rem. The following pseudo-code summarizes its major steps. Recall that Spa is obtained from S (ordered set) by traversing the set of vertices given by AS from the last to the first one, with the inclusion of the patterns that contains the vertex being considered. The worst-case complexity for the algorithm is O(n 2 ), since MDGh is linear (Halldórson & Radhakrishnan, 1994). Each rotation can be made in (log ) O n time (Angluin & Valiant, 1979), and the total number of extensions is at most O(n 2 ) time. The conjugated and remaining vertices are inserted in S also in O(n 2 ) time and the same to obtain the final sequence patterns generation. Hence, the total time is bounded by O(n 2 ). As it will be presented next, the heuristic has a much better behavior in the practice than this theoretical worst case bound. Moreover, the heuristic has a speed up of a factor n in comparison with Yuen3, since this latter one is O(n 3 ).

Computational Experiments
The suggested heuristic, AS, is compared with the Yuen3 algorithm. The first set of instances considered was suggested by Becceneri (1999) and covers the most common practical industrial scenario applications. In the second class a very large quantity of random instances were generated. The running times are expressed as CPU milliseconds in Table 1 and seconds in Table 2. The equipment is a Celeron 533 MHz with 64 Mbytes of main memory. All heuristics were implemented in Visual C++ 6.0.
For the tests it was assumed without loss of any generality that the quantity of pieces is equal to those of patterns since as observed by Yanasse (1997b) any pattern can either be grouped or divided into sets with exactly two pieces such that the total quantity of stacks remains the same in the optimal solution. Table 1 presents comparisons among the heuristics Yuen3 (Yuen, 1995), the Smaller Cost Node, BYS04 (Becceneri et al., 2004) and AS. The tests followed the notation given in Becceneri et al. (2004), that is, m x n stands respectively for the number of pieces and the number of patterns, C is the number of pieces to be allocated to a pattern. For instance, 20x20 and C = 12 means for 20 patterns and pieces and to each pattern at most 12 pieces will be allocated to it. mBYS04, mYuen3 and mAS indicate the mean number of open stacks and tBYS04, tYuen3 and tAS are the mean running time. For each case, the sample set has size 20 and it was randomly generated. It can be readily seen that BYS04 produces best results in terms of the quantity of open stacks, but at higher running times in relation to the number of patterns and pieces. Yuen3 and AS are very fast, but for increasing values of n, clearly, AS has a much better time performance than Yuen3. Also, AS produces a smaller quantity of open stacks than Yuen3 for larger values of n and is competitive with BYS04 for larger values of C. The second set of computational tests was designed to compare specifically Yuen3 and AS. A much larger quantity of instances, 2000, was used for each value of n ranging from 200 up to 1000 patterns and the results are presented in Table 2. The quantity of pieces and types were associated with the density of graphs G mosp 's which varied from 10% up to 90%. AS produces much better results than Yuen3 in all classes. It becomes clear that AS is much faster than Yuen3, indeed, it is almost ten times faster for instances with high density and/or n large. It is worth of mentioning that for a given value of n AS has an almost equal time response in respect to the density. A possible explanation to understand this behavior can be the fact that a G mosp has a large clique embedded in it and after sequencing it the induced graph becomes very sparse. The existence of a large clique detected by MDGh can also be a possible reason of why by imposing just two rotations to Erh sets Con and Rem have small cardinality. The suggested AS heuristic dominates Yuen3 in experimental running times and means errors. It possesses a smaller complexity order and also it has a very simple implementation.
Algorithm AS implemented in C++ can be obtained directly by request from the corresponding author.

Conclusion
The Minimization of Open Stacks Problem appears directly in a large quantity of practical settings and it has a structure that makes it difficult to be solved exactly since it is also a NP-Hard problem. The very well known and simple heuristic for solving the problem -Yuen3 -produces good results in the practice, in the quantity of open stacks and in the running time, therefore it is difficult to find a better approach for the solving the problem. It was observed here that the problem when modeled as a search in a special graph -the MOSP Graph -possesses very large cliques. This feature permitted to be explored and a quadratic computational requirements time and space heuristic, AS was suggested. Extensive computational experiments were carried out and from them it is possible to infer that the suggested heuristic dominates Yuen (1991 and approach in the running time and mean error too. AS generated smaller quantities of open stacks than Yuen3, also it was always faster than the latter in the practice and in theory it improves the running time by a factor of n. Moreover, no heuristic can have a better theoretical order of convergence than AS since it allocates a time for solving the problem proportional to the input size.