You are on page 1of 24

Submitted by: Professor In – Charge:

Dalai Bhargav Jnanadev Prof. Debjani Chakraborty


11MA20018 Mathematics and Computing
Mathematics and Computing IIT KARAGPUR
IIT KHARAGPUR
PROJECT OBJECTIVES
 Understanding about Ant Colony Optimization
 Metaheuristic of Ant Colony Optimization
 Heuristics of Travelling Salesman Problem
 ACO for Travelling Salesman Problem
 Implementation of ACO for TSP
 Why do we prefer ACO over other algorithms for
Travelling Salesman Problem
 Fuzzy Travelling Salesman Problem
ACKNOWLEDGEMENT
I would like to express my sincere gratitude to the Department of
Mathematics and Computing (IIT Kharagpur) and Prof. Debjani
Chakraborty for providing this opportunity. The opportunity of
ANT COLONY OPTIMIZATION FOR TRAVELLING SALESMAN PROBLEM.
I wish to express my profound gratitude to my Professor Debjani
Chakraborty for guiding me through this project of ‘’ ANT COLONY
OPTIMIZATION FOR TRAVELLING SALESMAN PROBLEM’’.
This project is quite learning for me at each and every step, at the same
time it is giving the confidence to work in real life and professional set
up. The challenges I am facing during the project is very helpful in
understanding the real life issues.

Dalai Bhargav Janandev


TABLE OF CONTENTS
1. Introduction
1.1 What is Ant Colony Optimization (ACO)?
1.1.1 Behavior and optimization of Ants
1.2 Practical Advantages of ACO
1.2.1 ACO for optimizing Traffic Signal Timings
1.2.2 Adaptive Sensor- Network Topology Estimating algorithm
2. Ant Colony Optimization Metaheuristic
7

2.1 Formal definition of Combinatorial Optimization


2.2 What is Metaheuristic?
2.3 Ant Colony Optimization Metaheuristic
2.3.1 Construction Ant Solution
2.3.2 Daemon Actions
2.3.3 Pheromone Updation
2.4 Illustion of ACO
3. Ant Colony Optimization for Travelling Salesman Problem
13

3.1 Travelling Salesman Problem


3.2 Heuristics of Travelling Salesman Problem
3.2.1 Nearest neighbor search
3.2.2 Minimum Spanning Tree
3.2.3 Twice around the tree heuristic
3.3 ACO metaheuristic for TSP
3.4 ACO Implementation for TSP
4. Fuzzy Travelling Salesman Problem
13

4.1 Fuzzy Travelling Salesman Problem


4.1 Fuzzy TSP
4.1.1Yager Ranking Approach
4.2 Formulation of ACO for Travelling Salesman Problem
5 Conclusion
6 Reference
1 . INTRODUCTION :

1.1 What is Ant Colony Optimization?

Ant colonies, and more generally social insect societies, are distributed
systems that, in spite of the simplicity of their individuals, present a highly
structured social organization. As a result of this organization, ant colonies can
accomplish complex tasks that in some cases far exceed the individual
capabilities of a single ant.
The main idea is that the self-organizing principles which allow the highly
coordinated behavior of real ants can be exploited to coordinate populations
of artificial agents that collaborate to solve computational problems. Several
different aspects of the behavior of ant colonies have inspired different kinds
of ant algorithms. Examples are foraging, division of labor, brood sorting, and
cooperative transport. In all these examples, ants coordinate their activities
via stigmergy, a form of indirect communication mediated by modifications of
the environment. For example, a foraging ant deposits a chemical on the
ground which increases the probability that other ants will follow the same
path. Biologists have shown that many colony-level behaviors observed in
social insects can be explained via rather simple models in which only
stigmergic communication is present. In other words, biologists have shown
that it is often sufficient to consider stigmergic, indirect communication to
explain how social insects can achieve self-organization. The idea behind ant
algorithms is then to use a form of artificial stigmergy to coordinate societies
of artificial agents.
One of the most successful examples of ant algorithms is known as ‘‘ant colony
optimization,’’ or ACO. ACO is inspired by the foraging behavior of ant
colonies, and targets discrete optimization problems.
Ant colony optimization is a population-based metaheuristic that can be used
to find approximate solutions to difficult optimization problems. It is inspired
by the above-described foraging behavior of ant colonies. In ant colony
optimization (ACO), a set of software agents called "artificial ants" search for
good solutions to a given optimization problem transformed into the problem
of finding the minimum cost path on a weighted graph.
1.1.1 Behavior and optimization of ants
The visual perceptive faculty of many ant species is only rudimentarily
developed and there are ant species that are completely blind. In fact, an
important insight of early research on ants’ behavior was that most of the
communication among individuals, or between individuals and the
environment, is based on the use of chemicals produced by the ants.
These chemicals are called pheromones. This is different from, for
example, what happens in humans and in other higher species, whose
most important senses are visual or acoustic. Particularly important for
the social life of some ant species is the trail pheromone. Trail pheromone
is a specific type of pheromone that some ant species, such as Lasius niger
or the Argentine ant Iridomyrmex humilis use for marking paths on the
ground, for example, paths from food sources to the nest. By sensing
pheromone trails foragers can follow the path to food discovered by
other ants. This collective trail-laying and trail-following behavior
whereby an ant is influenced by a chemical trail left by other ants is the
inspiring source of ACO.

Fig - 1.1.1 ( a ) Fig – 1.1.1 ( b )

A double bridge experiment was made to see the behavior of ant, in fig
1.1.1(a) there is no much pheromone deposit where as in second figure the
deposit of pheromone is way too much in order to find the shortest path.
1.2 Practical advantages of Ant Colony Optimization (ACO)
1.2.1 Ant Colony Optimization Approach for Optimizing Traffic Signal
Timings

Ant Colony Optimization (ACO) approach which is arisen from the


behaviors of real ant colonies is introduced to solve the upper level
problem in which traffic signal timings are optimized. Although ACO
algorithms are capable of finding global or near global optimum, it may
be further improved to locate better global optima for any given
problem. In this study, ACO Reduced Search Space (ACORSES) algorithm
is used for finding better signal timings. It differs from other approaches
in that its feasible search space (FSS) is reduced with best solution
obtained so far using the previous information at the each iteration. At
the end of the each iteration, only one ant is near to global optimum.
After the first iteration, when global optimum is searched around the
best solution of the previous iteration using reduced search space, the
ACORSES will reach to the global optimum quickly without being
trapped in bad local optimum.
1.2.2 Adaptive Sensor-Network Topology Estimating Algorithm Based
on the Ant Colony Optimization

Studies on ubiquitous-computing and/or ubiquitous-network systems


have recently been very attractive research topics along with interest in
rapid developments in information and communications technologies.
Consequently, everyone will be able to make use of all kinds of
information without stress, anywhere and at any time. ACO will have to
provide algorithm provides: Anytime characteristics- it had be able to
output optimal results through analysis over a finite period of time even
if the network scale or the frequency of movement increased.
Adaptability - the algorithm had to be free of special tuning to
accommodate all types of environments. It also had to automatically
adapt to changes in network structures. Robustness - it had to maintain
extremely accurate analysis results even if the ratio of noise data caused
by the simultaneous movements of numerous people or sensing errors
increased.
2 .THE ANT COLONY OPTIMIZATION METHEURISTIC

2.1 Formal definition of a combinatorial optimization


problem
The first step for the application of ACO to a combinatorial optimization problem
(COP) consists in defining a model of the COP as a triplet (S,Ω,f) , where:

 S is a search space defined over a finite set of discrete decision variables;


 Ω is a set of constraints among the variables; and
 f: S→R+0 is an objective function to be minimized (as maximizing over f is the
same as minimizing over −f , every COP can be described as a minimization
problem).
The search space S is defined as follows. A set of discrete
variables Xi , i=1,…,n , with values vji∈Di={v1i,…,v|Di|i} , is given. Elements of S are
full assignments, that is, assignments in which each variable Xi has a
value vji assigned from its domain Di . The set of feasible solutions SΩ is given by
the elements of S that satisfy all the constraints in the set Ω .
A solution s∗∈SΩ is called a global optimum if and only if
f(s∗)≤f(s) ∀s∈SΩ .
The set of all globally optimal solutions is denoted by S∗Ω⊆SΩ . Solving a COP
requires finding at least one s∗∈S∗Ω .

2.2 What is Metaheuristic?


A metaheuristic is a set of algorithmic concepts that can be used to define heuristic
methods applicable to a wide set of different problems. In other words, a
metaheuristic can be seen as a general-purpose heuristic method designed to guide
an underlying problem-specific heuristic (e.g., a local search algorithm or a
construction heuristic) toward promising regions of the search space containing
high-quality solutions. A metaheuristic is therefore a general algorithmic
framework which can be applied to different optimization problems with relatively
few modifications to make them adapted to a specific problem.
2.3 Ant Colony Optimization metaheuristic
In ACO, artificial ants build a solution to a combinatorial optimization problem by
traversing a fully connected construction graph, defined as follows. First, each
instantiated decision variable Xi=vji is called a solution component and denoted
by cij .The set of all possible solution components is denoted by c. Then the
construction graph Gc(V,E) is defined by associating the components C either with
the set of vertices V or with the set of edges E.
A pheromone trail value τij is associated with each component cij . (Note that
pheromone values are in general a function of the algorithm's iteration t:τij=τij(t)).
Pheromone values allow the probability distribution of different components of the
solution to be modelled. Pheromone values are used and updated by the ACO
algorithm during the search.
The ants move from vertex to vertex along the edges of the construction graph
exploiting information provided by the pheromone values and in this way
incrementally building a solution. Additionally, the ants deposit a certain amount
of pheromone on the components, that is, either on the vertices or on the edges
that they traverse. The amount Δτ of pheromone deposited may depend on the
quality of the solution found. Subsequent ants utilize the pheromone information
as a guide towards more promising regions of the search space.

The ACO metaheuristic is:


Set parameters, initialize pheromone
SCHEDULE_ACTIVITIES
 ConstructAntSolutions
 DaemonActions {Optional}
 UpdatePheromones
END_SCHEDULE_ACTIVITIES

SCHEDULE_ACTIVITIES construct is repeated until a termination criterion is met.


Typical criteria are a maximum number of iterations or a maximum CPU time.
The SCHEDULE_ACTIVITIES construct does not specify how the three algorithmic
components are scheduled and synchronized. In most applications of ACO to NP-
hard problems however, the three algorithmic components undergo a loop that
consists in (i) the construction of solutions by all ants, (ii) the (optional)
improvement of these solution via the use of a local search algorithm, and (iii) the
update of the pheromones.
2.3.1 Construction Ant Solution

A set of m artificial ants construct solutions from elements of a finite set of


available solution components C={cij} , i=1,…,n , j=1,…,|Di| . A solution
construction starts with an empty partial solution sp=∅ .Then, at each construction
step, the current partial solution sp is extended by adding a feasible solution
component from the set of feasible neighbors N(sp)⊆C . The process of
constructing solutions can be regarded as a path on the construction graph GC(V,E).
The allowed paths in GC are implicitly defined by the solution construction
mechanism that defines the set N(sp) with respect to a partial solution sp.
The choice of a solution component from N(sp) is done probabilistically at each
construction step. The exact rules for the probabilistic choice of solution
components vary across different ACO variants. The best known rule is the one of
ant system

where τij and ηij are respectively the pheromone value and the heuristic value
associated with the component cij . Furthermore, α and β are positive real
parameters whose values determine the relative importance of pheromone versus
heuristic information.
2.3.2 Daemon Actions

Once solutions have been constructed, and before updating the pheromone values,
often some problem specific actions may be required. These are often
called daemon actions, and can be used to implement problem specific and/or
centralized actions, which cannot be performed by single ants. The most used
daemon action consists in the application of local search to the constructed
solutions: the locally optimized solutions are then used to decide which pheromone
values to update.
2.3.3 Update Pheromones

The aim of the pheromone update is to increase the pheromone values associated
with good solutions, and to decrease those that are associated with bad ones.
Usually, this is achieved (i) by decreasing all the pheromone values
through pheromone evaporation, and (ii) by increasing the pheromone levels
associated with a chosen set of good solutions Supd :

where Supd is the set of solutions that are used for the update, ρ∈(0,1] is a
parameter called evaporation rate, and F:S→R+0 is a function such that

2.4 Illustration of ACO


The best way of illustrating how the ACO metaheuristic operates is by describing
how it has been applied to combinatorial optimization problems.
We illustrate the application to permutation problems in their unconstrained
forms TRAVELLING SALESMAN PROBLEM.
3 .ANT COLONY OPTIMIZATION FOR TRAVELLING
SALESMAN PROBLEM

3.1 Travelling Salesman Problem


The Travelling Salesman Problem is one of the best known NP-hard problems,
which means that there is no exact algorithm to solve it in polynomial time. The
minimal expected time to obtain optimal solution is exponential. So, for that
reason, we usually use heuristics to help us to obtain a “good” solution. Many
algorithms were applied to solve TSP with more or less success. There are various
ways to classify algorithms, each with its own merits. The basic characteristic is the
ability to reach optimal solution: exact algorithms or heuristics.
For the practical relevance, it is necessary to solve the larger-scale problems with
the help of heuristics. Heuristic methods vary from exacts methods in that they give
no guarantee to find the optimal solution to the given problem (so that solution is
called suboptimal), but in many cases this is the solution of good quality and we
can obtain it in acceptable time. Heuristic methods are usually focused on solving
the special type of problems.

3.2 Heuristics of Travelling Salesman Problem

3.2.1 Nearest neighbor search

It is also known as proximity search which is an optimization problem for


finding closest (or most similar) points. Closeness is typically expressed in
terms of a dissimilarity function: the less similar the objects, the larger
the function values. Formally, the nearest-neighbor (NN) search problem
is defined as follows: given a set S of points in a space M and a query
point q ∈ M, find the closest point in S to q.
Let us consider a graph of 5 cities and we would find the optimal by NNS(
Nearest Neighbour Search).
10 2
1 10
8

7 9
3
6

8
5 4
Fig – 3.2.1
6

Now we can consider from any city and formulate different solutions. We consider
city 1 and with it we calculate a solution which is 1 -> 5 -> 2 -> 4 -> 3 -> 1 and we
get Z =34. We calculate from city 2 we get 2 -> 4 -> 5 -> 1 -> 3 -> 2 and we get Z =36.
Similarly we calculate for city 3,4,5 and we get a feasible solution which is Z = 36.
And also provides a upper bound to the problem UB that is here is 34 and Lh and
Lo are the length of optimal solution solution and length of heuristic solution which
is always Lh>= Lo.
3.2.2 Minimum Spanning Tree
We consider the fig 3.2.1 and calculate the minimum spanning tree from
the graph. And then we calculate the length of minimum spanning tree
and consider all such spanning trees and we update the minimum
spanning tree. From fig 3.2.1 we get the fig

4 8
5

3
2

6
5 1
Fig – 3.2.2
7

Lmst = 26, Lst <= Lo , LMST<= Lst ,so Lmst <= Lo.
So Lmst is the lower bound and hence the optimal solution.
3.2.3 Twice around the tree heuristic
Here we consider the same graph fig 3.2.1 and construct the Eulerian
graph where you can start with any vertex, go through every edge or arc
once and only once and comeback to the starting vertex.

4 3

5 1
Fig – 3.2.3

We get a optimal solution 1 -> 5 -> 2 -> 4 -> 3 -> 4 -> 2 -> 5 -> 1. We will get
Feasible solution from this we get 1 -> 5 -> 2 -> 4 -> 3 -> 1 (feasible solution
to TSP) Z = 34.

3.3 ACO Metaheuristic for Travelling Salesman Problem


If m and n denote the number of ants and the number of cities respectively;
dij (i, j =1,2,…,n) is referred to as the distance of city i and city j, τ ij (t) is the amount
of pheromone between city i and city j at time t.

1) In initialization, pheromones on all paths are equal,suppose C τ ij (0) = (C is


constant). In the course of movement of the kth (where k=1,2,…,m) ant, its transfer
direction is determined by the probability of pheromone as a variable in each path,
which can be written as:
means the visibility on edges(i,j) and it can be calculated by a certain
heuristic function, which is

often described as: , is the probability that ant k moves form position i to position j
at time t. allowed k = { } 0,1,L,m −1 − tabu k denotes ant k has been allowed of
choice of the cities in the next step ( tabuk (k = 1,2,L,m) is the aggregation that ant
k already went across cities. In the beginning there is only one element that is the
starting city of ant k , With the development of evolution, element in the tabuk will
be increased ).α is the relatively weightiness of track. β is the parameter that
determines the influence of the heuristic function.
2) Once all ants have gone through solution construction and local search, the
pheromone update procedure is applied to these pheromone values.It can be
written as :

(2)
Where, ρ ∈ (0,1) means degree of attenuation of τ ij (t) with the process of time

(3)
Delta τ ij (t) is the amount of reinforcement in the edge (i ,j ). By different models
of algorithms of Ant Colony we have
In Ant System:

(4)
In Ant-Quantity System:

(5)
In Ant Density System:

(6)
Where Q is a constant that denotes the total information of which every ant leaves
behind after they travel once around the all cities; Lk is length of paths that ant k
have traveled in this cycle; dij means distance of two cities i and j.
3) Circulating the above steps until the time of travelachieve designated time or
haven’t appeared better solutions in a certain period of time. The flowchart of the
Ant Colony Algorithm is shown

Fig - 3.3 Flowchart for Ant Colony Algorithm.


3.4 ACO Implementation for TSP
Let us consider 4 cities Kolkata, Delhi, Chennai and Mumbai and we consider the
distance among them.

The possible solutions will be:


Kolkata–Delhi–Chennai–Mumbai-Kolkata
Kolkata-Chennai-Delhi-Mumbai-Kolkata
Kolkata-Mumbai-Chennai-Delhi-Kolkata
And so on
Now we solve it by ACO, let us consider x for a route.
Cost of travel = C(x),Length of travel = L(x), C(x) = K(L(x)), K is a conversion factor let
us say 0.2
Therefore objective function: F(x)=C(x)=0.2L(x), we need to minimize it.
Initialize parameters:
Number of ants = 100, Alpha=1, Beta=1, Evaporation Coefficient = 0.0
(for simplicity), Initial pheromone = 100,
Pheromone deposit function: Y = 10000/L(x) ,where L(x) is in kms.
Salesman is at Kolkata (start).
Probability of visiting the next city: Delhi: 38.34%, Mumbai: 33.45%
Chennai: 28.21%. The city are slected based on the probability using a roulette
wheel. Let us say that the city selected is Mumbai.
So, solution: Kolkata-Mumbai- (incomplete).Repeat the following steps till solution
is complete.
Salesman is at Mumbai
Probability of visiting the next city: Delhi: 48.8%, Chennai: 52.1%
Select the city based on the probability using a roulette wheel
Let us say that the city selected is Chennai
So, solution: Kolkata-Mumbai-Chennai- (incomplete)
There is only one city left. So, soluton: Kol-Mum-Che-Del- (incomplete)
He has to return back to Kol as all cities are visited once
Hence final solution: Kolkata-Mumbai-Chennai-Delhi-Kolkata.
X=Kolkata-Mumbai-Chennai-Delhi-Kolkata
Total trip length: 1987+1329+2095+1461
L(X) = 6872 kms
Therefore, F(X)=C(X)=0.2L(X) = 0.2 x 6872 = 1374.4
Pheromone Update: 10000/1374.4 = 7.276.
Updated pheromone values on the routes:
Kolkata to Mumbai – 100 + 7.276 = 107.276
Mumbai to Chennai – 107.276
Chennai to Delhi – 107.276
Delhi to Kolkata – 107.276
The pheromone count on other routes remain unchanged (It is assumed that
there is no evaporation).
The whole process discussed above constitutes the iteration:
 Construction of solution
 Evaluating the solution
 Updating the pheromone
This iteration is repeated again and again, until all ants have been used
For example say, the second ant constructs the solution:
Kolkata-Chennai-Mumbai-Delhi-Kolkata
X=Kolkata-Chennai-Mumbai-Delhi-Kolkata
Total trip length: 1676+1329+1407+1461
L(X) = 5873 kms
Therefore, F(X)= C(X)=0.2L(X) = 0.2 x 5873 = 1174.6
Pheromone Update: 10000/1174.6 = 8.513.
Updated pheromone values on the routes:
Kolkata to Chennai – 100 + 8.513 = 108.513
Chennai to Mumbai – 107.276 + 8.513 = 115.789
Mumbai to Delhi – 100 + 8.513 = 108.513
Delhi to Kolkata – 107.276 + 8.513 = 115.789
The pheromone count on other routes remain unchanged (It is assumed that
there is no evaporation).
It is observed that as the number of ants increases, the probability of choosing
the following solutions increases and the solution then alternates between the
following:
Kolkata-Chennai-Mumbai-Delhi-Kolkata
Kolkata-Delhi-Mumbai-Chennai-Kolkata
It is to be noted that these two paths infact represent the same.Hence the
solution can be any of these.Let us choose the first path.
X=Kolkata-Chennai-Mumbai-Delhi-Kolkata
Total trip length: 1987+1329+2095+1461
L(X) = 6872 kms
Therefore, F(X)=C(X)=0.2L(X) = 0.2 x 6872 = 1374.4.
Hence, the path with the least cost is obtained using Ant Colony Optimization
4 .FUZZY TRAVELLING SALESMAN PROBLEM

4.1 Fuzzy travelling salesman problem


We are considering the weights to be fuzzy number where a person going from
some particular city to another, the distance between the cities will not be precise.
Here the vertices and edges are crisp except the fact the weights are fuzzy numbers.

It is not travelling salesman problem, it just shows the weights as fuzzy number.
4.1.1 Yager Ranking Approach
Yager’s method involves relatively simple computation and is easily
understandable. This method involves a procedure for ordering fuzzy sets
in which a ranking approach (A˜) is calculated for the fuzzy number A =
(m, n, α, β)L−R from its λ-cut Aλ = [m − αL−1(λ), n + βR−1(λ)] according to
the following formula:

It is not necessary to know the explicit form of the membership functions


of the fuzzy numbers to be ranked. Unlike most of the ranking methods
that require the knowledge of the membership functions of all fuzzy
numbers to be ranked, the Yager’s ranking approach can be applied even
if the explicit form of membership function of the fuzzy number is
unknown.
4.2 Formulation of ACO for fuzzy TSP
Suppose a salesman has to visit n cities. He starts from a particular city, visit each
city once and then returns to the starting point. The fuzzy travelling costs from ith
city to jth city is given by ˜ ci j. The objective is to select the sequence (tour) in which
the cities are visited in such a way that the total travelling cost is minimum.

Where
Constraints (1) and (2) ensure that each city is visited only once. Constraint (3)
is known as subtour elimination constraint and eliminates all 2−city subtours.
Constraint (4) eliminates all 3−city subtours. Constraint (5) eliminates all
(n − 1)−city subtours. For a feasible solution of travelling salesman problem, the
solution should not contain subtours. So, for a 5−city travelling salesman problem,
we should not have subtours of length 2, 3 and 4. For a 6−city travelling salesman
problem, we should not have subtours of length 2, 3, 4 and 5. Similarly, for an n−city
travelling salesman problem, we should not have subtours of length 2 to n-1.
CONCLUSION
Ant Colony Optimization is used to get the Travelling salesman
problem. We use the Ant Colony Optimization over other
algorithms because it can be applied to large number of cities
and as we will be using metaheuristic Ant colony optimization to
Travelling Salesman Problem we get optimal solutions as the
heuristics are problem- dependent techniques, as they are
adapted to the problem at hand and they try to take full
advantage of the particularities of this problem. However
because they are too greedy, they usually get trapped in a local
optimum and thus fail in general.
The fuzzy formulation of the Travelling salesman Problem we get
to the different distances from cities to different cities. Further
studies on fuzzy optimization will lead to great optimization in
many sectors of transportation and networking etc.

You might also like