Genetic Algorithms and Sensitivity Analysis in Production Planning Optimization CECÍLIA REIS 1,2, LEONARDO PAIVA 2, JORGE MOUTINHO 2, VIRIATO M. MARQUES 1,3 1 GECAD Knowledge Engineering and Decision Support Research Centre 2 Electrical Engineering Department Institute of Engineering of Porto R. Dr. António Bernardino de Almeida, 42-72 Porto PORTUGAL {cmr,1832,185141}@isep.ipp.pt 3 Computer Science Department Institute of Engineering of Coimbra Quinta da Nora, 33-199 Coimbra PORTUGAL viriato@isec.pt Abstract: - This work presents a Genetic Algorithm (GA) to solve a planning production problem in fertilizer manufacturing. It also addresses the complete specification of a GA, since the modeling of the problem and its respective constraints, passing through the choice of techniques for initialization and selection, setting the values of operators such as crossover and mutation, among other factors. It was found that in this case, the use of a GA as a technique of resolution led to a detailed analysis of the problem at hand, which could be examined in several contexts of an optimization scenario. Key-Words: - Genetic Algorithms, Production Planning, Sensitivity Analysis 1 Introduction The cultural, political, economic and technological transformations that occurred over the centuries provided the expansion of companies that achieved the economic leadership as their products or services were made competitive anywhere in the world. The business competition has brought the need to find solutions that lead to a better use of resources, reducing costs and time as well as higher quality, better alignment with customers and also higher incomes. In many cases the experience is enough to achieve these objectives and address these problems. Nevertheless, the introduction of more variables in analysis and strategic definitions exponentially increases the problem complexity, performance achievement and the attainment of reliable indicators. Therefore, new mechanisms are required to lead to better solutions in different optimization processes. The concept of optimization is well identified as a mechanism to review complex decisions involving the selection of values of variables, with the simple objective of quantifying the performance and measuring the quality of the decisions [1]. The difficulty in finding the proper relationship between variables and between variables and restrictions leads the formulation of a real problem to a simple "good approximation ", which can then be improved with the introduction of theoretical knowledge, modeling experience, sensitivity in capturing the essential elements of the problem and especially with critical capacity in the interpretation of results, which is indispensable for meaningful conclusions. When it comes to complex problems, not all search methods find the best solution. There are different optimization techniques for different types and classes of problems. One of the procedures to evaluate and validate the choice of the best search technique is to check the success in reaching the solution over the numbers of executions. This is a key measure in several algorithms which include GAs. 2 GAs in Production Planning Davis [2] was one of the researchers who suggested the application of GAs to production planning and scheduling problems. He also states the utility of probabilistic local search methods in environments with large space searches and suggests an indirect representation, in which the GA operates on a list that has to be coded to form the production sequence (scheduling). From this fact, many applications have been proposed, aimed to several different types of planning and scheduling production problems. The ISSN: 1792-46X 246 ISBN: 978-96-474-216-5
representation for a class of problems can also be applied to other classes. However, small changes in the problem may require different representations. There are several references in the literature on the application of GAs to solve planning problems, such as shipments at port terminals, allocating employees in working shifts and provision of manufacturing resources, among others. 3 Fertilizers Production Problem This section presents a production plan problem for the manufacturing of two products with the aim of maximizing the total income, subject to imposed and intrinsic restrictions. A company manufactures two types of phosphate fertilizers, phosphate-hi and phosphate-li, composed by three macronutrients: nitrogen (N), phosphorus (P), and potassium (K). Table 1 shows the problem data. Material Phosphate-Hi Phosphate-Li Table 1: Problem data Amount of material available per month (tons) N 2 1 15 P 1.5 1 12 K.1 2 Sale price per ton (1^4 ) Tons of material required to produce one ton of fertilizer 2.24 1.49 Another important data is that the manufacturer has the capacity to store a maximum of 2 tons of fertilizer and for production balance reasons the quantity of each fertilizer to produce should not be less than 3% of the total production. 3.1 Mathematical Formulation Solving any optimization problem begins by its modeling, which consists of translating the problem into mathematical language, starting with the definition of variables, identification of the objective function (fitness function) and identification of restrictions in order to obtain a model that allows an objective resolution of the problem. Therefore, the two variables of this problem are: 1) hi (X 1 ) quantity, in tons, of phosphate-hi fertilizer to be produced; 2) li (X 2 ) quantity, in tons, of phosphate-li fertilizer to be produced. The objective of this problem is to maximize the monthly revenue from the sale of fertilizers produced, according to the established prices. So, the objective function can be formulated as follows: Given the limitations imposed on table 1 - the available quantities of each of the materials used in the manufacture of the fertilizers, the storage capacity and the minimum ratio of production of each of the fertilizers, the following restrictions must be considered: (2) (3) (4) (5) (6) (7) (8) 4 Resolution using the Excel Solver The Solver option [3] is part of a set of commands sometimes called hypotheses analysis tools, defined in Excel Help as: How to change the values of cells to analyze how these changes affect the result of the formulas in the spreadsheet. The results obtained by this method as well as the sensitivity analysis provided allowed a better understanding of the current problem. Next figures - 1, 2 and 3 - present the solution of the problem, the sensitivity analysis and a bound report. Decision variable F.O. X1 X2 1791 6 3 Objective Function Coefficients Constraints Coefficients X1 X2 X1 X2 Left Side Right Side 2,24 1,49 Availability Of Material 1 2 1 15 15 Availability Of Material 2 1,5 1 12 12 Availability Of Material 3,1 6 2 Availability Of Storage 1 1 9 2 X1> = 3% * (X2) 1 6 27 X2> = 3% * (X1) 1 3 27 Figure 1: Excel Solver solution (1) Figure 2: Sensitivity analysis ISSN: 1792-46X 247 ISBN: 978-96-474-216-5
Figure 3: Excel report 4.1 Sensitivity analysis Understanding the problem is an essential request for its proper modeling in order to obtain an adequate solution [4]. Besides the way the chromosome is encoded, there are several GA parameters that can be configured to improve the GA performance by adapting it to particular characteristics of the problem. One of many conclusions about the GAs is the one that specifies that a specific modeling of the problem is more effective than applying a generic model. Therefore, it is important to know and to have as much information on the problem as possible as well as knowledge on how to interpret the results, removing the possibility of accepting degenerated solutions as optimal solutions. The knowledge factory, the particular knowledge of the process and the experience, are key factors to achieve a correct interpretation of the obtained results. However, this knowledge is not always available to the persons that are working with the optimization tools. So, additional techniques are used to improve the parameters configuration. In this line of thought, figures 2 and 3 help the interpretation of the solution given as optimal. The report presented in figure 2, about the sensitivity analysis, gives information about the active restrictions. For example, although there exists 2 tons of component 3, only 6 tons are being used, giving a tolerance of 14 tons; this means that this restriction is not active. The same cannot be said for the restrictions of components 1 and 2 which are totally spent and represent the optimal solution space of the problem. The report presented in figure 3 allows knowing the maximum that can be reached for the production of X 1 and X 2 fulfilling the restrictions imposed on the problem. This sensitivity analysis is crucial for the interpretation of the results given by the GA and to not accept degenerate solutions as optimal solutions. 4.2 Graphical analysis From the sensitivity analysis obtained by Excel it is possible to do a graphical representation of the problem, in order to facilitate the interpretation of the results. The graphs of figures 4 and 5 were obtained from the Excel Report (figure 2). In this report, the constraints that are active in the problem are known and were represented graphically, as can be observed: Red (Availability of Nitrogen); Blue (Availability of Phosphorus) and Green (Objective Function). Placing the restrictions on a single active graphic, a shaded region comes out, resulting from the intersection of all the constraints. The points inside this region represent pairs of production (X 1, X 2 ) that meet all the constraints. The points outside it do not belong to the set of solutions. Thus, the problem can be interpreted as a problem of search point of the simplex region that provides the highest profit value. In the first graph of figure 4, the lines corresponding to the restrictions were drawn and also the line corresponding to the objective function. In order to obtain the second graph, the line of the objective function was shifted parallel to itself towards the growth of Z in order to reach the last point of contact with the admissible region. This last point corresponds to the optimal solution of the problem. As shown in the graph of figure 5, the values 6 and 3 are obtained for X 1 and X 2, respectively. Figure 4: Graphics obtained from Excel report Figure 5: Graphic showing the optimal solution ISSN: 1792-46X 248 ISBN: 978-96-474-216-5
5 Resolution using GAs This section presents the adopted methodology and the results obtained from experiments carried out with the application of a GA [5, 6, 7] to this problem. In order to obtain the best results, the settings for representation, operators, fitness function and selection should be tuned as a balanced package. 5.1 Parameters The analyzed parameters were: i. Parameter A: size of population of individuals processed in each generation; ii. Parameter B: crossover rate, feasibility of implementation, where necessary: adopted for the probability of crossover operator; iii. Parameter C: mutation rate, feasibility of implementation, where necessary: probability adopted for the mutation operator; iv. Parameter D: total number of generations; v. Parameter E: use or non-elitist strategies during processing; vi. Parameter F: type of selection adopted; vii. Parameter G: function evaluation; viii. Parameter H: stopping criterion. 5.2 Implementation The GA was implemented in Matlab 29 and the following table (table 2) lists the adopted parameters: Genetic Parameters Population Size 3 Elitism Rate 16% Type of Mutation mutationadaptfeasible Maximum Number of Generations 1 Crossover 1 point Selection Tournament Initial Population Generation AGcreationlinearfeasible Table 2: GA parameters Other implementation aspects are: Stopping Criterion - The stopping criterion occurs when the number of generations that was set is reached or when the average variation of the fitness function is less than the tolerance function defined by default; Population Initialization (gacreationlinearfeasible)- This parameter is indicated when there is the objective of solving problems with linear constraints. It creates a random initial population that satisfies all limits imposed by the restrictions; Elitism - Elitism is used with a rate of 16% of the population to join the Elite. It was noted that this is an important aspect for the convergence to the best solution; Selection Criteria - Tournament Selection was used. Four individuals in the population are chosen randomly, and a tournament between them is conducted to pick up which individual will be part of the parents population. The tournament winner is the individual with greater fitness function. Matlab GA Toolbox optimization functions minimize the objective or fitness function. Therefore, since the objective function is a maximizing function it was reversed to be applied in Matlab GA (the winner is the individual with a lower value of the fitness function); Fitness Function - The fitness function was written in a M file and has two variables X 1 and X 2, represented with 1 bits; Mutation - Since it was used the GAOPTIMSET function, the mutation operator used by default is MUTATIONADAPTFEASIBLE. 5.3 Parameters Analysis In the various stages of simulations the influence of the parameters was analyzed. The population size is directly related to the representation of the search space: larger population size leads to better representation. In several implemented scenarios it was found that the choice of the population size influences the maximum adaptability obtained. Although it was used a population slightly larger than the Matlab default, which is 2, it was found that values less than 1 individuals do not alter the last average found, but allow a smaller computational effort. The use of an elitist strategy was fundamental for improving the GA performance. In several simulations the best results were obtained with an elitism rate between 1 and 2%. Along with the elitist strategy, the adopted selection technique significantly affected the GA performance. The first test was implemented applying the roulette method, but in numerous works, several authors have obtained better results with the tournament method, so it was the chosen one. Regarding the crossover operator, it was found that the one point crossover brought better results. The number of generations also influences the system performance. In this way, it was used a confidence value of 1 generations. Table 3 presents the parameterization suggested as a starting point for solving the problem. Parameters Values Population size <=1 Crossover rate.7.9 Mutation rate Matlab default Stop criterion Maximum of generations Crossover type One point Selection strategy Tournament Initial population generation Matlab default Table 3: GA parameterization ISSN: 1792-46X 249 ISBN: 978-96-474-216-5
Number of individuals Number of children Current best individual Fitness value Avergae Distance NEW ASPECTS of APPLIED INFORMATICS, BIOMEDICAL ELECTRONICS & INFORMATICS and COMMUNICATIONS 6 Results Analysis Figures 6 and 7 represent some of the many results obtained with the GA. be to produce 48 tons of both fertilizers, with a revenue of 1.794 1 7. Figure 6: Simulation results generated by the GA Figure 8: Representation of the optimal solutions These two solutions, shown in figure 9, correspond to the maximum and minimum obtained values with a variation of just.3% of the objective function. Figure 7: Simulation results generated by the GA In many simulations it was found that, with minor exceptions, the fitness function value was between 1.794 1 7 and 1.791 1 7. The first result corresponds to the pair of 48 tons for X 1 and X 2, and the second result corresponds to the pair 6 and 3 tones for X 1 and X 2, respectively The graph in figure 8 presents a second set of points corresponding to a production of 48 tons for X 1 and X 2. This production schedule represents the minimum value obtained with this GA within the possible solutions of the objective function. This analysis became clear after the interpretation of the solutions generated by GA, which after the tune of the correct parameters and a significantly number of simulations allowed the observation that the solutions were around 48-6 tons for the production of X 1 and between 3-48 tons for the production of X 2. In terms of revenue (value of the objective function) the optimum value of the solution is between 1.794 1 7 and 1.791 1 7. From the point of view of a higher revenue, the best solution would be to produce 6 tons of X 1 and 3 tons of X 2, which would result in a revenue of 1.791 1 7. From the perspective of production balance and because there is no restriction regarding the amount of both products, the best solution would Figure 9: Set of solutions generated by the GA 7 Matlab Outputs For better presentation of the results, figures 1 and 11 show the images obtained in Matlab. Best: -179432.9387 x 17 Mean: -179432.9387 Average Distance Between Individuals 4 Best fitness -1 Mean fitness 2-2 5 1 Generation Selection Function 2 1 4 2 2 4 6 8 1121416182 Individual Score Histogram -1.794-1.794-1.794-1.794 Score (range) x 1 7 2 4 6 8 1 Generation Current Best Individual Figure 1: Matlab outputs 5 Stall (T) Stall (G) Time Generation 1 2 Number of variables (2) Stopping Criteria 5 1 % of criteria met ISSN: 1792-46X 25 ISBN: 978-96-474-216-5
FVAL NEW ASPECTS of APPLIED INFORMATICS, BIOMEDICAL ELECTRONICS & INFORMATICS and COMMUNICATIONS It is possible to conclude that the value of the fitness function rapidly improves in the first generations, where individuals are far from ideal. The best fitness value quickly stabilizes in subsequent generations, whose populations are closer to the ideal point (chart 1 and 2 of figure 1). The third graph of figure 1 shows the attainment of offspring obtained along the generations. Graph 5 presents the score of these descendants. Due to the fast stabilization of the algorithm at the optimum value of 1.794 1 7, the next generations of children have always the same value. Graph 4 presents the best value for each of the two variables and chart 6 displays the stopping criterion of the algorithm limited by a number of 5 generations, which is the default value. The GA was run in blocks of 5 times, varying the crossover fraction from to 1 in increments of.2. The obtained results are shown in figure 11: the best option for crossover fraction is located between.7 and.8. Therefore, in the simulation the crossover rate was set to.77. -1.793 x 17-1.794-1.795-1.796-1.797-1.798-1.799.1.2.3.4.5.6.7.8.9 1 CrossoverFraction Figure 11: Fitness function versus crossover rate Figure 12: Results with crossover rate of,77 The above presented results were obtained in the first simulations of the algorithm, that is, with all the restrictions of the problem. Since the sensitivity analysis revealed that some of the restrictions were not active, these restrictions were eliminated from the code source, and also the crossover rate was changed to.77. The results generated by the new algorithm on several new simulations presented results closer to the ones obtained by the deterministic methods. 8 Conclusions The GA was effective for solving the problem under study, since in numerous experiments it was possible to find an optimal solution. The efficiency was also evident, since, with few generations it is possible to obtain a solution that meets all constraints of the system with an objective function value very close to the final value obtained by the other optimization method cited in this work. It was observed a variation of only.3% between the worst outcome and the best results. The sensitivity analysis demonstrated to be crucial for the exact understanding of the problem as well as for the correct adjust of the GA parameters. Acknowledgements The authors would like to acknowledge FCT, FEDER, POCTI, POSI, POCI, POSC, and COMPETE for their support to R&D Projects and GECAD. References: [1] Soares, Gustavo L., Genetic Algorithms: Study, New Techniques and Applications - Graduate Thesis in Electrical Engineering, Research Centre in Electrical Engineering, Federal University of Minas Gerais, Brazil, 1997. [2] Davis, L., Handbook of Genetic Algorithms. Reissue edition. Stamford: International Thomson Publishing, 1996. [3] Júnior, A. and Souza, M., Excel (Solver): Reference Manual, Computer Science Department, Federal University of Ouro Preto, 24. [4] Ntaimo, L., Sensitivity Analysis and Duality, Chapter 6, Volume 1, 14 th edition, Wayne L. Winston and Munirpallam Venkataramanan, 25. [5] Goldberg, D. E., Genetic Algorithms in Search Optimization and Machine Learning. Addison- Wesley, 1989. [6] Mitchell, M., An Introduction to Genetic Algorithms. MIT Press, London England, 1999. [7] Davis, L., Handbook of Genetic Algorithms. Van Nostrand Reinhold, N.Y. 1992. ISSN: 1792-46X 251 ISBN: 978-96-474-216-5