Study of optimal allocation of water resources in Dujiangyan irrigation district of China based on an improved genetic algorithm

In order to distribute water resources reasonably, it is advantageous to make full use of resources and produce high economic and social benefits. Taking the Dujiangyan irrigation area of China as an example, we discuss the idea of establishing and solving the optimal allocation model of water resources. With this aim, a two-dimensional constraint model with highest economic value, minimum water shortage, minimum underground water consumption and necessary living water demand was established. In order to solve this model, we improved a multi-population genetic algorithm, extending the genetic optimization of the algorithm into two dimensions, taking population as the vertical dimension and the individual as the horizontal dimension, and transforming the cross genetic operator to copy the genetic (crossover) operator and the mutation operator to only act on the vertical dimension, so as to optimize the allocation of such discrete objectives of water resources in the irrigation area with a particular model suitable for the region. The distribution results successfully control the water shortage rate of each area at a low level, which saves the exploitation of groundwater to the maximum extent and produces high economic benefits. The improved algorithm proposed in this paper has a kind of strong optimization ability and provides a new solution for the optimization problem with multiple constraints.


INTRODUCTION
Water resources are essential for social development and are becoming increasingly scarce. Rational distribution of water resources is convenient for their full use, and produce high economic and social benefits. There are many kinds of optimization algorithms used in the optimal allocation of water resources, among which the most commonly used proposed a multi-objective technology based on group intelligence, that is, the elite mutation multi-objective particle swarm optimization (EM-MOPSO), to obtain the effective Pareto optimal solution of the multi-objective water resource management problem (Reddy & Nagesh ). In 2013, Yan Han proposed an interval parameter fuzzy linear programming method (IFLPSV) based on random vertices, which is used for the dual uncertainty allocation of water resources. For optimization problems with dual uncertainty, this method can provide more satisfactory solutions (Han et al. ). Mahdi Zarghami and others proposed a mutation particle swarm optimization algorithm (PSOMS) to solve the problem of the particle swarm optimization algorithm which easily falls into the optimal local solution due to the loss of diversity (Zarghami & Hajykazemian ). In 2014, Ali Dolatshahizand and others designed a multi-objective particle swarm optimization algorithm to effectively deal with the non-linear In 2017, Kourosh Qaderi and others proposed a new meta heuristic optimization algorithm called the water cycle algorithm (WCA), which is used to derive the operation strategy of a multi-reservoir system (Qaderi et al. ).
Hector Macian-Sorribes reviewed the development status of operation rules of a multi-reservoir water resources system in 2019, focusing on the efficient operation of the system and how to obtain and express the optimal operation rules (Macian-Sorribes & Pulido-Velazquez ). Yuxue Guo made an in-depth study on the latest optimization technology when implementing an inter basin water transfer (IBWT) in 2020, proposed a multi-objective optimization method based on practical control, updated the understanding of quantum theory on the multi-objective evolutionary algorithm (MOEAs), and provided a reference for IBWTs better to allocate water resources under uncertainty conditions (Guo et al. ). W. Deng et al. proposed an improved biological evolution algorithm to solve a series of complex problems, and achieved good results (Deng et al. a, b, c; Song et al. ). All of the above algorithms provide essential ideas for solving optimization problems. However, when applied to specific problems, necessary modifications are needed to adapt to the characteristics of the model in order to give full play to the performance of the algorithm.
Taking the data of the Dujiangyan irrigation district in China as an example, this paper establishes the optimal allocation of water resources under complex constraints, matches the corresponding mathematical model for the transformation algorithm, and proposes an improved genetic algorithm, which is simple, easy to operate and highly efficient. The following content of the paper is organized as follows: first the model of optimal allocation of water resources is established, and the constraints of the model are defined in detail; the solution of the model by using the improved genetic algorithm is then introduced; the operation and result from analysis of the algorithm are then carried out; finally, the application value, advantages and disadvantages of the algorithm are given.

WATER RESOURCES OPTIMAL ALLOCATION MODEL
The Dujiangyan irrigation district, located in the west of Sichuan Basin, has been destroyed by deforestation in the middle and upper reaches of the Minjiang River in recent years, resulting in the destruction of the natural environment and the large-scale destruction of the original forest.
The water resources in the basin have also gradually reduced, the water level in the flood season is decreased, and the dry season is longer. Because Dujiangyan irrigation area has six gates leading to different areas, sub irrigation areas are divided according to the six gate management areas, which are the Puyang River irrigation area, Baitiao River irrigation area, Zoma River irrigation area, Jiang'an River irrigation area, Shagou River irrigation area and Heishi River irrigation area. In this paper, the six sub irrigation areas of Dujiangyan are taken as the research object.
Through the establishment of a water resources optimal allocation model, an improved genetic algorithm is used to solve the problem.
The decision variables of rational allocation of water resources are: (1) where: x ijk is the amount of water distributed by the j-th water source to the k-th water use sector in the i-th division; i is the division number, which is in turn Puyang River irrigation area, Baitiao River irrigation area, Zoma River irrigation area, Jiang'an River irrigation area, Shagou River irrigation area and Heishi River irrigation area; j is the water source number, which is in turn weir headwater diversion, transit runoff water diversion, local reservoir water storage and groundwater; k is the number of water use sector, which is industrial water, agricultural water, domestic water and eco-

Water resource allocation model
Objective function of optimal allocation of water resources: Target 1: maximize the net benefit of regional water supply.
where: a ijk is the economic benefit of the unit water supply from j kinds of water sources in i division to k water sector.
Target 2: ensure that the total water deficit in each zone is minimized.
where: b ik is the sum of the water demand of the k water sector in zone i.
Target 3: minimize groundwater exploitation in the region and protect groundwater resources as much as possible.

Constraints
(1) Water resource constraints Water supply constraints of Dujiangyan irrigation district: Water supply constraints of cross-border runoff: Annual water supply constraints of local reservoirs: Groundwater quantity constraint: where: Q qs , Q gj , Q sk and Q dx are the available water supply of canal head, cross-border runoff, local reservoir and groundwater in division i, respectively.
(2) Domestic water demand must meet the constraints: where: BL i is the domestic water demand in division i.

SOLUTION OF THE MODEL
From the model point of view, parameter i represents the six sub irrigation areas of the Dujiangyan irrigation district.
Because the water supply of these sub irrigation areas can only meet the needs of their own irrigation areas, we discuss the six sub irrigation areas separately. In other words, for a certain sub irrigation area, there are only two variables. We extend the analysis method of the first irrigation area to the next irrigation areas to complete the optimization of other irrigation areas. In this way, the matrix analyzed in our model changes from three-dimensional to two-dimensional, that is, the matrix is a two-dimensional matrix composed of water supply and water use sectors for a certain sub irrigation area. In the water demand constraint, the domestic water demand constraint is a strong constraint that must be met. In the water supply constraint, water supply of canal head, runoff water supply and reservoir water supply should be saturated to create conditions for groundwater conservation.
From the constraints, it can be seen that the variables corresponding to domestic water demand are constrained by the two-dimensional non-equal quantity of water demand and water supply. Therefore, if the traditional genetic algorithm is used for calculation, there is a large probability that the constraint conditions will conflict when cross genetic (crossover) and mutation are carried out. Therefore, it is necessary to improve the genetic algorithm and match the genetic algorithm with the data adjustment function and constraint mechanism, so as to avoid invalid calculation caused by frequent updating of data.
The characteristic of the genetic algorithm is to approach optimal solution generation by generation through the genetic method. Each generation is a heuristic search based on the previous generation, so how to inherit the excellent genes of the previous generation is the key to the genetic algorithm. The apparent defects of the traditional genetic algorithm for this problem are summarized as follows: (1) Crossover and mutation will lead to data not meeting the constraints, thus updating the data and destroying the heredity.
(2) There are many constraints in each row and column, which reduces the similarity between individuals.
(3) A chromosome is a two-dimensional matrix, and the row and column are constrained, so the data is not easy to change.

Ideas for improvement
(1) The chromosome is the key to the genetic algorithm, and the constraint condition is a two-dimensional constraint. If the individual is one-dimensional, then the population is relatively two-dimensional. Each population completes a row constraint, and then individuals in each population complete a column constraint.
(2) The selection operator will select the population as a unit, retain the best individuals in the population with the best fitness, and then copy the chromosome of the population to generate new individuals, and then the mutation algorithm is applied to the population with low fitness.
(3) With a crossover operator, even if the population is taken as the unit, the data still needs to be updated and adjusted. Therefore, the complete replication algorithm can be considered to replace the cross genetic x ijk is positive, the water demand is greater than water supply, whilst a negative value means that water supply is greater than water demand, which will lead to waste of resources. Therefore, formula (3) is modified by adding a penalty factor T. which may also produce individuals with poor adaptability.
The flow chart of the improved genetic algorithm is shown in Figure 1.

Data analysis
The data come from the actual data of six sub irrigation districts in the Dujiangyan Irrigation Area in 2017. The objective function is the reciprocal of the maximum net benefit of water supply, the minimum of water shortage and groundwater exploitation. Actual data from 2017 are used for the data of water supply cost, water supply quantity and water demand in this calculation example (Table 1). The net benefit of agricultural water use is ¥ 7 yuan/m 3 , that of industrial water is ¥ 28 yuan/m 3 , that of ecological water is ¥ 2 yuan/m 3 , and that of domestic water is ¥ 3 yuan/m 3 .
The calculation results are shown in Table 2.
According to the data items in Table 1 can meet all the water supply in the irrigation areas. However, considering that the economic and ecological benefits will lead to a small amount of water shortage in some water sectors, each irrigation area is analyzed as an independent system. The calculation results are shown in Table 2 without considering the relationship between water supply and demand.
According to the calculation results, the water demand of various water sectors can basically be met. The industrial and domestic water demand is fully met, while the agricultural and ecological water demand is in short supply. In order to achieve the goal of maximum economic benefits, industrial water is fully met, and domestic water demand must meet the constraints. The maximum water shortage is 2 million m 3 , and the maximum water shortage ratio is 4.237%. In terms of water supply, the total water supply for the head of the canal is 11.992 billion m 3 , the local runoff is 2.117 billion m 3 , the total water supply of reservoirs is 511 million m 3 , the total underground water supply is 486 million m 3 , the total water consumption is 150.949 billion m 3 , and the total water demand is 15.099 billion m 3 . The  total amount of underground water consumption is 474.9 million m 3 , which reduces underground water by 11 million m 3 . There is no waste phenomenon that the water supply is greater than the water demand in each water supply sector.
The domestic water in each sub irrigation area is guaranteed, which meets the constraint conditions and optimization function, and the calculation results are correct.

Algorithm analysis
When the population number and population size are 100, the improved algorithm has a large amount of calculation per generation. However, the convergence speed is fast, and the calculation amount of a single generation is 100 times that of the traditional algorithm with the same parameters. Figure 2 shows the convergence curve of the optimal fitness value obtained by the above calculation, and Figure 3 shows the change curve of each variable.  From the convergence curve, the improved genetic algorithm has reached the optimal solution within 10 generations, but according to the variable change curve, the variables still change after the optimal solution reaches stability, but the correctness of the calculation results has not been affected. The reason why the variables still change is that the calculation accuracy of the improved genetic algorithm is not limited. The maximum iteration algebra is adjusted to 1000, and the curve obtained is shown in Figure 4.
It is not difficult to see from Figure 5 that the variables are stable after 300 generations, that is, the algorithm converges.

Example calculation results and application suggestions
According to the optimization results, the industrial water supply distribution in the six sub irrigation districts is at full allocation in order to achieve the maximum economic value, with economic development at the center. The data show that the gap of a molecular irrigation area in the middle of six sub irrigation areas lies in agricultural water use and ecological water use. In terms of agricultural water use, the water shortage in the Puyang River irrigation   and advanced irrigation methods such as sprinkler irrigation and drip irrigation should be adopted.
(2) For ecological water use, water-saving measures should be taken in time, significantly to strengthen the recycling of industrial water and reduce the exploitation of water resources. Industrial wastewater also needs a series of sewage treatment measures before it can be discharged.
At the same time, some water-saving measures need to be taken in agriculture. Additionally, domestic sewage can be used to supply agricultural and ecological water after treatment to alleviate the amount of groundwater and improve the utilization rate of water resources, so as to achieve the purpose of water saving.

Analysis of optimization algorithm model
The optimal allocation of water resources is a multi-objective goal, and the typical factors are regional water shortage, groundwater exploitation and regional water supply efficiency. At the same time, it is necessary to consider the construction of water demand and water supply constraints, so as to establish a water resources optimal allocation model which can balance the multi-objective allocation. An improved multi-population genetic algorithm was used to solve the two-dimensional constraint problem of the model.
The optimal configuration results verify the rationality of the model and the correctness of the improved genetic algorithm.
The advantages of this algorithm include: (1) The genetic algorithm is simple in structure, easy to understand and easy to operate.
(2) The improved multi-population genetic algorithm has the ability to deal with multi-dimensional data and multi-dimensional constraints. It is flexible and easy to operate. It can be modified according to the actual situation to adapt to various operating environments and mathematical models.
(3) The improved algorithm has high plasticity, which can be modified according to different applications.
However, at the same time, there are still some areas that need to be further improved, such as: (1) In the face of multi-level constraint problems, it is necessary to sort out the constraints and reduce the level of constraints as much as possible to ensure the regular operation of the algorithm.
(2) Different applications need to configure different parameters in order to give full play to the algorithm.
This problem will be further studied so that the algorithm can be better extended and applied to solve more complex related problems.