Application of Whale Optimization Algorithm in Optimal Allocation of Water Resources

. In order to solve the water crisis, it is important to optimize the allocation of water resources. In this paper, the Whale Optimization Algorithm (WOA) is applied to the optimal allocation of water resources in Xingtai with the goal of maximum economic benefit and minimum total water shortage. The results show that the total water demand of different water users in each district is 26.94×10 8 m 3 , the total allocated water is 19.83×10 8 m 3 , the total water shortage is 7.11×10 8 m 3 , and the water shortage rate was 26.39%. The lack of water is mainly concentrated in the primary industry. The result of the solution reflects the principle of water supply order and water use equity, which is in line with the actual development and utilization of water resources in the study area. It also verifies the feasibility of the whale optimization algorithm, such as less parameter adjustment, faster convergence, and better global optimization ability when solving water resources optimization problems.


Introduction
With the rapid development of society and economy, the demand for water has been increasing.The shortage of water resources has become a key issue that hinders economic and social development.The total amount of water resources in China accounts for 6% of the total water resources in the world.However, due to China's large population, per capita water resources account for approximately one-fourth of the world [1] .At the same time, with the spatial and temporal distribution of water resources in China is not compatible with the demand for water in some areas [2] , along with the rapid development of industry, water pollution has become more and more serious, which further exacerbates the scarcity of water resources.In order to solve the crisis of water resources shortage, it is necessary to optimize the allocation of water resources to realize the transfer of water resources from low-value use to high-value use and improve the utilization efficiency of water resource.
At present, the research on the optimal allocation of water resources is receiving extensive attention and is continuously improving [ 3 ] .Especially the new bionic intelligence algorithms proposed in recent years, such as particle swarm optimization [ 4 ] , artificial fish swarm algorithm [5] , ant colony optimization algorithm [6] , termite algorithm [ 7 ] , wasp swarm algorithm (WSA) [ 8 ] , firefly algorithm (FA) [ 9 ] , fruit fly optimization algorithm (FOA) [10] and so on, have overcome the shortcomings of the traditional intelligent algorithms and effectively solve the problems in the optimization of water resources allocation.In this paper, a new type of bionic intelligence algorithm, Whale Optimization Algorithm [11] , is applied to the water resources optimization allocation model.The algorithm has the characteristics of less parameter adjustment, fast convergence, and strong global optimization ability.

Whale optimization algorithm
The WOA is a new swarm intelligence optimization algorithm, which was proposed by Australian scholars Mirjalili and Lewis in 2016.Inspired by the hunting behavior of humpback whales in nature, the algorithm simulates the shrinking encircling, spiral updating position, and random hunting mechanisms of the humpback whale population.The algorithm includes three stages: encircling prey, bubble net attack and search for prey.

Encircling prey
In encircling prey, the humpback whale can identify the location of the prey and encircle it.Because of the location of the optimal solution in the search space is unknowable, the WOA assumes that the current optimal location as the target prey.After defining the optimal location, other whales try to update their location to the optimal location.This behavior is expressed as the following: (2) where t is the current number of iterations, A  and B  are coefficient vectors, " ⊗ " is an arithmetic between elements(e.g ( ) ( ) ( ) (3) (4) where r  is a random vector with a range of 0 to 1, a is a control parameter and a linearly decreases from 2 to 0 during the iteration.The change of a is shown as: where max t is the maximum number of iterations.

Bubble-net attack
The bubble net attack behavior of humpback whales includes two mechanisms of the shrinking encircling and spiral updating position.
(1) Shrinking encircling mechanism When the control parameter a is decreased, the random variable A decreases accordingly.The range of , the new position of the whale individual can be defined anywhere between the original position and the current best position.The mathematical model is represented by Equation ( 1) and ( 2).
(2) Spiral updating position mechanism In the spiral updating position mechanism, the distance between the whales and the prey (current best solution) is first calculated, and then a logarithmic spiral equation is established between the positions of the whales and the prey (current optimal solution) to simulate the spiral movement of humpback whales.The mathematical model is shown as: where D′ represents the distance between the th i whale and the prey (current best solution).b is a constant parameter that controls the shape of the logarithmic spiral l is a random number ranged from -1 to 1.
It should be known that as the humpback whales attacks its prey, they move along a spiral path while they are encircling.In order to simulate this behavior, it is assumed that the shrinking encircling mechanism and the spiral updating position mechanism have the same probability of 0.5.The mathematical model is as follows: Where p is a random probability ranged from 0 to 1.

Search for prey
In fact, during the predation of humpback whales, individual whales will randomly search for prey based on each other's location.The prey is called searching for prey.By setting a coefficient variable 1 Α ≥ , the individual whales are forced away from the reference whales to find other more suitable prey, there by making the WOA algorithm to search in a global scope.Its model can be expressed as: is the position vector of the whale individual randomly selected from the current whale population.

Solving steps
(1) Initializing the whale population: the size of the whale population is N, and the initial population is randomly generated with the maximum number of iterations max T .(2) Calculating each individual fitness value in the whales through the objective function, and the best whale individual in the current group was found and saved.
(3) When 0.5 p < and 1 Α < , the position of the current whale individual is updated by equations ( 1) and (2); when 1 Α ≥ , individuals of random whales are selected and the current position of the individual whales is updated by equations ( 9) and (10).
(4) When 0.5 p ≥ , the position of the current whale individual is updated by equations ( 6) and ( 7).
(5) Check if any whale individual's updated position exceeds the search space and amend the whale's position beyond the search space.
(6) The number of iterations is checked.If the maximum number of iterations is reached, the algorithm stops running; otherwise, it goes to step (3).

Background of the study area
Xingtai is located at the south-central part of Hebei Province, with the longest distance of 185 km from east to west and 80 km from north to south.The topography of Xingtai is high in the west and low in the east, with the hilly areas in the west and the plains in the east.The total area of Xingtai is 12,456 km 2 , including 17 counties (Fig. 1).The mountainous area is 3545.0km 2 , and the plain area is 8911 km 2 .There are five water users, namely: domestic, primary industry, secondary industry, tertiary industry, and environment; water supply sources include local surface water, groundwater, south-to-north transfer water, and external transfer water and reclaimed water.
Xingtai is a typical resource-based water shortage region.Due to the scarcity of water resources and unreasonable water use systems, the contradiction between supply and demand of different water departments has been increasing year by year.The contradiction between industry and agriculture has become increasingly prominent, forcing groundwater to be exploited in great quantities, resulting in the serious overexploitation of groundwater in the whole region.In order to solve the problems in water resources development and utilization, the whale algorithm is used to rationally allocate water resources in Xingtai.

Optimal water resource allocation model (1) Objective functions
The ultimate goal of optimal allocation of water resources is the efficient use of water resources and the promotion of coordinated and sustainable development of water resources and economy and society.Therefore, this paper aims at the best regional social benefits and economic benefits, and combines various constraints that satisfy the objective function to construct a water resources optimization allocation model in Xingtai.To facilitate the model description, it is assumed that there are I water supply sources, K sub-regions and J water users in the area, and there are ( ) I k water sources and ( ) J k water users in the K sub-region.① Social benefits target The least regional water shortage in the study area is characterized as the social benefits target.

( ) ( ) ( )
where k j D is the water demand of user j in k sub-region(×10 4 m 3 ), k ij x is the water supplies by i resource to user j in k sub-region(×10 4 m 3 ).

② Economic benefits target
The economic benefits target is characterized by the direct economic benefits of regional water supply.
where ③ The determination of the objective function The two objective functions of the best social benefit and the best economic benefit are converted into a single objective optimization problem by linear weighting, of which the social benefit weight is 0.6, and the economic benefit weight is 0.4 [12] .
(2) Constraint conditions ① Water supply capacity constraints ( ) where k i W is the available water supply by i resource to k sub-region(×10 4 m 3 ).
② Water delivery capacity constraints ( ) where k i Q is the water delivery capacity by i resource to k sub-region(×10 4 m 3 ).
③ Water user demand constraints where min

Results analysis
The parameters of the model are selected as follows: the number of whale populations N is taken as 1000, the maximum number of iterations max T is 1000; the control parameter a is linearly reduced from 2 to 0. Enter the above parameters and data into Matlab for solving.The iterative process is shown in Figure 2, and the optimized allocation results are shown in Figure 3 and Figure 4.It can be seen from Figure 2 that when the iteration is about 270 times, the objective function can converge better.Although there is a small range of fluctuations, the iteration continues to run in a stable trend.When iterating around 540 times, the objective function converges and runs in a stable trend.From Fig. 3 (a), it can be seen that the amount of water distributed in the sub-regions 1, 2, 4 and 11 can satisfy all the water demand.The areas with large water shortages were 5, 8, 14 and 17.The water shortage rates were 53.35%, 40.21%, 54.69% and 43.46%, respectively.As can be seen from Figures 3 (b)-(f), the water shortages of the domestic, primary sector, secondary sector, tertiary sector, ecological are 0, 6.92×10 8 m 3 , 0.09×10 8 m 3 , 0.02×10 8 m 3 , 0.08×10 8 m 3 ,respectively.The corresponding water shortage rates are 0, 35.73%, 3.75%, 2.42%, and 11.28%, respectively.The lack of water is mainly in the primary sector.The reason is that the primary sector generates less economic benefits, and its water use equity coefficient is the smallest.The model is based on the water use equity coefficient in the calculation of the operation, and it preferentially meets the water demand of domestic, secondary sector, tertiary sector, and ecological environment.From Figures 3 and 4, it can see that the total demand of water in the 17 sub-regions of Xingtai is 26.94×10 8 m 3 , the total water supply is 23.59×10 8 m 3 , the allocated water is 19.83×10 8 m 3 , the water shortage is 7.11×10 8 m 3 , and the water shortage rate is 26.39%.The remaining undistributed water is 3.76×10 8 m 3 , of which the remaining surface water volume is 0.57×10 8 m 3 , the remaining groundwater volume is 1.76×10 8 m 3 , the remaining water of the South-to-North Diversion Project is 0.87×10 8 m 3 , and the remaining amount of reclaimed water is 0.56×10 8 m 3 .The distributive water in sub-regions 1, 2, 4 and 11 has fully satisfied the water demand, the total remaining water in sub-regions 1, 2, 4 and 11 is 3.60×10 8 m 3 (including local surface water, groundwater, south-to-north transfer water, and reclaimed water).According to the order of water supply for the south-north transfer water, the water users they supply are domestic, secondary sector and tertiary sector.The remaining of south-north transfer water in sub-regions of 5, 10, 12, 15 and 16 is 0.16×10 8 m 3 , indicating that the allocated water for the three water users of domestic, secondary sector and tertiary sector can meet their water demand.

Conclusion
In this paper, the optimized allocation model of water resources in Xingtai is solved by using the whale optimization algorithm.The results showed that the total water demand of different water users in Xingtai is 26.94×10 8 m 3 , the total allocated water is 19.83×10 8 m 3 , the total water shortage is 7.11×10 8 m 3 , and the water shortage rate is 26.39%.The water shortage is mainly concentrated in the primary sector.The amount of water shortage is 6.92×10 8 m 3 , accounting for 97.33% of the total water shortage.The result of the solution reflects the principle of water supply order and water equity, and is in line with the actual development and utilization of water resources in the study area.At the same time, it also verifies the feasibility of the whale optimization algorithm, such as less parameter adjustment, faster convergence, and better global optimization ability when solving the optimal allocation of water resources.

Fig. 1 .
Fig. 1.The map of Xingtai administrative division coefficients of efficiency per unit water supply and the coefficients of cost per unit water supply by i resource to user j in k sub-region ( CNY/m 3 ) , respectively.k i α is the coefficients of water supply sequence by i resource to k sub-region, and k j β is the coefficient of water supply fairness of user j in k sub-region.
and upper demands of user j in sub-region k , respectively.