Reservoir Operation by Particle Swarm Optimization Algorithm
S. H. Meraji , Graduated Student , hamedmeraji civileng.iust.ac.ir,
Department oI Civil Engineering, Iran University oI Science and Technology, Tehran, Iran.
and
M. H. Afshar, Assistant Professor, mhaIshariust.ac.ir,
Department oI Civil Engineering, Iran University oI Science and Technology, Tehran, Iran.
and
A. Afshar, Professor, aaIshariust.ac.ir,
Department oI Civil Engineering, Iran University oI Science and Technology, Tehran, Iran.
Abstract
In this paper, a Particle Swarm Optimi:ation (PSO) algorithm is used for reservoir
operation. While manv evolutionarv computation techniques have been developed for
combinatorial optimi:ation problems, PSO has been basicallv developed for continuous
optimi:ation problem, based on the backgrounds of artificial life and psvchological
research. PSO is inherentlv some distributed algorithms, in which the solution for a
problem emerges from the interactions between manv simple individuals called particles.
The efficiencv of the PSO algorithm is tested against some benchmark functions
optimi:ation problem and then the method is applied to a problem in the reservoir
operation discipline. The results indicate the efficiencv of the PSO algorithm.
Key words: Particle Swarm Optimi:ation Algorithm, PSO, Reservoir operation
1 Introduction
In reservoir operation problems, to achieve the best possible perIormance oI the system,
decisions need to be made on releases and storages over a period oI time considering the
variations in inIlows and demands. In the past, various researchers applied diIIerent
mathematical programming techniques like Linear Programming (LP), Dynamic
Programming (DP), Nonlinear programming (NLP), etc., to solve such reservoir operation
problems. But oIten the objective Iunctions oI problems are complex, with nonlinear
relationships in objectives and constraints. So the linear programming methods may not
eIIiciency be used Ior many non convex, nonlinear reservoir operation problems. The
dynamic programming approach Iaces the additional problem oI the curse oI
dimensionality, whereas the nonlinear programming methods have the limitations oI slow
rate oI convergence, requiring large amount oI computational storage and time compared
with other methods. Also, oIten NLP results in local optimal solutions.
In spite oI development oI many conventional techniques Ior optimization, each oI these
techniques has its own limitations. To overcome those limitations, recently Evolutionary
Algorithms (EA) are being used Ior optimization. By using evolutionary techniques, the
given problem can be represented more realistically. These also provide ease in handling
the nonlinear and nonconvex relationships oI the Iormulated model. Particle Swarm
Optimization is one oI the techniques in this category. This evolutionary algorithm search
Irom a population oI points, so there is a greater possibility to cover the whole search space
and reaching the global optimum.
2  Particle Swarm Optimization
The Particle Swarm Optimization method was Iirst introduced by Kenney and
Eberhart in 1995 5. Particle Swarm Optimization (PSO) is a novel multi agent
optimization system (MAOS) inspired by social behavior metaphor . In PSO each agent,
call particle, Ilies in a Ddimensional space S according to the historical experiences oI its
own and its colleagues. The movement oI the particles is stochastic; however it is
inIluenced by the particle`s own memories as well as the memories oI its peers. Each
particle keeps track oI its coordinates in the problem space. PSO also keeps track oI the
best solution Ior all the particles (gbest) achieved so Iar, as well as the best solution (pbest)
achieved so Iar by each particle. At the end oI a training iteration, PSO changes the velocity
oI each particle toward its pbest and the current gbest value.
2.1  Background of Particle Swarm Optimization
Natural creatures sometimes behave as a swarm. One oI the main streams oI artiIicial
liIe researches is to examine how natural creatures behave as a swarm and reconIigure the
swarm models inside a computer. Swarm behavior can be modeled with a Iew simple rules.
School oI Iishes and swarm oI birds can be modeled with such simple models. Namely,
even iI the behavior rules oI each individual (agent) are simple, the behavior oI the swarm
can be complicated. Reynolds called this kind oI agent as boid 6. He utilized the
Iollowing three vectors as simple rules:
1 To step away Irom the nearest agent
2 To go toward the destination
3 To go to the center oI the swarm
Namely, behavior oI each agent inside the swarm can be modeled with simple
vectors. This characteristic is one oI the basic concepts oI PSO. Boyd and Richerson
examine the decision process oI human being and developed the concept oI individual
learning and cultural transmission 1. According to their examination, people utilize two
important kinds oI inIormation in decision process. The Iirst one is their own experience;
that is, they have tried the choices and know which state has been better so Iar, and they
know how good it was. The second one is other people's experiences; that is, they have
knowledge oI how the other agents around them have perIormed. Namely, they know
which choices their neighbors have Iound are most positive so Iar and how positive the best
pattern oI choices was. Namely each agent decides his decision using his own experiences
and other people's experiences. This characteristic is another basic concept oI PSO.
2.2  The Particle Swarm Optimization algorithm
According to the background oI PSO and simulation oI swarm oI bird, Kennedy and
Eberhart developed a PSO concept. Suppose that the search space is Ddimensional, then
the ith particle oI the swarm can be represented by a Ddimensional vector,
X
i
(x
i1
, x
i2
, . . . , x
iD
)
T
. The velocitv (position change) oI this particle, can be represented
by another Ddimensional vector Ji (v
i1
, v
i2 ,
. . . v
iD
)
T
. ModiIication oI the agent position
is realized by the position and velocity inIormation. Each agent knows its best value so Iar
(pbest) and its X
i
position. This inIormation is analogy oI personal experiences oI each
agent. Moreover, each agent knows the best value so Iar in the group (gbest) among pbests.
This inIormation is analogy oI knowledge oI how the other agents around them have
perIormed. Namely, each agent tries to modiIy its position using the Iollowing inIormation:
 The current positions X
i
,
 The current velocities J
i
,
 The distance between the current position and pbest
 The distance between the current position and gbest
This modiIication can be represented by the concept oI velocity. Velocity oI each agent can
be modiIied by the Iollowing equation:
1
, , 1 1 , , 2 2 ,
. ( ) ( )
n n n n n n n n
i d i d i d i d d i d
v wv c r pbest x c r gbest x
+
= + + (1)
Where,
,
n
i d
v : Velocity oI agent i at dimension d , and iteration n ,
w : Inertia weight ,
c
1
, c
2
: Two positive constants, called cognitive and social parameter respectively,
r
1
, r
2
: Random numbers, uniIormly distributed between 0 and 1 ,
,
n
i d
x : Current position oI agent i at dimension d , and iteration n ,
n
id
pbest : pbest oI agent i , at dimension d , and iteration n ,
n
d
gbest : gbest oI the group at dimension d , and iteration n ,
i 1, . , N , and N is the size oI the swarm ,
d 1, . , D , and D is the dimension oI search space ,
n 1, 2, 3, . , iTer
max
, and iTer
max
is the maximum oI iterations ,
The current position (searching point in the solution space) can be modiIied by the
Iollowing equation:
1 1
, , ,
n n n
i d i d i d
x x v
+ +
= + (2)
Equations (1) and (2) deIine the initial version oI the PSO algorithm. Since there was no
actual mechanism Ior controlling the velocity oI a particle, it was necessary to impose a
maximum value J
max
on it. II the velocity exceeded this threshold, it was set equal to J
max
.
This parameter proved to be crucial, because large values could result in particles moving
past good solutions, while small values could result in insuIIicient exploration oI the search
space. Table 1, provides an algorithm model Ior PSO method.
2.3  The parameters of PSO
The role oI the inertia weight, w, in Equation (1), is considered critical Ior the PSO`s
convergence behavior. The inertia weight is employed to control the impact oI the previous
history oI velocities on the current one. Accordingly, the parameter w regulates the trade
oII between the global and local exploration abilities oI the swarm. A large inertia weight
Table 1: Algorithm model of the PSO
Particle Swarm Optimizer
Step 1. Set randomly the population and the velocities.
Step 2. While (Stopping criterion not met) Do
Step 3. Update inertia and perIorm a PSO iteration Ior the objective Iunction f (x).
Step 4. EndWhile
Step 5. Report the results.
Iacilitates global exploration (searching new areas), while a small one tends to Iacilitate
local exploration, i.e., Iinetuning the current search area. A suitable value Ior the inertia
weight w usually provides balance between global and local exploration abilities and
consequently results in a reduction oI the number oI iterations required to locate the
optimum solution. Initially, the inertia weight was constant. However, experimental results
indicated that it is better to initially set the inertia to a large value, in order to promote
global exploration oI the search space, and gradually decrease it to get more reIined
solutions. Thus, Shi and Eberhart 7,8,9 ,made a signiIicant improvement in the
perIormance oI the PSO with a linearly varying inertia weight over the generations, which
linearly vary Irom w
max
at the beginning oI the search to w
min
at the end. Thus, The
Iollowing weighting Iunction is usually utilized in Equation (1) ,
max
min max
max
) (
iTer
n w w
w w
= (3)
where,
w
max
: Initial weight,
w
min
: Final weight,
iTer
max
: Maximum iteration number,
n : Current iteration number.
The parameters c
1
and c
2
, in Equation (1), are not critical Ior PSO`s convergence.
However, proper Iinetuning may result in Iaster convergence and alleviation oI local
minima. An extended study oI the acceleration parameter in the Iirst version oI PSO, is
given in 4. As deIault values, c
1
c
2
2 were proposed, but experimental results indicate
that c
1
c
2
0.5 might provide even better results. Recent work reports that it might be
even better to choose a larger cognitive parameter, c
1
, than a social parameter, c
2
, but with
c
1
c
2
_ 4 2.
The parameters r
1
and r
2
are used to maintain the diversity oI the population, and they
are uniIormly distributed in the range (0, 1).
3  Experimental studies
3.1  Test benchmark functions
To implement the Particle Swarm Optimization algorithm, a code was developed in
FORTRAN 90. The PSO algorithm was used Ior the optimization oI Iive benchmark
Iunctions. The Iunctions, the number oI dimensions (D), the admissible range oI the
variable (x), and their optimum values are summarized in Table 2.
Table 2: Optimi:ation test functions
Name Formula Dim. Range Optimal f Sketch in 2D
Sphere
=
=
n
i
i
x x f
1
2
) ( 0
10 100 , 100
n
0
Rosenbrock
( )
=
+
+ =
1
1
2 2 2
1
) 1 ( ) ( 100 ) ( 1
n
i
i i i
x x x x f
5 30 , 30
n
0
Rastrigin
( )
=
+ =
n
i
i i
x x x f
1
2
10 ) 2 cos( 10 ) ( 2 t
5 5.12 , 5.12
n
0
Griewank
[
= =
+


.

\

=
n
i
n
i
i
i
i
x
x x f
1 1
2
1 cos
4000
1
) ( 3
10 600 , 600
n
0
SchaIIer`s I6
( )
( )
2
2
2
2
1
2
2
2
2
1
) ( 001 . 0 1
5 . 0 sin
5 . 0 ) ( 6
x x
x x
x f
+
+
=
2 100 , 100
n
0
3.2  Result of benchmark functions
The maximum iteration number, the number oI particles (N), c
1
, c
2
, minimum and
maximum range oI inertia weight, and average, minimum and maximum Fitness values oI
Iunctions, Standard Deviation (S.D) and variance oI Iitness value Iunctions are summarized
in Table 3. Each optimization experiment was run 10 times with random initial values oI X
in the range x
min
, x
max
 indicated in Table 2. During the optimization process the particles
were not allowed to 'Ily outside the region deIined by x
min
, x
max
 and the velocity was not
restricted. Result oI Fitness values oI benchmark Iunctions, indicate that, PSO is successIul
to achieve the optimum solution.
4  PSO Algorithm for Optimum Reservoir Operation
4.1  Fitness function
The fitness function is a measure of the goodness of the generated solutions
according to the defined objective function. For this study, total squared deviation
(TSD) of the releases from the required demands is considered as the fitness
function defined as:
 
=
=
NT
t
i i
t D t R TSD
1
2
) ( ) ( (4)
Where,
R
i
(t) : release at period t recommended by particle i ,
D(t) : demand of period t;
To determine R (t), the continuity equation along with the Iollowing constraints, may
be employed as:
Table 3: Result of benchmark functions
N C
1
C
2
W
min
W
max
iTer
max
Average MIN. MAX. S.D Var.
Sphere 50 0.5 0.5 0.4 1.0 500 1.16E15 2.87E24 1.06E14 3.33E15 1.11E29
Rosenbrock 100 0.5 0.5 0.4 1.0 1000 1.18E03 1.30E05 5.43E04 0.00017 2.90E08
Rastrigin 100 0.5 0.5 0.4 1.0 1000 0.000 0.000 0.000 0.000 0.000
Griewank 200 0.5 0.5 0.4 1.0 1000 8.24E02 0.0713 0.0984 0.0094 0.0001
Schaffer's f6 50 0.5 0.5 0.4 1.0 500 8.13E05 0.000 8.13E04 2.57E04 6.61E08
( ) ( ) ( 1) ( ) ( ) R t S t S t I t Spill t = + + (5a)
max min
) ( S t S S s s (5b)
max min
) 1 ( S t S S s + s (5c)
1 1 +
=
NT
S S (5d)
) ( ) ( 0 t D t R s s (5e)
( ) 0 Spill t > (5I)
Where,
S(t) : initial storage volumes at period t ,
S(t1) : initial storage volumes at period t1 or Iinal storage volumes at period t ,
I(t) : inIlow to the reservoir at time period t,
Spill (t) : Spill at period t,
PSO parameters Value oI Iitness Iunction
Name
S
min
: minimum storage allowed,
S
max
: maximum storage allowed,
NT : total number oI periods.
4.2  Model application
To illustrate the perIormance oI the model, the Dez reservoir in southern Iran, with an
eIIective storage volume oI 2,510 MCM and average annual demand oI 5,900 MCM is
selected. For illustration purposes, a period oI 24 months with an average annual inIlow oI
5,792MCM is employed. To limit the range oI values oI the Iitness Iunction, a normalized
Iorm oI equation 4 has been used as:
( )
=
(
=
NT
t
i
i
D
t D t R
TSD
1
2
max
) ( ) (
(6)
Where,
D
max
: maximum monthly demand.
The model so developed was tested Ior the Dez reservoir with 10 runs. Results oI the
model are presented in Table 4 and convergence curves diagram oI PSO are presented in
Figure (1) .
Table 4: Result of Model application
N C
1
C
2
W
min
W
max
iTer
max
Average MIN. MAX. S.D Var.
Dez
reservoir
600 0.5 0.5 0.4 1.0 100 6.5E02 3.60E02 0.1025 0.0246 0.0006
The problem also solved using a Non Linear Programming (NLP) model yielding an
optimal solution with total normalized squared deviation (TSD) equal to 0.09143511 .
A comparison between PSO and NLP`s results, are presented in Table 5 and Figure (2).
Table 5: Comparison between PSO and NLPs results
First 6 month Second 6 month Third 6 month Forth 6 month
M
o
n
t
h
D
e
m
a
n
d
r
e
l
e
a
s
e
N
L
P
r
e
l
e
a
s
e
P
S
O
D
e
m
a
n
d
r
e
l
e
a
s
e
N
L
P
r
e
l
e
a
s
e
P
S
O
D
e
m
a
n
d
r
e
l
e
a
s
e
N
L
P
r
e
l
e
a
s
e
P
S
O
D
e
m
a
n
d
r
e
l
e
a
s
e
N
L
P
r
e
l
e
a
s
e
P
S
O
1 516.4 516.4 516.4 467.6 467.6 467.6 516.4 516.3858 516.4 467.6 372.47 407.26
2 603.7 603.7 603.7 318 318 318 603.7 509.5651 603.7 318 222.88 249.86
3 757.2 757.2 757.2 163 163 163 757.2 662.081 692.73 163 163 163
4 831.1 831.1 831.1 150.1 150.1 150.1 831.1 735.9712 765.17 150.1 150.1 150.0
5 818.8 818.8 818.8 203 202.99 203 818.8 723.6702 754.0 203 203 203
6 706 706 706 365.5 365.5 365.5 706 610.8702 642.62 365.5 365.5 365.5
Name
PSO parameters Value oI Iitness Iunction
5 Conclusions
In this paper, a new evolutionary algorithm namely Particle Swarm Optimization is
used to solve reservoir operating problem. The technique has global and local exploration
capabilities to search Ior the optimal solution. PSO is Iirst tested against Iive benchmark
Iunctions. The results indicate that PSO has acceptable ability Ior solving global
optimization (GO) problems. Then, PSO is successIully applied to the reservoir operation
problem oI Dez reservoir, in southern Iran. Results oI PSO are also compared with the
solution obtained by Non Linear Programming (NLP) model. It is observed that the results
obtained by PSO algorithm are better than those obtained by NLP model. Conclusively,
PSO appears to be a very useIul technique Ior solving GO problems in civil engineering,
especially in water reservoir engineering.
0
0.02
0.04
0.06
0.08
0.1
0.12
0.14
0.16
0 20000 40000 60000
Number of Function evolutions
O
b
j
e
c
t
i
v
e
f
u
n
c
t
i
o
n
0
100
200
300
400
500
600
700
800
900
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
Period (Month)
D
i
s
c
h
a
r
g
e
(
M
C
M
)
Monthly demand Monthly release (NLP)
Monthly release (PSO)
Figure1: convergence curves Figure2: Comparison between
of PSO PSO and NLPs results
5 References
1 Boyd, R, and Recharson, P,'Culture and the Evolutionary Process, University oI
Chicago Press, 1985.
2 Carlisle, A, and Dozier, G,'An OIITheShelI PSO. Proceedings of the Particle Swarm
Optimi:ation Workshop, 2001, pp. 16
3 Jalali1, M. R, AIshar, A; and Mario, M. A,Reservoir Operation by Ant Colony
Optimization Algorithms, Iran University oI Science and Technology (IUST), Tehran,
Iran.
4 Kennedy, J, 'The behavior oI particles. In. Porto JW, Saravanan N, Waagen D and
Eiben AE (eds) Evolutionarv Programming JII, , 1998, pp. 581590. Springer
5 Kennedy, J, and Eberhart, R, 'Particle Swarm Optimization ', Proceedings of the
International Conference on Neural Networks, Perth, Australia, 1995 IEEE, Piscataway,
1995, pp. 1942 1948.
6 Reynolds, C, "Flocks, Herds, and Schools: A Distributed Behavioral Model", Computer
Graphics, Vol.21, No.4, 1987, pp.2534.
7 Shi,Y, and Eberhart, RC. 'Empirical study oI particle swarm optimization,
Proceedings IEEE International Congers Evolutionarv Computation, Washington,
DC.,USA, 1999, pp. 194550.
8 Shi, Y, and Eberhart ,R , Parameter selection in Particle Swarm Optimization, In.
Porto JW, Saravanan N, Waagen D and Eiben AE (eds) Evolutionarv Programming JII,
1998, pp. 611 616.
9 Shi, Y, and Eberhart, R, 'A modiIied Particle Swarm Optimizer, Proceedings of the
1998 IEEE Conference on Evolutionarv Computation. AK, Anchorage, 1998.
10 PARSOPOULOS, K.E, and VRAHATIS, M.N, Recent approaches to global
optimization problems through Particle Swarm Optimization ',Natural Computing,
Universitv of Patras, Patras, Greece,2002 ,pp. : 235306 .