An Genetic Algorithm Approach to Solve the General Lot Sizing and ...

1 downloads 0 Views 289KB Size Report
Abstract. This paper presents preliminary results found by a genetic algorithm solving the general lot sizing and scheduling problem (GLSP) with single machine, ...
An Genetic Algorithm Approach to Solve the General Lot Sizing and Scheduling Problem C LAUDIO FABIANO M OTTA T OLEDO1 M ÁRCIO DA S ILVA A RANTES2 R ENATO R ESENDE R IBEIRO DE O LIVEIRA2 L UCAS DE O LIVEIRA3 PAULO M ORELATO F RANÇA4 UFLA - Universidade Federal de Lavras DCC - Departamento de Ciência da Computação P.O. Box 3037 - Campus da UFLA 37200-000 - Lavras (MG)- Brazil 1 [email protected] 2 (marcio,renatorro)@comp.ufla.br 3 [email protected] 1,2,3

UNESP - Universidade Estadual Paulista Departamento de Matemática,Estatística e Computação R. Roberto Simonsen, 305, CEP 19060-900, P. Prudente (SP) - Brazil 4 [email protected] 4

Abstract. This paper presents preliminary results found by a genetic algorithm solving the general lot sizing and scheduling problem (GLSP) with single machine, sequence dependent setup cost and penalties for demands not satisfied. A set of instances are generated for this problem where solutions are first obtained using the solver CPLEX. Next, these solutions are used as benchmark to evaluate the GA results. The results found by GA shows its promising performance for the set of instances solved. Keywords: Lot sizing, scheduling, genetic algorithm, heuristic. 1

Introduction

The present paper reports initial results for applying a Genetic Algorithm (GA) to solve the general lot sizing and scheduling problem (GLSP) with a single machine, sequence dependent setup costs and penalties for demand shortages. The GA used has individual hierarchically structured in ternary tree. A mathematical model and a set of instance are presented for the GLSP. First, the mathematical model and the set of instances are coded and solved using the package GAMS/CPLEX. Next, the solutions found are used as benchmark to evaluate the GA performance. A review about lot sizing and scheduling problems can be found in [4] and [12]. These works review models and methods for several lot sizing problems. Models and algorithms are reviewed in [15] for the dynamic demand and coordinate lot-size problems. This class of problem includes single and

multiple items, coordinated and uncoordinated structures of setup, uncapacitated and capacity problems. In [5] Fleischmann and Meyr introduced the General lot sizing and scheduling problem (GLSP). They present a mathematical model for GLSP with single machine and sequence dependent setup cost. Threshold accepting heuristic is applied to solve the same set of instances proposed in [9]. The GLSP with setup time and cost is studied in [13]. Simulated annealing and threshold accepting associated with an exact algorithm are described as approaches to solve this problem. The same approach is used to solve the GLSP with parallel machines in [14]. GLSP is a capacitated lot sizing and scheduling problem (CLSP) which is a NP-hard optimization problem second [1]. There are multi-item in the GLSP studied in this paper and the multi-item CLSP is strongly NP-hard [3]. Therefore, this work proposes a

� ����������������������� �������������������������������������������������������������������������������������������������������

genetic algorithm (GA) as approach to solve the GLSP. Genetic Algorithms are evolutionary computational methods that simulate biological processes [10]. They have been used to solve real-world problems [8]. A review on meta-heuristics applied to solve lot sizing problem is presented in [11] where issues as solution representation and neighborhoods are evaluated. A hybrid genetic algorithm with individuals hierarchically structured was applied by [2] to solve the asymmetric traveling salesman problem. The total tardiness single machine scheduling problem was also solved using GA with hierarchically structured individuals by [7] with better results reported. The same approach was applied in [6] to solve the problem of scheduling a flowshop manufacturing cell with sequence dependent family setups. A multi-population GA with a hierarchical ternary tree structure for individuals was proposed by [16] as a first approach to solve the so-called synchronized and integrated lot sizing and scheduling problem. Next section presents a mathematical model for GLSP. In section 3, the genetic algorithm proposed is described. The computational results are in section 4 and the conclusions of this work are reported in section 5. 2

Mathematical Model

A mathematical model is described for the single machine GLSP with sequence dependent setup cost and penalty for demands not satisfied. This model is almost the same presented in [13] where the present paper includes shortage variables as main difference. These variables are included at inventory constraints and objective function. Time horizon is divided in T macroperiods and each macro-period t has a set of microperiods S. The macro-periods have the same length, but the micro-periods inside each macro-period are not equal. The length of each micro-period is defined as the production time spent to produce a product assigned to it. The Figure 1 illustrates this idea for three products (P 1, P 2 and P 3) with three micro-periods for each macro-period.

assigned to micro-periods s1, s4 and s6 spend only 1 time unit and product P 2 in s2 spend 2 time unities. The mathematical model is described next, where it is taken into account J products, T macro-periods and S micro-periods for each macro-period. Parameters: Ct : Capacity available in time unities on macro-period t. T Pj : Processing time of product j. M inj : minimum lot size of product j. Hj : Inventory cost of product j. CTij : Setup cost of product i to product j. Djt : Demand of product j in macro-period t. Ij,0 : Initial inventory of product j. yj,0 : 1, if product j is set up initially on machine; 0 otherwise. Pj : Penalty unit for each demand of product j not satisfied. Set: St : Set of micro-periods in macro-period t. Variable: Ijt : Inventory of product j at the end of micro-period t. qjs : Lot size of product j produced in micro-period s. qj0 : Demand of product j not satisfied at all. yjs ∈ {0, 1} : if product j is assigned to micro-period s, then yjs = 1; 0 otherwise. zijs ≥ 0 : if there is a changeover from product i to j in micro-period s, then zijs = 1; 0 otherwise. min T J � � j=1 t=1

(Hj · Ijt ) +

J � T.S J � � i=1 j=1 s=1

Figure 1: Example of macro and micro-periods.

The size of micro-periods s1, s2, s3, s4, s5 and s6 is proportional to processing time of products P 1, P 2, P 1, P 2, P 3 and P 1 in line L1, respectively. Product P 3 spend more available capacity in macro-period 2, therefore micro-period s5 is the largest one. Products

+

(CTij · zijs ) J �

(Pj · qj0 )

(1)

qjs − Dj1 ∀j ∈ [1, J]

(2)

j=1

subject to: Ij1 = Ij0 + qj0 +

S � s=1

������������������������������������������������������������������������������������������������������� �����������������������������������������������

������������������������������������������������������������������������������������ ������������������������������������������������� �������������������������������������������������������������������������������������������������������

Ijt = Ij,t−1 +



s∈St J � �

j=1 s∈St

qjs ≤

qjs − Djt ∀j ∈ [1, J], t ∈ [2, T ]

(T Pj · qjs ) ≤ Ct ∀t ∈ [1, T ]

Ct · yjs ∀j ∈ [1, J], s ∈ [1, T.S] T Pj

(3) (4) (5)

qjs ≥ M inj · (yjs − yj,s−1 ) ∀j ∈ [1, J], s ∈ [1, T.S] (6) J � yjs = 1 ∀s ∈ [1, T.S] (7) j=1

zijs ≥ yi,s−1 + yj,s − 1 ∀i, j ∈ [1, J], s ∈ [1, T.S] (8) The objective function minimizes inventory and setup costs. Demand shortages are stored by variables qj0 and penalized at objective function. Constraints (2) and (3) determine the inventory for each macro-period, where demand shortage is accumulated by qj0 at the first time period. This allows that inventory constraints in other periods can be satisfied. Constraint (4) guarantee that available capacity in each period t will not be violated. The product lot size is limited by constraint (5). This constraint also defines that nothing will be produced, if there isn’t a product assigned in some microperiod (yjs = 0). The constraint (6) defines a minimum lot size when a new product occurs in two consecutive micro-periods. However, if the same product is allocated for two consecutive micro-periods, a minimum lot size does not need to be produced. Constraint (7) allows producing only one product in the same microperiod and constraint (8) defines product changeover. 3 3.1

Genetic Algorithm Approach Pseudocode and Population structure

Figure 2 presents a pseudo code for the proposed genetic algorithm (AG). First, the population is initialized, evaluated and hierarchically structured as a ternary tree. This type of structure disposes individuals in clusters with one leader node (individual) and three followers as shown in Figure 3. The leader has always better fitness value than its followers. The fitness in the proposed GA will be the objective function (1) of GLSP, so better individuals are those with smaller fitness (cost) value. In Figure 3, the fitness of each individual is represented by node value. This GA has time limit as stop criterion and the population evolves until convergence is reached. Genetic operators are responsible for create new individuals evolving population. Initially two individuals are

Genetic Algorithm While (execution time is not reached) Initialize, evaluate and structure individuals; While (there is no convergence) For i ← 1 to numberOf Crossovers Select parent individuals’ child ← crossover(parents) mutation (child) insert(child) Rearrange individuals. End for End while End while End Genetic Algorithm Figure 2: Genetic Algorithm pseudo code

Figure 3: Population hierarchically structured as ternary tree.

selected as parents that will generate a new individual (child) using crossover operator. This is done selecting randomly a cluster where a leader is always chosen as the first parent and one of its followers, randomly chosen, will be the second parent. Mutation operator is executed next in the child, if a random value λ ∈ [0, 1] is less than a mutation rate. The fitness of the child is evaluated and if this value is better than one of its parents, the new individual replaces the worst parent. This crossover and insertion process is illustrated by Figure 4. After child insertion, population is restructured aiming to keep population hierarchically structured (Figure 5).

Figure 4: Parent selection and child insertion.

������������������������������������������������������������������������������������������������������� �����������������������������������������������

� ����������������������� �������������������������������������������������������������������������������������������������������

be calculated just after defining lot size for each product. Lot sizes are established by a heurisitic method defined in Figure 7. This method is based on greedy-mod algorithm proposed in [5]. It is a heuristic that defines lot sizes minimizing inventory costs. Lot size method For t ← T to 1

Figure 5: Keeping population strucutre.

The evolution process described is repeated according to parameter numberOf Crossover defined next: numberOf Crossover ← popSize · crossoverRate (9) This amount is proportional to population size and it is defined using parameter crossoverRate. If new individuals are not inserted, convergence is reached and all individuals in the population are reinitialized, except the best individual. 3.2

Individual and Fitness

An individual in the genetic algorithm (GA) proposed is a representation of solution for the general lot sizing and scheduling problem (GLSP). It is a sequence of products assigned to micro-periods that can be produced in each macro-period. Figure 6 shows a possible individual, where it will produce products P 1−P 3−P 2 at the first macro-period T 1, P 2−P 3 in the next macroperiod and P 3 − P 1 in T 3.

//—–Minimum lot —— For all product-j with Yjt > 0 p ← min( M inj · Yjt , Dj − ACjt ); Update Xjt , Kt , Dj ; If Kt < 0 then Penalize capacity violation; End for //—-Avoiding infeasibilities —For all product-j Q ← Dj − LSjt ; If (Yjt > 0 e Q > 0) p ← min( Dj − ACjt , Kt /T Pj , Q); Update Xjt , Kt , Dj ; End for //– Allocating demand remaining – For product-j with Yjt > 0 in Hj /T Pj descending order p ← min( Dj − ACjt , Kt /T Pj ); Update Xjt , Kt , Dj ; End for End for //–Defining variables qj0 e qjs — ← Dj , for all product-j. For all j, t and s ∈ St If Yjt > 0 then qjs ← Xjt /Yjt ; Else qjs ← 0; qj0

End Lot Size method Figure 7: Pseudocode for Lot size method

Parameters: Figure 6: Example of individual.

This representation of solution is the same proposed in [5]. It is not possible to have identical products in two consecutive positions. However, the last product in a macro-period can be the first one in the next macroperiod. It is also not possible an empty entry between two products. The fitnesss value of each individual is defined by the objective function (1) presented in section 2. It is necessary to calculate inventory and setup costs as well as penalties for demand shortages. The setup costs can be determined from individual once that sequence of production in each macro-period is already known. However, the inventory and penalties costs can

Yjt : number of product j lots in macro-period t. ACjt : demand of product j accumulated until macroperiod t − 1. LSjt : upper bound for amount of product j that can be produced before macro-period t. Variables: Xjt : total amount of product j that will be produce in macro-period t. Dj : total demand of product j that need to be produced.

������������������������������������������������������������������������������������������������������� �����������������������������������������������

������������������������������������������������������������������������������������ ������������������������������������������������� �������������������������������������������������������������������������������������������������������

Kt : available capacity in macro-period t. Initially parameters Yjt , ACjt and LSjt must be calculated from problem data and from sequence of production defined in each individual. The parameter LSjt is defined next: LSj,1 = 0 LSj,t+1 = LSjt + min(1, Yjt ) ·

(10) Kt T Pj

(11)

Variables Xjt are initialized with value zero, Dj receives the total demand of product j and Kt is initialized with value of Ct . The method defines lots from the last to the first macro-period. First, a minimum amount is defined for each product assigned to some micro-period in the macro-periods of individual. Next, lot sizes are calculated for products that if they are not produced now, there won’t be available capacity to produce them, or the products aren’t in some sequence of production in other macro-periods. At this point, the objective is to avoid infeasibilities. Finally, all products in production sequences have their lots resized following the order of decreasing values Hj/T P j. Figure 8 shows how the values Xjt , Kt e Dj are updated.

Figure 9: One-point and uniform crossover

Delete: delete a product p from a micro-period randomly selected. Swap: swap two products p and p� from two microperiods randomly selected. Figures 10, 11 e 12 ilustrate insert, delete and swap mutation operators, respectively.

Update Xjt , Kt , Dj for lot size p previously calculated Xjt ← Xjt + p; Kt ← Kt − p; Dj ← Dj − p; Figure 8: Updating Xjt , Kt , Dj

3.3

Figure 10: Insert mutation

Crossover and Mutation operators

Two types of crossover operator are randomly selected to be applied over parent individuals: one point and uniform. In the one point crossover, the new individual (child) inherits all production sequence from the first parent until the cut point and from the second parent after this cut point. This point is randomly selected. In the uniform crossover, the new individual inherits a product from one of its parents. Each sequence position in the child is inherited sorting which parent will provide the product for that position. Figure 9 illustrates onepoint and uniform crossovers, where the highlighted positions are those inherited by the new individual. Three types of mutation operators are defined which are also randomly selected to be applied over a child. Parameters t, p and s are, respectively, macro-period, product and micro-period: Insert: insert a new product p in micro-periods randomly selected.

Figure 11: Delete mutation

Figure 12: Swap mutation

However, the genetic operators can produce a new individual with the same product in two consecutive positions. To avoid this problem, a repair is also applied as illustrated by Figure 13.

������������������������������������������������������������������������������������������������������� �����������������������������������������������

� ����������������������� �������������������������������������������������������������������������������������������������������

Table 2: Results for I1 and I2

Figure 13: Repair operator

4

Computational Results

A total of 40 problem instances were generated using the same parameters proposed in [9] and shown by Table 1. The parameter U(%) is the expected capacity utilization and T , S, J are the number of macro-periods, micro-periods and products, respectively. Other problem parameters were set using the same values presented in [9]. Table 1: Parameters for Set of Instances Set I1 I2 I3 I4

T 6 6 5 5

S 4 4 4 5

J 4 4 4 5

I1 I11

Cplex 1500,88

I12

1450,94

I13

1567,7

I14

1495,22

I15

1652

I16

1545

I17

1535,79

I18

1585,08

I19

1561,06

I110

1703,64

U (%) 80 90 90 90

I2 I21

Cplex 1594,74

I22

1953,44

I23

1462,42

I24

1747,28

I25

1717,43

I26

1669,74

I27

1680,83

I28

1811,05

I29

1661,52

I210

1477,75

GA 1596,74 0,13 1975,62 1,14 1503,42 2,8 1750,93 0,21 1718,84 0,08 1669,74 0 1686,82 0,36 1825,59 0,8 1691,81 1,82 1515,28 2,54

Table 3: Results for I3 and I4 I3 I31

There are 10 instances in each set I1, I2, I3 and I4. For example, I1 is a set with 10 instances all of them created to represent problems with 6 macro-periods, 4 micro-period in each macro-period, 4 products and 80% of capacity utilization. The mathematical model and the problem instances were first coded using computational package GAMS and solved by CPLEX solver, version 12.0. The solver was executed during 1 hour for each instance. GA ran over each instance 10 times spending 1 hour per execution. The method was adjusted with 40 individual, 20 of crossover rate and 0.95 of mutation rate. All computational tests were done using a core 2 Duo with 2.66 GHz, 1.95 GB of RAM. Computational results found by CPLEX and GA are compared in Tables 2 and 3. The solver was able to find optimal solution in all instances on sets I1, I2 and I3, except in instance I19 of set I1. In the set I4, GAMS/CPLEX returned the best feasible solution found within 1 hour. This results show that the exact approach has problems to return optimal solution in the set I4 that is the most complex one, if it is taken into account the value of parameters U , T , S and J. Tables show the average value for the final solutions returned by the genetic algorithm (GA) after its 10 executions over a same instance. It is also presented the deviation Dev(%) = 100 · (Z − Z ∗ )/Z ∗ , where Z is the average value of GA final solutions and Z ∗ is the value of GAMS/CPLEX final solution.

GA 1507,49 0,44 1457,65 0,46 1576,33 0,55 1496,12 0,06 1653,01 0,06 1552,35 0,48 1540,65 0,32 1589,41 0,27 1561,06 0 1705,38 0,10

I32 I33 I34 I35 I36 I37 I38 I39 I310

Cplex 1443,00 0,00 1393,07 0,00 1383,75 0,00 1670,51 0,00 1420,35 0,00 1599,29 0,00 1385,34 0,00 1326,13 0,00 1442,04 0,00 1405,01 0,00

GA 1443,00 0,00 1450,39 4,11 1401,00 1,25 1670,51 0,00 1466,80 3,27 1606,88 0,47 1385,60 0,02 1326,13 0,00 1451,38 0,65 1405,01 0,00

I4 I41 I42 I43 I44 I45 I46 I47 I48 I49 I410

Cplex 1930,14 0,00 2029,00 0,00 1730,51 0,00 1881,86 0,00 1773,44 0,00 2038,53 0,00 1634,00 0,00 1806,00 0,00 1874,82 0,00 1938,70 0,00

GA 1930,84 0,04 2030,06 0,05 1757,28 1,55 1901,69 1,05 1813,26 2,25 2068,25 1,46 1629,87 -0,25 1851,84 2,54 1911,02 1,93 1947,36 0,45

GA found average solution values with deviation less than 1% from GAMS/CPLEX solutions. This happen for 27 out of 40 instances. There are 6 instances where the GA was able to return the optimal solution in all 10 executions. GA returned average results better than GAMS/CPLEX for instance I37 which means that GA found in average better solutions than the final feasible solution of GAMS/CPLEX. Figure 14 presents the average deviation of GA from GAMS/CPLEX for each set of instances. The GA is

������������������������������������������������������������������������������������������������������� �����������������������������������������������

������������������������������������������������������������������������������������ ������������������������������������������������� �������������������������������������������������������������������������������������������������������

able to return deviation less than 1.2% taking into account the 10 final average results for all 10 instances in each set. As expected, these values increase following the complexity of each instance parameter.

ing salesman problem. 10(5):483–506, 2004.

Journal of Heuristics,

[3] Chen, W. and Thizy, J. Analysis of relaxations for the multi-item capacitated lot-sizing problem. Annals of Operations Research, 26:29–72, 1990. [4] Drexl, A. and Kimms, A. Lot sizing and scheduling - survey and extensions. European Journal of Operational Research, 99:221–235, 1997. [5] Fleischmann, B. and Meyr, H. The general lotsizing and scheduling problem. ORSpektrum, 19:11– 21, 1997.

Figure 14: Average deviation

5

Conclusion

This paper presents initial results applying a Genetic Algorithm (GA) to solve the General Lot Sizing and Scheduling problem (GLSP). The GA presents individuals hierarchically structured in ternary tree with a tailormade evolution process. This method solves instances of the GLSP with a single machine, sequence dependent setup cost and penalty for demand shortage. A total of 40 instances are created and solved. First, these instances are solved by GAMS/CPLEX that was able to return optimal solution in 29 out of 40 instances. However, the exact approach was not able to return optimal solution in the most complex set of instance I4. The proposed GA was evaluated taking into account its average final results after 10 executions over each instance. The metaheuristic presents in average small deviations from GAMS/CPLEX solutions. This means that this initial version of the proposed GA presents some stability on its final results. The GA is able to improve the best feasible solution found by GAMS/CPLEX in some instances and it also found optimal solutions for some instances. These promising results allows to improve and evaluate this GA approach in more complex set of instances as future works as well as to extend this approach to solve the GLSP with parallel machines References [1] Bitran, G. and Yanasse, H. Computational complexity of the capacitated lot size problem. Management Science, 28(10):1174–1186, 1982. [2] Buriol, L., França, P., and Moscato, P. A new memetic algorithm for the asymmetric travel-

[6] França, P., adn A.S. Mendes, J. G., Moscato, P., and Veltink, K. Evolutionary algorithms for scheduling a flowshop manufacturing cell with sequence dependent family setups. Computers & Industrial Engineering, 48:491–506, 2005. [7] França, P., Mendes, A., and Moscato, P. A memetic algorithm for the total tardiness single machine scheduling problem. European Journal of Operational Research, 132(1):224–242, 2001. [8] Gen, M. and Cheng, R. Genetic algorithms & engineering design. John Wiley & Sons New York NY, 1997. [9] Haase, K. Capacitated lot-sizing with sequence dependent setup costs. ORSpektrum, 8:51–59, 1996. [10] Holland, J. Adaptation in natural and artificial systems. The University of Michigan Press, 1975. [11] Jans, R. and Degraeve, Z. Metaheuristics for dynamic lot sizing: A review and comparison of solution approaches. European Journal of Operational Research, 177:1855–1875, 2007. [12] Karimi, B., Fatemi, S. G., and Wilson, J. The capacitated lot sizing problem: a review of models and algorithms. Omega, 31:365–378, 2003. [13] Meyr, H. Simultaneous lotsizing and scheduling by combining local search with dual reoptimization. European Journal of Operational Research, 120:311–326, 2000. [14] Meyr, H. Simultaneous lotsizing and scheduling on parallel machines. European Journal of Operational Research, 139:277–292, 2002.

������������������������������������������������������������������������������������������������������� �����������������������������������������������

� ����������������������� �������������������������������������������������������������������������������������������������������

[15] Robinson, P., Narayananb, A., and Sahinc, F. Coordinated deterministic dynamic demand lotsizing problem: A review of models and algorithms. Omega, 37:3–15, 2009. [16] Toledo, C., França, P., Morabito, R., and Kimms, A. Multi-population genetic algorithm to solve the synchronized and integrated two-level lot sizing and scheduling problem. International Journal of Production Research, 47(11):3097–3119, 2009.

������������������������������������������������������������������������������������������������������� �����������������������������������������������

Suggest Documents