Title: Department of Computer Engineering
1Department of Computer Engineering
ARTI Artificial Intelligence Laboratory
Member Murat ERENTÜRK
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
2Department of Computer Engineering
Problem A salesman must visit every city in his
territory exactly once and return to his starting
city. Given the cost of travel between all
cities, how should he plan his itinerary to
minimize the total cost of his tour?
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
3Department of Computer Engineering
- Search space is a set of permutations of n cities
- Traditional methods fail (tree search) size is
n! - No polinomial time algorithm exists
- Problem is considered NP-complete
- Many heuristics developed
- Has many applications
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
4Department of Computer Engineering
PROBLEM REPRESNETATION
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
5Department of Computer Engineering
All possible configurations have to be considered
to find the optimal solution. For our example the
possible solutions are a, b, c, d a, b,
d, c a, c, d, b a, d, b, c a, d, c, b
a, c, b, d
As we can see for N cities there are (N -1)!
possible configurations
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
6Department of Computer Engineering
- When N is small (like in our example) its very
easy to find the optimal solution. However, when
N becomes large the need for a computer becomes
useful - If we assume a computer can evaluate 1010
configurations in a second, how long would it
take to evaluate all the possible solutions of N?
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
7Department of Computer Engineering
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
8Department of Computer Engineering
- Nearly 2 million years just for 25 cities. This
exponential growth in computation time makes
enumeration of all possible solutions a
non-starter. - So we have to look for different kind of
approaches
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
9Department of Computer Engineering
Heuristics
- A heuristic is a method used to guess the cost of
getting from a non-goal state to a goal state.
- Heuristics are good when
- you have to make a moment decision OR
- you have limited information and cannot obtain
more OR - the decision is not that important
- Heuristics are bad when
- you have plenty of time and information to make
an important decision - you need to be right 100 of the time
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
10Department of Computer Engineering
2-OPT
A 2-opt move consists of eliminating two edges
and reconnecting the two resulting paths in a
different way to obtain a new tour. This is a
method by which we can improve the old tour by
the way of exchanging better neighbor than the
old neighbor. The main idea is to take all
nonadjacent vertices of the tour on the graph and
take the distance between them and their adjacent
and compare with the old distance
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
11Department of Computer Engineering
Let us suppose that these edges are (a, b) and
(c, d). Then we remove edges (a, b) and (c, d)
and swap b with c in other words edges become
(a, c) and (b, d). This operation is called a
2-interchange.
n(n-1)/2
. If the resulting solution is smaller than the
initial solution, it is stored as a candidate for
future consideration. Thus, whenever a better
solution is found, the algorithm discards the
previous best solution. If not, it is discarded
and the algorithm continues the iteration.
n(n-1)/2 replacements made
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
12Department of Computer Engineering
Let us suppose that these edges are (a, b) and
(c, d). Then we remove edges (a, b) and (c, d)
and swap b with c in other words edges become
(a, c) and (b, d). This operation is called a
2-interchange.
n(n-1)/2
. If the resulting solution is smaller than the
initial solution, it is stored as a candidate for
future consideration. Thus, whenever a better
solution is found, the algorithm discards the
previous best solution. If not, it is discarded
and the algorithm continues the iteration.
n(n-1)/2 replacements made
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
13Department of Computer Engineering
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
14Department of Computer Engineering
Hill Climbing (Local Search Method)
A neighbourhood search or so called local search
method that starts from some initial solution and
moves to a better neighbouring solution until it
arrives at a local optimum
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
15Department of Computer Engineering
Hill-climbing Algorithm
- Pick a random point in the search space
- Consider all the neighbour of the current state
- Choose the neighbour with the best quality and
move to that state - Repeat 2 thru 4 until all the neighbouring states
are of lower quality - Return the current state as the solution state
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
16Department of Computer Engineering
Hill climbing algorithm has three well-known
drawbacks as given below
- Local Optimum All neighboring states are worse
or the same. The algorithm will halt even though
the solution may be far from satisfactory. - Plateau All neighboring states are the same as
the current state. In other words the evaluation
function is essentially flat. The search will
conduct a random walk - Ridge The search may oscillate from side to
side, making little progress. In each case, the
algorithm reaches a point at which no progress is
being made. If this happens, an obvious thing to
do is start again from a different starting
point. - As a result may not find the minimum cost
solution and may get stuck in local minima
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
17Department of Computer Engineering
These algorithms guide an underlying
heuristic/local search to escape from being
trapped in a local optima and to explore better
areas of the solution space
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
18Department of Computer Engineering
Meta-Heuristic Approaches
- The most commonly used meta heuristic approaches
for solving TSP are - Genetic Algorithms (GA)
- Simulated Annealing (SA)
- Memetic Algorithms GA Hill Climbing
- Memetic Annealing SA Hill Climbing
- Tabu Search
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
19Department of Computer Engineering
Simulated Annealing (SA)
- SA is an analogy with thermodynamics,
specifically with the way that metals cool and
anneal. - At high temperatures, the molecules move freely
with respect to one another. If the liquid is
cooled slowly, thermal mobility is lost. The
amazing fact is that, for slowly cooled systems,
nature is able to find this minimum energy state.
- According to the idea that a system in thermal
equilibrium at temperature T has its energy
probabilistically distributed among all different
energy states E (Boltzmann probability
distribution).
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
20Department of Computer Engineering
When stuck on a local minimum just like in
hill-climbing, we could allow the search to take
some uphill steps to escape the local minimum
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
21Department of Computer Engineering
- Generate the initial configuration
- Tcurrent temperature
- Do i1,k
- Apply neighborhood operator, obtaining a new
configuration - Calculate the change in energy, dE E1-E2
- If (dE?0) then
- its a downhill move to lower energy so accept
and update configuration - Else
- its an uphill move so generate random number
P0,1 - if (PltPr(dE) then // compare with
Pr(dE)exp(-dE/kT) - accept move and update configuration
- Else
- reject move keep original configuration
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
22Department of Computer Engineering
- Cooling Schedule Strategy
- Linear
- temp temp - a
- Geometric
- temp temp a
a should be between 0.8 and 0.99, with better
results being found in the higher end of the
range. Of course, the higher the value of a, the
longer it will take to decrement the temperature
to the stopping criterion
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
23Department of Computer Engineering
Neighbourhood operators used
Mutation operators used as implemented in genetic
algorithms for Neighbourhood operator
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
24Department of Computer Engineering
Genetic Algorithms (GAs)
- GAs (John Holland) simulate natural evolution
(Darwinian Evolution) at the genetic level using
the idea of survival of the fittest - An individual (chromosome) represents a candidate
solution for the problem at hand. A collection of
individuals currently "alive, called population
is evolved from one generation to another
depending on the fitness of individuals,
indicating how fit an individual is, in other
words, how close it is to the solution. - Hope Last generation will contain the final
solution
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
25Department of Computer Engineering
Genetic Algorithm
- Generate the initial generation with the
population P(0), let i indicate the generation - Repeat until the population converges or a
termination criteria is satisfied - Evaluate the fitness of each individual in P(i)
- Select parents from P(i) based on their fitness
in P(i) - Apply genetic operators (crossover, mutation) to
the parents and produce offspring - Obtain the next generation P(i 1) from
offspring and the individuals in the generation
P(i)
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
26Department of Computer Engineering
Basic Components of GAs
- Representation
- Initial population generation - Initialization
- Fitness Function
- Selection for recombination
- Crossover
- Mutation
- Replacement Strategy
- Termination Criteria
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
27Department of Computer Engineering
Fitness value
evaluation
Population
001100101010
Calibration model
Variable set
RMS
Selection Crossover Mutation
Generate new population set
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
28Department of Computer Engineering
Structure of GA
Step 0 Initialization
- Procedure GA
- begin
- t 0
- initialize P(t)
- evaluate P(t)
- while (not termination-condition) do
- begin
- t t 1
- select P(t) from P(t-1)
- alter P(t)
- evaluate P(t)
- end
- end
Step 1 Selection
Step 2 Crossover
Step 3 Mutation
Step 4 Evaluation
Step 5 Termination Test
Step 6 End
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
29Department of Computer Engineering
Path Representation
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
30Department of Computer Engineering
Initialization
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
31Department of Computer Engineering
Fitness Function
f(indiv)S d i (i1) dn1 1?i lt n
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
32Department of Computer Engineering
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
33Department of Computer Engineering
Selection - Crossover
- Selection in GAs aims at giving higher chance for
fitter individuals to be selected as parents to
produce even better offspring - Rank-based Selection
- Tournament Selection
- Crossover exchanges parts from parent individuals
producing new offspring - PMX
- k-PTX
- Uniform Crossover
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
34Department of Computer Engineering
PMX XOVER
- builds offspring by
- choose a subsequence of a tour from one parent
- choose two random cut points to serve as swapping
boundaries - swap segments between cut points
- preserve the order and position of as many cities
as possible from other parent
35Department of Computer Engineering
Example
- p1 (1 2 3 4 5 6 7 8 9)
- p2 (4 5 2 1 8 7 6 9 3)
- step 1 swap segments
- o1 (x x x 1 8 7 6 x x)
- o2 (x x x 4 5 6 7 x x)
- this also defines mappings
- 1?4, 8?5, 7?6, 6?7
- step 2 fill in cities from other parents if no
conflict - o1 (x 2 3 1 8 7 6 x 9)
- o2 (x x 2 4 5 6 7 9 3)
- step 3 use mappings for conflicted positions
- o1 (4 2 3 1 8 7 6 5 9)
- o2 (1 8 2 4 5 6 7 9 3)
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
36Department of Computer Engineering
OX XOVER
- builds offspring by
- choose a subsequence of a tour from one parent
- preserve relative order of cities from other
parent
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
37Department of Computer Engineering
Example
- p1 (1 2 3 4 5 6 7 8 9)
- p2 (4 5 2 1 8 7 6 9 3)
- step 1 copy segments into offspring
- o1 (x x x 4 5 6 7 x x)
- o2 (x x x 1 8 7 6 x x)
- step 2 starting from 2nd cut point of one
parent, cities from other parent copied in same
order, omitting symbols already present if end
of string reached, continue from beginning of
string - sequence of cities in 2nd parent (from 2nd cut
point) is - 9-3-4-5-2-1-8-7-6 (remove 4,5,6,7 which are in
1st offspring) - 9-3-2-1-8
- place into first offspring o1 (2 1 8 4 5 6
7 9 3) - similarly the 2nd offspring o2 (3 4 5 1 8 7 6
9 2)
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
38Department of Computer Engineering
Insertion Mutation
- randomly selects a city
- removes it and inserts it at random position
- Example (1 2 3 4 5 6 7 8 9)
- 4 is selected randomly and placed after 7
- new tour becomes (1 2 3 5 6 7 4 8 9)
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
39Department of Computer Engineering
Swap Mutation
- randomly selects two cities in tour
- exchange them
- Example (1 2 3 4 5 6 7 8 9)
- 3rd and 5th selected randomly
- new tour becomes (1 2 5 4 3 6 7 8 9)
- also known as exchange mutation, point mutation,
reciprocal exchange mutation, order based
mutation
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
40Department of Computer Engineering
Replacement Strategy
- There are variety of strategies for replacing the
old population by the new offspring population to
form the next generation - (Trans-)Generational GA
- N parents produce N (or ?N) offspring (largest
generation gap,i.e. N). - Steady-State GA
- Two offspring replace two individuals from the
old generation
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
41Department of Computer Engineering
Termination Criteria
- If the result is known, whenever the population
converges, i.e. the fitness of the best
individual in the population is same as the
expected result, then terminate - Terminate whenever a predetermined value for the
number of generations is exceeded - Terminate whenever all the individuals become
alike - Terminate whenever the best individual in the
population does not change for a long time
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
42Department of Computer Engineering
Memetic Algorithms
- Developed by Michael G. Norman and Pablo Moscato
as a hybrid algorithm - They combine local search heuristics with
crossover operators - In this project Hill Climbing step is applied on
the children, right after the mutation is
completed
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
43Department of Computer Engineering
Test Datas
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
44Department of Computer Engineering
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
45Department of Computer Engineering
TSP of TURKEY
HAKKARI, SIRNAK, SIIRT, BITLIS, MUS, BINGÖL,
ERZINCAN, TUNCELI, ELAZIG, DIYARBAKIR, BATMAN,
MARDIN, SANLIURFA, ADIYAMAN, MALATYA,
KAHRAMANMARAS, GAZIANTEP, KILIS, HATAY (Antakya),
OSMANIYE, ADANA, KAYSERI, YOZGAT, NEVSEHIR,
NIGDE, IÇEL(Mersin), KARAMAN, ANTALYA, BURDUR,
AFYON, ISPARTA, KONYA, AKSARAY, KIRSEHIR,
KIRIKKALE, iKARABÜK, BARTIN, ZONGULDAK, BOLU,
DÜZCE, SAKARYA(Adapazari), BILECIK, KÜTAHYA,
USAK, DENIZLI, MUGLA, AYDIN, IZMIR, MANISA,
BALIKESIR, ÇANAKKALE, EDIRNE, KIRKLARELI,
TEKIRDAG, ISTANBUL, BURSA, YALOVA,
KOCAELI(Izmit), ESKISEHIR, ANKARA, ÇANKIRI,
KASTAMONU, ÇORUM, SINOP, AMASYA, SAMSUN, TOKAT,
SIVAS, ORDU, GIRESUN, GÜMÜSHANE, TRABZON,
BAYBURT, ERZURUM, RIZE, ATRVIN, ARDAHAN, KARS,
AGRI, IGDIR, VAN
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
46Department of Computer Engineering
Conclusion
- Considering path representation, several
different techniques and well known operators are
tested utilizing 2OPT, Simulated Annealing,
Genetic Algorithms, Memetic Algorithms and
Memetic Annealing to solve some small instances
of Traveling Salesman Problem in 2D, combining
with hill climbing. Empirical results yield the
success of the following operators from the best
to the worst Memetic Annealing performance.
Performance difference between ISM and classical
swap EM operator can be observed easily,
especially on fractal data. Hill climbing
improved the simulated annealings success rate
without considering any operator. Since the
simulated annealing is interested in the
individual not the population it performs faster
than genetic algorithms. For the genetic
algorithmic part OX1, 2PTX and PMX as crossover,
EM and ISM as mutation and hill climbing method
performs best. Note that 2PTX uses a patch-up
algorithm, producing a modified crossover
combining OX1 and scramble mutation that has not
been tested before. Hence, the best combination
of operators is OX1 and EM for both TGGA and
SSGA. Furthermore, results show that hill
climbing improves the solution in any GA type.
2OPT method is the fastest but the poorest one
when considered with average success rate for an
overall 100 runs. Since in some parts of the path
changing of two ways might not be enough so that
it gets stuck local optima and cannot perform
better than that. But on the other hand, it would
be very suitable if anyone looking for a local
optima instead of a global. It is the cheapest
and the fastest method for achieving that.
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem
47Department of Computer Engineering
Performance Analysis of Meta-Heuristic Approaches
for Traveling Salesperson Problem