0% found this document useful (0 votes)
61 views

TSM Using Genetic Algorithm

The document discusses using a genetic algorithm to solve the travelling salesman problem (TSP). TSP aims to find the shortest route for a salesman to visit each city once and return to the starting point. Standard genetic algorithms involve initializing a population, calculating fitness, selecting parents, crossing over genes, and mutating to introduce variations. The genetic algorithm approach for TSP involves representing cities as genes in a chromosome, calculating fitness as the path length, and evolving the population through selection, crossover and mutation to find the shortest route.

Uploaded by

Gaurav Tomar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views

TSM Using Genetic Algorithm

The document discusses using a genetic algorithm to solve the travelling salesman problem (TSP). TSP aims to find the shortest route for a salesman to visit each city once and return to the starting point. Standard genetic algorithms involve initializing a population, calculating fitness, selecting parents, crossing over genes, and mutating to introduce variations. The genetic algorithm approach for TSP involves representing cities as genes in a chromosome, calculating fitness as the path length, and evolving the population through selection, crossover and mutation to find the shortest route.

Uploaded by

Gaurav Tomar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Travelling Salesman Problem using Genetic Algorithm

Travelling Salesman Problem (TSP) is an optimization problem that aims navigating given a list of city
in the shortest possible route and visits each city exactly once. When number of cities increases,
solution of TSP with mathematical methods becomes almost impossible. Therefore it is better to use
heuristic methods to solve the problem.

Travelling Salesman Problem (TSP) is an important NP-hard problem in combinatorial optimization.


According to TSP, there is a salesman and he wants to sell his goods in different cities. Therefore, the
salesman leaves a city, visits each of the cities exactly once and returns back to the starting point.
The aim of the problem is to provide the possible shortest route to the salesman, among n cities
whose distances between each city are known.

Solution of TSP with Genetic Algorithm


Genetic Algorithm is significant optimization technique, offer heuristic methods for NP-hard
problems such as TSP. Genetic Algorithm (GA) which is an evolutionary algorithm is inspired by
biological changes. It uses random search techniques. It works using population of individuals. Thus,
it starts searching the set of the point, not one point and reaches the global optimum. It utilizes
operators such as natural selection, crossover and mutation for the evolution of population. Its
solutions can be exact or approximate.

Genetic algorithms are heuristic search algorithms inspired by the process that supports the
evolution of life. The algorithm is designed to replicate the natural selection process to carry
generation, i.e. survival of the fittest of beings. Standard genetic algorithms are divided into five
phases which are:

1. Creating initial population.


2. Calculating fitness.
3. Selecting the best genes.
4. Crossing over.
5. Mutating to introduce variations.

These algorithms can be implemented to find a solution to the optimization problems of various
types. One such problem is the Travelling Salesman Problem. The problem says that a salesman is
given a set of cities, he has to find the shortest route to as to visit each city exactly once and return
to the starting city.

Basic Concepts for Genetic Algorithm


Gene: The each parameter’s value which affects the results is called as gene.

Chromosome: Chromosome is a sequence, occurs from genes. It indicates the candidate solutions.

Population: It occurs from the specified number of chromosomes for the problem and indicates the
set of the candidate solutions.
Codification: With codification, the values of the parameters, are known as genes, are combined in
the form of an array of values.

Selection: In order to produce a new chromosome, the selection of parents from the previous
population is called as selection.

Crossover: Crossover is the exchange of genes between two chromosomes; as a result two new
chromosomes are created.

Mutation: With mutation, one or more genes of a chromosome are changed; as a result a new
chromosome is obtained

Approach:
In the following implementation, cities are taken as genes, string generated using these characters is
called a chromosome, while a fitness score which is equal to the path length of all the cities
mentioned, is used to target a population.

Fitness Score is defined as the length of the path described by the gene. Lesser the path length fitter
is the gene. The fittest of all the genes in the gene pool survive the population test and move to the
next iteration. The number of iterations depends upon the value of a cooling variable. The value of
the cooling variable keeps on decreasing with each iteration and reaches a threshold after a certain
number of iterations.

Algorithm:
1. Initialize the population randomly.
2. Determine the fitness of the chromosome.
3. Until done repeat:
1. Select parents.
2. Perform crossover and mutation.
3. Calculate the fitness of the new population.
4. Append it to the gene pool.

You might also like