A heuristic approach based on dynamic ... - Semantic Scholar

2 downloads 0 Views 299KB Size Report
Viswanathan and Bagchi (1993), Hifi (1997a), Cung et al. (2000) and Christofides and. Hadjiconstantinou (1995). In the latter, a tree search algorithm using ...
A heuristic approach based on dynamic programming and and/or-graph search for the constrained two-dimensional guillotine cutting problem Reinaldo Morabito Vitória Pureza Production Engineering Department Universidade Federal de São Carlos, São Carlos - SP, Brazil [email protected], [email protected]

Abstract In this paper we present a heuristic method to generate constrained two-dimensional guillotine cutting patterns. This problem appears in different industrial processes of cutting rectangular plates to produce ordered items, such as in the glass, furniture and circuit board business. The method combines a state space relaxation of a dynamic programming formulation of the problem, an and/or-graph search approach, a state space ascent procedure of subgradient optimization type, and an inner heuristic that turn infeasible solutions provided in each step of the ascent procedure into feasible solutions. Results for benchmark and randomly generated instances indicate that the method’s performance is competitive compared to other methods proposed in the literature. One of its advantages is that it often produces a relatively tight upper bound to the optimal value. Moreover, in most cases for which an optimal solution is obtained, it also provides a certificate of optimality. Keywords: cutting and packing problems, constrained two-dimensional guillotine cutting patterns, dynamic programming, and/or-graph search, heuristics.

1. Introduction Cutting and packing problems appear in a wide range of classes and practical situations and generally they are of difficult exact solutions (e.g. Dyckhoff and Finke, 1992; Lodi et al., 2002; Waescher et al., 2007). Many studies dealing with these problems can be found in the literature, as shown in different surveys and special issues such as in Dyckhoff and Waescher (1990), Dowsland and Dowsland (1992), Sweeney and Paternoster (1992), Martello (1994a, 1994b), Bischoff and Waescher (1995), Mukhacheva (1997), Dyckhoff et al. 1

(1997), Arenales et al. (1999), Wang and Waescher (2002), Hifi (2002), Oliveira and Waescher (2007) and ESICUP (2007). In this paper, we study the generation of constrained two-dimensional guillotine cutting patterns. Besides the inherent complexity of the problem (NP-hard), we are motivated by its practical relevance in many industrial settings, such as in the cutting of flat sheets in glass cutting processes, the cutting of wood boards in furniture factories, the cutting of fiberglass plates in the circuit board manufacturing, among others. The cutting pattern is called two-dimensional as it involves two relevant dimensions (the lengths and widths of the items). It is called guillotine because, due to constraints imposed by the cutting equipment, the cuts must be of a guillotine type (a cut is guillotine if when applied to a rectangle it produces two rectangles), and it is called constrained because, besides the non overlapping restraints, there are imposed limitations on the maximum number of items that can be produced in a pattern. Only a few studies proposed exact methods to generate constrained two-dimensional guillotine cutting patterns in the literature, such as work by Christofides and Whitlock (1977), Viswanathan and Bagchi (1993), Hifi (1997a), Cung et al. (2000) and Christofides and Hadjiconstantinou (1995). In the latter, a tree search algorithm using bounds derived from a state space relaxation of a dynamic programming formulation and a state space ascent procedure was presented. The application of the method was illustrated by solving only problem instances of moderate sizes. Due to the computational difficulties with exact methods, various studies propose heuristic methods to generate constrained guillotine patterns, as in the papers by Wang (1983), Vasko (1989), Oliveira and Ferreira (1990), Parada et al. (1995), Morabito and Arenales (1996), Mornar and Khoshnevis (1997), Fayard et al. (1998), Parada et al. (1998, 2000), Alvarez-Valdes et al. (2002), Hifi (2004) and Cui (2008); see also Burke et al. (2004) and Dowsland et al. (2006). In the present study, we combine a variant of Christofides and Hadjiconstantinou (1995)’s method with an and/or-graph search approach. Instead of using a tree search algorithm and performing a complete enumeration, we apply an inner heuristic (called feasibility heuristic) that turn infeasible solutions provided in each step of the subgradient optimization procedure into feasible solutions as an attempt to improve the lower bound. Moreover, we apply an and/or-graph approach in order to start the subgradient optimization procedure with a tight lower bound to the optimal solution value. Unlike Christofides and Hadjiconstantinou’s method, our approach does not have a guarantee of optimality; however,

2

it is faster and able to provide high-quality solutions (if not optimal) within reasonable computer runtimes for larger problem instances, as shown in our numerical experiments. One advantage of the present approach compared to other heuristic methods is that in the cases for which an optimal solution is found, the subgradient procedure may provide a certificate of optimality. Moreover, when the best solution is suboptimal or its optimality can not be proved, the approach often produces a relatively tight upper bound to the optimal value, which allows a good estimate of the optimality gap. It is worth mentioning that the method ensures optimality when solving unconstrained two-dimensional guillotine cutting patterns. To evaluate its performance, we solve benchmark and randomly generated examples with varying degrees of difficulty and compare the results to competitive methods of the literature. The paper is organized as follows. Section 2 briefly reviews a dynamic programming formulation of the problem. In section 3, the state space relaxation of the formulation is discussed and an ascent procedure of a subgradient optimization type is presented. In sections 4 and 5, we describe the and/or-graph approach and the feasibility heuristic used in the subgradient optimization procedure. In section 6, the computational performance of the method is analyzed followed by concluding remarks and perspectives for future research in section 7. 2. Dynamic programming formulation Consider a rectangular plate of length and width L x W, and a set of n smaller rectangles (sizes of ordered items or pieces) of lengths and widths l1, x w1, l2, x w2, ..., ln x wn, demands b1, b2, ..., bn, and values v1, v2, ..., vn. We assume that the pieces have a fixed orientation (i.e., sizes li x wi and wi x li refer to different pieces) and the lengths and widths of the plate and pieces are integer numbers. The constrained cutting problem consists of generating the most valuable guillotine cutting pattern using no more than bi pieces of type i = 1,2, ..., n (should the pattern also use at least ai pieces of type i = 1,2, ..., n, the problem would be referred to as double constrained by ai and bi). Moreover, the problem is called unweighed if all piece values vi are equal to the corresponding piece areas liwi (the objective consists of determining the minimum trim loss pattern); otherwise it is weighed. Christofides and Hadjiconstantinou (1995) proposed a dynamic programming formulation for the constrained guillotine problem assuming that the cuts on the plate are produced in consecutive stages. Figure 1 illustrates a 3-stage cutting pattern to a rectangle (x,

3

y). In the first stage, a horizontal cut divides (x, y) into two rectangles (top and bottom); in the second stage a vertical cut divides the top rectangle into two rectangles (left top and right top) and two vertical cuts divide the bottom rectangle into three rectangles (left bottom, middle bottom and right bottom). Finally, in the third stage a horizontal cut divides the left top rectangle into two rectangles and two horizontal cuts divide the right bottom rectangle into three rectangles.

y

x

Figure 1: Example of a 3-stage cutting pattern to a rectangle (x, y). Let s1, s2, ..., sn be the amount of pieces of types 1, 2, ...,n available to produce a feasible cutting pattern to rectangle (x, y). Representing these pieces by the ordered sequencing Sxy = {s1, s2, ..., sn}, let Fk(x, y, Sxy) be the value of the optimal guillotine cutting pattern produced with at most k cutting stages to rectangle (x, y), using a feasible combination of the rectangles available in set Sxy, with the cuts of the first stage parallel to axis y. Similarly, let Gk(x, y, Sxy) be the value of the optimal guillotine cutting pattern with at most k cutting stages to rectangle (x, y), using a feasible combination of the rectangles available in set Sxy, with the cuts of the first stage parallel to axis x. Defining the sets X = {1, 2, ... , L} and Y = {1, 2, ..., W}, the dynamic programming recursive functions Fk(x, y, Sxy) and Gk(x, y, Sxy), for all k ≥ 1, x∈X, y∈Y and Sxy⊆ S LW = {b1 , b 2 ,..., b n }, are given by: Fk ( x, y, S xy ) = max Gk −1 (x, y, S xy ), Gk ( x, y, S xy ) = max Fk −1 (x, y, S xy ),

max

[F (x', y, S ') + G (x − x', y, S

xy

) − S'

]

(1)

max

[G (x, y', S ') + F (x, y − y', S

xy

) − S'

]

(2)

x' < x,x ' ∈X ,S ' ⊂ S xy

y' bi and, at the same time, decrement the weight qi of the pieces for which γi ≤ bi. In the present work, we use the following formula to update the values of the weights:

if γ i > bi ,

qi + t (γ i − bi ) qi =

[

max 0, qi − t (bi − γ i )

]

if γ i ≤ bi ,

(9)

where z denotes the largest integer less than or equal to z, and t is the size of the positive scalar step, given by:

t = max 1, π ( ZUB − Z LB ) /

m i =1

(bi − γ i ) 2

(10)

This expression is a slight modification of the one used in Christofides and Hadjiconstantinou (1995). Our motivation for the lower limit t = 1 is to allow the change of qi in (9) when γi ≠ bi. The parameter value π is initially fixed and then it is halved along the iterations until it becomes less than an exogenous parameter ε. ZLB is a lower bound to the optimal solution of formulation (1)-(4); it corresponds to a feasible solution to (1)-(4) and it is initialized using the and/or-graph approach described in section 4. ZUB is the value of the current upper bound to (1)-(4). Note that if ZUB = ZLB, then the subgradient optimization procedure can be halted, returning ZLB as the optimal solution value of (1)-(4). The steps of the subgradient optimization algorithm are described as follows:

Subgradient optimization algorithm 1. Compute the normal sets X and Y (section 2) and initialize the lower bound ZLB using the and/or-graph approach (described in section 4). Make the weights qi = 0, i = 1,..., n. 2. Solve the relaxed formulation (5)-(8) with a sufficiently large k to obtain the optimal value

ZUB relative to the current vector q. 3. Verify if the cutting pattern associated to ZUB corresponds to a feasible solution to formulation (1)-(4). In this case, the solution is optimal and the procedure is halted. Otherwise, if ZUB < Zmin (i.e. the minimum upper bound obtained so far), then update Zmin with Zmin = ZUB. 4. Apply the feasibility heuristic (described in section 5) to find a feasible solution to (1)-(4). If the value of this solution is greater than ZLB (i.e. the value of the best feasible solution

8

obtained so far), then update ZLB. If ZLB = Zmin, then this solution is optimal and the procedure is terminated. 5. Modify vector q using expressions (9)-(10) and update Q and π. 6. Go to step 2 with the modified vector q, unless the maximum number of iterations is reached or π ≤ ε. At the end of the algorithm, an optimal solution to formulation (1)-(4) may be found (steps 3 or 4). Otherwise, the returned solution is either the solution obtained in step 1 with the and/or-graph approach or the best solution obtained in step 4 with the feasibility heuristic, which does not ensure optimality. The main differences between this algorithm and the one used in Christofides and Hadjiconstantinou (1995) are in steps 1 and 4. Lucena (2004) proposed some modifications of relax and cut type in subgradient optimization procedures. In particular, it was suggested that a good practice for the convergence of the algorithm is to adjust the subgradients before the computation of step size

t in (10), using si = 0 if si ≥ 0 and qi = 0 , where si = bi − γ i is the subgradient associated to the restraint of availability of piece i. In other words, if constraint i is not violated (i.e., si ≥ 0 ) in current iteration, and it has a null multiplier associated (i.e., qi = 0 ), then its subgradient is ignored, fixing it to si = 0 . Taking this into account, it does not contribute to the calculus of the step size t in (10). This strategy of adjusting multipliers was also applied to the present study.

4. And/or-graph approach In step 1 of the subgradient optimization algorithm of section 3 we use the and/orgraph approach presented in Morabito and Arenales (1994, 1996) to produce an initial feasible solution of high quality (i.e. a tight lower bound). Other related methods to the and/or-graph approach are found in Parada et al. (1995, 2000) and Hifi (1997b, 2004). This approach (denoted by AOG) is an implicit enumeration and represents each possible constrained two-dimensional guillotine cutting pattern as a complete path in an and/or-graph such that: (i) the nodes of the graph correspond to either the initial rectangle (plate), the intermediary rectangles obtained during the cutting process, the ordered rectangles (pieces) or the waste (trim losses) of the pattern, and (ii) the and-arcs of the graph correspond to the cuts on the rectangles, linking a node to other nodes. Figure 2 illustrates a sequence of five

9

guillotine cuts C1, C2, ..., C5, producing a cutting pattern containing the rectangles (pieces) denominated R8, R9, R10, R13, R16 and R17. Figure 3 presents the correspondent complete path of the and/or-graph with 17 nodes (rectangles R1, R2, ..., R17) and 5 and-arcs (cuts C1, C2, ..., C5). Note that the horizontal cut C1 on rectangle R1 (initial node) produces the intermediary rectangles R2 and R3, the vertical cut C2 on rectangle R2 produces rectangles R4 and R5 (which cannot be cut further and results in pieces R8 and R9 after a 0-cut, i.e., a cut that represents the option of stop cutting the rectangle, linking it to a final node), the vertical cut C3 on rectangle R3 produces the intermediary rectangles R6 and R7, and so on. C3

R 10 C1

R8

R 13 R 16

R 17

C4

R9 C2

C5

Figure 2 – Sequence of guillotine cuts producing a cutting pattern.

10

R1

C1 R2

R3

C2

C3

R4

R5

R8

R9

R6

R 10

R7

R 11

C4 R12

R 13 R14 R 16

C5

R 15 R 17

Figure 3 – Complete path of the and/or-graph representing the cutting pattern of Figure 2. To reduce the graph search, the AOG uses the normal sets X and Y defined in section 2 and applies rules of symmetry, exclusion and cut ordering. Moreover, the AOG discards nonpromising paths using hybrid search strategies (combinations of backtracking and hill-

climbing) and applying some heuristics (heuristics H1-H4). For instance, heuristic H1 discards a path from a node if the upper bound of this path value is not λ1% greater than the value of the incumbent solution of this node. Heuristic H2 discards a path from a node if the lower bound of this path value is not at least λ2% of the value of the incumbent solution of this node. Heuristic H3 imposes a symmetry rule with loss of generality to reduce the graph search. As the graph search substantially increases with the cardinalities of sets X and Y, heuristic H4 imposes a limit M on the maximum number of elements of X and Y. The quality of the solutions generated by the AOG is highly dependent on these heuristics’ parameters. Further details can be found in Morabito et al. (1992) and Morabito and Arenales (1994, 1996). The performance of the and/or-graph search could be also reduced by means of more effective lower bounds (feasible solutions) in the graph nodes, as the one used in Hifi (2004) based on the computation of a series of single bounded knapsack problems.

11

5. A Feasibility heuristic As mentioned in section 3, step 4 of the subgradient optimization algorithm comprises an inner heuristic that turn infeasible solutions provided in a given step of the algorithm into feasible solutions. The motivation for using this heuristic is that it may improve the instance’s current lower bound. In this case, if a feasible solution with value Zmin is found during the procedure, then this solution must be optimal. Otherwise, the best solution produced by the feasibility heuristic is returned along with the optimal solution upper bound Zmin. The feasibility heuristic consists of replacing blocks of type i pieces for which the demand has been exceeded by other piece types j that still have a demand to be fulfilled. Block Bi is a rectangular structure in the current pattern comprising one or more adjacent i pieces. Its exclusion results in a rectangular empty area Si which may also include unused spaces around

Bi’s outer perimeter. If there is more than one unit of piece i in excess, Bi comprises a number of adjacent pieces as close as possible to the number in excess. In the case of exactly one unit in excess, Bi corresponds to this single piece or, if the piece area does not allow the inclusion of any eligible piece type, the procedure searches for a block containing two adjacent units of

i. Note that by removing two or more adjacent pieces at once, instead of a piece at a time, a more efficient use of the empty area is achieved. Once Bi is removed, the resulting area Si can be filled with eligible pieces j. For each type

i piece in excess, the heuristic selects the combination (i, Si) that provides the most valuable homogeneous (arrangement of pieces with the same type) solution. If the arrangement does not completely fill Si, a horizontal and/or a vertical guillotine cut are applied to obtain up to two rectangles corresponding to the unused areas, which are also subject to the arrangement of pieces, taking into account the pieces used in the previous level. We disregard them if these cuts add further stages to the cutting pattern, since we are assuming that a maximum number of stages is not specified. However, only arrangements that maintain a guillotine cutting pattern of the plate are considered. This defines a recursive scheme applied as long as there is enough area to be filled with eligible pieces j. Therefore, rather than a single arrangement for each combination (i, Si), the heuristic stores a sequence of arrangement decisions Ai for each combination (i, Si). The sequence of decisions Ai* that provides the most valuable cutting pattern is implemented followed by the update of the demand for used pieces. The procedure is repeated until a feasible solution is obtained. The steps of the feasibility heuristic are described as follows. 12

Feasibility heuristic 1. Let I = set of types with pieces in excess, and J = set of types for which the demand is not fulfilled in the current pattern. 2. For each type i ∈ I with ei pieces in excess do: 2.1

Select a block Bi in the current pattern such that: (i) the number of pieces is close as possible to ei, and (ii) its exclusion produces the largest empty area Si. If ei =1 and it is not possible to fill the area with another piece type j ∈ J, and there is a block comprising at least two pieces of type i, make the number of pieces to be removed equal to 2 and define Bi and Si accordingly. Remove Bi from the current pattern.

3. For each area Si resulting from step 2: 3.1

Let Ai (set of selected homogeneous arrangements) = ∅ and Scurrent= Si.

3.2

Determine the most valuable homogeneous solution H i* among pieces j∈J that can be placed in space Scurrent, without exceeding the demand of j and that maintains the guillotine pattern of the plate. Make Ai= Ai ∪ H i* .

3.3

If H i* does completely fill Scurrent, obtain up to two rectangles corresponding to the unused areas by means of a horizontal and a vertical guillotine cut. For each rectangle resulting from each type of cut, verify if the area is large enough to be filled with pieces j∈J considering the arrangement decisions in Ai. In this case, make the area equal to Scurrent and go to step 3.2, storing the arrangement in the sequence of the associated decision tree.

3.4

Select Ai* as the sequence of arrangement decisions that results in the most valuable cutting pattern for Si.

4. Fill Si (with Ai* ) that results in the most valuable cutting pattern. Update the demand. 5. Return to step 1 while there are pieces in excess in the current pattern.

6. Experiments and computational results In this section, we present the experiments and computational results in order to illustrate the performance of the method described in sections 2 to 5, here denoted as DP_AOG. The implementation was coded in Pascal (Delphi 7 – Borland) and executed in a

13

microcomputer Pentium IV (2.99 Ghz – 2.0 GBytes RAM). After some preliminary experiments, parameters for the subgradient optimization algorithm (section 3) were chosen as π = 2 (halved at each 3 iterations) and ε = 0.05 (a limit of 18 iterations). In addition, the strategy of the multiplier adjustment was activated. The AOG approach parameters (section 4) were set as: search depth limit DB = 6, λ1 = 0 (heuristic H1 turned off) and λ2 = 0.9 (heuristic H2 turned on). The symmetry rule was activated (heuristic H3 turned on) and sets X and Y were fully generated for each example (heuristic H4 turned off).

6.1 Benchmark instances The performance of DP_AOG was initially evaluated by comparing its results to competitive methods reported in the literature. Three sets of benchmark constrained guillotine cutting instances with known optimal solutions were used in this analysis. The first set of instances (Table 1) comprises 8 largely applied weighed/unweighed examples with up to n = 20 piece types: ChW1, ChW2 and ChW3 (Christofides and Whitlock, 1977), OF1 and OF2 (Oliveira and Ferreira, 1990), and WANG1, WANG2 and WANG3 (Wang, 1983). The other two sets correspond to 22 well-known instances of 25 to 50 piece types (Table 2), 11 weighed examples CW1-CW11 and 11 unweighed examples CU1-CU11 (Hifi, 1997a, Fayard et al., 1998; Alvarez-Valdes, 2002; Hifi, 2004). The solution values provided by competitive algorithms were included (when applicable), as well as the required computational times (if available). The algorithms are referred to as follows:



CW77 (Christofides and Whitlock, 1977): Tree search algorithm with dynamic programming and a transportation routine – computer CDC 7600.



W83 (Wang, 1983): Algorithm 1 with

= 0.01, 0.02 and 0.03, respectively – computer

Univac 1100.



OF90 (Oliveira and Ferreira, 1990): Variation of Wang (1983)’s algorithm 1 – microcomputer 80286/7.



VB93 (Viswanathan and Bagchi, 1993): Best-first search algorithm– computer VAX 11.



CH95 (Christofides and Hadjiconstantinou, 1995): Tree search algorithm with state space relaxation of a dynamic programming formulation – microcomputer IBM 486.



H97 (Hifi, 1997a): Variation of Viswanathan and Bagchi’s algorithm – computer Data General AV 8000.

14



FHZ98 (Fayard et al., 1998): Algorithm based on solving a series of knapsack problems using dynamic programming – computer Sparc 20.



APT02 (Alvarez-Valdés et al, 2002): Tabu search algorithm – microcomputer Pentium II.



H04 (Hifi, 2004): Algorithm based on dynamic programming and hill climbing techniques – computer Ultra Sparc 10. It should be emphasized that among these algorithms, CW77, VB93, CH95 and H97

are implementations of exact methods. Table 1: Results – 1st set of benchmark instances. Instance n

Algorithm CW77 W83

ChW1

7

244♦

-

OF90 VB93 CH95

H97

APT02

H04

DP_AOG

244♦

244♦

244♦

-

-

244♦

1.6

120