You are on page 1of 4

ANT COLONY ALGORITHM FOR TSP

Problem Statement
Sales man has to start from one place
Go to all other city just once and come back to original city
Finding the least cost/distance path with above condition
Algorithm
If there are n cities, then L distinct ants start from any of these n cities randomly
Ants have few distinctive advantages over real ants
They have memory- not to visit
the cities, they have visited
They know the distance of the cities
and tend to choose nearby city
If distance of two paths are same, they tend
to choose path with more pheromone

There probability (PKij) to select city j by an ant k , sitting at city i is given


CONCEPT VISULISATIONS- How ACO Works with TSP

5 5
4 4

Iteration
1
1 1
3 3

2 2

Path:1 4 3 2 5 1 Path: 1 4 3 2 5 1
Distance is 45 Distance is 55
Iteration
2

From 1, 5 is much more probable due to less distance and higher pheromone
From 5, 2 can be selected based on pheromone, 4 based on distance and 3 based on probabilistic nature of the
algorithm
If any of the ant chose 4 from 5, It will have less total distance of the path- hence better pheromone update and then
to 3 due to distance and high pheromone
From 3, it will take path towards 2 and then to 1
THE LEAST DISTANCE
4

1
3

Path 154321 will have the least distance

You might also like