You are on page 1of 37

CHAKRESH SAHU NIVEDITA YADAV

2008 SIY7518 2008ANZ8413


Outline
Introduction (Swarm intelligence)
Natural behavior of ants
Ant Colonies Optimization & Ant Colony Meta-heuristic
Overview
Traveling Salesman Problem (TSP)
Ant Colony System
Reference
Demonstration
Vote of Thanks
Section I

Swarm intelligence
What is a Swarm?
A loosely structured collection of interacting agents
Agents:
 Individuals that belong to a group (but are not necessarily identical)
 They contribute to and benefit from the group
 They can recognize, communicate, and/or interact with each other
The instinctive perception of swarms is a group of
agents in motion – but that does not always have to
be the case.
A swarm is better understood if thought of as agents
exhibiting a collective behavior
Swarm Intelligence (SI)
An artificial intelligence (AI) technique based on
the collective behavior in decentralized, self-
organized systems
Generally made up of agents who interact with each
other and the environment
No centralized control structures
Based on group behavior found in nature
Examples of Swarms in Nature:
Classic Example: Swarm of Bees
Can be extended to other similar systems:
Ant colony
 Agents: ants
Flock of birds
 Agents: birds
Traffic
 Agents: cars
Crowd
 Agents: humans
Immune system
 Agents: cells and molecules
Section II

Ant in Nature
Ant Colonies in Nature
Lack of central control
Intelligent behavior is emergent from the collective
actions of simple agents
Ants communicate via altering the environment (deposit
pheromone)
Ants are more likely to follow routes with more
pheromone
Foraging Strategies in Ants
Ants deposit pheromone on the paths that they cover and
this results in the building of a solution (optimal path).
In SI and optimization, concept of pheromone
evaporation is used.
Helps in avoiding suboptimal solutions – local optima.
May differ from how it takes places in the real world.
Natural behavior of ant

Ref: www.idsia.ch/~luca/acs-bio97.pdf
Section III

1. Ant Colony Optimization (ACO)


2. Ant Colony Meta-heuristic Overview
Ant Colony Optimization (ACO)
The study of artificial systems modeled after the
behavior of real ant colonies and are useful in
solving discrete optimization problems
Introduced in 1992 by Marco Dorigo
Originally called it the Ant System (AS)
Has been applied to
 Traveling Salesman Problem (and other shortest path problems)
 Several NP-hard Problems
It is a population-based metaheuristic used to find
approximate solutions to difficult optimization
problems
What is Metaheuristic?
“A metaheuristic refers to a master strategy that
guides and modifies other heuristics to produce
solutions beyond those that are normally generated
in a quest for local optimality” – Fred Glover and
Manuel Laguna
Or more simply:
It is a set of algorithms used to define heuristic
methods that can be used for a large set of
problems
Artificial Ants
A set of software agents
Stochastic
Based on the pheromone model
 Pheromones are used by real ants to mark paths. Ants follow these
paths (i.e., trail-following behaviors)
Incrementally build solutions by moving on a graph
Constraints of the problem are built into the
heuristics of the ants
Using ACO
The optimization problem must be written in the
form of a path finding problem with a weighted
graph
The artificial ants search for “good” solutions by
moving on the graph
 Ants can also build infeasible solutions – which could be helpful in
solving some optimization problems
The metaheuristic is constructed using three
procedures:
ConstructAntsSolutions
UpdatePheromones
DaemonActions
Ant Colony Meta-heuristic
Procedure AntMetaHeuristic
Set parameters, initial pheromone levels
While (termination condition not met) do
 Construct Ants’ Solutions
 DaemonActions
 Update Pheromones (according to soln goodness)

End
End
ConstructAntsSolutions
Manages the colony of ants
Ants move to neighboring nodes of the graph
Moves are determined by stochastic local decision
policies based on pheromone tails and heuristic
information
Evaluates the current partial solution to determine
the quantity of pheromones the ants should deposit
at a given node
UpdatePheromones
Process for modifying the pheromone trails
Modified by
Increase
 Ants deposit pheromones on the nodes (or the edges)
Decrease
 Ants don’t replace the pheromones and they evaporate
Increasing the pheromones increases the probability
of paths being used (i.e., building the solution)
Decreasing the pheromones decreases the
probability of the paths being used (i.e., forgetting)
DaemonActions
Used to implement larger actions that require more
than one ant
Examples:
Perform a local search
Collection of global information
Section IV

Travelling Salesman Problem (TSP)


Traveling Salesman Problem
(TSP)
Informally: The problem of finding the shortest tour through a
set of cities starting at some city and going through all other
cities once and only once, returning to the starting city

Formally: Finding the shortest Hamiltonian path in a fully-


connected graph

TSP belongs to the class of NP-complete problems. Thus, it


is assumed that there is no efficient algorithm for solving
TSPs.
Simple TSP Instance
A Hamiltonian path (or
traceable path) is a path in an
undirected graph which visits
each vertex exactly once. A
Hamiltonian cycle (or
Hamiltonian circuit) is a cycle
in an undirected graph which
visits each vertex exactly once
and also returns to the starting
vertex. Determining whether
such paths and cycles exist in
A graph representing the vertices,
graphs is the Hamiltonian path
edges, and faces of a dodecahedron,
problem which is NP-complete. with a Hamiltonian cycle shown by
red color edges.
NP problem can not be solved in polynomial time.
Computing a solution Contd…
Exact algorithms: The most direct solution would be to try
all permutations (ordered combinations) and see which one is
cheapest (using brute force search).
The running time for this approach lies within a
polynomial factor of O(n!), the factorial of the number of
cities, so this solution becomes impractical even for only 20
cities.
• 3 cities – 3! = 6


4 cities – 4! = 24
5 cities – 5! = 120
Not a good idea
• 6 cities – 6! = 720
• 7 cities – 7! = 5040
• …
• 16 cities – 16! = 20922789888000
Computing a solution
Approximate methods - iterative methods start with a
“good” solution and try to improve it over the course of a
specific number of steps
Combinatorial Optimization
Terminology
Solution space
6 cities – 6! = 720
7 cities – 7! = 5040
Exploration
 Making choices contrary to previous experience in order to
explore new tours
Exploitation
Making choices considering previous experience in order to
find tours close to the ones we already have
Section V

Ant System(AS)
Ant Systems (AS)
Ant Systems for TSP
Graph (N,E): where N = cities/nodes, E = edges

d ij = the tour cost from city i to city j (edge weight)


Ant move from one city i to the next j with some transition probability. Let the number
of ants be m and cities n.

B
A

C
Ant System (AS)
 Transition from city i to j depends on:
1. Tabu list – list of cities not visited
1

2. Visibility ij = d ij ; represents local information –
heuristic desirability to visit city j when in city i.
3. Pheromone trail Tij (t) for each edge – represents the
learned desirability to visit city j when in city i.
 Generally, have several ants searching the solution space.
m=n
Ant System (AS)
Transition Rule
Probability of ant k going from city i to j:

p (t ) 
k
 (t ) . 
ij

ij

  (t ) .il 
ij  
il
J ik

Alpha and beta are adjustable parameters.


Ant System (AS)
p (t ) 
k
 (t ) . 
ij

ij

  (t ) .il 
ij  
il
J ik

If α is small then the closest cities are favored – classic


greedy
algorithm
 A high value for α means that pheromone trail is very
important and therefore ants tend to choose edges chosen by
other ants in the past.
 If β is small only pheromone +ve feedback at work – may
choose non-optimal paths too quickly
Ant System (AS)
Pheromone update :
  Q / L (t ) if (i, j )  T (t ) else 0.
k
ij
k k

T is the tour done at time t by ant k, L is the length, Q


is a heuristic parameter.
Pheromone decay:
m
 ij (t )  (1   ). ij (t )     ij (t )
k 1
where   (0,1] is the evaporation rate, m is the
number of ants and   ijk is the quantity of
pheromone laid on edge (i, j) by ant k.
Ant System (AS)
Initialize the pheromone Tij (t) , associated with the edge joining cities i
and j ;
Place each ant on a randomly selected city;
Let best be the best tour;
t = 1;
While t < max_iterations do
for each ant do
build tour; // probabilistic solution construction
end
(Perform local search);
Evaluate the length of the tour performed by each ant;
If a shorter tour has been found update best;
Perform pheromone update;
t = t+1;
end
Ant Systems Algorithm for TSP
Initialize

Place each ant in a randomly chosen city

For Each Ant

Choose NextCity(For Each Ant)

yes more cities


to visit

No

Return to the initial cities

Update pheromone level using the tour cost for each ant

No
Stopping
criteria
yes

Print Best tour


References
E. Bonabeau, M. Dorigo, G. Theraulaz. Swarm
Intelligence: From Natural to Artificial Systems, 1999

M. Dorigo and L. Gambardella. Ant colony system: A


cooperative learning approach to the traveling salesman
problem, 1997.

M. Dorigo and T. Stützle. Ant Colony Optimization, MIT


Press, 2004.

J. Kennedy and R. Eberhart. Swarm Intelligence, 2001


Demonstration

MatLab program to solve TSP problem


by Ant Colony Optimization
Using ants to solve the TSP

Thank you for your


attention

You might also like