genetic algorithm for the traveling salesman problem using minimal weight variable order selection...

Upload: murugiah-sudharson

Post on 03-Jun-2018

218 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/13/2019 Genetic Algorithm for the Traveling Salesman Problem using Minimal Weight Variable Order Selection Crossover Op

    1/10

    Genetic Algorithm for the Traveling Salesman Problem using Minimal Weight

    Variable Order Selection Crossover Operator (MWVOSX)

    Murugiah Sudharson [email protected]

    Abstract

    This paper introduces a new crossover operator, Minimal Weight Variable Order Selection Crossover Operator

    (MWVOSX), an improved version of existing order crossover operator (OX) for genetic algorithm that generates

    high quality solutions for Traveling Salesman Problem (TSP).The Minimal Weight Variable Order Selection

    Crossover operator selects a specific order from multiple orders which have the least weight , and takes thebalance from the second chromosome in forward & reverse order .Now it constructs two new children using

    specific order with forward order and specific order with reverse order, then it chooses the best/lease weight

    new chromosome from them . The efficiency of the MWVOSX is compared against only with generally used

    order crossover operator and not trying to compare with other crossover operators .Experiments show that the

    new crossover operator (MWVOSX) is better the then the existing order crossover (OX) operator.

    Keywords:Traveling salesman problem, Genetic algorithm,Minimal Weight Variable Order Selection Crossover,MWVOSX.

    1. INTRODUCTION

    The traveling salesman problem(TSP), which represents a classic optimization problem that cannot be solved using

    traditional techniques and one of the benchmark and old problems in Computer Science and Operations Research.

    For a given set of cities and the travel distance between each possible pairs, the TSP, is to find the best possible

    way of visiting all the cities (once) that minimize the travelling distance.

    For n number of cities with 'city 1' as Start Point and a travel distance (or cost, or travel time etc.,) matrix

    D = [dxy] of order n associated with ordered node pairs (x,y) is given. The problem is to find a least cost complete

    cycle.

    Broadly, the TSP is classified as symmetric travelling salesman problem (sTSP) & asymmetric travelling salesman

    problem (aTSP).For n number of cities, TSP is symmetric if dxy = dyx x, y and asymmetric otherwise.For n number of cities asymmetric TSP [1], there are (n 1)! possible solutions, one or more of which gives the

    minimum Euclidean distance. For symmetric TSP, there are (n 1)! /2 possible solutions & their reverse cyclic

    permutations having the same total distance.

  • 8/13/2019 Genetic Algorithm for the Traveling Salesman Problem using Minimal Weight Variable Order Selection Crossover Op

    2/10

    The TSP has many real world applications;a direct application is in the drilling problem of printed circuit boards (PCBs)

    ,vehicle routing,overhauling gas turbine engines, X-Ray crystallography, threading of scan cells in a testable VLSIcircuits, etc.

    An implicit way of solving the TSP is simply to list all the feasible solutions, evaluate their objective function values

    and pick out the good one. But it is obvious that this exhaustive search is grossly inefficient and time consuming

    job because of vast number of possible solutions to the TSP even for problem of moderate size. Since practical

    applications require solving larger problems, hence emphasis has shifted from the aim of finding exactly optimal

    solutions to TSP, to the aim of getting good solutions in reasonable .Genetic algorithm (GA) is one of the heuristic

    algorithms that have been used widely to solve the TSP instances.

    In this paper, a new crossover operator named Minimal Weight Variable Order Selection Crossover

    (MWVOSX) is developed and accordingly a genetic algorithm based on MWVOSX is developed for solving the TSP.

    This paper is organized as follows: Section 2 develops a genetic algorithm based on MWVOSX for the TSP.

    Section 3 describes computational experiments for crossover operators. Finally, Section 4 presents

    comments and concluding remarks.

    2. GENETIC ALGORITHM

    Genetic algorithm (GA), powerful and broadly applicable derivative free stochastic optimization techniques,loosely

    based on the concept of the natural selections and evolution process, are most widely known types of evolutionary

    computation methods today. The benefits of using GAs are as follows;

    1. GAsare parallel processing procedures, which will speed up their operations [2].

    2. Applicable to both discrete and continuous optimization problems.

    3. Modular, separate from application.

    4. Stochastic and less likely to get trapped in local minima [2].

    5. Always gives answer and answer gets better with time, etc.

    GAshas many real world applications;control, design, scheduling, robotics, machine learning, signal process,

    game playing, combinatorial optimization.

    In general, a GA has five basic components, as summarized by Michalewicz [1]:

    1. A genetic representation of solutions to the problem.

    2. A way to create initial population of solutions.

    3. An evaluation function rating solutions in term of their fitness.

    4. Genetic operators (Reproduction, crossover, mutation) that alter the genetic composition of children

    during reproduction.

    5. Values for the parameter of genetic algorithms.

  • 8/13/2019 Genetic Algorithm for the Traveling Salesman Problem using Minimal Weight Variable Order Selection Crossover Op

    3/10

    And refer to the Figure 1 shows the pictorial flowchart for the genetic algorithm general structure [7].

    FIGURE 1: General Structure of Genetic Algorithm.

    In figure 1, first the initial population (sample chromosomes) is being built and passed to Evolution Environment. In

    Evolution Environment, it evaluates the chromosomes and assigns a fitness value, then pass to GA Operators

    section. In GA Operators section the chromosomes with weak fitness values will die off and the good are

    reproduced and pass to for further modification to crossover operator and mutation operator.

    This cycle will continue until the stopping criteria is satisfied .Once the stop criteria is satisfied, GA will return the

    best/good result and GA cycle will get terminated. Now following subsections will discuss in depth about

    Chromosome Encoding, Euclidean distance Calculation, The Fitness Function, Selection Operators, general Order

    Crossover, newly constructed Minimal Weight Variable Order Selection Crossover (MWVOSX) and Mutation

    Operator.

    2.2 CHRMOSOME ENCODING

    To apply GA for any optimization problem, we need to think a way for encoding the solutions as chromosomes in a

    form so that a computer can process.The techniques for encoding solutions vary by problem and, involve a certainamount of art.For the TSP, solution is typically represented by chromosome of length as the number of nodes(cities) in the problem.Each gene of a chromosome takes a label of node (city) such that no node can appear twice

  • 8/13/2019 Genetic Algorithm for the Traveling Salesman Problem using Minimal Weight Variable Order Selection Crossover Op

    4/10

    in the same chromosome. There are mainly two representation methods for representing tour of the TSP

    adjacency representationandpath representation. We consider thepath representationfor a tour, which simply

    lists the label of nodes.

    For example, let {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}be the labels of nodes/cities in a 10cities instance where 0represents

    the starting point/headquarters, then a tour {1 38 2 5 74691}[4] may be represented

    as [1, 3, 8, 2, 5, 7, 4, 6, 9] .But in this paper the return to starting point is not shown in the Figure 7,normally back tostart point is not taken compulsorily in practice [5].

    2.3 EUCLIDEAN DISTANCE CALCULATION

    The Euclidean distance Di [3], between any two cities with coordinate (X1, Y1) and (X2, Y2) [5]is calculated byequation (1) as shown below;

    Di= ((|X1-X2|)2

    + (|Y1-Y2|)2

    ) (1)

    The equation (1) will be helpful in developing a two dimensional Euclidean distance calculation matrix (EDM) which

    will be a more important in calculating the total Euclidean distance for each chromosome. For example if we have

    10 cities [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] and their co-ordinates (x-axis & y-axis), then the Euclidean distance calculation

    matrix (EDM) will be developed as in figure 2.

    FIGURE 2: Euclidean distance calculation matrix (EDM).

    In figure 2, this is a two dimensional square (since its 10x10) scalar matrix, since its diagonal elements are equal (to

    0).The colored x values with appropriate numbers have same value for any different city co-ordinates.

    2.4 FITNESS FUNCTION

    A fitness function evaluation is incorporated to assigns a value to each organism, noted as fi.This fivalue is a figure

    of merit which is calculated by using any domain knowledge that applies. In principle, this is the only point in the

    algorithm that domain knowledge is necessary. Organisms are chosen using the fitness value as a guide, where

    those with higher fitness values are chosen more often.

    The GAsare used for maximization problem. For the maximization problem the fitness function is same as the

    objective function. But, for minimization problem, one way of defining a fitness function is as equation(2), where

  • 8/13/2019 Genetic Algorithm for the Traveling Salesman Problem using Minimal Weight Variable Order Selection Crossover Op

    5/10

    fiis the objective function. Since, TSP is a minimization problem; we consider this fitness function, wherefi

    calculates Euclidean distance (or value) of the tour represented by a chromosome.The method employed here

    was to calculate the total Euclidean distance Di for each organism first, then compute fiby using the equation (2).

    fi= 1 / Di (2)

    , Where Diis the Euclidean distance over organisms in the population.

    2.5 SELECTION

    Selection/Reproduction is usually the first operator applied to population. From the population, the chromosomes

    are selected to be parents to crossover and produce offspring. Many selection/reproduction operators exist and

    they all essentially do the same thing. They pick from current population, the strings of above average and insert

    their multiple copies in the mating pool in a probabilistic manner.

    The most commonly used methods of selecting chromosomes for parents to crossover are; Roulette wheel

    selection, Rank selection, Boltzmann selection, steady state selection, Tournament selection, etc.

    2.6 ORDER CROSSOVER (OX)

    Order Crossover operator is one of the fastest of its kind, which makes it more attractable for practical use.

    To apply OX,a swath of consecutive alleles from parent 1 drops down and remaining non-duplicative allelesare

    placed in the child in the order which they appear in parent 2 [6].An Example of OX is given in figure 3.

    FIGURE 3: An Example of Order Crossover.

    Referring to figure 3, a swath of consecutive alleles from point 3 to point 7 (totally 5 alleles) selected and copied to

    child in the same position. The remaining non-duplicativealleles which are in point 1, 4, 6 & 8 are copied to child in

    the same order to fill the gaps and form a new child chromosome. Here the point 0 is selected as headquarters or

    starting place and it is a constant to all chromosomes.

    2.7 MINIMAL WEIGHT VARIABLE ORDER SELECTION CROSSOVER (MWVOSX)

    This crossover is identical to the Order crossover (OX), except variable swaths are participants in the genetic

    exchange. The following figure 4 shows the flowchart of how the Minimal Weight Variable Order Selection

    Crossover (MWVOSX) works.

  • 8/13/2019 Genetic Algorithm for the Traveling Salesman Problem using Minimal Weight Variable Order Selection Crossover Op

    6/10

    (a) (b)

    FIGURE 4: (a) Flowchart of OX; (b)Flowchart of MWVOSX.

    DONE

    Randomly select a swat

    of consecutive alleles

    from Parent 1 &dropdown to child.

    Remaining values are

    placed in the child from

    parent 2 in the same

    order which they

    appear in parent 2.

    Select a limited number

    of multiple swats of

    consecutive alleles from

    Parent 1.

    Acquire remaining from

    parent 2 in forward

    orderto temporary

    chromosome as temp

    child1.

    Find a minimal weight swatof

    consecutive alleles from

    multiple swats in Parent 1 &

    drop down to child.

    Acquire remaining from

    parent 2 in reverse

    orderto temporary

    chromosome as temp

    child 2.

    Make two copiesof child as

    temp child 1 & temp child 2.

    Calculate the total

    weight(distance) of the

    temporary chromosome

    as temp child1.

    Calculate the total

    weight(distance) of the

    temporary chromosome

    as temp child2.

    Select temporary

    chromosometempchild 2 as child.

    YES NO

    Select temporary

    chromosometempchild 1 as child.

    DONE DONE

    START START

    Temp

    child1 child2

    3

    2

    5

    4

    1

  • 8/13/2019 Genetic Algorithm for the Traveling Salesman Problem using Minimal Weight Variable Order Selection Crossover Op

    7/10

    In figure 4, we have compared order crossover (figure 4(a)) and Minimal Weight Variable Order Selection

    Crossover (figure 4(b)).Referring to figure 4(b) shows a flowchart of the working mechanism of Minimal Weight

    Variable Order Selection Crossover (MWVOSX) and a points form brief description of how the MWVOSX works as

    follows;

    [1].Initially a limited number of multiple swaths with consecutive alleles in specific points are taken for next stage

    from parent 1(For more details on points selections refer section 3).

    [2].Now the weight calculation is performed for each selected swath using Euclidean distance calculation matrix

    (EDM) and the best swath with minimal weight is selected and drop down to child chromosome.

    [3].Now we make two copies of child as temp child 1 & temp child 2, and then pass them in parallel to fill their

    remaining from parent 2 in forward and reverse order.

    [4].Then the total weight/distance of both temp child 1 & temp child 2 calculated separately and pass for decision

    maker.

    [5].The child is selected from comparing the two temporary children and the smallest weighted chromosome is

    selected as child.

    Now consider a pictorial example of MWVOSX chromosome creation in figure 5.

    FIGURE 5: An Example of MWVOSX.

    Totally Four swaths with consecutive alleles are selected .Note the upcoming swaths have same specific number of

    alleles (here itsfive) and upcoming swaths are taken in an incrementing point by one. Now assume the second

    swath order has minimal weight comparing to other three and successfully selected and drop down to child.

    Next the remaining are selected from Parent 2 in forward and reverse order as shown in figure 5, then made two

    duplicate different children .

    Now the weight /distance of the both two new chromosomes are compared and its assumed that reverse order

    chromosome weight is smaller compared to forward order chromosome. So the reverse order chromosome is

    successfully selected as the child.

    2.8 MUTATION

    The mutation operator randomly selects a position in the chromosome and changes the corresponding allele,

    thereby modifying information. The need for mutation comes from the fact that as the less fit members of

    successive generations are discarded; some aspects of genetic material could be lost forever. By performing

    occasional random changes in the chromosomes, GAs ensure that new parts of the search space are reached,

    Selected Order

  • 8/13/2019 Genetic Algorithm for the Traveling Salesman Problem using Minimal Weight Variable Order Selection Crossover Op

    8/10

    which reproduction and crossover alone couldnt fullyguarantee. In doing so, mutation ensures that no important

    features are prematurely lost, thus maintaining the mating pool diversity.

    For the TSP, the classical mutation operator does not work. We have considered the reciprocal exchangemutation

    [4] that selects two nodes randomly and swapsthem.

    3. COMPUTATIONAL EXPERIMENTS

    For comparing the efficiency of the different crossover operators, genetic algorithms using OX & MWVOSX have

    been encoded in c programming language on a Pentium 4 personal computer with speed 3 GHz and 1 GB RAM

    under MS Windows XP, the program have been compiled and run by GCC (GNU C Compiler).

    Initially a population of 20 sample chromosomes has been chosen for the experiment and only the new

    chromosomes generated by both OX and MWVOSX are compared and no mutation is done, since this paper is only

    focus on order crossover and Minimal Weight Variable Order Selection Crossover (MWVOSX) which is identical to

    crossover operator.

    There should be control parameters present in the experiment, where the swath size and the numbers of swaths

    should be controlled. Here the swath size is fixed to five alleles and the numbers of swaths are fixed to four.

    There is only one generation of new chromosomes is generated for both crossover operators and fitness function

    Is evaluated by the fitness function equation (2).best chromosomes are taken from both highest fitness values.

    Figure 6 shows the fitness comparison between OX and MWVOSX chromosomes, out of 20new offspring/child

    chromosomes 16chromosomes which are generated by MWVOSX have high fitness values compared to

    offspring/child chromosomes generated by OX. OX also produced good four chromosomes compared toMWVOSX.

    Ten (5 in OX + 5 in MWVOSX) chromosomes are approximately equal to each other.

    FIGURE 6: Fitness Comparison between OX & MWVOSX.

    The best chromosome also being produced by the MWVOSX which is the fifth chromosome and the best for OX is

    the tenth & nineteenth which have the same pattern. But the best chromosome with highest fitness for overall is

    produce by MWVOSX operator which is the fifth chromosome for the first generation. The best chromosomes of

    which are generated by OX and MWVOSX are shown figure 7, 7(a) belong to OX and 7(b) to MWVOSX where 7(b) is

    the best offspring (minimal distance).

  • 8/13/2019 Genetic Algorithm for the Traveling Salesman Problem using Minimal Weight Variable Order Selection Crossover Op

    9/10

    (a)0197654382 (b)0723156984

    FIGURE 7: (a) OX generated best offspring; (b) MWVOSX generated best offspring.

    4. CONCLUSION & FUTURE WORK

    I have proposed a new crossover operator named Minimal Weight Variable Order Selection Crossover (MWVOSX)

    for a genetic algorithm for the Traveling Salesman Problem (TSP).In terms of quality of the solution, for the lesssized instances, MWVOSX is found to be better then OX. But as size increases the MWVOSX becomes slower

    compare to OX. Note that using multiprocessors pc[8], by parallel programming the MWVOSX operator will

    become more fast. Referring to figure 4(b) starting from point 3, where a parallel process is started and easily

    programmed.

    In-depth experiment shown in figure 8, the comparison between forward and reverse order acquiring in MWVOSX.

    Note here forward order has produced 13good off springs compared to reverse order.Fouroff springs are

    approximately equal to each other (2 in forward and 2 in reverse). Even though the best offspring is produced by

    reverse order. So it is unpredictable to find which order(forward/reverse) will produce the best offspring, eventhe forward order produced the most best offspring, but reverse order gives the best offspring with highest fitness

    value .

    FIGURE 8:Comparison between Forward and Reverse order acquiring in MWVOSX.

  • 8/13/2019 Genetic Algorithm for the Traveling Salesman Problem using Minimal Weight Variable Order Selection Crossover Op

    10/10

    The swath size should not be less than the half the size of the chromosome, because a swath size with higher then

    the half the size of the chromosome will make the MWVOSX operator inefficient and will limit the number of

    swaths. The number of swaths also should keep minimal, excessive number of swaths will slowdown the MWVOSX

    operator in finding the minimal weight swath. It is difficult to say what would the the size of the swath and how

    many swaths should be presented.

    In this paper I have only compared with OX, but there are other OX based crossover operators are exist in real

    world. So MWVOSX operator should be compared with OX based crossover operators and other crossover

    operators as well. The current studies about efficiency of MWVOSX compared with other alternatives and

    development of OX based new crossover operators are under investigation.

    5. REFERENCES

    *[1] Donald Davendra,"Traveling Salesman Problem, Theory and Applications".

    *[2] J.T.R.Jang,C.T.Sun,E.Mizutani,"Neuro-Fuzzy & Soft Computing".

    *[3] S.Rajasekaran,G.A.Vijayalakshmi Pai,"Nerural Neyworks,Fuzzy Logic,and Genetic Algorithms".

    *[4] RC Chakraborty,http://www.myreaders.info/09-Genetic_Algorithms.pdf

    *[5]Buthainah Fahran Al-Dulaimi, and Hamza A. Ali"Enhanced Traveling Salesman Problem Solving

    by Genetic Algorithm Technique (TSPGA)"

    *[6]http://www.rubicite.com/Tutorials/GeneticAlgorithms/CrossoverOperators/Order1CrossoverOperator.aspx

    *[7]D. E. Goldberg, Genetic Algorithm in Search, Optimization and Machine Learning

    *[8]P. Borovska, T. Ivanova and H. Salem, Efficient Parallel Computation of

    the Traveling Salesman Problem on Multicomputer Platform,

    Proceedings of the International Scientific Conference Computer Science

    2004, Sofia, Bulgaria, Dec. 2004, PP74-79.