Optimizing the distribution of tofu products using a genetic algorithm approach: a case study in tahu kres KWB Batu City, Malang

. The aim of this research is to determine the optimal route using a genetic algorithm and to compare the routes before and after optimization. The method used is the Genetic Algorithm, which consists of representation and initialization stages using permutation encode representation of the sequence of travel routes. The fitness function evaluation is the minimization of total fuel cost, selection is done using roulette wheel selection, crossover is done using PMX, and mutation is done using swap mutation. The testing of parameter combinations is carried out on population size, Cr and Mr values, and the number of generations. The parameter testing based on the highest average fitness is conducted 10 times for each parameter combination. Testing of population size and generation size was carried out in the range of 100-1000, obtained the best population size of 600 and the best generation size of 900. The combination testing of Cr and Mr is conducted for combinations of 1 and more than 1, and the values obtained are Cr: 0.6 and Mr: 0.5. This combination of parameters results in a fitness of 0.00960 with a total distance traveled of 307.61 and a total transportation cost of Rp 104,082 for fuel. Initially, the total distance traveled was 278.57 km with a fuel distribution cost of Rp 161,258. Therefore, the results of this research are able to save 35.46% of fuel transportation costs.


Introduction
Tofu is a food that is loved by almost all levels of Indonesian society and can be easily found in traditional and modern markets.Tofu is an alternative to animal protein sources such as beef and chicken.According to the [1], data for 2021 shows that the average consumption of tofu in a week is 0.158 kg per capita.Tofu, which is one of Indonesia's traditional foods, is produced mostly by small and medium industries.The total tofu industry in Indonesia reaches 84,000 units with the production of more than 2.56 million tons per day.Based on the location of the tofu industry, 80% of the industry is located on the island of Java [2].
MSMEs Tahu Kres KWB is one of the medium-scale tofu industries in Junrejo District, Batu City, which produces ready-to-fry white tofu.Tahu Kres products have three size variants, namely small packages, large packages, and mica plastic packages.In a day, MSMEs Tahu Kres KWB can produce more than 2,500 packs of products and adjust according to the number of demands.The distribution of MSMEs Tahu Kres KWB products to retailers is recorded as of October 2022, currently covering the Batu area, Malang City, Malang Regency, Pandaan, Sidoarjo, and Surabaya.Product distribution is carried out by delivering products to stalls and markets by Tahu Kres KWB drivers.The means of transportation used to distribute the products are two pick-ups and six motorcycles.
The increase in the price of fuel oil (BBM) which began in early September 2022 became a problem for MSMEs Tahu Kres KWB.As a result of the increase in fuel prices, it has an impact on increasing distribution costs for Tahu Kres KWB products.This is also supported by a product distribution system that has not been well organized where so far the selection of delivery routes has been made based on estimates without knowing whether the route chosen is an optimal route or not.In addition to the need to improve route selection, efforts are needed to consider the fleet to be used on a route.This is because there are two types of distribution fleets used, namely pick-up cars and motorcycles which have different fuel consumption, even differences in fuel consumption are also found in similar fleets.
Optimization is essentially the search or completion of variable values that are considered the best, most effective and efficient to achieve the desired results.In the world of distribution, optimization means the process of finding a formula that can reduce distribution costs while maintaining the main goal of providing goods on demand at the right place and right time [3].The distribution costs consist of transportation payments to costs incurred during the trip.According to [4] distribution problems occur when the marketing area is wider causing manufacturers to incur high transportation costs reaching 30% of total product sales.Optimal distribution can support the company's success in marketing its products so that it can generate maximum profits.
The problem of determining the optimal distribution route can be solved using metaheuristic methods which are based on biological evolutionary mechanisms, namely genetic algorithms [5].The principle of the genetic algorithm begins with choosing a set of solutions, which are represented by chromosomes, which is called the population.Solutions from a population are taken to form a new population, and the selection depends on the fitness value.It is hoped that the new population formed will be better than the previous population.This process is repeated until conditions are met where the fitness value approaches the most optimal solution [6].The advantage of using this method is that it has a computational implementation involving relatively simple mathematical operations and can even be parallelized in a computer cluster.This method does not require prior knowledge of the environment and can adapt to dynamic environments, where other objects can also move through the search space [7].Previous research by [8][9][10][11] proved that genetic algorithms can solve distribution route optimization problems and can reduce transportation costs in product distribution.In this research, the main objective is to obtain minimal transportation costs through optimal product distribution routes using a genetic algorithm approach.

Methods
This research was conducted at MSMEs Tahu Kres KWB located in Batu City, East Java.The distribution of retail locations includes Lowokwaru, Dau, Batu, Karang Ploso, Singosari, Pandaan, Lawang, Junrejo, and Bumiaji.Retailer codes start from 2 to 90 and 1 represents the Tahu Kres KWB code as the starting and ending points of each distribution route.Retailers' demand in general is in the form of the number of packages because Tahu Kres KWB's product has three types of packaging with different weights, it needs to be converted into kilograms so that it can be added up into the same unit.Large packaging weighs 1.4 kg, small packaging weighs 0.6 kg, while for mica plastic packaging there is no demand by retailers.

Problem limitations and assumptions
In this study there are several limitations of the problem defined, namely: 1.The distribution route starts and ends at Tahu Kres KWB 2. Transportation costs in this study are only the cost of fuel oil (BBM) in one trip.3. demands carried by each fleet must not exceed the capacity of the fleet.4. The entire fleet must do the distribution.5.All destination points must be visited once by one fleet.6.The optimal route is the route whose distance results in the lowest total transportation costs from the research results.

7.
The fitness used is minimizing the total cost of fuel.In this study there are several assumptions used, namely: 1. Retailer locations and the number of demands used are fixed retailer data from Tahu Kres KWB 2. The selected road is assumed to have no traffic jams and no damage, so it is feasible to pass.

3.
The route chosen for product distribution does not pass through toll roads.4. In conditions where in one individual there is demand that exceeds the capacity of a fleet, a penalty value of 1,000,000 will be given to the total cost of that individual, regardless of how much the excess capacity is.

5.
Total demands and fleet capacity are converted in kilograms and are assumed to be able to meet retailer demands without any complaints from retailers.

Mathematical formulation
Mathematical formulas for optimizing product distribution routes for MSMEs Tahu Kres KWB are used for the function of constraints and/or assumptions that can use the equation according to [12,13] as follows: Objectives function: 1.
The total cost objective function, calculated from the total distance traveled by each fleet with different fuel consumption: Minimization: (3) (4) With: X 0jk : Binary variable indicating whether fleet k departs from depot (point 0) to point j.X i0k : Binary variable indicating whether fleet k departs from point i to depot (point 0).

2.
Demands carried by the fleet must not exceed the capacity of each different fleet: (5) With: d j : demand at point j Q k : K fleet capacity If the capacity is exceeded, give a penalty of 1,000,000: (6) With: p ik ∶ penalty value if k fleet capacity is exceeded p ik = 1,000,000 ∀i, k : the total number of demands carried by the fleet in each route i must be greater than or equal to the capacity of the fleet Qk for each type of fleet k.

3.
Each fleet will come to a different destination point once and will leave that destination point and then go to another destination point: (7) (8)

5.
Preventing the formation of routes that do not involve all destination points:

Data collection
To collect the data used in this study, several methods were used, namely interviews by way of face-to-face interaction and debriefing with the owner of MSMEs Tahu Kres KWB as a resource person.The primary data obtained in this study is the distance from the location point of MSMEs Tahu Kres KWB to the retailer's destination point and the distance between one retailer and another using Google Maps.Secondary data obtained in this data collection is data related to distribution transportation costs including fuel consumption per liter from motorcycles and pick-ups, and the initial route used by the company.

Route optimization with genetic algorithms
Route optimization uses a genetic algorithm through the stages of representation and initialization, function evaluation, selection, crossover, mutation, and elitism.Parameter testing is done to get the combination that produces the best fitness.The stopping criterion in this study uses the maximum generation.The data to be processed are product distribution destination points, distances between all destination points, and parameter combinations to obtain the optimal distribution route.

Representation and initialization
The representation stage is carried out on the distribution destination point data, in this study, the distribution destination point representation will be represented or coded using the permutation method, then all destination points will be combined to generate the initial solution.The initialization of the parameters that will be used includes mr, cr, selection method, population size (popSize), crossover method, and mutation method to test the best combination of parameters.

Function evaluation
In this study, the function used is the fuel transportation cost function from the starting point to the endpoint again using the equation which can be seen in Equation 2. To find value fitness using cost minimization can be calculated with Equation 12: Total C in the fitness equation is the total cost of the entire fleet.Using the minimization formula aims to make the total cost smaller than the value fitness will get bigger, this is because the value fitness the highest will have the greatest chance of being selected at the selection stage and those selected must be the smallest total cost.According to [12], a relatively large penalty value can maintain an individual's fitness value according to predetermined limits.While the value of m is a penalty received by random chromosomes that do not meet the limits, the penalty value is very large so it will reduce the fitness value and reduce the chance of chromosomes that do not meet the criteria to be selected.

Selection
The selection method used in this research is Roulette Wheel Selection.The probability of selecting an individual is influenced by the amount of fitness value possessed because this method is built from the ratio of individual fitness and total fitness, then the cumulative probability of the individual to be selected will be calculated, then the formation of a pie chart to make a roulette wheel according to the range of individual values with other individuals sequentially obtained from relative values.After that, a random number with a range of zero to one will be generated for each individual and the random value will be adjusted to the range on the roulette wheel to become a new individual [12].

Crossing
The crossing will be carried out using the Partial Mapped Crossover method.Before crossing, it is necessary to determine the crossover rate (cr) and it is necessary to generate random numbers between zero and one for each parent, to be able to experience crossing each parent must get a random number less than the cr value [14,15].

Mutation
The mutation stage will be carried out using the method of exchange mutation or swap mutation.Before carrying out the mutation, it is necessary to determine the mutation rate (mr) and it is necessary to generate random numbers between zero and one for each individual.Individuals who will undergo mutations must obtain a random number less than the mr value from the results of crossing [16].

Elitism
The use of elitism is intended to produce the best fitness value from the previous generation to the next generation.Elitism will produce the highest fitness value in the last generation, it is different if you do not use elitism, the generation that produces the highest fitness value in the test is uncertain because it is not in the last generation in the test.The use of elitism in this study used only the best chromosome in the generation to be carried on to the next generation, this aims to still provide a great opportunity for chromosomes that have the potential to produce new individuals with higher fitness [17].

Genetic algorithm parameter combination test
Genetic algorithm parameter testing was carried out on each genetic algorithm parameter, namely Cr, Mr, population size, and generation number [18].This test is carried out one by one by trial and error for the value of each parameter which is carried out ten times for each parameter value.This test is carried out to obtain the optimal combination which is expected to produce the optimal distribution route.

Termination condition
The new group of individuals will be carried out in the function evaluation stage by calculating the new fitness value and will iterate through the selection stage until it meets the termination condition.Generation termination is used to declare the termination of a process in a genetic algorithm.In this study, the termination of generations is carried out if the maximum number of generations has been reached [19].

Product distribution tahu kres KWB
The distribution of Tahu Kres KWB products to consumers uses the form of producerretailer-consumer distribution channels.Producer-retailer-consumer distribution channels are categorized into level one distribution channels.Level one in the distribution channel is carried out by producers who sell their products to retailers (retailers), who are then sold to end consumers [17].Retailers of Kres Tahu KWB are generally vegetable sellers in markets, stalls, and itinerant vegetable sellers.The fleet used to distribute the product can be seen in Table 1.

Application of genetic algorithms
The optimal distribution route that will be obtained in this study is carried out by running a genetic algorithm program with the Python programming language using the Google Collaboratory.The initial stage in this programming is to input the 'distance matrix' and 'demand' data available in Excel (.csv) form using the random, pandas, and NumPy libraries.Data processing of route mileage in distribution activities in this study is used in the form of a distance matrix using the help of google maps.The programming used by the design uses a program according to the stages of the genetic algorithm and the type of method for each stage.

Genetic algorithm parameter combination test
Genetic algorithm parameter testing was carried out on each genetic algorithm parameter, namely Cr, Mr, population size, and generation number.This test is carried out one by one by trial and error for the value of each parameter which is carried out ten times for each parameter value.This test is carried out to obtain the optimal combination which is expected to produce the optimal distribution route.

Population size test
Testing the population size in this study using a range of 100-1000 was carried out for every 100 increments and each increase was carried out ten times and then the average fitness was calculated.The highest average fitness is found in a population size of 600 resulting in the highest fitness with an average fitness of 0.00524.The graph of the population size test results can be seen in Fig. 1.

Testing the combination of Cr and Mr
The combination of Cr and Mr testing in the research by [20] states that it is not recommended that the Mr value be higher than the Mr value because a Mr value that is higher than the Cr value will result in new individuals losing the characteristics inherited from their parents.The combinations of Cr and Mr that were carried out in this study were combinations that amounted to 1 and combinations that totaled more than 1.The graph of the results of testing the combination of Cr and Mr produced the highest average fitness at the combination Cr = 0.6 and Mr = 0.5 with an average fitness of 0.005336 which can be seen in Fig. 2.
0.00540 0.00520 0.00500 0.00480 0.00460 0.00440 0.00420 0.9;0.1 0.8;0.20.7;0.30.6;0.40.5;0.5 0.9;0.Generation size which is the number of iterations carried out in the genetic algorithm in this study was tested on 100-1000 generations with an increase every 100 generations, each increase was carried out ten times and then the average fitness was calculated.The highest average fitness in this study was in the 900 generation with an average fitness of 0.007926.The graph of the results of testing the number of generations to produce the highest average fitness can be seen in Fig. 3.

Results analysis
Based on the results of testing the combination of genetic algorithm parameters that have been carried out, a combination of population size = 600 Cr = 0.6, Mr = 0.5, and generation size = 900 is obtained.The combination of parameters is then run using programming and produces a fitness with the route that will be used as the optimal route result.The fitness obtained using this combination was carried out ten times and the highest fitness was taken, namely 0.00960.Fitness produces a route with the mileage of each fleet which can be seen in Table 2. Based on the distribution route produced by the genetic algorithm, the difference can be seen from the route used previously used by MSMEs Tahu Kres KWB through the results of the mileage, and fuel transportation costs from each fleet with the previous mileage which can be seen in Table 3.Based on the distribution route produced by the genetic algorithm, the difference can be seen through the results of the mileage of each fleet with the previous mileage, the mileage on motor_1 is 1.6 km longer than the previous route, motor_2 is 25.67 Km longer than before, motor_3 is 44.27Km longer than before, motor_4 is 12.96 Km longer than the previous route, motor_5 is 13.66 Km shorter than before, motor_6 is 20.21 Km longer than before, pickup_1 is 84.81 Km shorter than before and pickup_2 is 22.8 Km longer than before.The distance generated by the genetic algorithm was 29.04 Km longer than before, but the fleet with very high fuel consumption, namely pickup_1, experienced the most decline resulting in lower transportation costs compared to the transportation costs from the route used by the previous Tahu Kres KWB.Based on the route used by MSMEs Tahu Kres KWB previously, the cost of transportation of fuel oil used was IDR 161,258 and with the optimal route results obtained from the genetic algorithm method in this study, it was able to reduce transportation costs for fuel oil distribution fleets by 35.456% and higher than research by [11].Visualization of the optimal route resulting from the running program of the genetic algorithm method can be seen in Fig. 4.

Conclusion
The genetic algorithm method can solve the problem of finding the best route and the lowest cost in distributing products.The parameters of the genetic algorithm used in this study are the roulette wheel selection, partially mapped crossover, and swap mutation methods.Testing the parameters of the genetic algorithm that has been carried out produces a combination of population size = 600, Cr = 0.6, Mr = 0.5, and the number of generations = 900, resulting in the best fitness of 0.0096078.The result is a total mileage of 307.61 km with transportation costs for fuel oil of IDR 104,082.Distribution conditions at Tahu Kres KWB previously did not have routes with optimal fleet usage because there was no Further research can add constraints or other actual conditions, such as considering congestion, travel time, toll fees, and others.Determination of a penalty value that can be distinguished for each violation.The stopping criterion for the genetic algorithm in future studies can use convergence fitness.The range of parameter testing can be carried out more varied to get a more varied comparison of the highest fitness.Web or application development is also highly recommended to make it easier to use.

1 .
ijk = Cost of fuel for fleeting k traveling the distance from point i to j S ijk = total distance traveled by fleet k from point i to j , 03002 (2024) BIO Web of Conferences https://doi.org/10.1051/bioconf/2024900300290 ICGAB 2023 f k = fuel consumption per km of fleet h = pertalite fuel price per liter (IDR 10,000) Constraints: Each fleet starts and ends at the depot: with: u i : Variable indicating the order of visiting point i in the route.u j : Variable indicating the order of visiting point i in the route.In this equation model, the distance Cost (  ), demand (  ), capacity (  ), and variable matrices  according to data from the VRPHF (Vehicle Routing Problem with Heterogeneous Fleet) problem.Notation: n = number of destination points (including depots) = 90 m = total fleet i, j = index of destination point (i, j = 1, 2, ..., n) k = fleet index (k = 1, 2, ..., m) Variables: X ijk = binary variable is 1 if fleet k goes from point i to point j, and 0 otherwise) u i = variable indicating the order of visiting point i in the route (order of visiting point i) ∑ , 03002 (2024) BIO Web of Conferences https://doi.org/10.1051/bioconf/2024900300290 ICGAB 2023

Fig. 2 .
Fig. 2. Testing the combination of Cr and Mr.

,
03002 (2024) BIO Web of Conferences https://doi.org/10.1051/bioconf/2024900300290 ICGAB 2023 consideration of using the fleet for one fixed route with a total distance traveled of 278.57Km with a fuel distribution cost of IDR 161,258.Using genetic algorithms as a method of optimizing distribution routes can save fuel transportation costs by 35.46%.

Table 1 .
Product distribution fleet data.

Table 2 .
Optimal route genetic algorithm results.

Table 3 .
Comparison of results.