INTRODUCTION
GA which is based on the Darwin’s theory was introduced by Holland (1975) or the first time, then Goldberg (1989) and Michalewicz (1992) were presented a complete introduction of this method.
Fahmy et al. (1994) applied GA for optimization of a reservoir system. They compared the results of this model with dynamic programming model and showed that GA has a high potential for optimization of large water resources systems. Oliveira and Loucks (1997) used GA to obtain rule curves of a multireservoir system. Chang and Chen (2005) applied two types of GA (the binary and the realvalue coding) to optimize a flood control reservoir and showed that both algorithms were more effective than randomsearch methods. Wardlaw and Sharif (1999) used this algorithm to optimize a four reservoirs system of limited time horizon. They also solved a nonlinear fourreservoir system of wide horizon and a complex ten reservoirs system by GA. Sharif and Wardlaw (2000) used GA to optimize a multi reservoirs system in Indonesia and compared the results with the dynamic programming results and concluded that GA results are more confident. Yoon and Shoemaker (2001) applied a Realcoded Genetic Algorithm (RGA) coupled with two newly developed operators: directive recombination and screened replacement for an in situ bioremediation of ground water. They concluded that RGA performs better than the binarycoded GA. Srinivasa and Kumar (2004) used the GA method to design irrigation systems for a suitable cultivation pattern in India. Chang et al. (2005) used GA to optimize water release of 12 monthly periods to maximize the hydropower electricity. Ahmed and Sarma (2005) used GA to optimize the operation of a multipurpose reservoir. They compared the obtained results with the results of stochastic dynamic programming and concluded that GA has a better performance. In the present study, GA has been used to optimize the operation of the Jiroft dam reservoir. Considering the efficiency of GA in many fields, genetic algorithm toolbox in version 7 of Matlab has been used for this purpose.
MATERIALS AND METHODS
Genetic algorithm toolbox: Initially, the Matlab software was written to solve the problem in the field of matrices, linear algebra and numerical analyses in the Stanford and Newmexico universities in 1970. Today, the capability of the Matlab software is more than the first matrix library. The main element of this software is a matrix that doesn’t need to specify its dimensions. So, solution of the problems are as easy as writing them.
There are several different toolboxes in Matlab which can be used in engineering area. One of these toolboxes is Genetic Algorithm which is accessible from: Start/toolboxes/genetic algorithm and direct search/genetic algorithm tool menu.
For initial run of program, defining the objective function in an Mfile and identifying the number of variables are necessary. Then, the user can choose necessary plots such as mean distance between individuals in plot option and see them as the algorithms run. Finally, the user can change any options of running GA such as: selection, cross over, mutation and so on. As an example, for the option of selection the user can choose any kind of selections such as: stochastic uniform, reminder, uniform, tournament and custom which accept the function that is defined by user.
Jiroft dam: The Jiroft dam was built on the Halil river, is one of the
largest rivers in the Jiroft city of Kerman province in Iran.
Table 1: 
Jiroft dam associated parameters 

This river with
length 387 km, is passing the Jiroft and Roodbar plains and ending the Jazmooriyan. This river is a flood type river with at least a big flood annually. Halil
River is one of the most important sources of water for Jiroft and Roodbar plains.
The basin of Halil river is located in 45°15' to 58°30' Eastern longitude
and 27°45' to 29°33' Northern latitude. The total catchments area of
this river is over 18832 km^{2}. The Jiroft dam is located in the Narab
valley, 40 km NorthWest of the Jroft city. It is a thin concrete twinarch
dam. The mean annual inflow to the Jiroft dam is 426 MCM. Table
1 shows some parameters of this dam.
Model identification: To define the objective function, a number of optimization methods of reservoir operation, developed by other researchers have been investigated. However, in this study the objective function is defined as:
Where: 
R_{t } 
= 
Monthly release of water from reservoir 
D_{t } 
= 
Monthly downstream demand for water 
S_{t } 
= 
Storage volume of water at the beginning of each month 
E_{t } 
= 
Monthly evaporation 
The first term of Eq. 1 demonstrates the difference between demand (D_{t}) and release (R_{t}). The second term defines continuity. Different values for probability of inflow can be used in Eq. 1.
Generally GA solves unconstrained problems. So, a constrained problem should be converted into an unconstrained one. There are some methods which convert the fitness function and constrains into an unconstrained function which is called pseudo fitness function. One of the most common methods is exterior penalty function method, where fitness functions and constrains are transformed into a pseudo fitness function as shown below (Ebrahimifrasangi, 2002):
where, n is pseudo fitness function, F is fitness function, g_{i},
g_{j},
, are constraint terms and R_{p} is a coefficient which get a big value.
According to hydrological studies, the inflows to The Jiroft dam reservoir have a log normal distribution. Initially, the probability of inflows to the reservoir is selected as 90%. This means that, with probability of 90% the stream flow will be equal to or more than the specified value. In other words, optimization has been carried out in the most critical situation of drought. Considering the structure of objective function and capability of genetic algorithm toolbox, it is possible to optimize the operation of a reservoir for various inflows.
Genetic algorithm toolbox parameters: For different parts of genetic algorithm such as initial population size, probability of crossover, mutation type and so on, different options are available. Accurate selection of these options will affect the functioning and running speed of GA program. So, in this study, for each part of genetic algorithm based on the ability of its related toolbox, different options have been chosen and examined for the best solution.
In running genetic algorithm, one of the most important parameter is population distribution; it will be controlled by regulating the initial size of population and determining its suitable size. In this study, the initial rang of population is selected equal to 0 to 10. In order to obtain the best population size, using sensitivity analysis, different population sizes have been considered. The best population size equal to 300 corresponding to the minimum value of objective function is resulted (Fig. 1).
Two curves of GA toolbox (the fitness value and the average distance between
individuals in each generation) are selected and used (Fig. 2,
3). Figure 2 shows the behavior of average
and best fitness value in each generation. The average fitness value curve shows
population scattering, which is decreases by increasing the generation number
and becomes minimum at 1200 generations.
Figure 3 shows the average distance between individuals in different generations, it becomes equal to zero after 1200 generations, which is no difference between individuals, or individuals are similar to each other.
Some other parameters used in this study are: ranking for fitness scaling, stochastic uniform selection, scattered crossover, forward migration and two elite counts. The crossover fraction is considered 0.9 (Fig. 4).

Fig. 1: 
Results of sensitivity analysis for population size determination 

Fig. 2: 
Fitness value in each generation 

Fig. 3: 
Average distance between individuals 
Another advantage of genetic algorithm toolbox is option of the hybrid optimization
function. Running this function is after the genetic algorithm is terminated,
improves the value of fitness function. The hybrid function uses the final value
of the fitness function obtained by the genetic algorithm as its initial point.

Fig. 4: 
Sensitivity analysis curve 
In this study, the hybrid function is used, but the optimization results obtained
by GA were not improved significantly, that is the GA results are fair enough.
There are five criteria presented by genetic algorithm toolbox for stopping the algorithm. In this study, the stopping criteria was selected as 1200 generations and the best results were obtained according to this choice.
Another important option in genetic algorithm toolbox is vectorization of fitness function. Vectorizing the fitness function increases the running speed of GA significantly. In this case to run the GA. it has been taken 1850 sec, while by vectorization, it was reduced to 44 sec.
RESULTS
After the fitness function was defined and the parameters were identified in
genetic algorithm toolbox, 24 variables were computed. The first 12 variables
included monthly release of water from reservoir. The rest of variable were
the storage volume of reservoir in different months (Fig. 5,
6).
Figure 5 shows that the high release of water is related to the hot season (through June until the middle of September) which is quite compatible with the high demands of water during this period. Figure 6 shows that the reservoir storage volumes are high enough to satisfy release of water during the above mentioned period. Also, the reservoir storage volumes are low enough during the months October through February with high probability of flood flow.
The monthly downstream demands for water are computed based on the downstream
requirements. Figure 7 shows monthly release of water from
reservoir computed by GA, the monthly downstream demands and the monthly allowed
release of water from reservoir which is computed based on 15% deficiency of
downstream demands. The Fig. 7 shows that the monthly release
of water computed by GA is more than the allowed values.

Fig. 5: 
Monthly release of water from reservoir 

Fig. 6: 
Reservoir storage volume of water at the beginning of each
month 

Fig. 7: 
The monthly demand, computed release and allowed deficiency
of water 
Also, the curve of computed monthly release of water from reservoir quite matches
to the curve of downstream demands for water. It is concluded that by a good
management, it is possible to satisfy downstream demands for water even during
drought periods.
Earlier, the optimization processes are considered for inflows with 90% probability.

Fig. 8: 
Monthly reservoir storage volume for different probability
of inflow 
Based on the high capability of GA toolbox, it is possible to consider different
probability of inflows to the reservoir in optimization processes. As shown
on Fig. 8, changes of inflows affect the storage volume of
water at the beginning of each month, while it doesn’t affect downstream
releases of water. Also, storage volume of water during the drought period of
year is high while it is low during the flooding period.
So, by genetic algorithm toolbox it would be possible to change different options and obtain the results in few seconds, (in this study the results obtained in 44 sec).
CONCLUSION
Optimization of reservoir system operation was carried out using genetic algorithm. Genetic algorithm toolbox in Matlab7 software has been used to optimize operation of the Jiroft dam reservoir. It is concluded that a realvalue representation, population size of 300, stochastic uniform selection, scattered crossover and 0.95 for crossover fraction operate most effectively and produce the best results. Ranking for fitness scaling, 2 elite count, 1200 generation and forward migration are appropriate for this case. The inflow to dam reservoir has been considered uncertain. Applying inflows with different probabilities to the optimization model, the release of water from reservoir are not changed significantly, but the reservoir volumes are changed for different probabilities of inflows. The computed monthly release of water from reservoir is in a good consistency with monthly downstream demands. Also, storage volume of reservoir is low during the flood period of year and it becomes high enough during the drought period with high demands for water.