Date post: | 02-Jun-2018 |
Category: |
Documents |
Upload: | ramana-thiru |
View: | 219 times |
Download: | 0 times |
of 79
8/11/2019 HEghbalpouACO
1/79
Shahid Beheshti University of Tehran
Presented by:
Ant Colony Optimization
Requirements : .
+98 21 897 882 08
kourosh.eghbalpour
Hamid EghbalpourOperating Manager of Asia Peyman.Co
@IEEE.org1987H.Eghbalpour.
ir.academia.edu/HEghbalpour-https://sbu
mailto:[email protected]:[email protected]:[email protected]:[email protected]://sbu-ir.academia.edu/HEghbalpourhttps://sbu-ir.academia.edu/HEghbalpourhttps://sbu-ir.academia.edu/HEghbalpourhttps://sbu-ir.academia.edu/HEghbalpourhttps://sbu-ir.academia.edu/HEghbalpourhttps://sbu-ir.academia.edu/HEghbalpourmailto:[email protected]:[email protected]:[email protected]:[email protected]8/11/2019 HEghbalpouACO
2/79
Lecture 01
AntColony Optimization
Swarm Intelligence
8/11/2019 HEghbalpouACO
3/79
3
8/11/2019 HEghbalpouACO
4/79
8/11/2019 HEghbalpouACO
5/79
5
8/11/2019 HEghbalpouACO
6/79
6
Food
Nest
8/11/2019 HEghbalpouACO
7/79
7
8/11/2019 HEghbalpouACO
8/79
8
8/11/2019 HEghbalpouACO
9/79
9
NEST
FOOD
8/11/2019 HEghbalpouACO
10/79
Nest Food
10
8/11/2019 HEghbalpouACO
11/79
Nest Food
Obstacle
Interrupt The Flow
11
8/11/2019 HEghbalpouACO
12/79
The Path Thickens!
Nest Food
Obstacle
12
8/11/2019 HEghbalpouACO
13/79
The New Shortest Path
Nest Food
Obstacle
13
8/11/2019 HEghbalpouACO
14/79
Adapting to Environment Changes
NestFood
Obstacle
14
8/11/2019 HEghbalpouACO
15/79
Adapting to Environment Changes
NestFood
Obstacle
15
8/11/2019 HEghbalpouACO
16/79
History of Ant Algorithms
Goss et al. 1989,
Deneuborg et al. 1990,
experiments with
Argentine ants
Dorigo et al. 1991,
applications to shortest
path problems
Now: established methodfor various optimization
problems
16
8/11/2019 HEghbalpouACO
17/79
17
Natural Ant System
Initially, ants explore randomly
Leave behind pheromone when they travel back
to colony from food
Pheromone evaporates over time
Ants follow strong pheromone left behind by
other ants
Short routes to food have more pheromone (less
distance = less evaporation)
8/11/2019 HEghbalpouACO
18/79
18
DeneubourgsSimple Experiment
8/11/2019 HEghbalpouACO
19/79
Probabilistic Transition Function
is the probability that ant k will choose the link that goes from itoj
at time t
tpkij
is the amount of pheromone currently on the path that goes directly from ito j
at time t
)(tij
otherwise
allowedjift
t
tpk
allowedkk
ijij
ijij
k
ij
0
)(
)(
We let denote the intensity of trail on link(i,j) at time t.)(tij
19
8/11/2019 HEghbalpouACO
20/79
is the heuristic value of this linkin the classic TSP application, this is
chosen to be 1/distance(i,j) -- I.e. the shorter the distance, the higher the heuristic
value.
ij
, are parameters that we can call the heuristic strength
Where our antis at iandj is a point as yet unvisited on its tour, and the summation
is over all of ksunvisited points
20
otherwise
allowedjift
t
tpk
allowedkk
ijij
ijij
k
ij
0
)(
)(
8/11/2019 HEghbalpouACO
21/79
21
Three factors drive the probabilistic model:
1) Visibility,denoted ij, equals the quantity 1/dij
2) Trail,denoted ij(t)
3) Evaporation
These three factors play an essential role in the centralprobabilistic transition function of the Ant System.
In return, the weight of either factor in the transition
function is controlled by the variables and ,respectively. Significant study has been undertaken byresearchers to derive optimal :combinations.
8/11/2019 HEghbalpouACO
22/79
22
A high value for means that trail is very important
and therefore ants tend to choose edges chosen by
other ants in the past. On the other hand, low values
of make the algorithm very similar to a stochastic
multigreedy algorithm.
8/11/2019 HEghbalpouACO
23/79
Trail intensity is updated following the completion of each
algorithm cycle, at which time every ant will have
completed a tour. Each ant subsequently deposits trail ofquantity Q/Lkon every edge (i,j) visited in its individual
tour. Notice how this method would favor shorter tour
segments. The sum of all newly deposited trail is denoted
by ij. Following trail deposition by all ants, the trailvalue is updated using
Where is the rate of trail decay per time interval and
ij = .
m
k
ij
1
ijijij tnt )()(
23
N
k
kijijij tt
1
)()1()1(
8/11/2019 HEghbalpouACO
24/79
ijijij tnt )()(Fixed : For all links is fixed
ij ij
otherwise0
by tabudescribedtour),( k,
jiifL
Q
kji
otherwise0pathselect0
, ji
is proportional to link which ant passes, the ant who passes
the short links, produce more pheromone
ij
24
Pheromoneleft on each pathShort tourHigh pheromoneLong TourLow Pheromone
Pheromone increaseat the end of tour
After each ant tour the trail intensity on each edge is updated using the following
formula
8/11/2019 HEghbalpouACO
25/79
Example 1
Here we have 10 cities as follow :
X Y
1 974.55 90.95
2 81.189 701.4
3 428 783.79
4 81.56 685.07
5 852.81 699.51
6 883.9 330.777 226.25 673.3
8 478.86 820.88
9 638.63 884.22
10 406.19 782.67
8/11/2019 HEghbalpouACO
26/79
26
The pheromone trail must not build unbounded.
Therefore, we need evaporation
Evaporation
)()1()( tnt ijij Remove links of poor paths
8/11/2019 HEghbalpouACO
27/79
Cities distribution
8/11/2019 HEghbalpouACO
28/79
Distance between cities
1 2 3 4 5 6 7 8 9 10
1 0.0 1082.0 882.5 1072.6 620.6 256.4 948.2 882.3 861.5 895.3
2 1082.0 0.0 356.5 16.3 771.6 884.1 147.8 415.2 586.7 335.03 882.5 356.5 0.0 360.2 433.1 642.7 230.0 62.9 233.3 21.8
4 1072.6 16.3 360.2 0.0 771.4 877.1 145.2 419.9 591.6 339.0
5 620.6 771.6 433.1 771.4 0.0 370.0 627.1 393.2 282.8 454.3
6 256.4 884.1 642.7 877.1 370.0 0.0 741.5 635.8 605.4 657.6
7 948.2 147.8 230.0 145.2 627.1 741.5 0.0 292.6 463.2 210.6
8 882.3 415.2 62.9 419.9 393.2 635.8 292.6 0.0 171.9 82.1
9 861.5 586.7 233.3 591.6 282.8 605.4 463.2 171.9 0.0 253.7
10 895.3 335.0 21.8 339.0 454.3 657.6 210.6 82.1 253.7 0.0
8/11/2019 HEghbalpouACO
29/79
Distribute ants on cities randomly
City'sNumber 1 2 3 4 5 6 7 8 9 10
Numberof ant (s) 2 0 2 1 1 1 1 0 1 1
8/11/2019 HEghbalpouACO
30/79
Initiating pheromone table:
0 0 &ij nn
M
C
AntsNumber
Length of
a random
tour
8/11/2019 HEghbalpouACO
31/79
1 2 3 4 5 6 7 8 9 10
1 0.000 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001
2 0.001 0.000 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001
3 0.001 0.001 0.000 0.001 0.001 0.001 0.001 0.001 0.001 0.001
4 0.001 0.001 0.001 0.000 0.001 0.001 0.001 0.001 0.001 0.001
5 0.001 0.001 0.001 0.001 0.000 0.001 0.001 0.001 0.001 0.001
6 0.001 0.001 0.001 0.001 0.001 0.000 0.001 0.001 0.001 0.001
7 0.001 0.001 0.001 0.001 0.001 0.001 0.000 0.001 0.001 0.001
8 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.000 0.001 0.001
9 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.000 0.001
10 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.000
Pheromone distributions table
8/11/2019 HEghbalpouACO
32/79
Making taboo-list table and initiate
it depending on current Ants Position
1 2 3 4 5 6 7 8 9 10
1 2 0 0 0 0 0 0 0 0 0
2 2 0 0 0 0 0 0 0 0 0
3 0 0 2 0 0 0 0 0 0 04 0 0 2 0 0 0 0 0 0 0
5 0 0 0 2 0 0 0 0 0 0
6 0 0 0 0 2 0 0 0 0 0
7 0 0 0 0 0 2 0 0 0 0
8 0 0 0 0 0 0 2 0 0 0
9 0 0 0 0 0 0 0 0 2 0
10 0 0 0 0 0 0 0 0 0 2
Ants
Index
8/11/2019 HEghbalpouACO
33/79
Making Ant-city tour table
Ant-city is a matrix that shows tour ( in row)which a
ant passes and columns are cities that ant visits
them:
Ants
Index
First city and last city are the same.
1 1 0 0 0 0 0 0 0 0 0 12 1 0 0 0 0 0 0 0 0 0 1
3 3 0 0 0 0 0 0 0 0 0 3
4 3 0 0 0 0 0 0 0 0 0 3
5 4 0 0 0 0 0 0 0 0 0 4
6 5 0 0 0 0 0 0 0 0 0 5
7 6 0 0 0 0 0 0 0 0 0 6
8 7 0 0 0 0 0 0 0 0 0 7
9 9 0 0 0 0 0 0 0 0 0 9
10 10 0 0 0 0 0 0 0 0 0 10
8/11/2019 HEghbalpouACO
34/79
Making Ant-path length table
In this matrix we have total distance that any
ant passed until now!
In the first step all of the path-length are zero.
Ant_Num 1 2 3 4 5 6 7 8 9 10
Total
Path_len 0 0 0 0 0 0 0 0 0 0
8/11/2019 HEghbalpouACO
35/79
For first ant in first city we determine available
cities-cities that we can go-from taboo-list.Suppose the next ant is in the city 1
In next step we compute probability of
Available cities to go by this formula:
Available
Cities 2 3 4 5 6 7 8 9 10
8/11/2019 HEghbalpouACO
36/79
( )ij tPheromone amount
between city I & j
ij 1/(distance between city I & j)
otherwise
sNCift
t
tp
p
ij
sNC
ilil
ijij
kij
pil
0
)()(
)(
)(
When ant k is in city i and has so far constructed the partial solution sp, the
probability of going to cityj is given by
is the set of feasible components, that is, edges
(i, l) where l is a city not yet visited by the ant k.
)( psN
8/11/2019 HEghbalpouACO
37/79
For the first ant we have:
Available
Cities 2 3 4 5 6 7 8 9 10
Available Cities 2 3 4 5 6 7 8 9 10Distance from
current city(1) 1082 882 1072 620 256 948 882 861 895
Available Cities 2 3 4 5 6 7 8 9 10
1/Distance from
current city(1) 9.2E-04 1.1E-03 9.3E-04 1.6E-03 3.9E-03 1.1E-03 1.1E-03 1.2E-03 1.1E-03
Pheromone between city 1 and available
8/11/2019 HEghbalpouACO
38/79
Available Cities 2 3 4 5 6 7 8 9 10
(pheromone
amount)^1 1.E-03 1.E-03 1.E-03 1.E-03 1.E-03 1.E-03 1.E-03 1.E-03 1.E-03
Pheromone between city 1 and available
cities
Available Cities 2 3 4 5 6 7 8 9 10(1/Distance from
current city(1))^4
9.2E-
04
1.1E-
03
9.3E-
04
1.6E-
03
3.9E-
03
1.1E-
03
1.1E-
03
1.2E-
03
1.1E-
03
2 3 4 5 6 7 8 9 10
1.1E-15 2.4E-15 1.1E-15 9.9E-15 3.4E-13 1.8E-15 2.4E-15 2.7E-15 2.3E-15
8/11/2019 HEghbalpouACO
39/79
And finally based on eq.1 we have:
City's Number 2 3 4 5 6* 7 8 9 10
Probability 0% 1% 0% 3% 93% 0% 1% 1% 1%
8/11/2019 HEghbalpouACO
40/79
93%
3%
8/11/2019 HEghbalpouACO
41/79
In next step we must select next city
from available list and depending onprobabilities in previous stage.
Normally city with more probability
has more chance to be selected!
Here in program we have city number
6 next city.
8/11/2019 HEghbalpouACO
42/79
Then we update tables:
1 2 3 4 5 6 7 8 9 10
1 1 0 0 0 0 2 0 0 0 02 2 0 0 0 0 0 0 0 0 0
3 0 0 2 0 0 0 0 0 0 04 0 0 2 0 0 0 0 0 0 0
5 0 0 0 2 0 0 0 0 0 0
6 0 0 0 0 2 0 0 0 0 0
7 0 0 0 0 0 2 0 0 0 0
8 0 0 0 0 0 0 2 0 0 09 0 0 0 0 0 0 0 0 2 0
10 0 0 0 0 0 0 0 0 0 2
Ants
Index
Taboo-list
8/11/2019 HEghbalpouACO
43/79
8/11/2019 HEghbalpouACO
44/79
We do this operations to other ant at other
cities to move all ants to next city.
1 2 3 4 5 6 7 8 9 10
1 1 0 0 0 0 2 0 0 0 0
2 1 0 0 0 0 2 0 0 0 03 0 0 1 0 0 0 0 0 0 2
4 0 0 1 0 0 0 0 0 0 2
5 0 2 0 1 0 0 0 0 0 0
6 0 0 0 0 1 0 0 0 2 0
7 2 0 0 0 0 1 0 0 0 08 0 0 0 2 0 0 1 0 0 0
9 0 0 0 0 0 0 0 2 1 0
10 0 0 2 0 0 0 0 0 0 1
Taboo-list
Ants
Index
8/11/2019 HEghbalpouACO
45/79
Ant_Num 1 2 3 4 5 6 7 8 9 10
Path_Len 256.4 256.4 21.8 21.8 16.3 282.8 256.4 145.2 171.9 21.8
1 1 6 0 0 0 0 0 0 0 0 1
2 1 6 0 0 0 0 0 0 0 0 13 3 10 0 0 0 0 0 0 0 0 3
4 3 10 0 0 0 0 0 0 0 0 3
5 4 2 0 0 0 0 0 0 0 0 4
6 5 9 0 0 0 0 0 0 0 0 5
7 6 1 0 0 0 0 0 0 0 0 6
8 7 4 0 0 0 0 0 0 0 0 7
9 9 8 0 0 0 0 0 0 0 0 9
10 10 3 0 0 0 0 0 0 0 0 10
Ant-city table
Ants
Index
Ant-path length table
8/11/2019 HEghbalpouACO
46/79
At next step we come back to first ant
and move it to next city as same as last.Only different is that one city has
eliminated from available cities list. And
do same operation it to other ants until
a tour completed for all ants.
And update all table at any step seehere all table at the end of first tour:
8/11/2019 HEghbalpouACO
47/79
1 2 3 4 5 6 7 8 9 10
1 1 1 1 1 2 1 1 1 1 1
2 1 1 1 1 1 1 1 1 2 1
3 1 1 1 1 1 1 1 1 2 1
4 1 1 1 1 1 1 1 1 2 1
5 1 1 1 1 2 1 1 1 1 1
6 1 1 1 1 1 1 1 2 1 1
7 1 1 1 1 1 1 1 1 2 1
8 1 1 1 1 1 1 1 1 2 1
9 1 1 1 1 1 1 1 1 1 2
10 1 1 1 1 1 1 1 1 2 1
Taboo-list
Ants
Index
8/11/2019 HEghbalpouACO
48/79
Ant-city table
Ants
Index
Ant_Num 1 2 3 4 5 6 7* 8 9 10
Path_Len 3116.34051.53053.24653.03341.43163.6 3046.54041.33620.94121.4
Ant-path length table
1 1 6 2 4 7 9 3 10 8 5 1
2 1 6 8 3 10 2 4 5 7 9 1
3 3 10 8 7 2 4 5 6 1 9 3
4 3 10 8 1 4 2 6 5 7 9 3
5 4 2 7 1 6 3 10 8 9 5 4
6 5 9 1 6 7 2 4 3 10 8 57 6 1 5 2 4 7 8 3 10 9 6
8 7 4 2 6 3 10 8 1 5 9 7
9 9 8 5 2 4 7 1 6 3 10 9
10 10 3 8 1 5 2 4 7 6 9 10
At fi l t i fi t it ti t
8/11/2019 HEghbalpouACO
49/79
At final step in first iteration we must
save best tour(tour with shortest
length tour).
Steps 1 2 3 4 5 6 7 8 9 10 11
City
Number 6 1 5 2 4 7 8 3 10 9 6
Best tour in Itr.1 belongs to ant number 7
Length of best tour at Itr.1 : 3046.5
Ant Number 7 is winner7
8/11/2019 HEghbalpouACO
50/79
After each iteration we must
update pheromone table by usingthis formula:
Pheromone evaporation coefficient= 0.5
N
k
kijijij tt
1
)()1()1(
8/11/2019 HEghbalpouACO
51/79
( , )
( , )0
kk
kij
k
Qwhere edge i j T t
Lt if edge i j T t
Q Constant value =1
kLTours length of ant k
Tour of ant kkT
8/11/2019 HEghbalpouACO
52/79
For ant number k=1 to 10 :
/ kQ L
Ant
_number 1 2 3 4 5 6 7 8 9 10
1/L3.2E-
042.5E-
043.3E-
042.1E-
043.0E-
043.2E-
043.3E-
042.5E-
042.8E-
042.4E-
04
8/11/2019 HEghbalpouACO
53/79
1 2 3 4 5 6 7 8 9 10
1 0 0 0 0 3.2 3.2 0 0 0 0
2 0 0 0 3.2 0 3.2 0 0 0 0
3 0 0 0 0 0 0 0 0 3.2 3.2
4 0 3.2 0 0 0 0 3.2 0 0 05 3.2 0 0 0 0 0 0 3.2 0 0
6 3.2 3.2 0 0 0 0 0 0 0 0
7 0 0 0 3.2 0 0 0 0 3.2 0
8 0 0 0 0 3.2 0 0 0 0 3.2
9 0 0 3.2 0 0 0 3.2 0 0 010 0 0 3.2 0 0 0 0 3.2 0 0
Delta-pheromone table (*e-4)
updated by ant number 1
8/11/2019 HEghbalpouACO
54/79
1 2 3 4 5 6 7 8 9 10
1 0 0 0 2.1 11.4 14.6 0 0 5.7 02 0 0 0 20.6 0 4.6 3.0 0 0 0
3 0 0 0 0 0 0 0 2.4 5.4 25.8
4 0 7.6 3.2 0 8.7 0 11.7 0 0 0
5 0 8.5 0 0 0 3.3 4.6 3.2 5.6 0
6 6.6 3.2 8.2 0 2.1 0 3.2 2.5 5.7 07 5.8 6.4 0 2.5 0 2.4 0 3.3 10.3 0
8 7.0 0 5.8 0 6.0 0 3.3 0 3.0 0
9 3.2 0 3.2 0 3.0 0 0 2.8 0 2.8
10 0 2.5 2.4 0 0 0 0 17.3 5.7 0
Delta-pheromone table(*e-4)
Updating delta pheromone will be
continued by other ants and finally we
have:
8/11/2019 HEghbalpouACO
55/79
1 2 3 4 5 6 7 8 9 10
1 0 5 5 5 5 5 5 5 5 5
2 5 0 5 5 5 5 5 5 5 5
3 5 5 0 5 5 5 5 5 5 5
4 5 5 5 0 5 5 5 5 5 5
5 5 5 5 5 0 5 5 5 5 5
6 5 5 5 5 5 0 5 5 5 5
7 5 5 5 5 5 5 0 5 5 58 5 5 5 5 5 5 5 0 5 5
9 5 5 5 5 5 5 5 5 0 5
10 5 5 5 5 5 5 5 5 5 0
Pheromone table must be evaporated
at first then add with delta pheromone:
Evaporated pheromone table(*e-4)
8/11/2019 HEghbalpouACO
56/79
1 2 3 4 5 6 7 8 9
1
01 0 5 5 5 5 5 5 5 5 5
2 5 0 5 5 5 5 5 5 5 5
3 5 5 0 5 5 5 5 5 5 5
4 5 5 5 0 5 5 5 5 5 5
5 5 5 5 5 0 5 5 5 5 5
6 5 5 5 5 5 0 5 5 5 5
7 5 5 5 5 5 5 0 5 5 5
8 5 5 5 5 5 5 5 0 5 5
9 5 5 5 5 5 5 5 5 0 5
1
0 5 5 5 5 5 5 5 5 5 0
1 2 3 4 5 6 7 8 9 10
1 0 0 0 2 11 14 0 0 5 0
2 0 0 0 20 0 4 3 0 0 0
3 0 0 0 0 0 0 0 2 5 25
4 0 7 3 0 8 0 11 0 0 0
5 0 8 0 0 0 3 4 3 5 06 6 3 8 0 2 0 3 2 5 0
7 5 6 0 2 0 2 0 3 10 0
8 7 0 5 0 6 0 3 0 3 0
9 3 0 3 0 3 0 0 2 0 2
10 0 2 2 0 0 0 0 17 5 0
Evaporated pheromone table(*e-4) Delta-pheromone table(*e-4)
8/11/2019 HEghbalpouACO
57/79
1 2 3 4 5 6 7 8 9 10
1 0 7 7 10 19 22 7 7 13 7
2 7 0 7 28 7 12 10 7 7 7
3 7 7 0 7 7 7 7 10 13 33
4 7 15 11 0 16 7 19 7 7 75 7 16 7 7 0 11 12 11 13 7
6 14 11 16 7 10 0 11 10 13 7
7 13 14 7 10 7 10 0 11 18 7
8 14 7 13 7 13 7 11 0 10 7
9 11 7 11 7 10 7 7 10 0 1010 7 10 10 7 7 7 7 25 13 0
pheromone table(*e-4)
8/11/2019 HEghbalpouACO
58/79
For next iteration taboo-list and ant-city list set to initial
values. delta-pheromone and ant-path length table set to
be zero.
1 2 3 4 5 6 7 8 9 10
1 2 0 0 0 0 0 0 0 0 0
2 2 0 0 0 0 0 0 0 0 0
3 0 0 2 0 0 0 0 0 0 04 0 0 2 0 0 0 0 0 0 0
5 0 0 0 2 0 0 0 0 0 0
6 0 0 0 0 2 0 0 0 0 0
7 0 0 0 0 0 2 0 0 0 0
8 0 0 0 0 0 0 2 0 0 09 0 0 0 0 0 0 0 0 2 0
10 0 0 0 0 0 0 0 0 0 2
Ants
Index
8/11/2019 HEghbalpouACO
59/79
1 2 3 4 5 6 7 8 9 101 2 0 0 0 0 0 0 0 0 0
2 2 0 0 0 0 0 0 0 0 0
3 0 0 2 0 0 0 0 0 0 0
4 0 0 2 0 0 0 0 0 0 0
5 0 0 0 2 0 0 0 0 0 06 0 0 0 0 2 0 0 0 0 0
7 0 0 0 0 0 2 0 0 0 0
8 0 0 0 0 0 0 2 0 0 0
9 0 0 0 0 0 0 0 0 2 0
10 0 0 0 0 0 0 0 0 0 2
Ants
Index
Taboo list
8/11/2019 HEghbalpouACO
60/79
1 1 0 0 0 0 0 0 0 0 0 1
2 1 0 0 0 0 0 0 0 0 0 1
3 3 0 0 0 0 0 0 0 0 0 3
4 3 0 0 0 0 0 0 0 0 0 3
5 4 0 0 0 0 0 0 0 0 0 4
6 5 0 0 0 0 0 0 0 0 0 5
7 6 0 0 0 0 0 0 0 0 0 68 7 0 0 0 0 0 0 0 0 0 7
9 9 0 0 0 0 0 0 0 0 0 9
10 10 0 0 0 0 0 0 0 0 0 10
Ant-city table
Ants
Index
Ant_Num 1 2 3 4 5 6 7 8 9 10
Path_len 0 0 0 0 0 0 0 0 0 0
Ant-path length table
8/11/2019 HEghbalpouACO
61/79
We move ants to next city as same as last
iteration and fill taboo-list ,.
Until complete a tour. At the end of tour we
update pheromone table and find best tourand compare it to previous best tour and if
new best tour is better best tour is replace
with new best tour.
d
8/11/2019 HEghbalpouACO
62/79
second iteration:Ant-city table
Ants
Index
Ant_Num 1 2 3 4 5 6* 7 8 9 10
Path_Len 2915.12617.24450.12926.95043.52610.63108.43707.53573.43451.4
Ant-path length table
1 1 6 5 7 2 4 3 10 8 9 1
2 1 6 5 9 8 3 10 4 2 7 1
3 3 10 8 4 2 1 5 7 6 9 3
4 3 10 8 9 1 6 5 2 4 7 3
5 4 2 1 3 10 8 5 7 6 9 4
6 5 9 8 3 10 2 4 7 1 6 5
7 6 1 4 2 7 3 10 8 5 9 6
8 7 2 4 9 3 10 8 1 5 6 7
9 9 10 3 8 4 2 1 6 5 7 9
10 10 3 8 9 2 4 6 1 5 7 10
8/11/2019 HEghbalpouACO
63/79
Steps 1 2 3 4 5 6 7 8 9 10 11
City
Number 5 9 8 3 10 2 4 7 1 6 5
Best tour in Itr.2 belongs to ant number 6
Length of best tour in Itr.2 : 2610.6
Length of new best tour is shorter than old one then we
replace it to pervious best tour.
Steps 1 2 3 4 5 6 7 8 9 10 11
City
Number 5 9 8 3 10 2 4 7 1 6 5
Best tour
Ant Number 6 is winner 6
8/11/2019 HEghbalpouACO
64/79
1 2 3 4 5 6 7 8 9 10
1 0 0.000 0.001 0.001 0.002 0.003 0.001 0.000 0.001 0.000
2 0.001 0 0.000 0.003 0.000 0.001 0.001 0.000 0.000 0.000
3 0.000 0.000 0 0.000 0.000 0.000 0.001 0.001 0.001 0.004
4 0.000 0.002 0.001 0 0.001 0.001 0.002 0.000 0.001 0.0005 0.000 0.001 0.000 0.000 0 0.001 0.002 0.001 0.002 0.000
6 0.001 0.001 0.001 0.000 0.002 0 0.001 0.000 0.001 0.000
7 0.001 0.001 0.001 0.000 0.000 0.001 0 0.001 0.001 0.000
8 0.001 0.000 0.001 0.001 0.001 0.000 0.001 0 0.001 0.000
9 0.001 0.001 0.001 0.000 0.001 0.000 0.001 0.001 0 0.00110 0.000 0.001 0.001 0.001 0.000 0.000 0.001 0.003 0.001 0
pheromone table in Itr.2
Thi d i i
8/11/2019 HEghbalpouACO
65/79
Third iteration:Ant-city table
Ants
Index
Ant_Num 1 2 3 4* 5 6 7 8 9 10
Path_Len 3174.73217.23382.92771.53399.13273.53525.33913.03609.83365.0
Ant-path length table
1 1 6 5 2 4 7 9 8 3 10 1
2 1 6 5 9 2 4 3 10 8 7 1
3 3 10 8 6 1 2 4 7 5 9 3
4 3 10 8 2 4 7 1 6 5 9 3
5 4 2 7 3 10 8 9 1 5 6 4
6 5 9 1 6 4 2 7 8 3 10 5
7 6 1 9 3 10 8 5 4 2 7 6
8 7 2 4 1 5 3 10 8 9 6 7
9 9 5 7 3 10 8 2 4 1 6 9
10 10 3 8 9 1 5 6 2 4 7 10
8/11/2019 HEghbalpouACO
66/79
Steps 1 2 3 4 5 6 7 8 9 10 11
City
Number 3 10 8 2 4 7 1 6 5 9 3
Best tour in Itr.3 belong to ant number 4
Length of best tour in Itr.3 : 2771.5
Length of new best tour is longer than old one then we dont
replace it to pervious best tour.
Steps 1 2 3 4 5 6 7 8 9 10 11
City
Number 5 9 8 3 10 2 4 7 1 6 5
Best tour
Ant Number 4 is winner 4
8/11/2019 HEghbalpouACO
67/79
1 2 3 4 5 6 7 8 9 10
1 0 0.000 0.000 0.000 0.002 0.003 0.001 0.000 0.001 0.000
2 0.001 0 0.000 0.004 0.000 0.000 0.001 0.000 0.000 0.000
3 0.000 0.000 0 0.000 0.000 0.000 0.000 0.001 0.001 0.005
4 0.001 0.002 0.001 0 0.000 0.001 0.002 0.000 0.000 0.0005 0.000 0.001 0.000 0.000 0 0.001 0.001 0.000 0.002 0.000
6 0.001 0.001 0.000 0.000 0.002 0 0.001 0.000 0.001 0.000
7 0.001 0.001 0.001 0.000 0.000 0.001 0 0.001 0.001 0.000
8 0.000 0.001 0.001 0.000 0.001 0.000 0.001 0 0.002 0.000
9 0.001 0.001 0.001 0.000 0.001 0.001 0.000 0.001 0 0.00010 0.000 0.000 0.001 0.000 0.000 0.000 0.001 0.004 0.000 0
pheromone table in Itr.3
F th it ti
8/11/2019 HEghbalpouACO
68/79
Fourth iteration:Ant-city table
Ants
Index
Ant_Num 1 2 3 4 5* 6 7 8 9 10
Path_Len 3358.43455.83805.04020.62970.7 4862.63219.74973.13297.43465.3
Ant-path length table
1 1 6 3 10 8 4 2 7 5 9 1
2 1 6 7 2 4 9 5 3 10 8 1
3 3 10 8 9 5 6 2 4 7 1 3
4 3 10 8 9 1 2 4 7 5 6 3
5 4 2 7 3 10 8 5 6 1 9 4
6 5 3 10 8 9 6 2 4 1 7 5
7 6 1 2 4 7 8 3 10 5 9 6
8 7 6 8 3 10 1 2 4 5 9 7
9 9 8 3 10 2 4 7 1 5 6 9
10 10 3 8 9 4 2 5 1 6 7 10
8/11/2019 HEghbalpouACO
69/79
Steps 1 2 3 4 5 6 7 8 9 10 11
City
Number 4 2 7 3 10 8 5 6 1 9 4
Best tour in Itr.4 belongs to ant number 5
Length of best tour in Itr.4 : 2970.5
Length of new best tour is longer than old one then we dont
replace it to pervious best tour.
Steps 1 2 3 4 5 6 7 8 9 10 11
City
Number 5 9 8 3 10 2 4 7 1 6 5
Best tour
Ant Number 5 is winner 5
8/11/2019 HEghbalpouACO
70/79
1 2 3 4 5 6 7 8 9 10
1 0 0.001 0.000 0.000 0.001 0.002 0.001 0.000 0.001 0.000
2 0.000 0 0.000 0.004 0.000 0.000 0.001 0.000 0.000 0.000
3 0.000 0.000 0 0.000 0.000 0.000 0.000 0.001 0.001 0.005
4 0.001 0.002 0.000 0 0.000 0.000 0.002 0.000 0.001 0.0005 0.000 0.000 0.001 0.000 0 0.002 0.001 0.000 0.002 0.000
6 0.001 0.001 0.000 0.000 0.001 0 0.001 0.000 0.001 0.000
7 0.001 0.001 0.001 0.000 0.001 0.001 0 0.001 0.001 0.000
8 0.000 0.000 0.001 0.001 0.001 0.000 0.000 0 0.002 0.000
9 0.001 0.000 0.000 0.000 0.001 0.001 0.000 0.001 0 0.00010 0.000 0.001 0.001 0.000 0.000 0.000 0.001 0.003 0.000 0
pheromone table in Itr.4
8th it ti
8/11/2019 HEghbalpouACO
71/79
8th iteration:Ant-city table
Ants
Index
Ant_Num 1* 2 3 4 5 6 7 8 9 10
Path_Len 2876.7 2925.54339.93499.52881.24747.83108.43458.73651.43421.4
Ant-path length table
1 1 6 5 9 7 4 2 3 10 8 1
2 1 6 5 8 3 10 2 4 7 9 1
3 3 10 8 9 1 2 4 6 5 7 3
4 3 10 8 9 1 6 2 4 7 5 3
5 4 2 7 3 10 8 1 6 5 9 4
6 5 9 8 3 10 6 4 2 1 7 5
7 6 1 4 2 7 3 10 8 5 9 6
8 7 1 6 5 8 3 10 2 4 9 7
9 9 8 3 10 1 5 6 2 4 7 9
10 10 3 8 9 4 2 5 6 1 7 10
8/11/2019 HEghbalpouACO
72/79
Steps 1 2 3 4 5 6 7 8 9 10 11
City
Number 1 6 5 9 7 4 2 3 10 8 1
Best tour in Itr.8 belongs to ant number 1
Length of best tour in Itr.8 : 2876.7
Length of new best tour is longer than old one then we dont
replace it to pervious best tour.
Steps 1 2 3 4 5 6 7 8 9 10 11
City
Number 5 9 8 3 10 2 4 7 1 6 5
Best tour
Ant Number 1 is winner 1
8/11/2019 HEghbalpouACO
73/79
1 2 3 4 5 6 7 8 9 10
1 0 0.001 0.000 0.000 0.001 0.003 0.001 0.001 0.000 0.000
2 0.000 0 0.000 0.003 0.000 0.000 0.002 0.000 0.000 0.000
3 0.000 0.000 0 0.000 0.000 0.000 0.000 0.001 0.000 0.005
4 0.000 0.003 0.000 0 0.000 0.001 0.002 0.000 0.001 0.0005 0.000 0.000 0.000 0.000 0 0.001 0.001 0.001 0.002 0.000
6 0.001 0.001 0.000 0.000 0.003 0 0.000 0.000 0.001 0.000
7 0.001 0.000 0.001 0.000 0.001 0.000 0 0.000 0.001 0.000
8 0.001 0.000 0.002 0.000 0.000 0.000 0.000 0 0.002 0.000
9 0.001 0.000 0.000 0.001 0.000 0.000 0.001 0.001 0 0.000
10 0.000 0.001 0.001 0.000 0.000 0.000 0.001 0.003 0.000 0
pheromone table in Itr.8
last(10th) iteration
8/11/2019 HEghbalpouACO
74/79
last(10th) iteration:Ant-city table
Ants
Index
Ant_Num 1 2* 3 4 5 6 7 8 9 10
Path_Len 2771.5 2610.63605.53924.32929.23339.02885.34073.33998.04665.2
Ant-path length table
1 1 6 5 9 3 10 8 2 4 7 1
2 1 6 5 9 8 3 10 2 4 7 1
3 3 10 8 9 2 4 7 1 5 6 3
4 3 10 8 9 6 4 2 7 1 5 3
5 4 2 7 3 10 8 9 1 6 5 4
6 5 2 4 7 1 6 3 10 8 9 5
7 6 1 5 9 4 2 7 3 10 8 6
8 7 2 4 5 1 9 8 3 10 6 7
9 9 8 3 10 1 2 4 7 5 6 9
10 10 3 8 1 2 4 5 6 7 9 10
8/11/2019 HEghbalpouACO
75/79
Steps 1 2 3 4 5 6 7 8 9 10 11
City
Number 1 6 5 9 8 3 10 2 4 7 1
Best tour in Itr.10 belongs to ant number 2
Length of best tour in Itr.10 :2610.62030
Length of new best tour is the same as old one then we dont
replace it to pervious best tour.
Steps 1 2 3 4 5 6 7 8 9 10 11
City
Number 5 9 8 3 10 2 4 7 1 6 5
Best tour
Ant Number 2 is winner 2
8/11/2019 HEghbalpouACO
76/79
1 2 3 4 5 6 7 8 9 10
1 0 0.001 0.000 0.000 0.001 0.003 0.001 0.000 0.000 0.000
2 0.000 0 0.000 0.004 0.000 0.000 0.002 0.000 0.000 0.000
3 0.000 0.000 0 0.000 0.000 0.000 0.000 0.000 0.000 0.005
4 0.000 0.002 0.000 0 0.001 0.000 0.002 0.000 0.000 0.0005 0.000 0.000 0.000 0.000 0 0.001 0.001 0.000 0.002 0.000
6 0.001 0.000 0.000 0.000 0.002 0 0.000 0.000 0.001 0.000
7 0.001 0.000 0.001 0.000 0.001 0.000 0 0.000 0.001 0.000
8 0.001 0.001 0.002 0.000 0.000 0.000 0.000 0 0.002 0.000
9 0.001 0.001 0.001 0.001 0.000 0.001 0.000 0.001 0 0.000
10 0.000 0.001 0.000 0.000 0.000 0.001 0.000 0.004 0.000 0
pheromone table in last Itr
8/11/2019 HEghbalpouACO
77/79
Finally we find best-tour as:
Steps 1 2 3 4 5 6 7 8 9 10 11
City
Number 5 9 8 3 10 2 4 7 1 6 5
2610.62030
8/11/2019 HEghbalpouACO
78/79
8/11/2019 HEghbalpouACO
79/79
Questions? Discussion? Suggestions ?