AntColony
AntColony
Ant Algorithms
ACO Concept
• Ants (blind) navigate from nest to food source
• Shortest path is discovered via pheromone trails
– each ant moves at random
– pheromone is deposited on path
– ants detect lead ant’s path, inclined to follow
– more pheromone on path increases probability of
path being followed
ACO System
• Virtual “trail” accumulated on path segments
• Starting node selected at random
• Path selected at random
– based on amount of “trail” present on possible paths
from starting node
– higher probability for paths with more “trail”
• Ant reaches next node, selects next path
• Continues until reaches starting node
• Finished “tour” is a solution
ACO System, cont.
• A completed tour is analyzed for optimality
• “Trail” amount adjusted to favor better solutions
– better solutions receive more trail
– worse solutions receive less trail
– higher probability of ant selecting path that is part of a
better-performing tour
• New cycle is performed
• Repeated until most ants select the same tour
on every cycle (convergence to solution)
ACO System, cont.
• Often applied to TSP (Travelling Salesman
Problem): shortest path between n nodes
• Algorithm in Pseudocode:
– Initialize Trail
– Do While (Stopping Criteria Not Satisfied) – Cycle Loop
• Do Until (Each Ant Completes a Tour) – Tour Loop
• Local Trail Update
• End Do
• Analyze Tours
• Global Trail Update
– End Do
Background
• Discrete optimization problems difficult to
solve
• “Soft computing techniques” developed in
past ten years:
– Genetic algorithms (GAs)
• based on natural selection and genetics
– Ant Colony Optimization (ACO)
• modeling ant colony behavior
Background, cont.
• Developed by Marco Dorigo (Milan, Italy),
and others in early 1990s
• Some common applications:
– Quadratic assignment problems
– Scheduling problems
– Dynamic routing problems in networks
• Theoretical analysis difficult
– algorithm is based on a series of random decisions
(by artificial ants)
– probability of decisions changes on each iteration
Swarm Intelligence
• Inherent parallelism
• Stochastic nature
• Adaptivity
• Use of positive feedback
• Autocatalytic in nature
Natural behavior of an ant
Foraging modes
• Wander mode
• Search mode
• Return mode
• Attracted mode
• Trace mode
• Carry mode
Natural behavior of ant
•Trace: k
Pheromone, i , j , a global type of information
•Memory: MK or TabuK
B
A
C
Ant Colony Optimization (ACO) for TSP
No
Update trace level using the tour cost for each ant
No
Stopping
criteria
yes
[]
A
B
2
[]
C
3
[]
4
D
E []
[A] [B]
2
1
A
B
[C]
3
C
[D] [E]
4
D 5
E
How to choose next city?
[A]
1
A
[A]
B
1
[ ( t )] [ ]
[ ( t )] C[ ] if j allowed k
[A] ij ij
pij ( t )
k
ik ik
kallowedk
[A,D]
1
[A]
0 otherwise
1 1
D
E
Iteration 2
[E,A] [C,B]
5 3
A
B
[B,C]
2
C
[A,D]
[D,E]
1
D 4
E
Iteration 3
[D,E,A] [E,A,B]
4 5
A
B
[A,D,C]
1
C
[B,C,D]
[C,B,E]
2
D 3
E
Iteration 4
[B,C,D,A] [D,E,A,B]
2 4
A
B
[E,A,B,C]
5
C
[C,B,E,D]
[A,DCE]
D 3
1
E
Iteration 5
[C,B,E,D,A] [A,D,C,E,B]
1
3
A
B
[D,E,A,B,C]
4
C
[E,A,B,C,D]
[B,C,D,A,E]
D 5
E 2
Path and Trace Update
[A,D,C,E,B]
L1 =300
1
[B,C,D,A,E]
L2 =450
2
Q
[C,B,E,D,A]
if (i, j ) bestTour
L3 =260
ik, j Lk
0
3
otherwise
[D,E,A,B,C]
L4 =280
4
[E,A,B,C,D]
L5 =420
5
End of First Run
Update tabu (s)
if j allowed k
pijk ( t ) [ ik ( t )] [ ik ]
k
Tabu list management
kallowedk
[ ( t )] [ ] if j allowed
ij
Choose the city j to move
ij
p (
[ ( t )] [ ]
to. Use probability
k
k
ij t )0 ik
otherwise
ik
kallowedk
Move k-th ant to town j.
0 otherwise Insert town j in tabuk(s)
if (i, j ) bestTour
ij : ij ijk
k
Lk
Yes
iSet
, jt = t + n; NC=NC+1; ∆τ =0
0
ij
NC<NCmax
&& not
otherwise stagn.
No
End
Stopping Criteria
• Stagnation
• Max Iterations
ACO : Ant Colony Optimization for TSP
Performance
Comparison between ACS standard, ACS with no heuristic (i.e., we set B=0), and ACS in which ants
neither sense nor deposit pheromone. Problem: Oliver30. Averaged over 30 trials, 10,000/m iterations per trial.
General ACO