100% found this document useful (1 vote)
114 views41 pages

GP - Ant Colony Optimization

This document provides an overview of the Ant Colony Algorithm (ACA) for optimization problems. It begins with an introduction to soft computing techniques including artificial neural networks, genetic algorithms, and fuzzy logic. It then discusses the traveling salesman problem (TSP) as an example optimization problem. The main sections describe the ACA procedure which is inspired by how ants find the shortest path between their colony and food sources using pheromone trails. It also briefly discusses genetic algorithms and the ants net algorithm, both of which are compared to ACA.

Uploaded by

Pratap Barre
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
114 views41 pages

GP - Ant Colony Optimization

This document provides an overview of the Ant Colony Algorithm (ACA) for optimization problems. It begins with an introduction to soft computing techniques including artificial neural networks, genetic algorithms, and fuzzy logic. It then discusses the traveling salesman problem (TSP) as an example optimization problem. The main sections describe the ACA procedure which is inspired by how ants find the shortest path between their colony and food sources using pheromone trails. It also briefly discusses genetic algorithms and the ants net algorithm, both of which are compared to ACA.

Uploaded by

Pratap Barre
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 41

Ant Colony Algorithm (ACA)

Prof. G. Panda, FNAE, FNASc.


Indian Institute of Technology, Bhubaneswar
Email : [email protected] / [email protected]

Presentation Flow
Introduction

The Traveling Salesman Problem


Ant Colony Algorithm (ACA)
Genetic Algorithm (GA)
Ants Net Algorithm

Numerical Examples
Conclusions
References

Introduction
Soft computing

Inspired by the biological computational methods and natures problem


solving strategies.
Includes

Artificial Neural Networks (ANN) Model of Neurons of the brain,

Genetic Algorithm - Evolutionary Computational model,

Fuzzy logic - Linguistic method.

Soft Computing = Computational Intelligence.


3

Introduction Contd
Ant Colony Algorithm (ACA)

A component of Swarm Intelligence.


Used for Optimization.

Application Areas
Vehicle Routing,
Sequential Ordering,
Graph Coloring,
Routing Communication Networks etc.

Introduction Contd
What do Foraging ants and long distance truck drivers have in
common??

Both want to deliver the loads as quickly as possible.

But while ants invariably take the shortest path to their destinations, human
counterparts often choose a more circuitous route.
So, thanks to the new algorithm ACA (Ant Colony Algorithm) that imitates
insect behavior, trucks can be as efficient as ants.

ACA - proposed by Dorigo and his colleagues as a multi-agent approach


to solve difficult combinatorial optimization problem such as Traveling
Salesman Problem (TSP), Quadratic Assignment Problem (QAP).
5

Introduction Contd
Insects that live in colonies - ants, bees, wasps, termites have long
fascinated everyone from naturalists to artists.

Each insect in a colony seems to have its own agenda and yet the group as
a whole is highly organized.
Ants behavior is unsophisticated and they collectively perform complex
tasks. Ants have highly developed sophisticated sign based stigmergy.

Ants deposit a trail of pheromones - chemicals whose smell can


inform or influence the behavior of other ants - along the route they
travel in search of food.
6

Introduction Contd
When a food source is found, the ant that discovered it communicate this
information to its peers, who thus follow that insects pheromone trail.
As more and more ants travel to the food source the pheromone track
becomes thicker and thicker attracting more and more ants who in turn
deposit their own pheromone and so on.
When confronted to the obstacle (Fig.1) on the preferred path, the ants
quickly switch to the next most efficient line to the food.

A high level of pheromone on the right path gives the ant stronger stimulus
and has higher probability to turn right.

Introduction Contd

Fig. 1: Path of Ants when there is obstruction

Introduction Contd
Consider A is the food source, E is the nest and an obstruction HBCD. The
distances of various points are shown in Fig.2.

Fig. 2: Pheromone Trail of Ants

Introduction Contd
At T = 0,
60 ants at B and 60 at D on the average 30 ants from each node will go
towards H and 30 towards C.

At T=1,
The new 60 ants that come to B from A find a trail of intensity 30 on the
path that leaves to H laid by 30 ants that went the way from B and trail of
intensity 30 on path to C obtained as sum of trail laid by 30 ants that went
all way from B and 30 ants coming from D via C.
The probability of choosing the path is based so that expected number of
ants going towards C is double towards it.
The process continues like all the ants will eventually choose the shortest
path.
10

The Traveling Salesman Problem


(TSP)
The Traveling Salesman Problem (TSP) is a well known in optimization.
TSP is the problem of a salesman who wants to find, starting from his
hometown a shortest possible trip through a given set of customer cities and
to return to his hometown.
The weighted graph,
G = (N, A)
N = set of nodes representing the cities.
A = set of arcs fully connecting the nodes N.

Each are assigned a value dij, which is the length of the arc (i, j) A in the
distance between cities i, j with (i, j) N.
The TSP is the problem of finding a minimal length Hamiltonian circuit of the
graph, where an Hamiltonian circuit is a closed tour visiting exactly once
each of the n N nodes of G.
11

TSP Contd
For symmetric TSPs, the distances between the cities are independent of
the direction of traversing the arcs, that is dij=dji for every pair of nodes.
And in asymmetric TSP (ATSP) at least for one pair of node i, j,
we have, dij dji.

The TSP in a Nutshell


For n cities to visit, let Xij has the variable that has value 1 if the salesman
goes from city i to city j and the value 0 if the salesman does not go from city i
to city j. Let dij is the distance from city i to city j.

12

TSP Contd
Maximize the linear objective function

X ij d ij
n

(1)

j 1

Subject to

X ij 1
n

i 1,i j

X ij 1
n

i 1,i j

X ij 0

for each j=1, 2, n (linear constraint)

(2)

for each i=1, 2, n (linear constraint

(3)

for 1 for all i and j (integer constraint)

(4)
13

Ant Colony Algorithm (ACA)


Procedure:
In ACA, the solution is built by the ants and the algorithm executes tmax
iterations and during each iteration m ants build a tour executing n steps
in which probability decision rule is applied. In general when the ant in
node i chooses to node j and the arc (i-j) is added to the tour under
construction. This is repeated till the ant completes its tour.
In any tth iteration, the amount of pheromone ij(t) associated to arc (i-j)
is intended to represent the learned desirability of choosing city j when in
city i.

14

ACA Contd
If the ant K has visited some cities already, this memory is called tabu list.
The ant decision table [aij(t)]/i of node i' is given by

t t
t
t

aij

ij

i i

ij

ij

(5)

ij

ij(t) = amount of pheromone trail on the arc (i, j) at time t.

ij = 1/dij ,, dij = distance between nodes i to j.


dij = dji (symmetric) and dij dji (un-symmetric).
i = number of neighbors of node i.
, = control parameters.
15

ACA Contd
The probability with which ant K chooses to go from city i to city j
while building its tour at the tth iteration is
p t
k
ij

aij t

k ail t

(6)

l i

where
ik i

= set of node in the neighbor of i that K has not visited yet.

16

ACA Contd
After ants have completed the tour, pheromone evaporation of arcs is
triggered and then each ant K deposits a quantity of pheromone ijk t on
each arc it has used as
1 Lk t
t
0
k
ij

if i, j T k t

if i, j T k t

(7)

Tk (t) = tour done by ant K at iteration t.


Lk (t) = its length.
It is clear from (3) that the shorter the tour the greater the pheromone
deposited. Pheromone evaporation is incorporated as

ij 1 ij t ij t

(8)
17

ACA Contd
Where

ij t ijk t
m

k 1

(9)

= pheromone decay coefficient.


m = total number of ants.
n = total number of cities.

= 1 and = 2 to 5.

18

Genetic Algorithm (GA)

Genetic Algorithm (GA) is a computational model based on natural


evolution originally developed by Holland.

GA are attractive classes of computational models that mimic natural


evolution to solve the problems in wide variety of domains.

Pioneering work of Holland, Goldberg, Dejong Grefenstette, Davis and


Muhlenbein and others were fueling the spectacular growth of GA.

It is used as a powerful optimization tool.

system to be optimized is represented by a binary string, which


encodes the parameters of the system.
A population

of strings with initial random parameters is used.

Genetic Algorithm combines the Darwinian theory of survival of the


fittest procedure.
19

GA Contd
A

number of generations are simulated with operators representing the


major elements of evolution such as competition, fitness based selection,
recombination such as cross over and mutation.

Inversion, duplication, segregation, dominance, intra chromosomal


duplication, translocation, speciation, migration, sharing are also used.

In the TSP instead of binary coding the real coding (Fig.3).


Once the shortest path is obtained from ACA the nodes of all the cities are
written in order and two cross-sites are selected.
For the example, two cross sites are 2 and 5.

20

GA Contd
If the mth ant produces Tk shortest path and two cross-sites are selected at
random and the cities in between the cross-sites are inverted (Fig.3).

All the bits are compressed and the bits between the two cross-sites are
written at the end (Fig.4).

Once the shortest path is obtained by the above three methods, each city is
chosen and positioned at different locations without changing the order of
the other cities and the shortest path is found.
21

Ants Net Algorithm


Step-1:
Initialize
Set t: = 0 (t is the time counter)
Set NC: = 0 (NC is the cycle counter)
For every edge (i,j) set an initial value of
ij = C a random value for trail intensity and ij 0
Place m ants at n nodes (in our problems m = n)
Step-2:
Set s: = 1 {s is the tabu list index}
For k: = 1 to m do
Place the starting town of kth ant in tabuk(s)

22

Ants Net Algorithm Contd


Step-3:
Repeat until tabu list is full {this step will be repeated (n-1) times}
Set s:= s+1
For k:=1 to m do
Choose the town to move to with a probability pijk (t) given in (6) {at time kth
ant is on town i = tabuk(s-1)}
Move kth ant to town j
Insert town j in tabuk(s)}
Step-4:
For k:=1 to m do
Move the kth ant from tabuk(n) to tabuk(1)}
Compute the length Lk of the tour described by the ant k
Update the shortest tour found
For every edge (i,j)
For k:=i to m do
ij Q Lk if (i tour described by tabuk (normally Q is taken as 1)
0 otherwise

23

Ants Net Algorithm Contd


Step-5:
For every edge (i,j)
According to (8)
Set t:=t+n
Set NC:=NC+1
For every edge (i,j) set 0
Step-6:
If (NC < NCmax) and (not stagnation behavior)
Then
Empty all tabu lists
Go to Step 2
Else
Print shortest tour

24

Ants Net Algorithm Contd


Step-7:
Once shortest tour from ACA is obtained perform inversion or compression
by GA

Step-8:
Once the shortest path is obtained by the above three methods, each city
is chosen and positioned at different locations without changing the order
of the other cities and the shortest path is found

25

Numerical Examples
Examples
Problem 1 Un symmetric TSP (dij dji)
Five cities 1,2,3,4,5 and the distances between are given in table.
Answer 15

Cities

1-2-3-4-5-1 (un symmetric tsp)

26

Examples Contd
Step 1

At t = 0, NC = 0, ij = C = 0.2 a random number is assumed and the ij


matrix is given by

27

Examples Contd
Step 2
s=1; k=1. Place the ant 1 at node 1 the probabilities of choosing the
shortest path by that ant is shown below

1
since p15 is the highest and 1 moves to 5 and tabu list is
5
28

Examples Contd
Step 3
Place the ant at 5 and let us calculate the probability matrix as shown
below

Now p53 is the highest and the ant moves from city 5 to 3 and the tabu
1

list, is 5
3

29

Examples Contd
Place the ant at 3 and calculate the probabilities to the paths and the
matrix is shown below

Now p34 is the highest and the ant at 3 moves to 2 and the tabu list is
1
5


3
4

Place the ant at 4 and it can go to only city 2 and the path is 1 - 5 - 3 - 4 2 - 1 and the distance of the path taken by the ant is
1 + 2 + 4 + 4 + 6 = 17

30

Examples Contd
ij

Step 4
is calculated from (7) as 1/17=0.06

ij

similarly for other ants the distance of the path traveled is


calculated and computed as shown above for all the ants.

31

Examples Contd
Step 5
Now is updated using (8) as

ij1 1 0.5 ij 0 ij 1 0.5 0.2 0.06 0.16

go to step no 2 and repeat.


Assume 5 - 1 - 2 - 3 - 4 - 5 is the shortest path obtained by ant colony
optimization and we are ready to apply the inversion operator of GA.
Choose the cross sites at random as 2 and 4 and the real values between
the sites are inverted as shown below.

32

Examples Contd
If the bits are compressed between the cross sites we get 5 1 4 2
3 5 and the length of the route 1 + 7 + 4 + 3 + 7 = 22.

The shortest of all the three in the first iteration is 17 and if it goes for
many iterations this converges to 15 and the path is given as 5-1-2-3-4-5
and the shortest length is 15.

33

Examples Contd
Problem 2: answer 179
net
179

6-1-4-3-5-2-6 (un symmetric tsp) using ants


3-5-2-6-1-4-3

34

Examples Contd
Problem 3: answer 45 1-7-2-6-4-3-5-1 (un symmetric tsp) using ants
net
42 3-5-2-6-4-1-7-3

35

Examples Contd
Problem 4: answer 190 2-3-1-4-7-6-5-2 (symmetric tsp) using ants net
190 2-3-1-4-7-6-5-2

36

Examples Contd
Problem 5: answer 73.07
net
73.07

1-7-3-4-2-6-5-1 (symmetric tsp) using ants


5-6-7-4-3-7-1-5

37

Examples Contd
Problem 6: answer 33.8
using ants net
33.8

1-9-5-6-4-7-10-2-3-8-1 L (un symmetric tsp)


7-10-2-3-8-1-9-5-6-4-7

Some more realistic problems are selected from web site:


http://www.iwr.uni-heidelberg.de/groups/comopt/software/TSPLIB95

and shown in Table-1

38

Examples Contd
TABLE. 1 EXAMPLE PROBLEMS FROM TSPLIB95
(Values given in brackets are given in TSPLIB95)

39

Conclusions

ACA and GA is used to solve symmetric and un symmetric TSP.


It is a novel and very promising research field.
It is derivative free optimization technique.
It does not fall to local minima/maxima.
Lot of application areas.
More information on ACA from the website of Dorigo:
http://iridia.ulb.ac.be/~mdorigo/ACO/ACO.html

40

References
1.

Dorigo,M. and Gambardalla,L.M., Ant Colonies for the Traveling


Salesman Problem, Bio Systems, 43, pp 73-81,1997.

2.

Dorigo,M. and Gambardalla,L.M., Ant Colony System: A Cooperative


Learning Application to Traveling Salesman Problem, IEEE
Transactions on Evolutionary Computation, Vol.1, No.1, April.1997.

3.

Dorigo .M. http://iridia.ulb.ac.be/~mdorigo/ACO/ACO.html, 1999.

4.

Reinelt,G.,
http://www.iwr.uni-heidelberg.de/groups/comopt/software/TSPLIB95,
1994.

41

You might also like