Optimization Of Vehicle Routing Problem With Time Window ( Vrptw ) For Food Product Distribution Using Genetics Algorithm

Abstract. Food distribution process is very important task because the product can expire during distribution and the further the distance the greater the cost. Determining the route will be more difficult if all customers have their own time to be visited. This problem is known as the Vehicle Routing Problem with Time Windows (VRPTW). VRPTW problems can be solved using genetic algorithms because genetic algorithms generate multiple solutions at once. Genetic algorithms generate chromosomes from serial numbers that represent the customer number to visit. These chromosomes are used in the calculation process together with other genetic operators such as population size, number of generations, crossover and mutation rate. The results show that the best population size is 300, 3,000 generations, the combination of crossover and mutation rate is 0.4:0.6 and the best selection method is elitist selection. Using a data test, the best parameters give a good solution that minimize the distribution route.


Introduction
Food product distribution is an activity of food industry for fulfilling customer need due to product ordering.Distribution can become a serious problem if too many customers are listed, so it requires a lot of time to choose the shortest one among all possible routes.The further route taken, the greater cost are needed.The products should distribute fast and efficiently because they have expired date.Determining route will be more difficult if each customers have specific time schedule on receiving distribution product.This problem also called vehicle routing problem with time window (VRPTW).
VRPTW problem can be solved using various methods.Improved simulated annealing is used for solving VRPTW problem and obtain 82.29 second average time [1].Adding distributed algorithms into evolutionary algorithms also improve the result and computation time [2].Improved Genetics Algorithms also has better result compare to group-based pattern method on solving VRPTW problem [3].Optimized crossover genetic algorithm gives competitive quality in term of travel distance on VRPTW problem [4].Genetic algorithms also used to solve VRPTW problem [5].
Genetic algorithm (GA) is part of evolution algorithm that applied in many other field like biology, physic, social and etc. GA could solve many complex problems and developed rapidly [6].GA has some steps: (1) representing chromosome, (2) initializing population, (3) doing reproduction, (4) calculating fitness, (5) selecting chromosome to proceed to the next generation.There are 4 representation of chromosome such as binary, octal, hexadecimal and permutation.Population are generated from chromosomes.Reproduction is creating new chromosome from previous chromosome through crossover and mutation.Each chromosome in the population (after doing reproduction) is being calculated to get fitness.Chromosomes that surpass minimum fitness are being used for next generation.GA's steps: Pseudo code for GA [7] is: Initialize (population) Evaluate (population) While (not stop) do { Crossover (chromosome) Mutation (chromosome) Calculate fitness (population) } The iteration will be repeated until maximum number of iteration passed.

Genetic Algorithm with Proposed Approach
This section explain about solving VRPTW problem using genetic algorithm.We use data from VRPTW benchmark problem with R101 for more precisely.There are 100 customers that have different location which describe as coordinate.Each customer has different ready time, demand but same service time.Ready time is used to calculate time penalty, otherwise demand is used to calculate demand penalty.This study use 25 vehicle which has 200 capacity.

Chromosome Representation
There are 100 customers from dataset R101 in VRPTW benchmark problem, so there will be 100 genes in a chromosome.Chromosome must represent customers to visit in distribution process.The possible representation for this problem is permutation encoding.Permutation encoding is an encoding which uses number to represent a problem and used as a sequence [8].For example, food will be delivered to 10 p-ISSN: 2540-9433; e-ISSN: 2540-9824 cutomers.Based on permutation encoding, it will generate chromosome X [ 1 2 3 4 5 6  7 8 9 10].Chromosome X show that the sequence of distribution is start from customer 1 to customer 10.

Reproduction
Reproduction is process to produce child/offspring from parent chromosome.In GA, reproduction consist of crossover and mutation.Crossover is method to exchange gene from one chromosome to gene from another chromosome.Mutation is method to exchange gene in a chromosome.

Ordered Crossover (OX)
Order crossover exchange genes two chromosomes to produce 2 offspring, but this study only take 1 offspring.This crossover begin with choosing two random chromosomes and select two cut points from each chromosome.The genes between those cut point are copied to the offspring.Then, exchange the rest of genes within both chromosome and remove same number.After that, fill the empty genes of offspring with genes from the previous process start from the second cut point then continue from beginning of chromosome after the last gene filled.

Reciprocal Mutation
Reciprocal mutation is integer representation-type of mutation.Reciprocal mutation exchange two genes from a chromosome after being randomly selected.1 offspring are produced by reciprocal mutation.This reciprocal mutation is suitable for VRPTW problem because after being exchanged, there are no same gene and maintain the sequence.

Fitness
Fitness on each chromosome is calculated every iteration.Before selection begin, each chromosome on the population is being calculated to get its fitness.Before calculating fitness on each chromosome, we need to calculate capacity and time penalty.Since each chromosome has coordinate, we use Euclidean distance to calculate distance between two chromosomes.The Euclidean distance equation is shown in equation (1).
Where X is X coordinate from chromosome A and B, Y is Y coordinate from chromosome A and B.
The vehicle speed is constant 2 unit, so to get vehicle travel time we multiply the distance with vehicle speed.Time penalty is given to vehicle which has arrive before customer's ready time.Capacity penalty is given to vehicle which has less product from customer's demand.To calculate fitness, we use equation (2).p-ISSN: 2540-9433; e-ISSN: 2540-9824 Where ∑  is total distance from all customer, and ∑  is total penalty given to vehicle.

Selection
After calculating fitness on each chromosome, next step in GA is doing selection.Chromosomes are being selected based on fitness value.If the chromosome pass the minimum fitness (fit for next generation), then it will be used for next generation.This study use two kinds of selection, that are elitism and binary selection.

Elitism Selection
This selection method maintain best chromosome to be used in next generation.This happened because elitism sort all chromosomes from the highest fitness.Top nchromosomes are selected for next generation.Steps for elitism selection are: 1. Sort chromosomes in the population start from highest fitness.

Binary Tournament Selection
Binary tournament selection works like tournament system which compare fitness from two selected chromosomes.Chromosomes are selected randomly, so chromosome with low fitness is possible to continue to next generation.Steps for binary tournament selection are: 1.For n (n = initial population), do: a. Select two chromosome randomly b.Select one chromosome which has better fitness

Result and Discussion
This study is implemented using Java programming language and personal computer that has specification such as Intel Core i5 Processor with 2.5 GHz clock speed, 4 GB DDR3 RAM and Nvidia Geforce 525M graphic card.GA is a stochastic method that has different result for different run, so we run 10 times for each categories with same initial parameter.
First category is comparing selection method that used in this study.This category run with 50 initial population, 500 generation, 0.5 crossover and mutation rate.The result is shown in Figure 1.

Figure 1. Result of comparison between Elitism and Binary Tournament selection
It show that Elitism selection has better average fitness compare to Binary Tournament selection.Elitism has 0.000593 while binary tournament has 0.000279.Elitism selection has better fitness than binary tournament because elitism maintain chromosomes that have best fitness from previous generation to continue to next generation.Different from elitism selection, binary tournament select two chromosomes randomly so there is a chance that chromosomes with low fitness are selected.
Second is comparing population size.For genetic operator, we use 100 generation, 0.5 crossover and mutation rate.Elitism selection is used.Range of population size that used is 50 to 350 with multiple of 50.The result show that 300 is optimal population size for this problem with 0.0005142 fitness.The result is shown in Figure 2.

Figure 2. Result of Population size comparison
Comparing generation is the third.We use 100 population size, 0.5 crossover and mutation rate with elitism selection.Generation that used is 500 to 3500 with multiple of 500.The result show that 3000 is optimal generation with fitness of 0.000755.The result is shown in Figure 3. Fourth is comparing crossover and mutation rate combination.We use 50 population size, 500 generation.Crossover and mutation rate combination is 0 to 1 with 0.2 difference.Selection that used is elitism selection.The result show that the best fitness come from crossover and mutation rate combination of 0.4:0.6 with 0.000595 fitness average.The result is shown in Figure 4.

Figure 4. Result of comparison in crossover and mutation rate combination
Last category is to find out fitness from best genetic operator.From previous category, it is found that best population size is 300, best generation is 3000 and crossover and mutation rate combination is 0.4:0.6.This category, we use best genetic operator to get best fitness.We also use Elitism selection.The result show that best fitness is 0.000788.The result is shown in Figure 5.  Figure 5 shows that the best fitness is calculated from 4 th and 10 th trial.Although the chromosomes result are different but they produce same fitness (0.000788), so the 4 th trial is chosen.The chromosome from the 4 th trial is shown in table 1.From the table 1, the chromosome is a representation of customer's sequence that have to be visited.The distribution start from 23 rd customer and then stop at 38 th .Total distance is 1264.85 unit and the distribution process takes 258.37 time unit.

Conclusion
This study conclude that VRPTW problem can be solved using genetic algorithms.GA generate chromosome from 100 customers randomly, evaluating each chromosome than select chromosomes that fit for next generation based on their fitness.This study also point out that elitism selection is better than binary tournament because it maintain chromosomes with best fitness to be the next generation.Fitness is influenced by genetic operator.300 population size, 300 generation and 0.4:0.6 combination of crossover and mutation rate is best genetic operator that produce best fitness.Best genetic operator produce fitness of 0.000788.

Figure 3 .
Figure 3. Result of Generation comparison

Figure 5 .
Figure 5. Fitness result from best genetic operator