Research and Application of Reservoir Flood Control Optimal Operation Based on Improved Genetic Algorithm

: This paper took the Foziling Reservoir in the Pi River Basin as an example, used an improved genetic algorithm to optimize the ﬂood control dispatching during the ﬂood process, and compared the results with the traditional genetic algorithm and the dispatching plan in the 2020 large-scale reservoir ﬂood control operation plan. The results showed that, compared with the traditional genetic algorithm, the improved genetic algorithm saved the time for the model to determine the penalty coefﬁcients and made the model application more convenient. At the same time, the design of the original scheduling scheme also has certain limitations. The scheduling results obtained by improving the genetic algorithm could occupy a small ﬂood control capacity as much as possible under the premise of ensuring the safety of the reservoir itself and the downstream area.


Introduction
Reservoir flood control optimization dispatch is an important non-engineering flood control measure that can improve the flood control capacity of the reservoir, which plays a role in regulating flood peaks, storing floodwaters, reducing or even avoiding flood disasters [1]. In practice, the optimal operation model is generally constructed and solved based on certain optimization algorithms such as linear programming, nonlinear programming and dynamic programming [2][3][4] to realize the optimal operation of reservoir flood control.
With the progress of modern computer technology, a class of modern heuristic algorithms based on biology, physics and artificial intelligence [5][6][7][8] has been developed. The genetic algorithm (GA) is an important optimization algorithm in heuristic algorithms. It imitates the law of "survival of the fittest" in nature, uses a selection operation to eliminate individuals with low fitness according to the fitness of the generated individual, uses "crossover" and "mutation" operations to generate new populations, and finally gets feasible solutions that meet the requirements of decision makers with evolution from generation to generation. Compared with other optimization methods, such as linear programming and dynamic programming, the GA algorithm has the characteristics of strong adaptability, global optimization, self-adaptation, strong robustness, etc., so it is widely used in reservoir optimal scheduling and other fields [9][10][11].
Then, in order to improve the convergence speed of the genetic algorithm, Liu et al. [12] proposed an improved strategy which can comprehensively improve the computational efficiency of the genetic algorithm by studying the encoding method, constraint processing strategy and convergence of the genetic algorithm. Ahmed et al. [13] used the penalty 2 of 15 function method to deal with constraints, that is, using the appropriate fitting function to distinguish between feasible and infeasible solutions satisfying the constraints, and obtained good convergence results. In order to solve the problem where the genetic algorithm converges to the local optimal solution, Wang [14] constructed a multi-objective reservoir optimal operation model, proposed an adaptive genetic algorithm and applied it to an example. The results showed that the genetic algorithm combined with adaptive mapping could make the optimization results closer to the frontier of the non-inferior solution of the model.
There are many constraints in the process of reservoir dispatching. The common processing method of the traditional GA algorithm is the penalty function method, which accelerates the screening by imposing penalties on the individual fitness of each generation that does not meet the constraints. However, the penalty coefficient of the penalty function is often difficult to determine, as the algorithm with the too small coefficient may converge to an infeasible solution, and the algorithm that is too large may fall into local convergence [12]. Therefore, this paper improves the traditional GA algorithm and uses prior knowledge to consider some constraints (such as water balance constraints and discharge capacity constraints) when generating the initial population, screens randomly generated genes, and keeps a series of qualified genes so as to avoid excessive or negative flow at adjacent times, thus reducing the number of penalty functions; At the same time, new individuals generated by crossover and variation in each generation are screened to ensure that genes on each chromosome meet the constraints to improve the efficiency of calculation.
As an important tributary of the middle reaches of the Huai River, the Pi River has a steep slope and rapid flow, and flood disasters have occurred frequently in its history. Since the founding of the People's Republic of China, large floods occurred in 14 years, including 1951, 1953, 1954, 1956, 1964, 1969, 1975, 1984, 1991, 1996, 1999, 2003, 2005 and 2015, which brought serious flooding disasters to the middle and lower reaches of the river basin [15]. The Foziling Reservoir is located in the middle reaches of the Dongpi River in Huoshan County, Lu' an City. It belongs to the Pi River system of the Huai River Basin and is the lowest level of the Dongpi River cascade reservoir group. The Foziling Reservoir is located in the northern edge of the northern subtropical zone, belonging to the East Asian monsoon humid climate zone. The reservoir basin is a deep mountain area of the Dabie Mountains, most of which are high mountains, and a rainy center is formed with the main peak of the Dabie Mountains as the center. The main river is 77 km with an average slope of 6.5 ‰. Precipitation is mainly concentrated in the flood season (May-September), during which the flood collection time is short, the fluctuation is fast, the flood peak flow is large, and the main inflow rivers are the Manshui River and the Huangwei River. According to the measured data from 1956 to 2010, the average annual rainfall is 1481 mm, the average annual inflow is 51.4 m 3 /s, the average annual inflow is 1.62 billion m 3 , and the average annual runoff depth is 880 mm. The historical highest reservoir water level is 130.64 m, and the corresponding reservoir capacity is 511 million m 3 .
In addition, the Foziling Reservoir is an important part of the Huai River treatment project and protects Huoshan County Town and Luan City downstream of the reservoir. The location of the Foziling Reservoir and its objects of protection is shown in Figure 1. Therefore, this paper took Foziling Reservoir in the Pi River Basin as the research object, took the maximum safe discharge and the maximum flood control capacity occupied by the reservoir as the control index, and used the July 1991 and June 1999 floods as an example to optimize the flood control operation of the reservoir through the improved genetic algorithm and the flood control optimization dispatching model. The results were compared with the traditional genetic algorithm and the scheduling plan of the Foziling Reservoir in the 2020 large-scale reservoir flood control operation plan (hereinafter referred to as the 2020 operation regulation) to verify the effectiveness and rationality of the improved genetic algorithm.

Construction of Optimal Flood Control Dispatching Model
The prerequisite for the optimized flood control dispatching of reservoirs is to clarify whether there are flood control tasks downstream. If there is no protection object downstream, the reservoir only needs to be designed for its own safety, and the discharge can be based on its own discharge capacity; however, if there are important towns and other objects in the downstream that need to be protected, then the reservoir discharge cannot only be designed for its own discharge capacity. On this basis, the downstream protection objects need to be considered [16]. Only when the discharge flow of the reservoir is lower than the maximum safe discharge flow of the control section of the downstream protection object can the protection object be considered to be in a safe state. Therefore, when encountering a flood, the optimization objective is to occupy as little as possible of the flood control reservoir capacity under the premise of ensuring the safety of the reservoir itself and the protection objects downstream of the reservoir [17,18], that is, the maximum flood control safety guarantee criterion [19]. Under the circumstances, the reservoir has enough capacity to deal with the next possible flood. For the convenience of calculation, the scheduling process is discretized into t + 1 moments and t periods. At this time, the objective function is shown in the following formula: where V t is the flood control storage capacity occupied by the reservoir at time t, million m 3 . In order to make the results of the model fit the actual situation, the following constraints need to be constructed to limit the solution process, so as to obtain a feasible solution that meets the requirements of decision makers.
Water balance restriction

4.
Relationship between water level and storage capacity, relationship between water level and discharge capacity 5. Amplitude constraints of discharge flow 6.
The above variables such as water level, storage capacity, and discharge flow are not negative.
In Formulas (2)-(8), H min and H max are the flood limit water level of the reservoir, the design flood level, m; H t is the water level of the reservoir at time t, m; Q out_t is the discharge flow of the reservoir during the t period, m 3 /s; Q out_max is the maximum discharge capacity of the reservoir itself at each time period, including spillway steel pipe, spillway, etc., m 3 /s; Q s is the safe discharge flow of the control section downstream of the reservoir, m 3 /s; Q in_t is the inflow of the reservoir during the t period, m 3 /s; ∆t is the time step; f V (Z t ) is the water level and storage capacity relation curve function of the reservoir at time t; f Q (Z t+1 ) is the function of the water level and discharge capacity of the reservoir at the end of the t period; ∆Q is the variation range of reservoir discharge flow in adjacent periods.

Model Solving Method
In this paper, the improved GA algorithm is used to solve the model.

Population initialization
When generating the initial population, different coding strategies will affect the calculation accuracy of the algorithm and the time required to achieve convergence. For example, although the concept of binary code is clear, its output needs to be converted to a real number and is limited by the length of code, which often causes problems such as inadequate calculation accuracy and coding redundancy. Real value coding minimizes the problem of limited coding length and saves time for binary to real value conversion. Therefore, this paper uses real value coding to take the discharge flow rate of each period in the dispatching process as a decision variable, i.e., gene, so the length of coding is the number of decision variables.
where Q out is the individuals in a population; q is the gene on the chromosome; t is the number of genes; n is the population size. The inflow process and starting water level of the reservoir are often known during operation, and the population initialization can be completed according to the following steps.
(1) There are n groups, and t random outflow from 0 to Q s are generated in each group; (2) According to the relationship between water level and storage capacity, water level and discharge capacity, the storage capacity V t and discharge capacity Q t corresponding to H t at the current time are calculated; (3) According to Formula (10), the initial outflow is replaced, and the storage capacity V t+1 at the next moment is calculated; (4) According to Formula (6), the H t+1 corresponding to V t+1 at t + 1 is obtained. Repeat steps 2 and 3. 2.

Construct penalty functions
There are three penalty functions, which are punish 1, which is imposed on the failure of reservoir water levels to return to flood limit levels at the end of the dispatching period, punish 2, which is imposed on reservoir water levels exceeding flood control high levels or below flood limit levels during the dispatching period, and punish 3 for the variation of discharge flow rates in adjacent periods of the reservoir, as detailed in Formulas (11)- (13).
where H end is the water level at the end of dispatching; H t_max and H t_min are the highest and lowest water levels that can be reached during dispatching.

Calculate population fitness
Fitness reflects the strengths and weaknesses of individuals in a population. The design and complexity of the fitness function will affect the convergence speed and robustness of the algorithm. In this paper, the fitness function consists of the objective function and the penalty function.
where f itness i is the fitness of the chromosome I; max{V t } is the storage capacity corresponding to the largest gene on the chromosome I; k 1 , k 2 and k 3 are the penalty coefficients corresponding to each penalty function.
Since the objective function of this study is to minimize the flood reservoir capacity occupied in the process of dispatching, individuals with high fitness values are easy to be eliminated in the next genetic operation, and the lower the fitness value, the stronger the competitiveness of the individuals.

Genetic manipulation
Selection: This operation simulates the survival of the fittest in nature, ranks the individuals in the population according to the fitness value, selects the individuals with lower fitness in the population through the selection rate Ps and then selects the better ones from the remaining individuals to replace the eliminated ones again so as to ensure that the size of the population remains unchanged. At the same time, in order to avoid the gene of the best individual being destroyed due to crossover and mutation in the evolution process, the elite strategy is adopted, i.e., to preserve the best individual that has appeared so far in the evolution process and copy it to the next generation to replace the individual with high fitness value.
Crossover: In order to generate new individuals for the next generation and improve the search ability of the genetic algorithm, the selected individuals need to be crossed. The crossover operator includes single point crossover, multi-point crossover, uniform crossover, etc. In this paper, a single point crossover method is used to generate new individuals. That is to say, according to the crossover rate Pc, the paired chromosomes generate crossover sites and exchange gene fragments before or after the crossover sites of paired chromosomes, as shown in the following Figure 2.
ness of the algorithm. In this paper, the fitness function consists of the objective function and the penalty function.
where i fitness is the fitness of the chromosome I; max{ } t V is the storage capacity corresponding to the largest gene on the chromosome I; 1 k , 2 k and 3 k are the penalty coefficients corresponding to each penalty function.
Since the objective function of this study is to minimize the flood reservoir capacity occupied in the process of dispatching, individuals with high fitness values are easy to be eliminated in the next genetic operation, and the lower the fitness value, the stronger the competitiveness of the individuals.

Genetic manipulation
Selection: This operation simulates the survival of the fittest in nature, ranks the individuals in the population according to the fitness value, selects the individuals with lower fitness in the population through the selection rate Ps and then selects the better ones from the remaining individuals to replace the eliminated ones again so as to ensure that the size of the population remains unchanged. At the same time, in order to avoid the gene of the best individual being destroyed due to crossover and mutation in the evolution process, the elite strategy is adopted, i.e., to preserve the best individual that has appeared so far in the evolution process and copy it to the next generation to replace the individual with high fitness value.
Crossover: In order to generate new individuals for the next generation and improve the search ability of the genetic algorithm, the selected individuals need to be crossed. The crossover operator includes single point crossover, multi-point crossover, uniform crossover, etc. In this paper, a single point crossover method is used to generate new individuals. That is to say, according to the crossover rate Pc, the paired chromosomes generate crossover sites and exchange gene fragments before or after the crossover sites of paired chromosomes, as shown in the following Figure 2. Mutation: During the process of new population generation, some individual genes will be mutated, so it is necessary to mutate the crossed individuals according to the rate of mutation Pm. Among them, the individuals with good fitness value have little probability of mutation, so as to ensure that the effective genes on the chromosome will not be deleted as much as possible [20]. At the same time, with the increase of evolutionary generation, the range of mutation gradually decreases. In the early stage of evolution, the Mutation: During the process of new population generation, some individual genes will be mutated, so it is necessary to mutate the crossed individuals according to the rate of mutation Pm. Among them, the individuals with good fitness value have little probability of mutation, so as to ensure that the effective genes on the chromosome will not be deleted as much as possible [20]. At the same time, with the increase of evolutionary generation, the range of mutation gradually decreases. In the early stage of evolution, the original gene is replaced by a randomly generated gene. In the later stage of evolution, the gene to be mutated is enlarged or reduced on a small scale to enable the algorithm to perform a local search.
After crossover and mutation, genes on each individual's chromosome still need to be screened to satisfy the downstream safety discharge, reservoir discharge capacity and water balance constraints. The calculation steps of the genetic algorithm are shown in Figure 3. the gene to be mutated is enlarged or reduced on a small scale to enable the algorithm t perform a local search.
After crossover and mutation, genes on each individual's chromosome still need t be screened to satisfy the downstream safety discharge, reservoir discharge capacity an water balance constraints. The calculation steps of the genetic algorithm are shown in Figure 3.  Control Parameters The control parameters are generally determined by experience. In order to make th calculation results close to the theoretical optimal solution and reduce the amount of ca culation to improve the calculation efficiency, this paper makes several trial calculation based on experience. Finally, the initial population n, selection rate Ps, and crossover rat Pc is defined as 40, 40%, and 60%, respectively. The formula for calculating the mutatio rate Pm is as follows. Selection of parameters can be seen in 4.3 Selection of control pa rameters. min 0.5 ,

Overview of the Study Area
The Foziling Reservoir is located at the upper reaches of the east source of the P River, a tributary of the Huai River. The Manshui River and the Huangwei River run int the reservoir. It is a large (2) reservoir that focuses on flood control and takes irrigation power generation, and shipping into account. It is rated to withstand a one in a thousan years flood. The dam site of the reservoir is in the southwest of Huoshan County, Anhu Province, with a control area of 1270 km 2 . The flood limit water level in the main floo season is 118.56 m, the design flood level is 125.65 m, and corresponding storage capacit is 262.02 × 10 6 m 3 , 397.80 × 10 6 m 3 , respectively. Reservoir flood discharge facilities ar equipped with flood discharge steel pipes, spillways, etc. When the water level rises t

Control Parameters
The control parameters are generally determined by experience. In order to make the calculation results close to the theoretical optimal solution and reduce the amount of calculation to improve the calculation efficiency, this paper makes several trial calculations based on experience. Finally, the initial population n, selection rate Ps, and crossover rate Pc is defined as 40, 40%, and 60%, respectively. The formula for calculating the mutation rate Pm is as follows. Selection of parameters can be seen in 4.3 Selection of control parameters.
where f i , f , f min are respectively the fitness value of the individual I of the population, the current average fitness value and the minimum fitness value of the population.

Overview of the Study Area
The Foziling Reservoir is located at the upper reaches of the east source of the Pi River, a tributary of the Huai River. The Manshui River and the Huangwei River run into the reservoir. It is a large (2) reservoir that focuses on flood control and takes irrigation, power generation, and shipping into account. It is rated to withstand a one in a thousand years flood. The dam site of the reservoir is in the southwest of Huoshan County, Anhui Province, with a control area of 1270 km 2 . The flood limit water level in the main flood season is 118.56 m, the design flood level is 125.65 m, and corresponding storage capacity is 262.02 × 10 6 m 3 , 397.80 × 10 6 m 3 , respectively. Reservoir flood discharge facilities are equipped with flood discharge steel pipes, spillways, etc. When the water level rises to the corresponding elevation, they undertake their discharge tasks respectively. The characteristic water level of the Foziling Reservoir is shown in Table 1.
The flood control standard of the downstream reservoir is once in 20 years, so the reservoir should play a flood control role. The reservoir protects important cities and towns such as Huoshan County (17 km downstream) and Luan City (60 km downstream), important infrastructure such as Hewu, Ningxi Railway, G35 and G42 Expressway downstream, and the 312 National Highway (65 km away from the reservoir), and protects about 1.3 million people and 720,000 mu of cultivated land. The corresponding control sections in Huoshan County and Luan City are the Gaoqiaowan Section and the In the 2020 operation regulation, when the water level of the Foziling Reservoir rises in flood season but does not exceed 123.08 m, the discharge flow of the reservoir is controlled within 3450 m 3 /s. If the water level continues to rise, then all flood discharge facilities will be opened to ensure the safety of the reservoir itself. Therefore, in this study, the maximum safe discharge flow of the reservoir is 3450 m 3 /s, which means that as long as the maximum discharge flow of the reservoir does not exceed 3450 m 3 /s, the downstream Huoshan County and Luan City will be protected in a safe state. Figures 4 and 5 show the water level-reservoir capacity relation curve and water level-discharge capacity relation curve of the Foziling Reservoir. The flood control standard of the downstream reservoir is once in 20 years, so the reservoir should play a flood control role. The reservoir protects important cities and towns such as Huoshan County (17 km downstream) and Luan City (60 km downstream), important infrastructure such as Hewu, Ningxi Railway, G35 and G42 Expressway downstream, and the 312 National Highway (65 km away from the reservoir), and protects about 1.3 million people and 720,000 mu of cultivated land. The corresponding control sections in Huoshan County and Luan City are the Gaoqiaowan Section and the Hengpaitou Section, respectively, and the corresponding maximum safe discharge is 3760 m 3 /s and 4770 m 3 /s.
In the 2020 operation regulation, when the water level of the Foziling Reservoir rises in flood season but does not exceed 123.08 m, the discharge flow of the reservoir is controlled within 3450 m 3 /s. If the water level continues to rise, then all flood discharge facilities will be opened to ensure the safety of the reservoir itself. Therefore, in this study, the maximum safe discharge flow of the reservoir is 3450 m 3 /s, which means that as long as the maximum discharge flow of the reservoir does not exceed 3450 m 3 /s, the downstream Huoshan County and Luan City will be protected in a safe state. Figures 4 and 5 show the water level-reservoir capacity relation curve and water level-discharge capacity relation curve of the Foziling Reservoir.

Scheduling Rules of Optimization Algorithm
On the premise of ensuring the safety of downstream flood control, this paper takes

Scheduling Rules of Optimization Algorithm
On the premise of ensuring the safety of downstream flood control, this paper takes the minimum flood control reservoir capacity of the Foziling Reservoir in the situation of a flood as the goal and considers the following principles: From flood limit water level (118.56 m) in the main flood season, the water level during dispatching cannot exceed the designed flood level (125.65 m). After the end of the flood, the water level is required to fall back to the flood limit water level in order to cope with the next possible flood.
In order to ensure the flood control safety of Huoshan County and Luan City downstream of the reservoir, the maximum discharge flow of the reservoir cannot exceed 3450 m 3 /s during operation.

Optimization Results
The floods that occurred in the history of the Foziling Reservoir areselected as the input condition of the model for optimal flood control operation. Taking

Scheduling Rules of Optimization Algorithm
On the premise of ensuring the safety of downstream flood control, this paper takes the minimum flood control reservoir capacity of the Foziling Reservoir in the situation of a flood as the goal and considers the following principles: From flood limit water level (118.56 m) in the main flood season, the water level during dispatching cannot exceed the designed flood level (125.65m). After the end of the flood, the water level is required to fall back to the flood limit water level in order to cope with the next possible flood.
In order to ensure the flood control safety of Huoshan County and Luan City downstream of the reservoir, the maximum discharge flow of the reservoir cannot exceed 3450 m 3 /s during operation.

Optimization Results
The floods that occurred in the history of the Foziling Reservoir areselected as the input condition of the model for optimal flood control operation. Taking   The flood process is discretized, in which the flood dispatching process in July 1991 is divided into 88 periods, and the step length of each period is 2 h. The flood dispatching process in June 1999 is divided into 67 periods, and each time step is 1 h. It can be seen from Figures 6 and 7 that the reservoir plays a full role in flood control. Through the reservoir storage, the discharge of the reservoir has never exceeded the maximum safe discharge of 3450 m 3 /s, and the downstream safety is guaranteed. At the same time, in these The flood process is discretized, in which the flood dispatching process in July 1991 is divided into 88 periods, and the step length of each period is 2 h. The flood dispatching process in June 1999 is divided into 67 periods, and each time step is 1 h. It can be seen from Figures 6 and 7 that the reservoir plays a full role in flood control. Through the reservoir storage, the discharge of the reservoir has never exceeded the maximum safe discharge of 3450 m 3 /s, and the downstream safety is guaranteed. At the same time, in these two floods, the highest water level of the reservoir did not reach the design flood level of 125.65 m, and both fell back to the flood limit water level at the end of the period. It can be considered that the safety of the reservoir is also guaranteed.

Comparison between Improved Genetic Algorithm and 2020 Operation Regulation
In order to verify the rationality of the model, the results are compared with the 2020 operation regulation. The reservoir operation process is shown in Figures 8 and 9. The flood process is discretized, in which the flood dispatching process in July 1991 is divided into 88 periods, and the step length of each period is 2 h. The flood dispatching process in June 1999 is divided into 67 periods, and each time step is 1 h. It can be seen from Figures 6 and 7 that the reservoir plays a full role in flood control. Through the reservoir storage, the discharge of the reservoir has never exceeded the maximum safe discharge of 3450 m 3 /s, and the downstream safety is guaranteed. At the same time, in these two floods, the highest water level of the reservoir did not reach the design flood level of 125.65 m, and both fell back to the flood limit water level at the end of the period. It can be considered that the safety of the reservoir is also guaranteed.

Comparison between Improved Genetic Algorithm and 2020 Operation Regulation
In order to verify the rationality of the model, the results are compared with the 2020 operation regulation. The reservoir operation process is shown in Figures 8 and 9.  The optimal scheduling scheme in 2020 is shown in Table 2. When the flood occurred in July 1991, the reservoir water level was up to 124.86 m, which was lower than the design flood level of 125.65 m, and the reservoir capacity was 372.60 × 10 6 m 3 . However, since the 62nd period, the reservoir no longer guarantees the downstream safety. At this time, the reservoir flood discharge facilities are fully discharged, according to the discharge capacity, to ensure its own safety. At the 67th period, the water level is lower than 123.08 m, and the discharge is re-controlled within 3450 m 3 /s. In the flood scenario of June 1999, the reservoir water exceeded 123.08 m in the 39th period, and reached the highest level at 123.62 m in the 41st period. The corresponding reservoir capacity was 348.84 × 10 6 m 3 , and returned to below 123.08 m in the 45th period.  The optimal scheduling scheme in 2020 is shown in Table 2. When the flood occurred in July 1991, the reservoir water level was up to 124.86 m, which was lower than the design flood level of 125.65 m, and the reservoir capacity was 372.60 × 10 6 m 3 . However, since the 62nd period, the reservoir no longer guarantees the downstream safety. At this time, the reservoir flood discharge facilities are fully discharged, according to the discharge capacity, to ensure its own safety. At the 67th period, the water level is lower than 123.08 m, and the discharge is re-controlled within 3450 m 3 /s. In the flood scenario of June 1999, the reservoir water exceeded 123.08 m in the 39th period, and reached the highest level at 123.62 m in the 41st period. The corresponding reservoir capacity was 348.84 × 10 6 m 3 , and returned to below 123.08 m in the 45th period. According to the 2020 regulation, under the ideal scenario, the downstream was in a dangerous state for 10 h when the flood occurred in July 1991, and the maximum discharge was 4187.92 m 3 /s. At the same time, the maximum water level of the reservoir was 124.86 m, and there was still 0.79 m space to be used from the designed flood level. When the reservoir suffered the flood in June 1999, the maximum storage capacity of the reservoir was 348.84 × 10 6 m 3 , the corresponding water level was 123.62 m, and the discharge was 3585.02 m 3 /s, which still exceeded the maximum safe discharge of 3450 m 3 /s, and the downstream control section of Gaoqiaowan was facing a flood risk for up to 6 h. Compared with the 2020 operation regulation, the flood control capacity occupied by the operation scheme under the improved genetic algorithm is 391.84 × 10 6 m 3 , 352.80 × 10 6 m 3 , and the corresponding water level is 125.36 m and 123.83 m, respectively. However, the downstream of the reservoir is always in a safe state. The reservoir occupied the flood control capacity as small as possible under the condition that its water level does not exceed the designed flood level and ensures the safety of the downstream. The operation scheme reduces the risk of flood control.

Comparison between Improved Genetic Algorithm and Traditional Genetic Algorithm
Compared with the improved genetic algorithm, the traditional genetic algorithm does not consider the constraint of the maximum discharge capacity of the reservoir when generating the initial population, but takes it into account in the penalty function. Therefore, the punish 4 should be added when the reservoir discharge exceeds the maximum discharge capacity of the reservoir.
The number of evolutions is set to 100,000 generations and both converge within 100,000 generations. Therefore, under different flood scenarios, the scheduling processes of the improved genetic algorithm and traditional genetic algorithm are shown in Figures 10 and 11. Therefore, the punish 4 should be added when the reservoir discharge exceeds the maximum discharge capacity of the reservoir.
The number of evolutions is set to 100,000 generations and both converge within 100,000 generations. Therefore, under different flood scenarios, the scheduling processes of the improved genetic algorithm and traditional genetic algorithm are shown in Figures  10 and 11.     Table 3. To explore the reason, the fitness value and its composition when the algorithms converge are counted, as shown in Table 3.  Table 3 shows that under two flood scenarios, the punish 4 (discharge capacity penalty value) is not completely removed according to the fitness value obtained by the traditional genetic algorithm, that is, the fitness value is composed of the maximum flood control capacity occupied by the reservoir and the discharge capacity penalty value. That is to say, there is an outflow greater than the discharge capacity in the scheduling process, which is not in line with the actual situation. Because the penalty coefficient is too small, the algorithm converges to an infeasible solution. Therefore, the more penalty functions, the more difficult it is to determine the coefficients of penalty functions. In this paper, the improved genetic algorithm not only improves the genetic operation, but also considers the discharge capacity constraint when generating new individuals, reduces the number of penalty functions, saves the time for determining the penalty coefficient, and makes the model application more convenient.

Selection of Control Parameters
The effects of initial population n, selection rate Ps, and crossover rate Pc on the fitness values are shown in the Figures 12-14, where the fitness values are the average of the results obtained after 10 runs of the model. of penalty functions, saves the time for determining the penalty coefficient, and makes the model application more convenient.

Selection of Control Parameters
The effects of initial population n, selection rate Ps, and crossover rate Pc on the fitness values are shown in the Figures 12-14, where the fitness values are the average of the results obtained after 10 runs of the model.    Figure 12 shows the effect of different initial population sizes on fitness values after 10,000 generations of evolution with experience-based selection rates Ps = 0.6 and Pc = 0.8.
From the graph, it can be seen that the increase of initial population n enriches the diversity of the population and the fitness values tend to be stable. When n is small, although the calculation speed is improved, it is easy to cause close relatives to get married, and the fitness values are unsatisfactory due to insufficient initial samples. If the number   Figure 12 shows the effect of different initial population sizes on fitness values after 10,000 generations of evolution with experience-based selection rates Ps = 0.6 and Pc = 0.8.
From the graph, it can be seen that the increase of initial population n enriches the diversity of the population and the fitness values tend to be stable. When n is small, although the calculation speed is improved, it is easy to cause close relatives to get married, Figure 14. Impact of crossover rate Pc on fitness value. Figure 12 shows the effect of different initial population sizes on fitness values after 10,000 generations of evolution with experience-based selection rates Ps = 0.6 and Pc = 0.8. From the graph, it can be seen that the increase of initial population n enriches the diversity of the population and the fitness values tend to be stable. When n is small, although the calculation speed is improved, it is easy to cause close relatives to get married, and the fitness values are unsatisfactory due to insufficient initial samples. If the number of n is too large, it will result in an increase in computational effort without a significant change in fitness values. To sum up, the initial population n is set at 40. Figure 13 shows the effect of selection rate Ps on fitness values when the number of evolutionary generations is 10,000, the initial population is 40, and the crossover rate is 0.8. Population diversity decreases with the decrease of Ps, which may lead to the loss of effective genes and the converging to an infeasible solution. If the level of Ps is too high, the evolutionary effect is not obvious, and the fitness value is not convergent at the end of evolution, so Ps = 0.4 is selected in this paper.
If the crossover rate Pc is too high, it is likely to destroy the individuals with good fitness values. If the Pc is too small, it will cause the generation of new individuals to be slow and the search will stall. This paper explores the effect of crossover Pc on fitness values based on 10,000 generations of evolution, initial population n = 40 and selection rate Ps = 0.4. See Figure 14. Since the elite strategy is used to prevent gene destruction in good individuals to some extent, the fitness values do not fluctuate much with the increase of Pc, and the crossover rate Pc is finally set to 0.6.

Conclusions
In this paper, the improved genetic algorithm is used to optimize flood control operation. The results are compared with the schemes of the traditional genetic algorithm and reservoir operation regulation in 2020. The main conclusions are as follows.
The improved genetic algorithm can save time for determining the penalty coefficient and make the model application more convenient. The traditional genetic algorithm penalty function needs to consider the water level constraint, discharge amplitude constraint, discharge capacity constraint, etc., while the improved genetic algorithm considers the water balance constraint, maximum safety discharge constraint, non-negative constraint and discharge capacity constraint in the coding, which reduces the number of penalty functions and makes the penalty coefficient easy to determine to a certain extent.
Compared with the scheme based on the 2020 operation regulation, the optimization of the dispatching scheme by the improved genetic algorithm occupies the flood control storage as small as possible under the premise of ensuring the flood control safety of the reservoir itself and the downstream protection objects. Under different flood scenarios in July 1991 and June 1999, according to the scheme in the 2020 operation regulation, the downstream protection object is in danger for 10 h and 6 h, respectively. The improved genetic algorithm not only ensures the downstream safety, but also achieves the highest reservoir water levels of 125.36 m and 123.83 m, which are lower than the designed flood level of 125.65 m.