You are on page 1of 66

Ant Colony

Optimization
ARAVIND DAMMU
HIRAY KUNAL SATISH
SANDEEP NAGARKOTI
Introduc tion
Ant societies present a highly structured social orga niza tion. As a result of this
orga niza tion, they accomplish complex tasks.
The mecha nisms which allow the coordina ted behavior of real ants are used to
solve computa tional problems.
The chara cteristics of real ants are modified to be able to solve minimum cost
problems.
In this way, artificial ants are designed according to the need of different
problems.
Charac teristic s of Real Ants
Communication between ants is based on the use of chemicals called pheromones,
produced by the ants.
While walking from food sources to the nest and vice versa, ants deposit
pheromones on the ground, forming in this way a pheromone trail.
By sensing pheromone trials fora gers follow pa th of food discovered by other ants .
Double-Bridge Experiment
In this model, ants per second cross the
bridge in each direction at a consta nt speed of
v cm/s , depositing one unit of pheromone
on that branch.
Given the lengths LS and LL an ant
choosing the short branch will traverse it in
ts=Ls/v s, while the ant choosing the long
branch will use r*ts s (r=LL/LS )

Ants choose pa ths ma rked by strong pheromone concentra tions proba bilistically.
The amount of pheromone on a branch is proportional to the no. of ants that used the
branch in the pa st.
Double-Bridge Experiment
. Because the two branches initially appea r identical to the ants, they choose
randomly
On avera ge, half of the ants choose the short branch and the other half the long
branch
The ants choosing the short branch are the first to reach the food and to start their
return to the nest.
Pheromone starts to accumulate faster on the short branch which will eventually be
used by all the ants
Ant colony is offered, after convergence, a new shorter connection between the
nest and the food.
Double-Bridge Experiment
Ant colony is offered, after convergence, a new shorter connection between the nest
and the food.
In this case, the short branch was only selected spora dically and the colony was
trapped on the long branch.
Majority of ants choose the long branch because of its high pheromone
concentra tion, and this feedback behavior continues to reinforce the long branch, even
if a shorter one appea rs the ants choosing the short branch are the first to reach the
food and to start their return to the nest.
Pheromone starts to accumulate faster on the short branch which will eventually be
used by all the ants.
Do uble-Bridge Experiment
The proba bility Pia(t) that an ant arriving at decision point selects branch,
at insta nt t is set to be a function of the total amount of pheromone

The evolution of the pheromone trial is given by:


Artific ial Ants
In complex graphs, loops tend to become
more and more attra ctive and ants can get
trapped in them.
Artificial ants are, therefore, given a limited
form of memory in which they can store the
pa rtial pa ths they have followed so far, as
well as the cost of the links they have
traversed.
This memory is utilized to elimina te loops.
Artific ial Ants
Ants move on the graph by choosing the pa th proba bilistically, Pis(t) is the
proba bility for an ant loca ted in node i at time t to choose the short pa th, and
Pil(t) the proba bility to choose the long pa th.
These proba bilities are a function of the pheromone trails ia that ants in node i
(i=1,2) encounter on the branch a(a =s,l).
Trail upda te on the two branches is performed as follows

Artific ial Ants

where mi(t) is the number of ants on node i at time t, is given by


Simple-ACO
It is a instructional tool to explain the basic mecha nisms underlying ACO
Algorithms.
Artificial ants are given a limited form of memory in which they can store the
pa rtial pa ths they have followed so far, as well as the cost of the links they have
traversed.
This memory is used to exhibit the following behaviors:
a) Proba bilistic solution construction biased by pheromone trails, without
forwa rd pheromone upda ting.
b) Deterministic backwa rd ants and pheromone upda te
c) Pheromone upda tes based on solution quality
d) Pheromone Eva pora tion
Simple-ACO
c) Pheromone upda tes based on solution quality:
The costs of arcs traversed in forwa rd pa th is memorized.
The cost of the solution is evaluated and the pheromone upda ting is done as a
function of the genera ted solution quality
d) Pheromone Eva pora tion: Evolution is simulated by applying an appropriately
defined pheromone evapora tion rule.
This reduces the influence of the pheromones deposited in the early stages of the
search, when artificial ants can build poor quality solutions.
Basic Algorithm &
Variants
BY HIRAY KUNAL SATISH
10CE31009
The Ant Colony Optimization
Metaheuristic
Ant colony optimization has been formalized into a metaheuristic for combinatorial optimization
problems by Dorigo and co-workers.
A metaheuristic is a set of algorithmic concepts that can be used to define heuristic methods
applicable to a wide set of different problems.
In other words, a metaheuristic is a general-purpose algorithmic framework that can be applied
to different optimization problems with relatively few modifications.
Combinatorial optimization problem
Combinatorial optimization problems involve finding values for discrete variables such that the
optimal solution with respect to a given objective function is found. Many optimization
problems of practical and theoretical importance are of combinatorial in nature.
Model P = (S, , f) of a combinatorial optimization problem consists of:
a search space S defined over a finite set of discrete decision variables. Xi, i = 1 , n.
a set of constraints among the variables.
an objective function f: SR0+ to be minimized.
The generic variable Xi takes values in Di = {vi1, . . . , vi|Di| }. A feasible solution s S is a complete
assignment of values to variables that satisfies all constraints in . A solution s S is called a
global optimum if and only if: f (s) f (s) s S.
Algorithm Ant Colony Optimization
Metaheuristic
Set parameters, initialize pheromone trails
while termination conditions not met do
ConstructAntSolutions
ApplyLocalSearch (optional)
UpdatePheromones
end while
ConstructAntSolutions
A set of m artificial ants construct solutions from elements of a finite set of available solution
components C = {cij}; i = 1,, n, j = 1,, |Di|.
A solution construction starts with an empty partial solution sp = . Then, at each construction
step, the current partial solution sp is extended by adding a feasible solution component from
the set of feasible neighbors N(sp) C.
The process of constructing solutions can be regarded as a path on the construction graph
GC =(V,E). The allowed paths in GC are implicitly defined by the solution construction mechanism
that defines the set N(sp) with respect to a partial solution sp.
The choice of a solution component from N(sp) is done probabilistically at each construction
step. The exact rules for the probabilistic choice of solution components vary across different
ACO variants.
ConstructAntSolutions
The best known rule is the one of ant system (AS)

where ij is the pheromone value associated with the component cij , and (.) is a function that
assigns at each construction step a heuristic value to each feasible solution component cij
N(sp). The values that are returned by this function are commonly called heuristic information.
Furthermore, and are positive parameters, whose values determine the relative importance
of pheromone versus heuristic information
ApplyLocalSearch
Once solutions have been constructed, and before updating pheromones, often some optional
actions may be required. These are often called daemon actions, and can be used to implement
problem specific and/or centralized actions, which cannot be performed by single ants.
The most used daemon action consists in the application of local search to the constructed
solutions: the locally optimized solutions are then used to decide which pheromones to update.
UpdatePheromones
The aim of the pheromone update is to increase the pheromone values associated with good or
promising solutions, and to decrease those that are associated with bad ones.
Usually, this is achieved
(i) by decreasing all the pheromone values through pheromone evaporation, and
(ii) by increasing the pheromone levels associated with a chosen set of good solutions.
Ant System (AS)
Ant System is the first ACO algorithm proposed in the literature. Its main characteristic is that, at
each iteration, the pheromone values are updated by all the m ants that have built a solution in
the iteration itself. The pheromone ij, associated with the edge joining cities i and j, is updated
as follows:

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

where Q is a constant, and Lk is the length of the tour constructed by ant k.


Ant System (AS)
In the construction of a solution, ants select the following city to be visited through a stochastic
mechanism.
When ant k is in city i and has so far constructed the partial solution sp, the probability of going to city
j is given by:

where N(sp) is the set of feasible components; that is, edges (i, l) where l is a city not yet visited by the
ant k.
The parameters and control the relative importance of the pheromone versus the heuristic
information ij, which is given by:

where dij is the distance between cities i and j.


MAX MIN Ant System (MMAS)
This algorithm is an improvement over the original Ant System. Its characterizing elements are
that only the best ant updates the pheromone trails and that the value of the pheromone is
bound. The pheromone update is implemented as follows:

where max and min are respectively the upper and lowerbounds imposed on the pheromone;
the operator [x]ba is defined as:

and ijbest is:

where Lbest is the length of the tour of the best ant.


MAX MIN Ant System (MMAS)
Concerning the lower and upper bounds on the pheromone values, min and max, they are
typically obtained empirically and tuned on the specific problem considered.
Nonetheless, some guidelines have been provided for defining min and max on the basis of
analytical considerations.
Ant Colony System (ACS)
The most interesting contribution of ACS is the introduction of a local pheromone update in
addition to the pheromone update performed at the end of the construction process (called
offline pheromone update).
The local pheromone update is performed by all the ants after each construction step. Each ant
applies it only to the last edge traversed:

where (0, 1] is the pheromone decay coefficient, and 0 is the initial value of the
pheromone.
Ant Colony System (ACS)
The main goal of the local update is to diversify the search performed by subsequent ants during
an iteration: by decreasing the pheromone concentration on the traversed edges, ants
encourage subsequent ants to choose other edges and, hence, to produce different solutions.
This makes it less likely that several ants produce identical solutions during one iteration.
The offline pheromone update, similarly to MMAS, is applied at the end of each iteration by only
one ant, which can be either the iteration-best or the best-so-far. However, the update formula
is slightly different:

As in MMAS, ij = 1/Lbest , where Lbest can be either Lib or Lbs .


Ant Colony Applications
BY SANDEEP NAGARKOTI
10CE31014
Ant Colony Applications
Damage assessment of truss structures from changes in natural
frequency
Design of tall bridge piers and trusses.
Travelling Salesman Problem (TSP)
Facility Layout Problem - which can be shown to be a Quadratic
Assignment Problem (QAP)
Network Model Problem
Vehicle Routing
Damage assessment of truss structures
from changes in natural frequency
TRUSS STRUCTURE
PLANE TRUSS STRUCTURE
A Truss is a structure comprising one or more triangular units constructed
with straight members whose ends are connected at joints referred to as
nodes.
External forces and reactions to those forces are considered to act only at
the nodes and result in forces in the members which are either tensile or
compressive forces.
A planar truss is one where all the members and nodes lie within a two
dimensional plane.
PROBLEM DEFINITION
A 9 bar plane truss is considered in the present analysis to check the
damage assessment of truss structures from changes in natural frequency.
Certain geometrical parameters, ground properties forces and unit price
of the various materials are kept constant throughout the optimization
process.
The material properties and cross sectional area of 9-bar plane truss are
considered as E = 200GPa, q = 7850kg/m3 and A = 0.0025m2
FIGURE
Figure below shows the Considered 9 bar plane truss
DESIGN PARAMETERS
E = 200GPa
q = 7850kg/m^3
A = 0.0025m^2
i ranges from 1 to 0.4, where i is the stiffness reduction factor.
For the specific problem these parameters are considered as the design
parameters.
DESIGN VARIABLES
The measured frequency fm.
The computed frequency fc.
ALGORITHM PARAMETERS

Number of Ants = 50.


Maximum number of Iterations= 200.
OBJECTIVE FUNCTION
The objective function has been developed based on the physical properties and state of the structure.
The objective function is formulated in such a way that the minimum value is obtained when evaluated
with the measured parameters.
The objective function used is one plus the RMS of the difference between the measured outputs and the
computed frequency using the FEM where n is the number of natural frequencies fm and fc are the
measured frequency and the computed frequency respectively.
R`is a vector representing the state of damage of the structure, and is given by, R`=[r1; r2; r3; . . . rn]T
Damage at single location or multiple locations in the structure is found based on the ACO methodology.
DAMAGE FORMULATION
Damage in the present study is considered as reduction in stiffness only, without any
change in mass of the structure.
When damage occurs in a structure, the stiffness matrix of the damaged structure,
donated as [kd] can be expressed as the sum of element stiffness matrix multiplied by the
stiffness reduction factor.
i(i = 1,2,. . .m) associated with each of the m elements
The percentage of damage is considered as 0%60%
The governing Eigen value equation is given by for the damaged structure.
ANT COLONY ALGORITHM -FLOW CHART
RESULTS
Case 1: Plane truss with single element damage
The natural frequencies of damaged and undamaged truss structure.
The convergence study of different no. of ants taken for same iterations for
single element case.
Single element damage assessment of 9 bar plane truss
Case 2: Plane truss with two element damage
Probability of damage in element 2 with 50% damage is 98% and in element 3 with 20% damage
is only 2% after 100 iterations
The variations of the objective function with the number of iterations for first three and six
natural frequencies
Case 3: Plane truss with four element damage.
Travelling Salesman Problem (TSP)
TSP PROBLEM : Given N cities, and a distance function d between cities,
find a tour that:
1. Goes through every city once and only once
2. Minimizes the total distance
An artificial ant is considered an agent which moves from city to city on a TSP
graph. It chooses the city to move to using a probabilistic function both of trail
accumulated on edges and of a heuristic value, which was chosen here to be a
function of the edges length.
Search Space
To each edge is a associated static value returned by an heuristic function (r,s) based on the
edge cost.

Each edge of the graph is augmented with a pheromone trail (r,s) deposited by artificial
ants.
Artificial ants probabilistically prefer cities that are connected by edges with a lot of
pheromone trail and which are close by.
Here the artificial ant is trying to move from city r to city s.
Ant Systems (AS)
Ant Systems for TSP
Graph (N,E): where N = cities/nodes, E = edges
dij = the tour cost from city i to city j (edge weight)
When an ant decides which town to move to next, it does so with a probability that is
based on the visibility for that city and the amount of trail intensity on the connecting
edge.
. B
A

C
AS Algorithm for TSP
Rules of transition probability
Whether or not a city has been visited
Use of a memory (tabu list): J ik : set of all cities that are to be visited

N ij = 1 d ij is visibility: Heuristic desirability of choosing city j when in city i.


Pheromone trail:Tij (t ) which can be modified both locally and globally.
Transition probability for ant k to go from city i to city j while building its route is given by :-

a = 0; probability depends on visibility


= 0; Probability depends on pheromone trail.
Trail Pheromone in AS
After the completion of a tour, each ant lays some pheromone
K ij (t ) for each edge that it has used. depends on how well the ant has
performed.
At each cycle pheromone evaporation takes place ,so trail pheromone decay
is given by :-
ACO State transition rule
Next city to which an ant wants to move is chosen between the not visited cities according to a probabilistic rule
ACS Local Trail Updating
Local updating is intended to avoid a very strong edge being chosen by all the
ants: Every time an edge is chosen by an ant its amount of pheromone is
changed by applying the local trail updating formula. Local trail updating is
also motivated by trail evaporation in real ants.
ACS Global Trail Updating
At the end of each iteration the best ant is allowed to reinforce its tour by
depositing additional pheromone inversely proportional to the length of the
tour
Global trail updating is similar to a reinforcement learning scheme in which
better solutions get a higher reinforcement.
Advantages & Disadvantages
For TSPs (Traveling Salesman Problem), ACO is relatively efficient
for a small number of nodes, TSPs can be solved by exhaustive search
for a large number of nodes, TSPs are very computationally difficult to
solve exponential time to convergence.
Performs better against other global optimization techniques such as neural
net, genetic algorithms, simulated annealing.
Can be used in dynamic applications (adapts to changes such as new
distances, etc.)
Convergence is guaranteed, but time to convergence uncertain.
Design of Trusses Using Ant Colony
Optimization
The objective is to select the cross-sectional area of each member so that the weight is
minimized and the stress and deflection constraints are met.
In design of truss following things are considered :-
1. There are multiple paths from one node in the truss to another ~in a traditional TSP
there is one path between cities i and j.
2. The order in which the members of a truss are visited by an ant is not important (in a
traditional TSP the order in which the cities are visited is the solution).
3. A design developed by an ant is not necessarily feasible (feasibility in a TSP is
guaranteed by the tabu list).
`

Possible virtual paths of seven-element truss


Ant Colony Optimization Truss Design
Algorithm
The first step in the application of ACO to truss design is to set an initial trail value, t0 , which is
defined as

where Wmin = weight of the truss resulting from assigning the smallest nonzero area to each
member of the truss calculated by

The first ant then selects an area or path for member i, using the following decision process The
ant decision table at time t, aij(t) is
where j = path (cross-sectional area) assigned to member I ; and na = number of possible areas.
The probability that ant k (k=1,2,...,m) will assign area j to member i at time t, pi j k (t) is

The ACO process begins when the first ant selects an area for its member or member group i
based upon these probabilities.
After the decision is made and the area assigned, the intensity of trail on this path is lowered in
order to promote exploration in the search using the following local update rule:

where = adjustable parameter between 0 and 1 representing the persistence of the trail.
Ant colony model for tall bridge piers
The problem of structural concrete design consists of an economic optimization of the structural
design of tall bridge piers.

where T (t, i, j) is the total trace at the end of stage t for variable i and position j, T (t, i) is the
addition of all T (t, i, j), and determine whether the choice prefers the trace or the random
selection and R is a random number between 0 and 1.
Once the probability of each position j is known, the procedure generates ants by means of the
roulette, taking into account the high or low probability of choosing a position.
ACO Characteristics
Exploit a positive feedback mechanism
Demonstrate a distributed computational architecture
Exploit a global data structure that changes dynamically as each ant
transverses the route
Has an element of distributed computation to it involving the population
of ants
Involves probabilistic transitions among states or rather between nodes
Conclusions
ACO is a recently proposed meta-heuristic approach for solving hard
combinatorial optimization problems.
Artificial ants implement a randomized construction heuristic which makes
probabilistic decisions.
The cumulated search experience is taken into account by the adaptation of the
pheromone trail.
ACO Shows great performance with the ill-structured problems like network
routing.
In ACO Local search is extremely important to obtain good results.
Thank You!