Fodder composition optimization using modified genetic algorithm

Received Apr 21, 2018 Revised Sep 07, 2018 Accepted Feb 24, 2019 Determination of the fodder composition is a difficult process because it should simultaneously consider several constraints, such as minimizing the total cost of feed ingredients and maximizing the nutrient needs required by livestock. This study uses a modified genetic algorithm to solve the problem in order to obtain better results. The modification is done by applying numerical methods in generating an initial population of the genetic algorithm. Testing results show that the optimal parameters that can be used to produce the optimal solution are as follows: population size (popsize) is 300, generation number is 400, crossover rate (cr) value is 0.2, and mutation rate (mr) value is 0.6. The modified genetic algorithm provides an average fitness value of 0.142357, while the classical genetic algorithm provides an average fitness value of 0.094354. With additional computational time equal to 110 ms, the use of modified genetic algorithm offered has proven to provide a better result, with a higher fitness value compared with classical genetic algorithm.


INTRODUCTION
The fodder is one factor that plays an important role in determining success in the livestock sector.It has a major contribution in the number of 50-70% of the total cost of livestock.The rise in prices of feed ingredients generally, especially soybeans, making the producers reconsider the fodder composition in order to increase the efficiency target of the fodder cost [1].Therefore, additional efforts are needed to optimize the use of the feed in order to increase livestock products.
The problem of mixing fodder composition becomes difficult because it should simultaneously consider several constraints.On one hand, selecting the feed ingredients should consider the total cost of the feed ingredients to a minimum, but on the other hand, it should also maximize the nutrient needs required by livestock.The criteria for determining the composition of fodder formulation consist of the selection of feed ingredients and nutrient contents, so it is necessary to form a combination of feed ingredients to produce high nutrient content value [2].
Several techniques have been proposed to form the fodder composition formulations.Genetic algorithm is used to optimize the cost of feed ingredients in the mixing fodder composition by determining the proportion of feed ingredients randomly in mixing feed ingredients in the beginning of the calculation process to form an optimal feed ingredient solutions by considering constraints such as the availability of ingredients and overall total feed ingredients [3].The mixing of fodder composition by using Goal Programming is done by forming a model of multi-criteria programming to determine the mix of feed ingredients to minimize costs, maximize nutrients and minimize the water content [4].Mathematical Programming is used to solve the problems of poultry feed formulations in Nigeria.The mathematical equation is formed to minimize the total ISSN: 2089-3272  Fodder composition optimization using modified genetic algorithm (Vivi Nur Wijayaningrum) 69 cost of feed ingredients and consider constraints such as the number of fodder required, the minimum number of nutrients and energy that must be met, and the limited availability of feed ingredients [5].
The genetic algorithm can be used to solve problems in various fields of science and technology.It has several advantages, such as it can be used optimally in problems with continuous and discrete variables, it provides some optimal solutions, not just a single solution, and it works well on various types of optimization such as numerical data and analytical functions [6].It also has the ability to generate good solutions for some complex problems [7]- [9].However, initial values at the beginning of genetic algorithm process which is usually done at random must meet predetermined constraints because it can affect a given solution [10].If the values in the initial population are not well chosen, then the right solution will be difficult to find [11], [12].
The genetic algorithm is selected to solve this problem because it is easy to use, simple, and has a wide search area [13].In previous research, numerical methods such as Cramer's Rule, Gauss-Elimination, and Gauss-Jordan method were used to determine the values that will be used in the initialization process of the genetic algorithm.The calculation process was carried out by forming a linear equation system to obtain values that represented the number of feed ingredients to be used in the mixing of fodder composition [14].In this research, the determination of the fodder composition solved using a modified genetic algorithm by applying a numerical method for the initialization of the initial chromosome.The proposed solution is to create a model of feed ingredients composition to meet the nutrient needs of livestock by minimizing the total cost of feed ingredients.

MODIFIED GENETIC ALGORITHM
The genetic algorithm (GA) is an optimization algorithm inspired by the process of natural selection.It is a general algorithm that can be applied to the large and complex problems [15] because it works based on population searching so that it can search globally and in all directions [16].Like the other stochastic methods, there is no guarantee that the GA will find a global optimum solution for a problem.However, it can provide an acceptable solution well with a reasonable process [17].
The GA has a population consisting of several individuals or chromosomes which evolve with the selection rules which is determined to maximize the fitness value by minimizing the cost function [18].The process starting from generating a random population consisting of several chromosomes, which each chromosome represents a problem solution.Then, the fitness value of each chromosome in the population is calculated.Afterwards, offspring are formed by performing crossover and mutation based on the crossover rate and mutation rate.Selection is performed to select a number of chromosomes to proceed to the next generation.The chromosomes are selected according to their fitness value.The population of the newly formed will replace the old population [15].
The proposed method is to modify the chromosome initialization process in the population.The modification is done by applying numerical methods in generating an initial population of the genetic algorithm.This mechanism is carried out by inserting the initial values obtain from the calculation using Cramer's Rule as a chromosome into the population.Then, the other chromosomes in the population will be generated randomly.
A chromosome from the calculation result using Cramer's Rule allows to produce a solution in an area close to the optimal solution in the search space so that it can provide a higher fitness value compared to other chromosomes.During the evolutionary process, the other chromosomes will be updated through the process of reproduction.Thus, the process of searching a solution will produce a fairly high fitness value at the beginning of time.

RESEARCH METHOD
The problem of fodder composition formulation is defined as the determination of the number of each feed ingredient to meet the required nutrient of livestock by considering the minimum total cost but still meet a minimum and a maximum number of feed ingredients required.Data of cattle used in this problem shown in Table 1.The nutrients consist of Dry Matter (DM), Digestible Crude Protein (DCP), Total Digestible Nutrients (TDN), Metabolizable Energy (ME), Calcium (Ca), and Phosphorus (P) shown in Table 2 [19].

Chromosome Representation
The GA has a population consisting of several possible solutions.Every possible solution is represented by a chromosome in the form of abstract representation.Encoding solutions into the chromosome is a process that is first performed in the GA.This process is not easy to do because of the determination of the proper representation of chromosomes will affect the overall process of the GA [20].The effectiveness of the GA in the exploration of the search space will be strongly influenced by the representation of the chromosome used [21].To formulate the fodder composition, the chromosome representation that is used is real code representation that describes the number of each feed ingredient used in the fodder mixing.The number of genes in a chromosome is the percentage of feed ingredients.Real-code representation is chosen because it has several advantages such as improving the efficiency of genetic algorithms because it does not need to convert the value of solution variables, less memory is needed, and there is freedom to use different genetic operators [22].
Suppose the feed composition will be used for cattle weighing 200 kg and the expected weight gain is 0.5 kg.The chromosome can be formed as shown in Table 3.In Table 3, the first gene with a value of 0 indicates the percentage of the first feed ingredient (coconut meal), the second gene with a value of 12.27 indicates the percentage of the second feed ingredient (corn bran), and so on up to the sixth gene with a value of 0 which indicates that the percentage of the eight-feed ingredient (elephant grass).The feed ingredients which have a value of 0 indicates that these feed ingredients are not used as fodder mixes.
These gene values have limits, they are 0 for the lower limit value and 50 for the upper limit value.If there is a gene which has a value less or more than the predetermined limit value, then the gene value will be set in accordance with the minimum or maximum limit value.

Fitness Function
The fitness value is used to measure the quality of the solutions produced by each individual based on the objective function [23].In this research, the fitness function is calculated based on the total price of feed ingredients used in fodder compositions.In addition, the fitness function is also calculated based on the fulfillment of nutrient needs.If there are nutrients that have a number less than a predetermined number, then the number of nutrient deficiencies is used as a penalty value.This penalty technique is used to penalize the ISSN: 2089-3272  Fodder composition optimization using modified genetic algorithm (Vivi Nur Wijayaningrum)

71
infeasible solutions, which depends on the number of violation of the constraints that occur [24].Fitness function can be calculated using (1) [8].
Cost is the total cost of feed ingredients used, penalty is the total value given for any deficiency number of nutrients, N is a number of feed ingredient, and M is a number of nutrients.

Crossover
Crossover is the process of combining the genetic information from two individuals [12].It is used to exploit the current solution in order to get a better solution.This process begins with selecting two parents that will be crossed, then the genetic information from both parents are exchanged [25].
The crossover rate (cr) is used to determine how often the crossover process will be conducted.When the value of cr is 1, then all the offspring derived from the crossover.While the value of cr is 0 illustrates that the new population generated is exactly the same chromosomes copy of the previous population [11].
In this research, the crossover process is done by using extended intermediate crossover which produces two offspring of the combined value of the two parental chromosomes [26].The offspring can be generated using (2) [27], with the value of  selected randomly in the interval [-0.25, 1.25].

Mutation
Mutation is used to explore the whole search space.It is used to prevent the algorithm trapped in local optimum solution and maintain the diversity of individuals in the population.Low population diversity leads to premature convergence.This happens when all the individuals in the population reach suboptimal conditions so that the genetic algorithm cannot produce offspring that have better fitness values than their parents [11].
Mutation usually performed on selected individual to produce its new version by modifying the genetic material randomly [28].A random mutation method used by increasing or decreasing the value of the selected genes with small random numbers [21], [29].Suppose the range of values of variables xi is [mini, maxi] and the resulting offspring is C = [x'1, …, x'n], then the value of genes in offspring can be generated using (3), with a value of r selected randomly in the interval [-0.1, 0.1].

Selection
The selection process is done by comparing each chromosome in a population based on its fitness value.This process is used to select individuals used for the reproduction process in the next generation in order to generate new search areas [24].
In this research, the selection method used is a combination of random selection and elitism selection.The random selection is the simplest selection operator and has a low speed to produce a uniform population.In the random selection, each individual has an equal chance of n 1 where n is population size (popsize), so that the best and worst individuals in the population has an equal chance to move on to the next generation.While elitism selection has a high speed to produce a uniform population because this method ensures the best individual in the population currently can survive to move on to the next generation [27].The combination of these two methods is used to prevent the dominance of the best individuals in the population which led to the acquisition of a local optimum solution.

RESULTS AND DISCUSSION
The parameter testing is conducted to determine the best parameter values used in the genetic algorithm in order to obtain the optimal solution.Setting the parameter values in the genetic algorithm is a determining factor in the balance of exploration and exploitation.The performance of genetic algorithm is not optimal if these parameters are not well defined, which results in premature convergence [30].
The parameter testing consists of population size testing, the generation number testing, the crossover rate (cr) value testing, and the mutation rate (mr) value testing.In this testing scenario, the data used are cattle with a weight of 200 kg and a target for weight gain of 0.5 kg.
The population size testing used to determine the proper chromosome number so it can produce the optimum solution for the completion of the optimization of fodder composition.The population size tested are 100, 200, 300, 400, 500, and 600.The number of generations used in this test is 500, with a combination of cr and mr are 0.3 and 0.4.The testing conducted 20 times for each population size testing scenario.Figure 1 shows the testing result of population size.
Figure 1 shows that the average fitness value will be increasing along with increasing the population size.This is because the genetic algorithm has a wider search area if the population size is large, so better average fitness value can be obtained.However, the fitness value does not increase significantly at a certain point.As shown in Figure 2, the average fitness value generated by population size 100 to 300 are increasing, but the fitness value tends to be stable when the population size more than 300, which means that 300 is the optimal population size.
The generation number testing used to determine the proper generation number so it can produce the optimum solution.The number of the generation tested are 100, 200, 300, 400, 500, and 600.The population size used is 300, which is the best population size based on test results as shown in Figure 1.While the combination of cr and mr used are 0.3 and 0.4.The testing conducted 20 times for each testing scenario of generation number.Figure 2 shows the testing result of generation number.
Figure 2 shows that the average fitness value will increase with the increasing of generation number.The average fitness value produced by the generation of 100 to 400 are increasing but tends to be stable when the generation number more than 400.This indicates that the optimal generation number is 400.73 the testing results as shown in Figure 1 and Figure 2. In order to get a fair result, the combination of cr and mr used is cr × 2 + mr = 1 since the crossover method used is extended intermediate, which produce two offspring in each process.Figure 3 shows the testing result of the value of cr and mr.
The testing results of cr and mr value in Figure 3 shows that the best parameters used to generate the optimal solution are the cr value is 0.2 and the value of mr is 0.6.The higher value of cr, the exploitation process will be faster and new solutions will be more quickly introduced to the population [31].If the value of cr is too high, the genetic algorithm is not able to maintain the diversity of the population, so that it can produce a local optimum solution.Otherwise, if the value of mr is too high, the genetic algorithm will work like a random search method that causes lessening the effectiveness of the process of searching solutions [29].
Table 4 shows the comparison of the fitness value generated by the classical genetic algorithm and the modified genetic algorithm.The comparison of the fitness value indicates that resolving the problem of determining the fodder composition using the modified genetic algorithm gives better results with higher fitness value than the classical genetic algorithm, with little additional computational time.The average fitness value generated by the modified genetic algorithm is better than the classical genetic algorithm because the gene values used in the initialization process are the initial values close to the optimal solution.These initial values are the number of feed ingredients obtained from the calculation using numerical methods.Using these initial values, the genetic algorithm can improve its ability to find good areas in the search space quickly.To find out the improvements made by the modified genetic algorithm, additional testing is performed to compare the results given by the classical genetic algorithm, the modified genetic algorithm, and Simulated Annealing.Comparison is done using the genetic algorithm optimal parameters as follows: population size is 300, the generation number is 400, the crossover rate value is 0.2, and the mutation rate value is 0.6.While the parameters used by Simulated Annealing are as follows: the iteration number is 100 and the temperature decrease rate is 0.75.Figure 4 shows the comparison result of the three algorithms.
Based on Figure 4, it can be seen that the use of the initial values obtained from the calculation using numerical methods during the initialization process gives an impact to the performance of the genetic algorithm.The increase in results given by classical genetic algorithms and Annealing Simulated at each iteration is not high enough, even Simulated Annealing tends to produce stable results, while the modified genetic algorithm has increased significantly over several times.Even in the early iterations, modified genetic algorithm has resulted in a high increase on the fitness value compared to the classical genetic algorithm.This makes the modified genetic algorithm able to achieve the optimal solution with a small number of iterations.

CONCLUSION
This research has found that the genetic algorithm is usable to solve the problem of determining the fodder composition.The modified genetic algorithm provides a better fitness value than the classical genetic algorithm.The parameters used to obtain the optimal solution are as follows: population size is 300, the generation number is 400, the crossover rate value is 0.2, and the mutation rate value is 0.6.The use of the initial values obtained from the calculation using numerical methods during the initialization process makes the genetic algorithm get higher fitness values at each iteration rapidly, so the genetic algorithm can achieve the optimal solution in few iterations.
In the next research, the problem of determining the fodder composition can be developed by considering the availability of feed ingredients in the warehouse so the number and type of feed ingredient to be used in the fodder mixing can be determined.With the increasing of the complexity of the problems to be solved, then the techniques required to get the solution will also be complex.Therefore, hybridization technique is necessary to do between the genetic algorithms with other algorithms to get a better solution.The process of finding solutions by using hybridization between the genetic algorithm with Tabu Search will be used in the future research [32].To prevent premature convergence, the use of a fuzzy crossover operator can also be applied to the genetic algorithm [33].

Figure 1 .
Figure 1.The Testing Result of Population Size

Figure 2 .
Figure 2. The Testing Result of Generation Number

Figure 3 .
Figure 3.The Testing Result of the Value of cr and mr

Figure 4 .
Figure 4. Comparison result of classical GA, modified GA, and simulated annealing

Table 2 .
Cost and nutrient content

Table 3 .
Example of the chromosome representation

Table 4 .
Comparison of the fitness value