Reducing impacts of rice fields nitrate contamination on the river ecosystem by a coupled SWAT reservoir operation optimization model

The present study proposes a multipurpose reservoir operation optimization for mitigating impact of rice fields’ contamination on the downstream river ecosystem. The developed model was applied in the Tajan River basin in Mazandaran Province, Iran, in which the rice is the main crop. We used soil and water assessment tool (SWAT) to simulate inflow of the reservoir and nitrate load at downstream river reach. Nash–Sutcliffe model efficiency coefficient was used to measure the robustness of SWAT. NSE indicated that SWAT is acceptable to simulate nitrate load of the rice fields. The results of SWAT was applied in the structure of a multipurpose reservoir operation optimization in which three metaheuristic algorithms including differential evolution algorithm, particle swarm optimization and biogeography-based algorithm were utilized in the optimization process. Reliability index, mean absolute error and failure index were used to measure the robustness of the optimization algorithms. Fuzzy Technique for Order of Preference by Similarity to Ideal Solution was utilized to select the best algorithm. Based on results, particle swarm optimization is the best method to optimize reservoir operation in the case study. The reliability index and mean absolute error for water supply are 0.6 and 5 million cubic meters, respectively. Furthermore, the failure index of contamination is 0.027. Hence, it could be concluded that the proposed optimization system is reliable and robust to mitigate losses and nitrate contamination simultaneously. However, its performance is not perfect for minimizing impact of contamination in all the simulated months.


Introduction
Nitrogen is found in several different forms in terrestrial and aquatic ecosystems. Different forms of nitrogen include ammonia (NH3), nitrates (NO3) and nitrites (NO2). Nitrates in excess amount are considerably detrimental for aquatic ecosystems. High amount of nitrates and phosphorous would accelerate eutrophication. Moreover, excess nitrates can reduce level of dissolved oxygen (Burt et al. 2011). Hence, high level of nitrates could be detrimental for aquatics such as fish and macroinvertebrates. Source of nitrates contain wastewater treatment plants, runoff from croplands or animal storage areas and industrial discharges (Xue et al. 2016). Excessive use of chemical fertilizers might be one of the sources of nitrate contamination in the basins (Ostad- Ali-Askari et al., 2017a). Rice field is one of the main source of nitrates in areas where are appropriate to cultivate this crop (Ehteshami et al. 2016). It should be noted that due to remarkable economic benefits of rice, it is an important crop in many countries. Hence, reducing impact of nitrate contamination to protect aquatic habitats is one of the important purposes in an integrated river basin management especially in areas in which nitrate contamination is the main source of water quality crisis. Thus, modelling of nitrate in the catchment scale is a key tool to simulate and manage contamination. Soil and water assessment tool (SWAT) is a continuous hydrologic simulator that is able to simulate outflow of catchment. Furthermore, it is able to simulate water quality parameters at the outflow of the catchment. This model has been used to simulate outflow of the catchment and water quality parameters (Arnold et al., 2012). Many previous studies corroborate its abilities to simulate Responsible Editor: Broder J. Merkel flow and water quality (e.g., Cambien et al. 2020;Wang et al. 2019). The most important advantages of this model are continuous simulation. Using continuous simulation has been recommended by Australian Rainfall andRunoff 2016 (ARR 2016) to improve results of hydrological simulations (Ball et al. 2016). Moreover, importance of water quality modelling in the surface and groundwater in the structure of hydrological modelling has been highlighted in the previous studies (e.g. Ostad-Ali-Askari and Shayannejad (2021).
Large dams are the most important hydraulic structures in the river basins. They have significant role for economic development of urban and rural areas (Altinbilek 2002). Management of reservoir operation may be a complex task for engineers. In other words, maximum benefits must be achieved due to high expenses of dam construction. Hence, optimizing reservoir operation is a highlighted topic in water resource management (Ahmad et al. 2014). Moreover, climate change might make the management of water resource more complex (Ostad-Ali-Askar et al. 2018). Hashimoto et al. (1982) developed an applicable form of the loss function that has been utilized as the objective function in many recent studies (e.g., Ehteram et al. 2018b). Moreover, Datta and Burges (1984) underlined that not only loss of release could be important but also storage loss must be taken into account in a reservoir optimization model. In other words, deviation from optimal storage might reduce the reservoir benefits. Furthermore, Hashimoto et al. (1982) proposed three system performance indices including reliability, vulnerability and resiliency to measure performance of the optimization model. In fact, these indices assess the robustness of reservoir operation model. Most of the reservoirs are multipurpose which means other purposes such as flood control and hydropower electricity supply might be considered in the optimization of reservoir operation as addressed in the literature (e.g., Jahandideh-Tehrani et al. 2015). Furthermore, water quality control using optimal operation might be defined as the purpose of reservoir. However, it is not a primitive purpose for many constructed dams. Dhar and Datta (2008) used elitist genetic algorithm based in the structure of a simulation-optimization model to optimize reservoir operation for controlling downstream water quality unsuitability. More studies have been addressed in the literature regarding optimal reservoir operation considering water quality purposes (e.g., Kerachian and Karamouz 2006;Shirangi et al. 2008;Amirkhani et al. 2016;Castelletti et al. 2014;Azadi et al. 2019).
Two challenges should be noted in the reservoir operation optimization including forecasting inflow and defining optimization model. In fact, reservoir operation needs a robust forecasting inflow model. Two main types of models have been utilized to forecast inflow including runoff routing models and data-driven models. Using a robust continuous runoff routing that might cover a long-term period of reservoir operation is a requirement for optimal reservoir management. If water quality modelling is necessary as a purpose of the reservoir optimization, it should be incorporated with hydrologic inflow model in an integrated model to make the highest efficiency. Moreover, optimization method is another important issue to optimize operation. Linear programming was the simplest solution to optimize reservoir operation (Reis et al. 2006). Due to nonlinearity nature of the reservoir operation, non-linear programming and dynamic programming were other mathematical models that have been addressed in the literature (Ahmad et al. 2014). Novel computational solutions such as evolutionary or metaheuristic algorithms have broadly been used as the optimization methods for the reservoir operation (e.g., Afshar et al. 2007;Afshar et al. 2011;Yaseen et al. 2019). It should be noted that different types of optimization models have extensively been used in the water engineering problems such as environmental issues or irrigation management in the droughts (e.g. Javadinejad et al. 2019, Ostad-Ali-Askari et al. 2017b.
The present study proposes a robust simulation-optimization method to reduce impact of nitrate contamination of rice fields at downstream river ecosystem. The main novelty of this study is to link the continuous hydrological model for simulating flow and water quality to the reservoir operation optimization. In fact, continuous hydrological modelling is coupled with artificial intelligence method to manage water quality in the river ecosystem. Another novelty is to integrate purposes of the conventional reservoir operation model and environmental impacts of rice field runoff. Moreover, an applicable hierarchical system is proposed to finalize the optimal release from the reservoir. Simulated river basin contains rice fields at downstream areas of reservoir. Due to high irrigation demand by vast agricultural lands, supply of water demand increases challenges. Hence, a complex simulation-optimization method was designed to minimize water demand loss, storage loss and impact of nitrate contamination at downstream river reach. We used different metaheuristic algorithm to solve defined objective function. Furthermore, different system performance indices were utilized to measure the robustness of reservoir operation optimization. Finally, a decision-making system was applied to select the best algorithm. Results and analysis of present study are helpful for designing an integrated system that might be aimed to maximize benefits of reservoir beyond initial defined purposes of reservoir.

Overview on the methodology
The proposed method is a combined approach. Hence, an overview on the methodology might be helpful for the readers. Figure 1 displays the workflow of the proposed method.
More details regarding each part will be presented in the next sections.

Study area
The Tajan River basin at northern region of Iran was selected for implementing the proposed framework. This river is one of the largest rivers in southern Caspian Sea basin that is located in the Mazandaran Province. Major economic activity of the residents in this river basin is agriculture. Due to the suitable climatic condition at downstream region of the Tajan River basin, rice is the major crop for many farms. Cultivation of rice is very important in Mazandaran Province based on to two reasons. First, it increases the farmers' income remarkably. Thus, they try to maximize area of rice fields in this area as much as possible. Secondly, rice production in Mazandaran Province is strategic for the country. According to regional studies, the limited areas are appropriate for cultivating rice in Iran that means maximizing rice production in suitable regions is important for intensifying food security. Conversely, two major problems have been observed due to rice fields. First is the high irrigation demand of the rice that makes it necessary to construct reservoir and water diversion structures. Available water at downstream river reach has been significantly decreased due to high water demand. Moreover, excess amount of nitrates would be drained into river due to runoff from rice fields. It should be noted that unsuitability of the aquatic river habitats might increase due to other source of water pollutant by urban source points and lack of sufficient instream flow. Hence, management of nitrate contamination as the main type of pollutant is necessary. Figure 2 displays river catchment location, land use and main structures. As a description on problem definition, Rajaei Dam has been constructed at upstream of catchment due to proper location to regulate water demand at downstream. Moreover, given the appropriate outflow of tributaries after reservoir and conveying release water from dam, a water diversion structure has been constructed between location of dam and Sari City. In fact, most of available water would be diverted into agricultural lands in this area. On the other hand, runoff from rice fields flows into river at downstream of water diversion project. Thus, excess amount of nitrate damages aquatic habitat suitability at downstream of Tajan River due to lack of enough environmental flow. Hence, its management to recover river ecosystem at downstream is essential. The present study proposes a solution for this major problem by defining a flow regime from reservoir to reduce impacts of nitrate. Maximum storage of the reservoir is 160 MCM, minimum operational storage is 70 MCM and optimal storage in the reservoir is 140 MCM.
It should be noted that the department of environment in the study area has carried out extensive ecological studies in the river habitats of the study area. Based on the results and expert opinions, main generated pollutant by the rice fields is nitrate that might have significant impact on the river habitats. In fact, nitrate is a serious threat for the native species that are inhabited at downstream river habitats. Hence, focus on nitrate concentration seems logical and justifiable in the present study. The safe nitrate concentration was defined in the study area that was applied in the structure of the optimization model. In the Tajan River basin, the safe nitrate concentration was defined 20 mg/L. Defining threshold should be based on the environmental considerations in each river basin. In fact, threshold of nitrate might not be the same for all the aquatics. Hence, field studies might be needed. Field observations including fish observations and nitrate concentration measurements were carried out in the study area in different points. Based on the results, the number of fish will be highly considerable, if the concentration is less than 20 mg/L. Hence, considering SCF = 20 mg/L as the threshold in the optimization model is logical and defensible. We did not claim that this threshold is utilizable for all the river basins that means independent field studies might be needed in each river basins for determining SCF based on fish population in the habitats.
To sum up the problem in the study area, nitrate contamination from the rice fields needs to be managed robustly to mitigate the impacts on the aquatic habitats at downstream river. No regulated environmental flow is available in the current condition for minimizing the environmental impacts. Release from the reservoir should be able to mitigate the environmental impacts of the nitrate contamination. Hence, the reservoir operation of the Rajaei reservoir at upstream of Tajan River basin should be able to provide safe concentration of nitrate (i.e. 20 mg/L) or less concentration in the simulated period. We selected 72 months as the simulation period in the basin in which nitrate concentration could be critical.

Integrated hydrological modelling
We applied soil and water assessment tool (SWAT) as a robust river catchment model to simulate runoff and nitrate load. Figure 3 displays flowchart of SWAT methodology to simulate runoff and nitrate load. As can be seen, calibration and validation of SWAT results could be carried out by standalone program that has been named SWAT-CUP. Different inputs are needed to run SWAT in our case study. Land use map was displayed in Fig. 1 which reveals some points regarding Tajan River basin. Upstream lands where has been located at upstream of reservoir are mainly natural areas. In other words, there is a least concern regarding nitrate due to croplands at upstream catchment. Furthermore, main cropland areas including rice fields have been located at downstream area of basin close to sea. In other words, downstream river ecosystem is seriously threatened by considerable load of nitrate. Hence, we assumed that total of nitrate load owing to crop would be occurred at downstream areas. Thus, main objective of optimization model is to mitigate impacts at downstream river ecosystem. Figure 4 displays digital elevation model (DEM) and slope map of Tajan River basin as other requirements for modelling by SWAT.
Due to complex processes in the SWAT to simulate flow and water quality, it is needed to present more details regarding the process. In the first step, watershed delineation is carried out in the GIS software environment by SWAT extension automatically. Next, surveyed land use map in the study area should be inserted to the model. It should be noted that only raster files are useable as the land use map in the modelling by SWAT. Soil map should be inserted to the model as well as land use map. It should be noted that it is required to insert the weather data before commencing simulation process. SWAT works based on the daily scale. However, outputs could be in the monthly scale. Thus, it is necessary to insert the weather data including daily air temperature and rainfall to the model. In the next step, SWAT is defined hydrological units, which would be utilized to compute flow and constituents concentration. Finally, user can commence simulation process by clicking on the simulation button. The outputs could be observed in the text file. However, the generated model is not useable before calibration and validation process.
It is necessary to review how the calibration by SWAT-CUP could be carried out. This standalone program is a tool for SWAT Calibration and Uncertainty analysis. One of the very applicable algorithms for calibrating results of SWAT in this program is sequential uncertainty fitting (SUFI-2) algorithm. SUFI-2 carries out a combined optimization and uncertainty analysis using a global search procedure. Many parameters could be considered in the runoff modelling. However, SWAT-CUP generally utilizes four calibration parameters including CN2.mgt (initial SCS runoff curve number for moisture condition II), ALPHA_BF.gw (alpha factor for groundwater recession curve of the deep aquifer (1/days)), GW_DELAY.gw (ground water delay time) and GWQMN.gw (threshold depth of water in the shallow aquifer required for return flow to occur (mm H2O)). In fact, SWAT-CUP is able to find the best values for the calibration parameters as mentioned to minimize difference between observed stream flow and simulated stream flow.

Reservoir operation optimization
Defining objective function is the first step to develop reservoir operation model. Equation 1 displays defined objective function. This function contains two terms including water demand and nitrate concentration. Water demand term has been developed in the previous studies (Ehteram et al. 2018a). However, second term is added in the present study.
where D t is demand, R t is release and NC t is nitrate concentration. SFC is safe nitrate concentration which does not make river habitats unsuitable. We considered SFC = 20 mg/L in the present study. It should be noted that all of the consideration such as other pollutant sources were taken into account to define this value. Based on our investigation, this maximum concentration in the optimization model would protect habitats in terms of nitrate contamination. In other words, this assumption assures us that released flow regime is highly reliable to protect downstream river habitats from possible damages to river ecosystem. Some constraints should be added based on considerations in reservoir management as follows.
Storage constraints Owing to importance of storage in the reservoir, we considered constraints regarding storage. In other words, storage benefits are depended on storage level in the reservoir. Hence, minimum storage in the reservoir must be more than minimum operational storage. Moreover, storage must not be more than maximum possible storage in the reservoir. Thus, these two constraints were considered in optimization model.
Water demand constraint Release for water demand must not be more than requested water demand in each time step. Hence, it should be considered as another constraint in optimization model.
Nitrate concentration constraint It should be noted that objective function tries to minimize difference between actual nitrate concentration and safe nitrate concentration. Obviously, nitrate concentration must not be more than safe nitrate concentration in the optimization model. Hence, a constraint is required in this regard.
Metaheuristic algorithms were utilized to optimize reservoir operation. It should be noted that implementing the constraints in coded metaheuristic algorithms might not be possible easily. Hence, using tricky solutions would be helpful in this regard. According to the literature, using penalty function method is a common procedure for reservoir operation optimization. In other words, this method is a known and popular method that has been used in many optimization cases such as reservoir optimization. Thus, we utilized penalty function method to convert a constrained optimization problem to unconstrained problem. Two penalty functions were added for storage as displayed in Eq. 2. In fact, these penalty functions would increase penalty when storage is more than maximum storage or less than minimum operational storage. More details regarding the penalty function is available in the literature (Yeniay 2005). Storage penalty function (Eq. 2) and water supply penalty function (Eq. 3) are originally proposed in the previous studies (e.g. Ehteram et al. 2018a).
Moreover, a penalty function is required for water demand as displayed in Eq. 3. This penalty function would increase penalty when release for water demand is more than target demand.
Final penalty function is related to nitrate concentration at downstream river reach. If nitrate concentration is more than safe concentration, penalty function will increase penalty for objective function as displayed in Eq. 4.
Available water at downstream river reach (downstream of Sari diversion project) is very low. Hence, we considered it as zero in optimization model. In other words, we assumed no flow at downstream reach. Thus, new water allocation is required to mitigate impact of nitrate load from rice fields based on safe concentration at 20 mg/L.
Furthermore, it is required to update storage in each time step by Eq. 5 where S t is storage at time period t, I t is inflow to reservoir at time t, E t is evaporation from reservoir surface at time t, A is area of reservoir surface, R t is release for demand in time period t, EN t is release for mitigating nitrate concentration and F t is overflow. T is the time horizon. Overflow would be computed by Eq. 6 (5)

Metaheuristic algorithms
Three metaheuristic algorithms were used in the optimization process including differential evolution (DE), biogeography-based optimization (BBO) and particle swarm optimization (PSO). Figures 5, 6 to 7 display the flowchart of these algorithms. It is to have an overview on the methodology by each algorithm. PSO can solve the optimization problem by allocating an initial population of candidates or solutions. Then, it moves particles or solutions in the search space by a simple mathematical formula in which particle's position and velocity would be changed. This powerful algorithm is inspired by social behaviour of animals such as movement of organisms in a bird flock or fish school. BBO was developed based on mathematical models of biogeography in which speciation (the evolution of new species), the migration of species (animals, fish, birds or insects) between islands and the extinction of species could be imitated. Islands where are appropriate for life should have a high habitat suitability index. HSI is utilized as a criterion to select the best solution by this algorithm. DE could be applied for multidimensional real-valued functions. It does not utilize the gradient of the problem being optimized. The optimization problem is like a black box that provides a measure of quality for selected solutions that means gradient is not required. Using three algorithms is helpful

System performance measurement
Each optimization model might need some indices to measure the performance of the model. In fact, these indices would measure how the model is able to cover the defined purposes for the optimization model. Some indices are known regarding the system performance analysis of the reservoir. For example, the reliability index is able to measure how the reservoir would supply water demand in the study area. Hashimoto et al. (1982) suggested reliability index to measure reliability of water supply in a reservoir operation optimization. We used this index as displayed in Eq. 7. More details regarding the applicability of reliability index has been addressed in the literature (Yaseen et al. 2019) Moreover, we applied mean absolute error (MAE) to measure robustness of optimization model in terms of supply of water demand and storage level as displayed in Eqs. 8 and 9 Moreover, it was essential to measure system performance in terms of nitrate concentration mitigation. In other words, we should measure how impact of nitrate would be mitigated at downstream river ecosystem. Hence, failure index was defined in this regard as displayed in Eq. 10. This index indicates that in how many months, nitrate concentration is more than safe concentration. FI is an improved form of resiliency index developed by Hashimoto et al. (1982): where T f is the number of months in which nitrate concentration is more than safe concentration and T S is total number of simulated months. Furthermore, we simulated outflow of catchment and nitrate concentration by SWAT. Hence, it is required to measure robustness of inflow model. The Nash-Sutcliffe model efficiency Fig. 7 Particle swarm optimization (PSO) flowchart (Eberhart and Kennedy 1995) coefficient (NSE) could be utilized to assess the predictive skill of SWAT as displayed in Eq. 1. More details regarding the NSE has been addressed in the literature (McCuen et al. 2006) Qm t is simulated outflow in time step t, Qo t is observed outflow in time step t and MQo is mean observed outflow. Similarly, this index would be used to measure robustness of model in terms of nitrate concentration.

Decision-making system
We applied fuzzy Technique for Order of Preference by Similarity to Ideal Solution (FTOPSIS) as decision-making system in the present study. It should be noted that using decision-making system would be essential when using different optimization algorithms is targeted. Figure 8 displays flowchart of FTOPSIS method to make a decision.

Results and discussion
Figure 9 displays calibration and validation result of forecasting reservoir inflow that shows simulated monthly flow and recorded monthly flow. The most accurate model may have uncertainties that means differences between model and observation would be expected in each modelling process. As discussed, we utilized NSE to measure robustness of forecasting flow model. Computed index is displayed on the figures. Previous studies on application of NSE to evaluate hydrologic models demonstrated that NSE = 0 means that the model has the same predictive skill as the mean of the time-series in terms of the sum of the squared error. Previous studies by SWAT-CUP program to calibrate and validate outputs of SWAT indicate that NSE more than zero may be adopted as robust predictive skill for the model (Abbaspour et al. 2015). Maximum NSE could be 1 that means complete match between model and observations. NSE for calibration and validation period is 0.19 that demonstrates Ranking alternatives according to CC acceptable predictive skill for developed model. According to the literature, if the NSE is more than 0.5, the model is robust, and predictive skills are highly reliable. However, if the NSE is more than zero, the model might be averagely acceptable in terms of predictive skills. Hence, we could not claim that the model is highly robust to simulate flow. However, it is averagely acceptable. The previous studies corroborated that continuous hydrological simulation might be very complex and uncertainties might be considerable that is one of the limitations for continuous hydrological models. Previous studies corroborate the results of the present study and uncertainties in the continuous hydrological simulation.
The calibration results demonstrated that the model is able to simulate peak points properly. Hence, final outputs of the model (optimization results) as the main finding of the study are almost reliable. In other words, model is acceptably able to predict inflow of reservoir. Figure 10 displays calibration and validation results of nitrate concentration modelled by SWAT. It seems that model is robust in terms of prediction of nitrate concentration in simulated period. NSE is 0.74 that indicates model has strong predictive skills. It should be noted that calibration and validation of nitrate concentration was based on recorded water quality parameters in the past years when no dam or diversion project were constructed. In other words, they are nitrate load by cropland in recorded months.
Next step is computation of reservoir inflow in simulated period of reservoir operation. In other words, we considered 72 months as simulated period of reservoir operation to mitigate the impact of nitrate concentration at downstream river reach. Due to approved abilities of forecasting model, it is reliable to forecast inflow in an unrecorded period (Fig. 11).
Minimum reservoir inflow is less than 10 MCM. On the other hand, maximum reservoir inflow is more than 80 MCM. Moreover, Fig. 12 displays nitrate load by cropland during simulated period of reservoir operation. Nitrate load is remarkable in some months due to rice cultivation. Nitrate load damages river habitats considerably owing to very low flow after Sari diversion project. Fig. 13 displays maximum requested water demand from reservoir. Comparing reservoir inflow and water demand indicates that reservoir has remarkable role to supply water demand. Figure 14 displays results by differential evolution (DE) algorithm to optimize reservoir operation in terms of maximizing water supply, storage benefits and mitigation of nitrate concentration at downstream river ecosystem. Moreover, Figs. 15 and 16 display results of BBO and PSO, respectively. Nitrate concentration is displayed based on nitrate load in total released flow at downstream. It should be noted that it is not included release for water demand. Water demand is diverted before simulated segment. However, it includes release for environment and overflow. Release and storage time series indicate that performance of algorithms are different in terms of benefits. One of the aims in the optimization framework of present study was to reduce nitrate concentration equal or less than 20 mg/L. It seems that the performance of algorithms is not similar in this regard. Maximum nitrate concentration by DE algorithm is 20 mg/L approximately. In contrast, maximum nitrate concentration by PSO and BBO is higher than 20 mg/L. Maximum concentrations by BBO and PSO are 35 and 40 mg/L approximately. However, considering maximum nitrate concentration is not enough to evaluate optimization method. In fact, reducing environmental impacts of nitrate is not the only purpose for the reservoir. In other words, an optimization method must be able to maximize all of the benefits of the reservoir simultaneously. For example, results by different algorithms demonstrate that their performance is different in terms of storage in the reservoir. Hence, using time series of storage, water demand and nitrate concentration to compare and select the best algorithm is not possible directly. In other words, discussion on results need applying measurement indices as discussed in the previous section of the paper. We utilized reliability index and mean absolute error for water demand, mean absolute error for storage and failure index for nitrate concentration. All of these criteria might be important to evaluate performance of optimization framework. We used two indices to evaluate performance of reservoir operation in terms of supply of water demand. The main purpose of construction of dam is supply of water demand. Hence, if it cannot have acceptable performance in terms of water supply, it might not be assessed as suitable optimization model. However, other criteria including storage measurement index and failure index of nitrate are important as well. Reliability index of water supply indicates that PSO is the best algorithm. This algorithm is able to supply more than 60% of maximum water demand. However, DE as the weakest method is not able to supply more than 45% of maximum demand. It should be noted that 15% difference between the weakest and the best algorithm could be considerable in practical reservoir operation. MAE for demand is a good criterion to evaluate performance of algorithms in terms of errors to supply water demand in simulating period. It should be noted that this index is the cost for the optimization system unlike reliability index that is a benefit. In other words, optimization system should minimize MAE for demand. Based on Fig. 17, PSO is the best method in terms of MAE. Hence, it could be concluded that PSO is the best algorithm to supply water demand at downstream of reservoir. However, it is required to measure performance of algorithms in terms of storage and nitrate concentration.
It should be noted that reliability index is not an appropriate index to measure performance of model in terms of storage. In fact, summation of storage benefits is meaningless. Hence, using MAE for storage could demonstrate performance of model regarding storage by displaying mean error compared with optimal storage. MAE for storage is also the cost index for the system. Thus, its minimization is the favourite. DE is the best method to minimize storage loss in the reservoir. Performance of either BBO or PSO is not as robust as DE. However, BBO is more robust compared with PSO. It seems that results by different algorithms are contradictory. PSO is the best method to supply water demand though it is not robust method to maximize storage benefits.
FI is the last index to measure system performance in terms of nitrate concentration. This index is the cost for the system. If it increases, the performance of the system will be weakened. DE is the best method in this regard. In other words, this algorithm minimizes number of failures. Performance of PSO and BBO is the same regarding the number of failures. Performance of optimization model to maximize benefits of the reservoir is complex due to contradictory results. Hence, it is not possible to select the best algorithm easily. It sounds that it is necessary to use a robust decisionmaking system to select the best solution. As presented in the previous section, we used FTOPSIS method to make a decision regarding algorithms. Two main requirements for applying FTOPSIS method is estimation of weight of importance and rating of alternatives or candidates. Table 1 displays weight of importance. We considered H (high) for reliability index and MAE of water demand. Furthermore, weight of importance for error of storage and failure index was considered as very high (VH). In fact, we utilized two indices for water demand and one index for storage or nitrate concentration. Thus, considering high for water demand indices and very high for other two indices is seemingly logic.
Another requirement for using FTOPSIS method is rating of alternatives. Table 2 shows rating of alternatives in the present study. We discussed regarding performance of alternatives. Hence, rating process was carried out based on performance of algorithms. In Table 2, VG, G, F and RP mean very good, good, fair and relatively poor, respectively. It should be noted that the type of criteria has been considered in rating which means each criterion might be cost or benefit as discussed. Table 3 displays integrated matrix of FTOPSIS method as a result of computations. Table 4 shows result of computing D + and D − by FTOP-SIS method. These values were utilized to calculate closeness coefficient (CC) to prioritize methods. If CC is higher for a method, it will indicate that method is more suitable to optimize reservoir operation by proposed framework in the present study. Figure 18 displays final ranking by FTOPSIS method. Based on ranking, PSO is the best method to optimize reservoir operation. This output needs a discussion on outcome of present study and some points must be noted that for further application of proposed optimization framework. The initial purpose of proposed framework was defined based on mitigation of nitrate concentration at downstream of the reservoir. However, other benefits of the reservoir including storage benefit and supply of water demand were considered in the context of optimization. Results demonstrate that outcome of optimization model might be complex. In other words, not all of the expected achievement could be seen in outputs. DE is a good method in terms of reducing nitrate concentration. It is able to consider defined safe concentration. However, it is not able to maximize benefits of water supply at downstream. Conversely, PSO is a proper option to maximize water supply benefits. However, it is not very robust method to minimize nitrate concentration impacts based on defined safe concentration compared with DE algorithm. It seems that using reservoir to control water quality at downstream might not be useable easily which means it is essential to minimize all of the losses simultaneously. In other words, using decision-making system is necessary in reservoir operation optimization when complex impacts such as control of downstream water quality is came to picture. Using robust measurement indices is another recommendation by the present study. If we do not utilize measurement indices in all of the aspects of reservoir benefits, it will create misconception regarding reservoir operation. In other words, it is possible to select incorrect optimization solution for reservoir operation. A full discussion regarding different aspects of the proposed method is essential. First, it is essential to discuss on results in terms of environmental issues by highlighting causes and effects. Moreover, each optimization system might have some advantages and limitations that should be noticed in the applications. The results of the present study demonstrated that reservoir could be an environmental tool to mitigate impacts of human activities such as agriculture on the aquatic habitats while it would be able to carry out defined responsibilities such as water supply. The main effect of using reservoir for reducing the environmental impacts was to mitigate nitrate concentration in most of the time steps. However, its performance might not be perfect in all the time steps. The high nitrate concentration is considerably detrimental for the aquatic habitats in terms of all biological activities. In our field studies, we focused on the fish species in the Tajan River. The main environmental impact of high nitrate concentration is to decrease the population of fish in the river that might be highly deleterious for the river ecosystem. It is important to discuss how nitrate contamination could be effective on the population. In fact, high nitrate concentration reduces the reproduction by the adult fishes because suitable habitats are not available. Moreover, high nitrate concentration might perish the juvenile fish. It might be intensified when concentration in most of the time steps is higher than defined threshold as the safe level. Using the proposed optimization method diminishes the possibility of perishing juvenile fish in the Tajan River habitats. Another important point that should be discussed is weight of importance for different factors as displayed in the Table 1. Selecting the weight of importance should be based on the environmental considerations in the case study. In the present study, environmental impacts are highly important. Hence, failure index was taken into account as very high. However, other responsibilities of reservoir such as water supply have been considered as high. Hence, weight of importance might have considerable impact on selecting the best algorithms and related environmental impacts in the river. Some limitations should be noted regarding the proposed method. First, using SWAT needs adequate recorded flow and water quality data. Hence, if enough recorded data is not available, the proposed method might not be applicable that is the main limitation of the proposed method. Moreover, simulating a long-term period might increase the computational complexities. Thus, using the proposed method for very long-term period might need significant computational time. Furthermore, the propose method should be improved when point and non-point source of pollution are available in the study area simultaneously. To sum up, some points should be noted as outcome of the present study as follows: 1-Reservoir could be utilized as a reliable tool to reduce environmental impacts of nitrate load at downstream by application of an optimization framework. It should be noted that increasing population makes it essential to expand farms such as rice fields to supply food demand. Hence, using reservoirs as tool to reduce environmental impacts would be beneficial. These expensive structures have been constructed to supply water or electricity demand. Thus, using reservoirs for mitigation of environmental impacts is a benefit for these hydraulic structures. 2-The reservoirs are generally multipurpose. Hence, optimization framework must be defined to maximize all of the benefits of the reservoir. In the present study, three main purposes were considered including storage benefit, water supply benefit and mitigation of environmental impact of nitrate load. Using three optimization algorithms including DE, PSO and BBO demonstrated that using different algorithms is essential in practical projects. Outputs might be contradictory. In other words, an algorithm might have good results in terms of one of the benefits though other algorithms might have weak performance. It should be noted that we could not judge regarding performance of algorithm by the observation.   It is required to use a quantified system to make a decision 3-Using decision-making system needs two requirements.
First is applying robust measurement indices as criteria in the decision-making system. Second is considering all of the benefits in decision-making system. We considered three reservoir benefits including water supply, storage benefits and mitigation of nitrate impacts in our decision-making system. It seems that it is essential to consider these three main purposes in similar studies at least. 4-Outcome of decision-making system might not fully support initial objectives of optimization model. However, it is the best available output due to existent con-dition. In other words, it is able to minimize all of the losses for the reservoir operation optimization.

Conclusions
The present study developed a multipurpose reservoir operation optimization for using the reservoir as an appropriate method to mitigate impact of rice fields on the river aquatic habitats in terms of nitrate contamination impacts. Moreover, other reservoir losses such as water supply loss are minimized simultaneously. We used SWAT to simulate inf low and nitrate load in our framework. Based on ranking by the FTOPSIS as one of the robust decisionmaking system, PSO is the best method to optimize reservoir operation in proposed optimization framework. BBO is the second appropriate option to optimize reservoir operation. DE is the weakest option to optimize reservoir operation in the present study. Generally, the optimization framework is able to  X2  X3  X4  PSO  9  10  10  3  5  7  9  10  10  7  9  10  BBO  7  9  10  7  9  10  7  9  10  7  9  10  DE  3  5  7  9 10 10 3 5 7 1 3 5 mitigate environmental impacts of nitrate contamination remarkably. Moreover, the proposed framework is highly efficient for maximizing the benefits from the reservoir such as water supply.
Funding Open Access funding enabled and organized by CAUL and its Member Institutions.

Conflict of interest
The authors declare no competing interests.
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http:// creat iveco mmons. org/ licen ses/ by/4. 0/.