Application of a Hybrid Genetic Algorithm for cutting with particular stock Leon Kos1 , Nikola Jelić1,2 , and Jožef Duhovnik1 1
University of Ljubljana, Faculty of Mechanical Engineering Aškerčeva 6, SI-1000 Ljubljana, Slovenia,
[email protected],
[email protected]
2
Association EURATOM-ÖAW, University of Innsbruck, Department of Theoretical Physics, A-6020 Innsbruck, Austria,
[email protected]
ABSTRACT The paper presents approach to solve a problem of optimum cutting with the particular stock. This problem has already been tackled via developing and applying a first version of the Hybrid Grouping Genetic Algorithm (HGGA) code (Kos and Duhovnik, 2002) employed in the optimum cutting plan. It turned out that the slightly upgraded version of the code show a wider applicability and can apply to many problems of practical interest like cutting, packing, production scheduling, and planning. Many production environments entail additional requirements that should be weighted during the search for an optimum solution. We present the motivation, flowchart and capabilities of the code and results obtained on a case of interest, i.e., we have shown how the hybrid genetic algorithm can be used as heuristics which, provides quality packing for cutting large items. The problem can be effectively tackled, provided practical requirements and limitations are taken into consideration. Domain-specific knowledge and local hillclimbing in the genetic algorithm has turned out to be helpful in many aspects of the optimization process. The HGGA presented is robust and easy to use, as there are only few parameters with a large range of successful operation. Directions for possible future developments are discussed. KEYWORDS: variable-sized bin packing, sawing, large items, genetic algorithms
1
Introduction
The problem of cutting optimization frequently arises in steel structure production where the packing of item lengths of equal cross-sections into larger beams for cutting occurs. Problem is related to the area of Cutting and Packing (see Wäscher et al., 2007; and references therein) with requirements that are normally specific to the type of production. In particular steel structure production the beams of standard lengths are cut into smaller pieces. Their cost per unit weight/length is constant. A structural steel is limited to small number of standard lengths to accommodate transportation, handling and storage. Big consumers can also order custom sized beams for the same price from suppliers. But at the end, as always, the decision for order is based on availability and total production cost. To reduce the cost, as little as possible waste is preferable. Further, any combination of standard lengths is feasible in order to minimize waste. Beam lengths can also comply with some internal standard of the final producer as steelworks are flexible enough to provide a batch of lengths up to some maximum (e.g. 12m). Similar philosophy of the supply/order chain can be found in other disciplines with different production characteristics. 1
150
Count
100
50
0
1
2
length [m]
3
4
Figure 1: A free-form structure and the corresponding lengths histogram of total 704 I-beams distributed into 100mm wide bins. No small items and few large are used for support structure.
In particular production this method minimizes costs, transport logistics and enables production flexibility. In so doing, cutting/sawing can be planned at the designing stage, with production material not yet available. The preferred practice is then to order beams of standard lengths (also called ‘bins’) and cut them with minimal trim loss. After dimensions have been established, production possibilities and orders are examined. To illustrate practical implications of the problematic we show in Fig. 1 free-form structure and corresponding distribution of I-beams lengths that are used as support structure. Lengths of all beams vary and there are no two beams alike. One can notice that average length is 3m and that there are few larger beams, some smaller and no small lengths. In such cases we can expect that packing into standard sizes will occur with 2 items when sawing from 6m beams and 4+ when using 12m beams. In any case, we expect that perfect packing will be hard to achieve and that substantial waste can occur, if sawing is not carefully planned. Unless there are cost justifications in selecting different bins the tendency is to use as little as possible of various lengths to simplify orders and transportation to the works. Disregarding available items from the inventory status data, a simplified approach to cutting optimization from a list of available lengths can be formulated as the Variable-Sized Bin Packing Problem (VBPP). Since the VBPP is a NP-hard problem with exponential time for global optimization (Friesen and Langston, 1986), only approximation algorithms are feasible to apply. Several approximation algorithms have been studied so far, mostly for the online case (see Coffman et al., 2007; for a survey) with emphasis on the worst-case analysis for variations of well-known classical bin packing algorithms, such as First-Fit, Next-Fit, Best-Fit, with various opening and closing rules (Burkard and Zhang, 1997). The offline VBPP, which is the subject of our research, has been sparsely studied so far. Epstein and Levin (2008) present an approximation scheme based on Murgolo (1987) ideas with a linear programming formulation of the VBPP, which reduces the number of item sizes by rounding. The linear objective function is implicitly constrained and solved with the Ellipsoid method by the separation oracle. Unfortunately, computational experience with Ellipsoid Algorithm showed a disappointing gap between the theoretical promise and practical efficiency for solving implicitly given linear programs (Gröetschel et al., 1993). Computational approach to optimization mimics some natural processes (e.g. simulated annealing) and implicitly “believes” that this leads to optimal solution. To widen the 2
search, stochastic processes (e.g. genetic algorithms) are applied with local search metaheuristics. Scholl and Klein (1997) uses Tabu search meta-heuristics to prevent cycling to previous optimal solution space. Genetic algorithms (GA) gained its reputation as the most popular stochastic optimization algorithms. Classical GA encoding with constant-size chromosomes leads to invalid solutions that even repair operator cannot compensate. Falkenauer (1998) proposed variable-sized encoding (GGA) that treats bins as groups. This arguably violates original theory of the GA hyper-plane sampling, as do violate all derived methods (e.g. Memetic) with additional meta-heuristics. In fact, various ideas can be applied in pursuit to the “nice” optimum solution. Performance of ideas implemented is then verified by practical (usually hard) examples. In the presence of readily available computational power, approach with stochastic sampling and meta-heuristics is often the only one that can provide some optimized results including all specifics of the production.
2
Hybrid Grouping Genetic Algorithm
Here we concentrate in solving problem specifics presented in Introduction. Examining the problem distribution in Fig. 1 again we notice that there are no small items. Secondly, problems are regarded as offline, i.e., there is sufficient computational time available to solve the cutting problem with a minimal waste. Cutting stock can be variable if particular judgments of supply and transportation costs are obeyed. Considering the size of the problem we start from adaptation of our HGGA (Kos and Duhovnik, 2002) and apply some additional specializations and techniques tailored. As VBPP can’t specify optimal solution (stopping criterion) the whole interface to the optimization can be regarded as a simulation where all parameters can be controlled and even perturbed during the search. Such approach is not uncommon (see Kljajić et al., 2003) when integer-programming like decisions needs to be monitored. The framework of the HGGA, as a population heuristic method, works in various steps, which are repeated several times to reach the desired packing when searching for the best solution. General steps used in the VBPP are described below: Step 1. The initial population (100 individuals) is generated as a set of valid chromosomes using
grouping genetic encoding. The only requirement is that it is capable of producing valid chromosomes which are diversified in search space. To provide good initial population, we implemented VBBk by Burkard and Zhang (1997). Step 2. Evaluation determines the fitness f of each individual. Promotion of full bins f=1/N ∑ i=1..N (Fi /Ci )k is obtained with exponent k > 1. N is the number of bins used for individual, Fi the sum of the items in i-th bin, and Ci the capacity of the i-th bin. Step 3. Selection (duplication) generates an intermediate generation with a doubled number of individuals. The probability of copying a member into the intermediate generation is defined by the member fitness using Stochastic Universal Sampling. Step 4. Crossover is an operation which passes properties of the selected parents to their offspring. GGA employs random bin range selection from two random parents. Common items are removed and assigned for use in Adaptation. Number generated of individuals remains the same during the search. 3
Step 5. Adaptation for the VBPP is divided into two consecutive procedures: a) Local optimi-
zation is used to repack the eliminated elements and possibly improve “repair” already packed bins; b) For the rest of unassigned items new bins are opened with best fitness by solving Multiple Subset Sum Problem (MSSP) with an algorithm based on the separability property by Horowitz and Sahni (1974). Step 6. Mutation is sparsely applied to introduce diversity into the population by randomly eliminating the worst and some random individuals. Adaptation is applied afterward. Step 7. Stop criteria should be verified with Step 2 by setting acceptable level, number of generations or manual halt. Cycling continues with Step 3. Result is given by the best individual that is preserved during search. Again, we refer to (Kos and Duhovnik, 2002) for details, and (Falkenauer, 1998) for introduction.
3
Results
As an example of typical I-beam length distribution as shown in Fig. 1 we performed comparison of the HGGA for different bin sizes. In Fig. 2(a) we reduced VBPP to classical BPP and tried to solve the problem by single bin size. Such use is justified with the rationale of simplicity. 1.0
C = 9m
1.0
C = 12m
C = {5, 6, 7}m
C = 6m
0.9
fitness
fitness
0.9
(b)
(a)
0.8
0.8
C = 7m 0.7
0
500
1000
1500
2000
generation number
2500
3000
3500
0.7
0
500
1000
1500
2000
2500
generation number
3000
3500
Figure 2: (a) Single bin performance for lengths 6m, 7m, 9m and 12m compared to (b) variablesized solution with lengths 5m, 6m and 7m. Thick lines represent preserved best individual whereas thin lines show best current generation fitness.
With 3m mean length and no small items one can expect best results at multiples of that size. This is evident for lengths 6m, 9m and 12m. Increasing the size to 7m does not improve overall fitness. Surprisingly, we found a “perfect” fit f = 0.994 with the largest available I-beam after just 3450 generations steps. However, using 12m I-beams is unpractical for transportation and handling. Instead we tried VBPP lengths that sum up to 12m. Fig. 2(b) shows solution where lengths of 5m, 6m, and 7m were permissible as they can be ordered with a single cut at works with no additional penalties. Fitness f = 0.991 was obtained with 62x5m, 245x6m and 29x7m beams with a majority of two items per bin. Additional examples showed similar characteristics on performance with running times from few minutes to an hour.
4
4
Conclusion
We have shown how the hybrid genetic algorithm with meta-heuristics can be used for packing large items with variable-sized bins of particular sizes. To reduce computational complexity of the exact MSSP we introduced adaptation with reasonable number of the “repair” items. In the presence of no-free-lunch theorem for optimization we can interpret our results as applicable. We are aware that domain specific knowledge can improve overall results. So does the persistence of the simulation operator. GA includes many configurable parameters that can be used to support him. At present stage results are satisfactory, but additional requirements like even distribution of long and short beam sizes are hard to implement. Although convergence to “nice” solution is fast we are (always) faced with the question: “Can we get it better than this?” One of the weaknesses of GA is repeating fitness evaluation. To overcome this one can apply Tabusearch like look-up table and broaden the search space on the expense of computational speed. Parallel processing on clusters, graphics processors (GPUs) or commodity hardware can nowadays be employed for that. REFERENCES
R. E. Burkard and G. Zhang. Bounded space on-line variable-sized bin packing. Acta Cybernetca, 13(1):63–76, 1997. E. G. Coffman, J. Y.-T. Leung, and J. Csirik. Variable-Sized Bin Packing and Bin Coveing, chapter 34, pages 34.1–34.11. Chapman and Hall/CRC, 2007. ISBN 978-1-58488-550-4. doi:10.1201/9781420010749.ch34. L. Epstein and A. Levin. An APTAS for generalized cost variable-sized bin packing. SIAM Journal on Computing, 38(1):411 – 428, 2008. ISSN 00975397. doi: 10.1137/060670328. E. Falkenauer. Genetic Algorithms and Grouping Problems. John Wiley & Sons, 1998. D. K. Friesen and M. A. Langston. Variable sized bin packing. SIAM Journal on Computing, 15 (1):222–230, 2 1986. M. Gröetschel, L. Lova´sz, and A. Schrijver. Geometric algorithms and combinatorial optimization. Springer-Verlag, Berlin, New York, etc., 2nd corrected edition, 1993. E. Horowitz and S. Sahni. Computing partitions with applications to the knapsack problem. Journal of the ACM, 21(2):277–292, 1974. M. Kljajić, I. Bernik, and U. Breskvar. Production planning using simulation and genetic algorithms in multi-criteria scheduling optimization, pages 193–208. P. Lang verlag, Frankfurt am Main, 2003. ISBN 978-3-631-50407-9. L. Kos and J. Duhovnik. Cutting optimization with variable-sized stock and inventory status data. Int. J. Prod. Res., 40(10):2289–2301, 2002. F. D. Murgolo. An efficient approximation scheme for variable-sized bin packing. SIAM Jounal on Computing, 16(1):149–161, Feb. 1987. A. Scholl and R. Klein. Bison: A fast hybrid procedure for exactly solving the onedimensional bin packing problem. Computers & Operations Research, 24(7):627–645, 1997. G. Wäscher, H. Haussner, and H. Schumann. An improved typology of cutting and packing problems. European Journal of Operations Research., 183(3):1109 – 1130, 2007. ISSN 03772217. doi:10.1016/j.ejor.2005.12.047. 5