ant colony optimization for solving the traveling salesman problem

37
CHAKRESH SAHU NIVEDITA YADAV 2008 SIY7518 2008ANZ8413

Upload: chakreshsahu

Post on 07-Apr-2015

353 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: Ant Colony Optimization for Solving the Traveling Salesman Problem

CHAKRESH SAHU NIVEDITA YADAV2008 SIY7518 2008ANZ8413

Page 2: Ant Colony Optimization for Solving the Traveling Salesman Problem

OutlineIntroduction (Swarm intelligence)Natural behavior of antsAnt Colonies Optimization & Ant Colony Meta-heuristic

OverviewTraveling Salesman Problem (TSP)Ant Colony SystemReferenceDemonstrationVote of Thanks

Page 3: Ant Colony Optimization for Solving the Traveling Salesman Problem

Section I

Swarm intelligence

Page 4: Ant Colony Optimization for Solving the Traveling Salesman Problem

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

Page 5: Ant Colony Optimization for Solving the Traveling Salesman Problem

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 structuresBased on group behavior found in nature

Page 6: Ant Colony Optimization for Solving the Traveling Salesman Problem

Examples of Swarms in Nature:Classic Example: Swarm of BeesCan 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

Page 7: Ant Colony Optimization for Solving the Traveling Salesman Problem

Section II

Ant in Nature

Page 8: Ant Colony Optimization for Solving the Traveling Salesman Problem

Ant Colonies in NatureLack of central controlIntelligent 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

Page 9: Ant Colony Optimization for Solving the Traveling Salesman Problem

Foraging Strategies in AntsAnts 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.

Page 10: Ant Colony Optimization for Solving the Traveling Salesman Problem

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

Natural behavior of ant

Page 11: Ant Colony Optimization for Solving the Traveling Salesman Problem

Section III

1. Ant Colony Optimization (ACO)

2. Ant Colony Meta-heuristic Overview

Page 12: Ant Colony Optimization for Solving the Traveling Salesman Problem

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

Page 13: Ant Colony Optimization for Solving the Traveling Salesman Problem

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

Page 14: Ant Colony Optimization for Solving the Traveling Salesman Problem

Artificial AntsA set of software agentsStochasticBased 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 graphConstraints of the problem are built into the

heuristics of the ants

Page 15: Ant Colony Optimization for Solving the Traveling Salesman Problem

Using ACOThe 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:ConstructAntsSolutionsUpdatePheromonesDaemonActions

Page 16: Ant Colony Optimization for Solving the Traveling Salesman Problem

Ant Colony Meta-heuristicProcedure AntMetaHeuristic

Set parameters, initial pheromone levelsWhile (termination condition not met) do

Construct Ants’ Solutions DaemonActions Update Pheromones (according to soln goodness)

EndEnd

Page 17: Ant Colony Optimization for Solving the Traveling Salesman Problem

ConstructAntsSolutionsManages the colony of antsAnts move to neighboring nodes of the graphMoves 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

Page 18: Ant Colony Optimization for Solving the Traveling Salesman Problem

UpdatePheromonesProcess for modifying the pheromone trailsModified 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)

Page 19: Ant Colony Optimization for Solving the Traveling Salesman Problem

DaemonActionsUsed to implement larger actions that require more

than one antExamples:

Perform a local searchCollection of global information

Page 20: Ant Colony Optimization for Solving the Traveling Salesman Problem

Section IV

Travelling Salesman Problem (TSP)

Page 21: Ant Colony Optimization for Solving the Traveling Salesman Problem

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.

Page 22: Ant Colony Optimization for Solving the Traveling Salesman Problem

Simple TSP Instance

Page 23: Ant Colony Optimization for Solving the Traveling Salesman Problem

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 graphs is the Hamiltonian path problem which is NP-complete.

NP problem can not be solved in polynomial time.

A graph representing the vertices, edges, and faces of a dodecahedron, with a Hamiltonian cycle shown by red color edges.

Page 24: Ant Colony Optimization for Solving the Traveling Salesman Problem

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• 6 cities – 6! = 720• 7 cities – 7! = 5040 • …• 16 cities – 16! = 20922789888000

Not a good idea

Page 25: Ant Colony Optimization for Solving the Traveling Salesman Problem

Computing a solutionApproximate methods - iterative methods start with a

“good” solution and try to improve it over the course of a specific number of steps

Page 26: Ant Colony Optimization for Solving the Traveling Salesman Problem

Combinatorial Optimization Terminology

Solution space6 cities – 6! = 7207 cities – 7! = 5040

Exploration Making choices contrary to previous experience in order to

explore new tours

ExploitationMaking choices considering previous experience in order to

find tours close to the ones we already have

Page 27: Ant Colony Optimization for Solving the Traveling Salesman Problem

Section V

Ant System(AS)

Page 28: Ant Colony Optimization for Solving the Traveling Salesman Problem

Ant Systems for TSP

Graph (N,E): where N = cities/nodes, E = edges

= 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.

ijd

A

D

C

B

Ant Systems (AS)

Page 29: Ant Colony Optimization for Solving the Traveling Salesman Problem

Ant System (AS) Transition from city i to j depends on:

1. Tabu list – list of cities not visited

2. Visibility = ; represents local information – heuristic desirability to visit city j when in city i.

3. Pheromone trail 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

ij

)(tTij

ijd1

Page 30: Ant Colony Optimization for Solving the Traveling Salesman Problem

Ant System (AS)Transition RuleProbability of ant k going from city i to j:

Alpha and beta are adjustable parameters.

kiJ

ilil

ijijkij

t

ttp

.)(

.)()(

Page 31: Ant Colony Optimization for Solving the Traveling Salesman Problem

Ant System (AS)

kiJ

ilil

ijijkij

t

ttp

.)(

.)()(

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

Page 32: Ant Colony Optimization for Solving the Traveling Salesman Problem

Ant System (AS)Pheromone update :

T is the tour done at time t by ant k, L is the length, Q is a heuristic parameter.

Pheromone decay:

where is the evaporation rate, m is the number of ants and is the quantity of pheromone laid on edge (i, j) by ant k.

.0)(),()(/ elsetTjiiftLQ kkkij

m

kijijij ttt

1

)()().1()(

]1,0(kij

Page 33: Ant Colony Optimization for Solving the Traveling Salesman Problem

Initialize the pheromone , 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 dofor each ant dobuild tour; // probabilistic solution constructionend(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

)(tTij

Ant System (AS)

Page 34: Ant Colony Optimization for Solving the Traveling Salesman Problem

Ant Systems Algorithm for TSP

Initialize

Place each ant in a randomly chosen city

Choose NextCity(For Each Ant)

more cities to visit

For Each Ant

Return to the initial cities

Update pheromone level using the tour cost for each ant

Print Best tour

yes

No

Stoppingcriteria

yes

No

Page 35: Ant Colony Optimization for Solving the Traveling Salesman Problem

ReferencesE. 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

Page 36: Ant Colony Optimization for Solving the Traveling Salesman Problem

Demonstration

MatLab program to solve TSP problem by Ant Colony Optimization

Page 37: Ant Colony Optimization for Solving the Traveling Salesman Problem

Using ants to solve the TSP

Thank you for your

attention