An inverse design method for determining the optimal tributary ﬂ ow into a main stream in a rainstorm period

To ensure water quality at the control cross-section of main streams (CCMS) in a rainstorm period, an inverse design method was proposed to determine the optimal discharge ﬂ ow of tributary rivers. The design variables are tributary discharges and the target variables are the required concentrations of chemical oxygen demand (COD), dissolved oxygen (DO) and ammonia nitrogen (NH 3 -N) at CCMS. The relationship between target variables and design variables was identi ﬁ ed using an arti ﬁ cial neural network (ANN). The database was obtained by Environmental Fluid Dynamics Code (EFDC) and the optimal tributary discharges were obtained by a genetic algorithm (GA) coupled with well trained ANN. The results showed the following results: (a) The relative prediction errors of ANN are mostly less than 5%. (b) When the inlet ﬂ ow rate is 0 m 3 /s, 30 m 3 /s, 50 m 3 /s, 100 m 3 /s and 200 m 3 /s, the optimization total discharges of tributaries are 5.7 m 3 /s, 12.5 m 3 /s, 18.6 m 3 /s, 33.4 m 3 /s and 61.8 m 3 /s, respectively. (c) Most of optimization plans entirely satisfy the water quality requirements at CCMS except a few plans, in which the relative errors between optimized results and required values of COD and DO are less than 0.4% and 0.1%, respectively. The study showed that the inverse design method is ef ﬁ cient for determining the optimal discharges of multiple tributaries.


GRAPHICAL ABSTRACT INTRODUCTION
Rivers are major inland water resources for municipal, industrial and irrigational purposes. However, the water quality of rivers in many regions has deteriorated because of artificial pollution such as industrial wastewater, domestic sewage and urban and agricultural runoff.
Simultaneously, rainfall runoff including numerous pollutants has become an important pollution source (Wijesiri et al. ). Particularly, these pollutants are transported to main streams via tributaries in a rainstorm period and lead to the deterioration of water quality. To ensure the water quality requirements of main streams, the rainfall runoff pollution via tributaries needs to be controlled.
Some studies have shown that stormwater runoff contained large amounts of heavy metal, organic matter and suspended substance (Helmreich et al. ; Zhao et al. ). Meanwhile, stormwater was also found to be a significant source of labile organic matter to receiving waters, especially during the first flush of runoff (McCabe et al. ). Furthermore, it was reported that suspended substances were an important carrier of chemical oxygen demand and total phosphorus. In stormwater runoff, the average particulate phosphorus concentration was high and organic phosphorus was in the majority (Zhang et al. b; Hu et al. ). These pollutants lead to the eutrophication of receiving waters. It is very important to control the discharge of stormwater runoff into receiving waters.
Artificial intelligence algorithm has been successfully applied in many fields including water engineering, ecological and environmental sciences. ANN is successfully used for predicting water quality because it is characterized to model the complex pattern and nonlinear processes without any advance knowledge of the relationship between the input and output data (Salari et al. ; Jahan & Pradhanang ).
The parameters of transient storage model were well predicted by using the symbiotic organism search algorithm and improved moth-swarm algorithm, respectively (Madadi et al. a, b). To solve optimization problems, the GA is usually used. For instance, it is used for optimizing the structural best management practices to improve water quality goals and assess water quality in parameter optimization (Kaini et al. ; Sotomayor et al. ). Recently, the inverse design method has gained much attention due to its high efficiency and wide applications. Zhai et al. () proposed an inverse design method to research the air flow of a threedimensional aircraft cabin. This was based on multi-objective GA and computational fluid dynamics was used. Xu et al.
() used the GA to propose a new optimization approach for reservoir operation to balance hydropower generation and plant diversity conservation in downstream wetlands.
However, to our best knowledge, the discharge rate of all tributary rivers into main streams to ensure the water quality at CCMS has rarely been optimized in a rainstorm period based on the reverse design principle.
The aim of this study was to determine the optimal tributary discharge to meet the water quality requirements at CCMS in a rainstorm period. To realize this purpose, an inverse design method was proposed based on the combination of EFDC, ANN and GA. Tributary discharges are design variables and the required concentrations of COD, DO and NH 3 -N at CCMS are target variables. The database of 25 samples was obtained by EFDC for training the ANN in order to establish the relationship between the variables of design and target. Subsequently, the GA was applied to find optimization plans. Finally, the obtained optimization plans were verified by EFDC. With the optimization plans, control strategies were carried out to prevent the water quality deterioration in the main stream in a rainstorm period.

Inverse design method
The inverse design method was used to find the optimal conditions to satisfy the required objectives. This operates in an inverse adaptation of the forward method used commonly.
In this method, the discharges of multiple tributaries were put as design variables, and the concentrations of COD, DO and NH 3 -N at the CCMS were set as target variables.
The target variables were obtained through EFDC simulation under different typical cases. Based on results of EFDC simulation, the BPNN (Back Propagation Neural Network) learned the relationship between the variables of design and target. With the requirement of water quality for the main stream at CCMS, the GA and well trained BPNN were combined to obtain the optimal discharges of tributaries.
Establishing the EFDC database is the primary step. Different cases were generated using the orthogonal design method. In an inverse design step, the GA and the well trained BPNN were combined to obtain the optimal discharge of each tributary by satisfying the requirements of water quality of the main stream at CCMS. In this method, the well trained BPNN was used to predict target variables of new individuals. The GA was to find the optimal solutions. The individuals with high fitness were selected and the selected  individuals were then used in the next iteration of the algorithm (Ayvaz & Elci ). When the maximum generation size was reached, the iteration stops and the optimal discharges of tributaries were obtained. Finally, the optimal discharges of tributaries were verified by EFDC to ensure that the optimal discharges satisfied the requirement of the water quality of main stream at CCMS. The flow chart of the calculation is explained in Figure 1.

Artificial neural network
The BPNN was used to realize the mapping relationship of input data and output ones. The discharges of five tributary rivers are input variables and the concentrations of COD, DO or NH 3 -N at CCMS are output ones. Therefore, the input layer and output layer have five nodes and one node, respectively. As for the hidden layer, the number range of nodes was firstly determined as: where, l, m and n are the number of nodes of hidden, input and output layers, respectively. a is a constant between 0 and 10. The optimal number of hidden nodes was determined by trial and error method and was 6 initially.
Finally, three single-output BPNNs for COD, DO or  In order to evaluate the prediction performance of the trained BPNN, root mean square error (RMSE) was used.
The RMSE between predicted results of BPNN and target output was expressed as: where, C P is the predicted concentration of COD, DO or NH 3 -N; C T is target concentration of COD, DO or NH 3 -N; n is number of samples. The case in which the inlet flow rate of the main stream was 50 m 3 /s was taken as an example. Table 3 shows the values of RMSE varying with the learning rate, number of hidden nodes and number of training samples. A small learning rate ensures the stability of training, but a too small learning rate reduces the speed of training. Therefore, the learning rate was chosen as 0.02.

Genetic algorithm
Coupled with the BPNN, the GA was used to find the opti- Hydrodynamic and water quality model  In a water quality model, the governing mass-balance equation for each state variable is expressed as: where, C is the concentration of state variable; u and v are velocity components in the x and y directions, respectively; K x and K y are turbulent diffusivity coefficients in the x and y directions, respectively; S c is internal and external sources and sinks per unit volume.

CASE STUDIES
The upstream segment of the Haihe River located in the downtown of Tianjin city was chosen to investigate the    (4) where, i is the rainstorm intensity (mm/min); P is the rainfall recurrence period (a); t is the duration time (min).
Here, the runoff coefficient was chosen to be 0.5 (Zhang  Table 5 were adopted to establish the database of the inverse design method. Twenty-five simulation cases were set up for each inlet flow rate of the main stream. In addition, two more cases were added to ensure the completeness of the database. One case was zero discharge of each

Optimized design
After the database was obtained, the BPNN was trained and tested. When the inlet flow rate of the main stream was   In order to verify the reliability of the prediction, the predicted results of BPNN and simulated ones of EFDC were compared in detail and the relative errors between the above results were calculated using the following equation: where, RE is the relative error; B and S are predicted results of BPNN and simulated results of EFDC, respectively.
The results in Table 6 show that the relative errors between above two methods are small. Therefore, the water quality of the main stream at CCMS can be predicted by well trained BPNN.
The discharges of tributary rivers were optimized by GA coupled with well trained BPNN. When the inlet flow rate of the main stream was 0 m 3 /s, four optimization plans were obtained. They are shown in Figure 5 Verification of water quality at the control cross-section In order to check the performance of the proposed inverse design method, the optimized plans were validated by comparing with the water quality requirements at CCMS. The comparison is shown in Table 7. For the index of COD, DO and NH 3 -N, the negative difference indicates that it not only meets the water quality requirement, but also has  were better than those of water quality requirements. For Plan-1, the concentration of DO exceeded the water quality requirement. For Plan-2 to Plan-4, the concentrations of DO were less than the water quality requirement. However, the relative error between the optimized result and the required DO value at CCMS was very small and it was only 0.2%, 0.4% and 0.01%, respectively. This means that this method can reliably obtain the optimal flow rate of tributary discharged into the main stream. It also showed that DO is the limiting factor for this discharge case.
When the inlet flow rate of the main stream was 30 m 3 /s, 50 m 3 /s, 100 m 3 /s or 200 m 3 /s, the optimized concentration of DO at CCMS was more than that of water quality requirement. The concentration of NH 3 -N was less than the required value for the water quality requirement.
When the inlet flow rate of the main stream was 30 m 3 /s, the concentration of COD of Plan-2 slightly exceeded that of the required value for the water quality requirement. Furthermore, when the inlet flow rate of the main stream was 200 m 3 /s, the optimized concentrations of COD of Plan-1 and Plan-2 were more than those of the required value of water quality requirement. However, the relative errors between the result of the inverse design method and the required COD value at CCMS was very small and it was only 0.03%, 0.008% and 0.1%, respectively. This means the inverse design method can give a reliable optimal flow rate for tributary rivers discharged into the main stream.
From the above optimized results, the absolute difference of NH 3 -N was the largest and was more than 0.3 mg/ L in all plans. This means that NH 3 -N was not the limiting factor for all plans in this approach.
The optimized concentration of DO was more than that   showed that the present inverse design method has important application value for main stream water quality control and management.