You are on page 1of 4

International Journal of Scientific Research Engineering & Technology (IJSRET), ISSN 2278 0882

Volume 3, Issue 2, May 2014

Modifications done in Ant Colony Algorithm for its application to PID


Controller Parameters Optimization
1
2

Samarth Singh 1, R. Mitra 2

Department of Electronics and Communication Engineering, Indian Institute of Technology, Roorkee, India
Department of Electronics and Communication Engineering, Indian Institute of Technology, Roorkee, India

ABSTRACT

Ant Colony Algorithm is an algorithm used for obtaining


optimized cost solutions for graphical problems. This
paper deals with modifications done in this algorithm
and uses it for finding optimal values of PID controller
parameters. These modifications are actually the
solutions to the problems that were encountered while
implementing this algorithm on PID controller.
Modifications done to this algorithm provided better
results as compared to the simplified version of the
algorithm, in terms of lesser number of iterations taken
to reach optimal solution, along with improvement in the
response obtained. The results have been obtained by
making use of MATLAB simulations.

they have higher tendency (or probability) to follow that


path which has higher deposition of pheromone.

Keywords: Ant Colony Algorithm, modifications, PID


controller, iterations, MATLAB.

I.

INTRODUCTION

Ants are creatures which as individuals are quite simple,


but collectively they are known for their complex social
behavior in terms of gathering food. Due to this behavior
ants are able to find the shortest path from their nest to
the food source. Studies were conducted in the early 90's
on their food gathering mechanisms and the result of
these studies was the Ant Colony Algorithm [1].
Since then it has been applied in numerous fields for
optimization purposes. It is basically a probabilistic
technique used for finding shortest path in graphs. A
number of artificial ants build solutions for a certain
optimization problem and exchange information about
the quality of these solutions making allusion to the
communication systems of the real ants [1]. This
exchange of information is done by the means of a
chemical known as pheromone, towards which ants are
highly responsive [1] [2].

II. FOOD GATHERING BEHAVIOR OF


ANTS IN BRIEF

Fig 1. Shows sequentially how ants gather food in a


simplified manner. Starting from the top of the figure we
can say that six ants are about to leave the ant nest for
gathering food. It is clear from the figure that there are
two paths available towards the food source, one is the
shorter one the other is the longer one. Now ants release
the chemical pheromone as they travel, along with this

Fig 1. Food gathering mechanism of ants.


So initially as there is no deposition of pheromone on
any of the paths, so there ants have 50-50 probability to
follow any of the two paths. However ants on the shorter
path will reach the food source first and also return back
to the nest fast, hence pheromone deposition on shorter
path would be higher as compared to the longer path. At

www.ijsret.org

225

International Journal of Scientific Research Engineering & Technology (IJSRET), ISSN 2278 0882

Volume 3, Issue 2, May 2014

this point of time, Any other ant ready to gather food


would thus have higher tendency to follow shorter path
as compared to the longer path . Pheromone also decays
with time. After a long period of time almost all the ants
would follow the shorter path, thereby optimizing their
path from the nest towards the food source.

III. ANT COLONY ALGORITHM

1. Define objective function as:

2.
3.
4.
5.

where Q is a constant and ISE is Integral Square of


Error.
Discritize all the parameters that are to be optimized.
Decide the maximum number of iterations, number of
ants in the nest, path tables for each ant, pheromone
tables and optimal path table.
Set a counter equal to 0 and begin algorithm.
For each ant find the transitional probability to each
node as it travel along a particular path.

where
P
:Probability of kth ant going from source node s
to destination node d.

6. After probabilities found out let ants travel and store


their path in respective path tables. From this find
objective function value for each ant.
7. At the end of iteration update the pheromone
deposition at each node from the following:

Along with this increment the counter

8. End the algorithm if either all the ants start to follow

a single path or the counter achieves maximum value


of iterations. Else go to step 5.
Algorithm has been developed using [1] [2][3][4][5]

IV.
MODIFICATIONS DONE IN ANT
COLONY ALGORITHM AND RESULTS

A.
Deposition of pheromone on optimal nodes
It is known that the pheromone deposition on each node
is proportional to the value of objective function
obtained at the end of iteration for each path ants have
travelled for this iteration. The objective function is in
fact inversely proportional to ISE (Integral Square of
Error) [4][5]. Suppose the most optimal path was found
during the second or higher iteration, then the ants would
not settle to the new found optimal path because the
optimal path obtained from previous iterations will have
significant deposition of pheromone on it. From
simulation results it was seen that, although we did found
out the most optimal path but it took significant number
or in most cases maximum number of iterations for all
the ants to settle on it.
We know that at the end of every iteration ,the
pheromone deposition on every node gets updated.
Based on the ISE value, obtained for a particular path,
this update takes place [4][5]. So in order to save time
what we can do is that at the end of each iteration we can
increment the pheromone deposition by certain factor on
the nodes of the most optimal path. Along with this we
need to define a pre optimal path, which we can say that
it was the optimal path in the previous iterations, at the
end of each iteration reduce its pheromone contents by
certain large factor so that the probability of ants
following that path decrease or in other words we are
increasing the probability of rejecting this pre optimal
path and increasing the probability of settling of all the
ants on the optimal path.
At the end of iteration let

The figure 2, figure 3 and figure 4 shows values of


pheromone at various nodes for the three controller
parameters at the termination of the algorithm, whose
optimal values are being found out. We see that
significant and considerable deposition on several nodes
other than the optimal nodes( optimal nodes in above
case are Kp=2.5, Ki=1.2, Kd=2.9) in case of Kp, nodes
other than optimal one have more pheromone deposition
, thus this can cause the algorithm to not converge
immediately to optimal solution.

www.ijsret.org

226

International Journal of Scientific Research Engineering & Technology (IJSRET), ISSN 2278 0882

Volume 3, Issue 2, May 2014

After making use of the offered solution the result that


we got can be seen from fig 5, fig 6 and fig 7. the
optimal nodes here are Kp=2.5 ,Ki=1.1 ,Kd=3. From the
above figures we can say that the deposition on optimal
nodes is significantly high as compared to other nodes.
Greater the deposition of pheromone on a path, greater
will be the ants probability to follow that path. So the
ants can easily converge to the optimal solution. This can
also be seen from table 1.

Fig 5. Pheromone deposition on each Ki node (after


modification)

Fig 2. Pheromone deposition on each Ki node (without


modification)

Fig 6. Pheromone deposition on each Kp node (after


modification)

Fig 3. Pheromone deposition on each Kp node (without


modification)

Fig 7. Pheromone deposition on each Kd node (after


modification)

Fig 4. Pheromone deposition for each Kd node (without


modification)

For the same system, the Ant Colony Algorithm was run
10 times for original algorithm and 10 times after
modification to see whether the algorithm is terminating
or not with modification. The above results also conform
that the solution proposed is giving us an early
termination to the algorithm.

www.ijsret.org

227

International Journal of Scientific Research Engineering & Technology (IJSRET), ISSN 2278 0882

Volume 3, Issue 2, May 2014

TABLE 1: Showing number of iterations taken using

with and without modification to find optimal


solution.
After
modification

1
2
3
4
5
6
7
8
9
10

6
10(max)
10(max)
10(max)
10(max)
10(max)
10(max)
10(max)
9
10(max)

5
8
10(max)
4
6
5
4
5
5
4

1.2
1
Response

Original

1.4

0.8
0.6
0.4
0.2
0
0

2000

4000

6000
8000
Time(.003 secs)

10000

12000

Fig 8. Response for without modified objective function


1.4
1.2

B. MODIFICATION IN OBJECTIVE FUNCTION


For any path to be accepted or rejected for being the
most optimal one, depends on the objective
function(inversely proportional to ISE) value obtained
for that path, The logic of this algorithm allows that path
to be chosen which has the least ISE value[4][5]. To
obtain the desired response, it sometimes becomes
necessary to make modifications in the objective
function. One of the major problems that was
encountered was when the offline tuning of scaling
factors of Fuzzy supervised PID for a third order system
was done through the algorithm. The response obtained
is of fashion as shown in figure.
The initial oscillations in the response are undesirable as
can be seen from the figure 8, although best possible ISE
has been obtained for this response. The undesirability is
due to the fact that such sudden and large oscillations can
damage the actuator. To reduce these oscillations we
need to modify the objective function so that such tuned
values can completely be rejected while the algorithm is
being proceeded.
In the algorithm we are actually storing the values of the
error at each sampling instant in an array. Here
modification done was that for each sampling instant and
a future sampling instant (+1 sec and +2 sec) was taken
into consideration, the difference between the values of
output for both of these time instants must be less than
0.2(taking into assumption a value less than or equal to
0.2 is desirable). If this condition is not true the
algorithm immediately rejects that path. This is done by
putting ISE value for that path very large forcefully. The
reason the future sampling instant was taken at +1 and
+2 sec is that the time difference in occurrence of crest
and trough was around 1 to 2 seconds which can be seen
from the response.
This resulted in getting a response with significantly less
oscillatory behavior in the transient section of the

1
Response

S.no

response as can be seen from fig 9. Thus giving us


desirable response.

0.8
0.6
0.4
0.2
0
0

2000

4000

6000
8000
Time(.003sec)

10000

12000

Fig 9. Response with modification in objective function

VI. CONCLUSION

In this paper it can be said that the problems were


encountered while implementation of Ant Colony
Algorithm, in the form of large number of iterations and
improper response, so suitable modifications were done
in the algorithm so as to get proper results.
[1]
[2]

[3]

[4]

[5]

REFERENCES

Marco Dorigo, Thomas Stutzle," Ant Colony


Optimization", A Bradford Book The MIT Press
Cambridge, Massachusetts London, England 2004.
Marco Dorigo, Luca Maria Gambardella, "Ant Colony
System: A Cooperative Learning Approach to the
Travelling Salesman Problem" ,Accepted for publication
in the IEEE Transactions on Evolutionary Computation,
Vol.1, No.1, 1997.PP 1-21.
Oscar Castillo, Witold Pedrycz, and Janusz Kacprzyk
,"Evolutionary Design of Intelligent Systems in
Modelling, Simulation and Control", Springer-Verlag
Berlin Heidelberg 2009. pp.3-16.
R. Mitra, Samarth Singh, "Optimal Fuzzy Supervised PID
Controller using Ant Colony Optimization Algorithm" ,
published in International Journal of Advance in
Electronic and Electric Engineering, Research India
Publication, vol 3, No.5. pp.543-550.
Yongsheng Zhao, Baoying Li "A New Method for
Optimizing Fuzzy Membership Function", Proceedings of
the 2007 IEEE International Conference on Mechatronics
and Automation, 2007, Harbin, China. pp. 674-678.

www.ijsret.org

228