## Services on Demand

## Journal

## Article

## Indicators

## Related links

- Cited by Google
- Similars in SciELO
- Similars in Google

## Share

## Pesquisa Operacional

##
*Print version* ISSN 0101-7438*On-line version* ISSN 1678-5142

### Pesqui. Oper. vol.29 no.2 Rio de Janeiro May/Aug. 2009

#### http://dx.doi.org/10.1590/S0101-74382009000200010

**A heuristic for the minimization of open stacks problem**

**Fernando Masanori Ashikaga ^{I,}^{*}; Nei Yoshihiro Soma^{II}**

^{I}FATEC São José dos Campos, Centro Paula Souza, São José dos Campos - SP, Brazil, fmasanori@gmail.com

^{II}Computer Science Division, Technological Institute of Aeronautics, São José dos Campos - SP, Brazil

**ABSTRACT**

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 (*G _{mosp}*) with a special structure (Yanasse, 1997b). It was observed in Ashikaga (2001) that, in the mean experimental case,

*G*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.

_{mosp}**Keywords:** minimization of open stacks; extension-rotation heuristic; clique.

**RESUMO**

Sugerimos uma heurística rápida e de implementação simples para o problema de minimização de pilhas abertas (MOSP). O problema é modelado como um problema de percorrimento de arcos no grafo (*G _{mosp}*) associado (Yanasse, 1997b). Foi observado em Ashikaga (2001) que o grafo

*G*possui grandes cliques e uma alta densidade de arestas. Esta informação foi utilizada para implementar uma heurística baseada no algoritmo Extensão-Rotação de Pósa (1976) para aproximação de Circuitos Hamiltonianos. O caminho inicial para o algoritmo de Pósa é obtido a partir dos vértices de uma aproximação do maior clique do grafo para acelerar o processo. Testes computacionais extensivos mostram que a abordagem domina tanto em tempo quanto em erro médio a mais rápida heurística conhecida de Yuen (1991 e 1995).

_{mosp}**Palavras-chave:** minimização de pilhas abertas; heurística extensão-rotação; clique.

**1. 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*containing the piece

_{j}*ρ*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 presents a small example of two sequences of patterns (

*Spa*'s) with the corresponding stacks opened during the cutting process. For

*Spa = {1, 2, 3, 4, 5, 6},*seven stacks are opened, while for

*Spa = {2, 4, 3, 5, 1, 6}*just three stacks are used during the entire process. A shaded area indicates that a stack associated to a given piece remains open while its demand is not fulfilled. For instance, a stack containing piece 4 remains open while patterns

*P*and

_{2}, P_{3}*P*are processed,

_{4}*cf.*left side of 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 1995). 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*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.

_{mosp}.

**2. 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*is the number of different pieces in pattern

_{j}*j*not included in the current open stacks and

*M*is defined as the number of piece types common to pattern

_{j}*j*and the current open stacks less the number of new piece types or potential stacks contained in that pattern. This difference,

*M*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

_{j}= C_{j}- N_{j}*M*A tie is broken in favor of a pattern with the lowest

_{j}.*N*value and if it still persists the one with lowest index

_{j}*j*is chosen. This heuristic has a straightforward implementation and its running time is bounded by

*O(n*

^{3}).

**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*A

_{n}.*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*can be scheduled immediately, since, the associated number of open stacks is clearly ω(

_{mosp}*G*). 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 (

_{mosp}*n*-ω

*(G*<< 1.

_{mosp}))/nThe 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).

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.*

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 vertices in the set *Conj* are included *before* their neighbors generated by MDGh and Erh. For instance, in Figure 7, with *S = {6, 7, 3, 2, 1, 4, 9, 10, 5, 8}* the new sequence becomes *S = {C2, 6, 7, 3, C1, 2, 1, 4, 9, 10, 5, 8}.* Finally, the vertices in *Rem* of *G _{mosp},* are inserted at the end of the sequence in a simple lexicographical manner. For the example given before,

*S*becomes:

*S = {C2, 6,7, 3, C1, 2,1, 4, 9, 10, 5, 8, R}.*

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

*O*(log

*n*) time (Angluin & Valiant, 1979), and the total number of extensions is at most

*O(n*time. The conjugated and remaining vertices are inserted in

^{2})*S*also in

*O(n*time and the same to obtain the final sequence patterns generation. Hence, the total time is bounded by

^{2})*O(n*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

^{2}).*n*in comparison with Yuen3, since this latter one is

*O(n*

^{3}).

**4. 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*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

_{mosp}*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.

**5. 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 1995) 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.

**Acknowledgments**

We are greatly indebted to three anonymous reviewers whose thorough and detailed review helped pretty much us to greatly improve the manuscript. We would like to thank José Carlos Becceneri for sending us the code for the BYS04 heuristic and Horacio Hideki Yanasse for many helpful discussions too.

**Dedication**

This paper is in loving memory of Prof. Vakulathil Abdurahiman. BEng, MSc, PhD, 12.12.1953 - 06.04.2007.

**References**

(1) Angluin, D. & Valiant, L.G. (1979). Fast probabilistic algorithms for Hamiltonian circuits and matchings. *Journal of Computer and System Sciences,* **18,** 155-193. [ Links ]

(2) Ashikaga, F.M. (2001). A frugal method for the minimization of open stacks problem. (in Portuguese) MSc. Thesis. Technological Institute of Aeronautics. [ Links ]

(3) Becceneri, J.C.; Yanasse, H.H. & Soma, N.Y. (2004). A method for solving the minimization of the maximum number of open stacks problem within a cutting process. *Computers & Operations Research,* **31,** 2315-2332. [ Links ]

(4) Becceneri, J.C. (1999). The Minimization of Open Stacks Problem in industrial environments (in Portuguese). DSc. Thesis. Technological Institute of Aeronautics. [ Links ]

(5) Bollobás, B. (1998). *Modern Graph Theory.* Springer, New York. [ Links ]

(6) Bollobás, B. (2001). *Random Graphs.* 2 edition, Cambridge University Press, Cambridge. [ Links ]

(7) Ferreira, A.G. & Song, S.W. (1992). Achieving optimality for gate matrix layout and PLA folding: a graph theoretic approach. *Integration. The VLSI Journal,* **14**(2), 173-195. [ Links ]

(8) Faggioli, E. & Bentivoglio, C.A. (1998). Heuristic and exact methods for the cutting sequencing problem. *European Journal of Operational Research,* **110**(3), 564-575. [ Links ]

(9) Fink, A. & Voss, S. (1999). Applications of modern heuristic search methods to pattern sequencing problems. *Computer and Operations Research,* **26**(1). 17-34. [ Links ]

(10) Garey, M.R. & Johnson, D.S. (1979). *Computers and Intractability: A Guide to the theory of NP-Completeness.* Freeman, San Francisco. [ Links ]

(11) Halldórsson, M.M. & Radhakrishnan, J. (1994). Greed is good: approximating independent sets in sparse and bounded-degree graphs. *Proc. STOC'94,* 439-448. [ Links ]

(12) Homer, S. & Peinado, M. (1996). Experiments with polynomial-time clique approximation algorithms on very large graphs. **In:** *Cliques. Coloring. and Satisfability: Second DIMACS Implementation Challenge* [edited by D.S. Johnson and M.A. Trick], **26,** 146-167. [ Links ]

(13) Kučera, L. (1995). Expected complexity of graph partitioning problems. *Discrete Applied Mathematics,* **57,** 193-212. [ Links ]

(14) Linhares, A. & Yanasse, H.H. (2002). Connections between cutting-pattern sequencing. VLSI design and flexible machines. *Computers and Operations Research,* **29**(12), 1759-1772. [ Links ]

(15) Pósa, L. (1976). Hamiltonian circuits in random graphs. *Discrete Mathematics,* **14,** 359-364. [ Links ]

(16) Yanasse, H.H. (1997a). On a pattern sequencing problem to minimize the maximum number of open stacks. *European Journal of Operational Research,* **100,** 456-463. [ Links ]

(17) Yanasse, H.H. (1997b). A transformation for solving a pattern sequencing problem in the wood cut industry. *Pesquisa Operacional,* **17**(1), 57-70. [ Links ]

(18) Yuen, B.J. (1991). Heuristics for sequencing cutting patterns. *European Journal of Operational Research,* **55,** 183-190. [ Links ]

(19) Yuen, B.J. (1995). Improved heuristics for sequencing cutting patterns. *European Journal of Operational Research,* **87,** 57-64. [ Links ]

*Recebido em 05/2008; aceito em 04/2009 após 1 revisão Received May 2008; accepted April 2009 after one revision*

* *Corresponding author* / autor para quem as correspondências devem ser encaminhadas