Intelligent water quantity optimization allocation method and device based on topological relationship and dynamic programming, and electronic equipment
By constructing a hierarchical cost vector and a directed acyclic graph dynamic programming optimization strategy, the problem of unreasonable water allocation in the water resource allocation model is solved, and the global optimal water allocation under multiple water sources and complex water flow paths is achieved, thereby improving the efficiency and fairness of water resource utilization.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZHEJIANG YUANSUAN TECH CO LTD
- Filing Date
- 2026-04-10
- Publication Date
- 2026-07-14
AI Technical Summary
Existing water resource allocation models fail to fully consider the dynamic transmission patterns of water volume between different units and the complex correlation between water sources and water demand. This leads to unreasonable water resource allocation and failure to achieve optimal utilization in situations with multiple water sources, complex water flow paths, and significant differences in priorities within irrigation districts, resulting in waste and exacerbating supply and demand imbalances.
By constructing a hierarchical cost vector and combining it with a post-order traversal dynamic programming optimization strategy for directed acyclic graphs, a multi-level water resource allocation topology network is constructed within the irrigation district. The lexicographically ordered hierarchical optimization objective and the post-order traversal dynamic programming method are used to optimize the water allocation of multi-source and multi-level water use units, ensuring that high-priority water demand is absolutely satisfied.
It achieves a scientifically optimized allocation that balances security, fairness, and efficiency under conditions of water scarcity, avoids computational explosion, is applicable to solvable large-scale problems, and ensures a globally optimal water allocation scheme.
Smart Images

Figure CN121998389B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of water resource management technology, and in particular to an intelligent water quantity optimization allocation method, device and electronic equipment based on topological relationships and dynamic programming. Background Technology
[0002] A water resource system is a complex network composed of multiple water sources, water conveyance facilities, and water users, including various facilities and water use structures such as rivers, reservoirs, pumping stations, and irrigation districts. Compared with a simple water supply system based on a single water source, a water resource allocation system based on multiple water sources, multiple users, and complex water flow paths has a multi-level topological structure and dynamic interaction characteristics. Under conditions of limited water supply and intense water use competition, its allocation complexity and coordination difficulty increase significantly. Therefore, it is necessary to conduct refined topological modeling and optimization analysis to ensure the efficiency, fairness, and sustainability of the water resource system under various water inflow and water use scenarios during the design and management stages.
[0003] In existing technologies, a common water resource allocation model is a priority allocation model based on the topological relationship between water sources and water users. This model constructs a multi-level topological structure by establishing the order of water supply and use between water sources and water users, the priority of water users, and the spatial topological relationships of series or parallel connections between water sources, and allocates water resources according to priority. However, this method mainly relies on the static priority and preset weights of each water user unit for water allocation, failing to fully consider the dynamic transmission patterns of water volume between different units, as well as the complex temporal and spatial correlations between water sources and water demand.
[0004] Especially when there are multiple water sources, complex water flow paths, and significant differences in priorities within irrigation districts, existing models cannot flexibly handle the impact of these factors on water allocation. Particularly when water resources are insufficient, they fail to accurately identify and adjust the inherent laws of water transmission and distribution, resulting in a large gap between the actual water allocation and the ideal water allocation. This makes it impossible to achieve optimal utilization of water resources, leading to water waste and exacerbating the supply-demand imbalance, which seriously restricts the sustainable development of the water supply economy. Summary of the Invention
[0005] The purpose of this application is to provide an intelligent water allocation optimization method, device, and electronic device based on topological relationships and dynamic programming. While retaining the traditional water allocation rules, it constructs a hierarchical cost vector and combines it with a post-order traversal dynamic programming optimization strategy based on directed acyclic graphs to globally optimize the water allocation of multiple water sources and multiple levels of water use units in the irrigation area. This effectively solves the problems of complex water flow paths, differences in water use priorities, and unreasonable water resource allocation under conditions of insufficient water sources.
[0006] Firstly, this application provides an intelligent water allocation optimization method based on topological relationships and dynamic programming. The method includes: constructing a water resource allocation topology network within an irrigation district; the topology network is a multi-level structure containing a global system, intermediate subsystems, and a bottom-level subsystem; each node in the topology network represents a water-using unit; each edge represents a water flow transmission path; the information of each node includes water demand, water inflow, water use priority, and water allocation rules; based on the information of each node in the topology network, initial water allocation is performed, and the water shortage and water allocation deviation of each water-using unit under each water use type in each priority layer are determined and recorded; based on the water shortage and deviation of each water-using unit under each water use type in each priority layer, the hierarchical total cost vector of each water-using unit is determined; based on the hierarchical total cost vector of each water-using unit, a lexicographically ordered hierarchical optimization objective is constructed, and a post-order traversal dynamic programming method is adopted to merge and optimize the water allocation schemes of each system layer by layer from the bottom-level subsystem of the topology network to obtain the optimal water allocation result of the entire system; the optimization objective is to minimize the sum of the hierarchical total cost vectors of the entire system according to the lexicographical order criterion among all feasible water allocation schemes.
[0007] Furthermore, the steps described above for initial water allocation based on node information in the topology network, determining and recording the water shortage and allocation deviation for each water user unit under each water use type in each priority layer, include: based on node information in the water resource allocation topology network, calculating the total water inflow of the target subsystem and the classified water demand of all water users within the target subsystem, and performing initial water allocation according to the following three basic rules: priority rule, demand-based ratio rule, and weighted ratio rule; during the initial water allocation process, for each water user unit under each water use type in each priority layer, determining whether the actual allocation amount for the water user unit under the water use type in the priority layer is less than the demand amount; if so, the difference between the demand amount and the actual allocation amount is determined as the water shortage amount for the water user unit under the water use type in the priority layer; if not, the difference between the actual allocation amount and the demand amount is determined as the allocation deviation amount for the water user unit under the water use type in the priority layer.
[0008] Furthermore, the steps for combining the initial water allocation based on the following three basic rules include: in one allocation round, firstly, using priority rules, on-demand ratio rules, or weighted ratio rules to ensure that the first priority water use type is satisfied first; then, the remaining water is further allocated to the second priority water use type using on-demand ratio rules or weighted ratio rules, and so on, to obtain the initial water allocation scheme.
[0009] Further, the step of determining the stratified total cost vector for each water-using unit based on the water shortage and deviation for each water-using type within each priority layer includes: for each priority layer of each water-using unit, performing the following steps: using the square of the water shortage for each water-using type within the priority layer as the nonlinear penalty function for each water-using type within the priority layer; using the square of the water allocation deviation for each water-using type within the priority layer as the quadratic water allocation deviation penalty function for each water-using type within the priority layer; weighted summing the nonlinear penalty function for each water-using type within the priority layer with the weight coefficient for each water-using type within the priority layer to obtain the stratified water shortage cost for each water-using type within the priority layer; weighted summing the quadratic water allocation deviation penalty function for each water-using type within the priority layer with the deviation sensitivity coefficient for each water-using type within the priority layer to obtain the stratified deviation cost for each water-using type within the priority layer; and merging the stratified water shortage cost and the stratified deviation cost for each water-using type within each priority layer to construct the stratified total cost vector for the water-using unit.
[0010] Furthermore, the step of merging the water use type stratification water shortage cost and water use type stratification deviation cost of the water use unit in each priority layer to construct the stratified total cost vector of the water use unit includes: for each priority layer, calculating the product of the water use type stratification deviation cost of the water use unit in the priority layer and the corresponding penalty coefficient; calculating the sum of the product and the water use type stratification water shortage cost of the water use unit in the priority layer to obtain the stratified cost vector of the water use unit in the priority layer; and merging the stratified cost vectors of the water use unit in each priority layer to obtain the stratified total cost vector of the water use unit.
[0011] Furthermore, the steps described above, which involve constructing a lexicographically ordered hierarchical optimization objective based on the hierarchical total cost vector of each water-using unit and employing a post-order traversal dynamic programming method to merge and optimize the water allocation schemes of each system layer by layer upwards from the lowest-level subsystem of the topology network to obtain the optimal water allocation result for the entire system, include: taking the lowest-level subsystem as the current system and performing the following water allocation scheme optimization steps: constructing a value function based on the hierarchical total cost vector of each water-using unit in the current system; the value function is used to represent the value that minimizes the sum of the hierarchical cost vectors among all feasible water allocation schemes under the total water constraint of the current system, selected in lexicographical order; based on the value function, traversing all feasible water allocation schemes to determine the optimal sub-water allocation scheme corresponding to the current system; taking the intermediate subsystem above the current system as the current system again and continuing to execute the water allocation scheme solution steps until the entire global system is traversed; backtracking downwards from the global system and determining the optimal water allocation amount for each water-using unit based on the optimal sub-water allocation scheme determined at each layer to obtain the optimal water allocation result for the entire system.
[0012] Furthermore, the steps described above for determining the value function based on the hierarchical total cost vector of each water-using unit in the current system include:
[0013] If the current system is the lowest-level subsystem, the value function is determined according to the following formula:
[0014] ;
[0015] in, S represents the total water volume of the current system. l Value function when used entirely for itself; S represents l Substitute the actual allocation amount into the hierarchical total cost vector of the water-using unit corresponding to the current system;
[0016] If the current system is not a bottom-level subsystem, the value function is determined according to the following formula:
[0017] ;
[0018] Constraints:
[0019] ;
[0020] ;
[0021] in, S represents the total water volume of the current system. j Value function used for itself and downstream water-using units; This indicates that the current system will use water volume w j The total cost vector of the hierarchical structure when used for itself; This indicates the optimal water allocation w for downstream water users. c The value function at time.
[0022] Secondly, this application also provides an intelligent water allocation optimization device based on topological relationships and dynamic programming. The device includes: a topology construction module for constructing a water resource allocation topology network within the irrigation area; the topology network is a multi-level structure containing a global system, intermediate subsystems, and the lowest-level subsystem; each node in the topology network represents a water-using unit; each edge represents a water flow path; and the information of each node includes water demand, water inflow, water use priority, and water allocation rules; and an initial water allocation module for performing initial water allocation based on the information of each node in the topology network, determining and recording the water shortage of each water-using unit under each water use type in each priority layer. The system comprises two modules: a cost vector determination module, which determines the total cost vector for each water user unit based on the water shortage and deviation for each water use type within each priority level; and a water allocation optimization module, which constructs a lexicographically ordered hierarchical optimization objective based on the total cost vector for each water user unit. Using a post-order traversal dynamic programming method, it merges and optimizes the water allocation schemes of each system, starting from the lowest-level subsystem of the topology network and moving upwards layer by layer, to obtain the optimal water allocation result for the entire system. The optimization objective is to minimize the sum of the total cost vectors for the entire system among all feasible water allocation schemes, according to the lexicographical order criterion.
[0023] Thirdly, this application also provides an electronic device, including a processor and a memory, wherein the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the method described in the first aspect above.
[0024] Fourthly, this application also provides a computer-readable storage medium storing computer-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the method described in the first aspect above.
[0025] The intelligent water allocation method, device, and electronic equipment based on topology and dynamic programming provided in this application construct a vectorized hierarchical cost function and a lexicographical dynamic programming optimization framework, forming a logically rigorous and computationally efficient technical solution. By employing hierarchical cost vectors and defining priority coefficients for different water use types, a multi-dimensional cost vector is constructed for each water use unit, ensuring at the mathematical model level that high-priority water use demands are absolutely prioritized. Simultaneously, this solution uses lexicographical optimization as the global objective, performing state recursion and decision-making through lexicographical comparison. Starting from the downstream subsystem, a post-order traversal dynamic programming algorithm is used to decompose the complex global optimization problem into a series of hierarchical subproblems for recursive solution. This process strictly adheres to the Bellman optimality principle, ensuring that the final water allocation scheme is the globally optimal solution under network topology and water quantity constraints. This scheme not only avoids computational explosion by discretizing the state space, achieving solvability for large-scale problems, but also fits the tree-like or DAG (Directed Acyclic Graph) network structure of irrigation districts, ultimately achieving a scientifically optimized allocation that balances security, fairness, and efficiency under water scarcity conditions. Attached Figure Description
[0026] To more clearly illustrate the technical solutions in the specific embodiments of this application or the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0027] Figure 1 A flowchart illustrating an intelligent water quantity optimization allocation method based on topological relationships and dynamic programming, provided for an embodiment of this application;
[0028] Figure 2 A flowchart illustrating another intelligent water quantity optimization and allocation method based on topology and dynamic programming provided in this application embodiment;
[0029] Figure 3 A schematic diagram of a water resource allocation topology network provided in this application embodiment;
[0030] Figure 4 A schematic diagram of a conventional water distribution process provided for an embodiment of this application;
[0031] Figure 5 A structural block diagram of an intelligent water volume optimization and allocation device based on topological relationships and dynamic programming provided in an embodiment of this application;
[0032] Figure 6This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0033] The technical solutions of this application will be clearly and completely described below with reference to the embodiments. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0034] To address the problem that existing water resource allocation models mainly rely on static priorities and struggle to uniformly calculate multi-level water demand guarantee relationships under complex topological structures, this invention proposes an intelligent water quantity optimization allocation method, device, and electronic equipment based on topological relationships and dynamic programming. While retaining traditional water allocation rules, it constructs a hierarchical cost vector and combines it with a post-order traversal dynamic programming optimization strategy based on directed acyclic graphs to globally optimize water allocation for multi-source, multi-level water-using units within an irrigation district. This effectively solves the problems of complex water flow paths, differences in water use priorities, and unreasonable water resource allocation under conditions of water shortage. To facilitate understanding of this embodiment, a detailed description of the intelligent water quantity optimization allocation method based on topological relationships and dynamic programming disclosed in this application is provided first.
[0035] Figure 1 A flowchart illustrating an intelligent water allocation method based on topological relationships and dynamic programming, provided in this application embodiment, is included. The method specifically comprises the following steps:
[0036] Step S1: Construct a water resource allocation topology network within the irrigation district. The topology network is a multi-level structure containing a global system, intermediate subsystems, and the lowest-level subsystem. Each node in the topology network represents a water-using unit. Each edge represents a water flow transmission path. The information of each node includes water demand, water inflow, water use priority, and water allocation rules.
[0037] In practical implementation, a water resource allocation topology network for the irrigation district can be constructed based on the district's topographic information and actual data. This topology network adopts a directed acyclic graph (DAG) form, where nodes represent water-using units, and directed edges represent the direction of water flow, describing the flow path of water from the water source to the water-using unit. Each node contains information such as water demand, priority coefficient, deviation sensitivity coefficient, inflow, upstream reservoir capacity, and its own node water allocation rules. During network construction, the water sources and water-using units of the entire irrigation district are divided into multiple subsystems. Each subsystem has an independent water source and water use structure, and the subsystems are connected through key nodes to form a hierarchical structure.
[0038] Step S2: Based on the information of each node in the topology network, perform initial water allocation, determine and record the water shortage and water allocation deviation of each water-using unit under each water-using type in each priority layer;
[0039] In this step, based on the topology network, the water inflow and demand of each subsystem and its internal water-using units are statistically analyzed, and water is allocated layer by layer according to preset water distribution rules. This step does not involve optimization decision-making; it is only used to obtain the initial water distribution results of the system under the constraints of the given topology and water distribution rules. During the water distribution process, the water shortage of each water-using unit and the deviation between the actual water distribution and the water demand are recorded, providing a quantitative basis for the subsequent construction of the cost vector.
[0040] In practice, the initial water allocation is first determined based on the information of each node in the water resource allocation topology network. This involves calculating the total water inflow of the target subsystem and the water demand of all water-using units within the target subsystem. The initial water allocation is then performed using a combination of three basic rules: priority rules, on-demand ratio rules, and weighted ratio rules. Specifically, in one allocation round, the priority rules are first applied, followed by on-demand ratio rules or weighted ratio rules to ensure that the first priority water use type is satisfied first. The remaining water is then redistributed to the second priority water use type using on-demand ratio rules or weighted ratio rules, and so on, to obtain the initial water allocation scheme.
[0041] Then, during the initial water allocation process, for each water-using unit in each priority layer and for each water-using type, it is determined whether the actual allocation amount of the water-using unit in the priority layer is less than the demand amount. If so, the difference between the demand amount and the actual allocation amount is determined as the water shortage amount of the water-using unit in the priority layer. If not, the difference between the actual water allocation amount and the demand amount is determined as the water allocation deviation amount of the water-using unit in the priority layer.
[0042] Step S3: Determine the total cost vector of each water-using unit based on the water shortage and deviation of each water-using type in each priority layer.
[0043] Based on the water shortage and water allocation deviation results obtained from the above steps, a priority coefficient and a deviation sensitivity coefficient are introduced for each water-using unit. Different water demands are divided into several levels according to their priority, and a corresponding cost component is constructed within each priority level, thus forming a hierarchical cost vector to describe the water allocation status of that water-using unit. Through this cost vector, the guarantee order among different priority water demands is clarified at the mathematical model level, and a unified evaluation basis is provided for the lexicographical optimization of the entire system.
[0044] In specific implementation, for each priority level of each water-using unit, the following steps are performed: The square of the water shortage amount for each water type within the priority level is used as the nonlinear penalty function for each water type within the priority level; the square of the water allocation deviation for each water type within the priority level is used as the quadratic water allocation deviation penalty function; a weighted sum is performed based on the nonlinear penalty function and the weight coefficient for each water type within the priority level to obtain the water shortage cost for each water type within the priority level; a weighted sum is performed based on the quadratic water allocation deviation penalty function and the deviation sensitivity coefficient for each water type within the priority level to obtain the water type deviation cost for each water type within the priority level; the water shortage cost and the water type deviation cost for each water type within the priority level are combined to construct the total cost vector for each water-using unit.
[0045] Furthermore, the step of merging the water use type stratification water shortage cost and water use type stratification deviation cost of the water use unit in each priority layer to construct the stratified total cost vector of the water use unit includes: for each priority layer, calculating the product of the water use type stratification deviation cost of the water use unit in the priority layer and the corresponding penalty coefficient; calculating the sum of the product and the water use type stratification water shortage cost of the water use unit in the priority layer to obtain the stratified cost vector of the water use unit in the priority layer; and merging the stratified cost vectors of the water use unit in each priority layer to obtain the stratified total cost vector of the water use unit.
[0046] Step S4: Based on the total cost vector of each water-using unit, construct the lexicographically ordered hierarchical optimization objective. Using a post-order traversal dynamic programming method, starting from the lowest subsystem of the topology network, merge and optimize the water allocation schemes of each system layer by layer to obtain the optimal water allocation result of the entire system. The optimization objective is to minimize the sum of the total cost vector of the entire system hierarchical structure among all feasible water allocation schemes, according to the lexicographical criterion.
[0047] Based on the directed acyclic topology network constructed in step S1 and the hierarchical total cost vector defined in step S3, a post-order traversal dynamic programming method is adopted to merge and optimize the water allocation schemes of each subsystem, starting from the lowest-level subsystem and moving upwards layer by layer. Under the premise of satisfying water volume constraints and network topology constraints, the lexicographical minimization of the hierarchical cost vector is used as the optimization criterion. Finally, the optimal water allocation result of the entire system is obtained at the root node, realizing the global optimal allocation of irrigation district water resources.
[0048] In practical implementation, the lowest-level subsystem can be taken as the current system, and the following water allocation scheme optimization steps can be performed: Based on the hierarchical total cost vector of each water-using unit in the current system, a value function is constructed; the value function is used to represent the value that minimizes the sum of the hierarchical cost vectors among all feasible water allocation schemes under the total water volume constraint of the current system, selected in lexicographical order; based on the value function, all feasible water allocation schemes are traversed to determine the optimal sub-water allocation scheme corresponding to the current system; the intermediate subsystem above the current system is taken as the current system again, and the water allocation scheme solution steps are continued until the entire global system is traversed; starting from the global system, backtracking downwards, the optimal water allocation amount for each water-using unit is determined based on the optimal sub-water allocation scheme determined at each level, and the optimal water allocation result of the entire system is obtained.
[0049] See Figure 2 The flowchart of another intelligent water allocation method based on topology and dynamic programming is shown below, with the specific steps as follows:
[0050] In S1, a water resource allocation network for the irrigation district is constructed based on topographic information and actual data. This network adopts the form of a directed acyclic graph (DAG), where nodes represent water-using units, and directed edges represent the direction of water flow, describing the flow path of water from the water source to the water-using unit. Each node... Each node contains information such as water demand, priority coefficient, deviation sensitivity coefficient, inflow, upstream reservoir capacity, and its own node water allocation rules. During network construction, the water sources and water use units of the entire irrigation district are divided into multiple subsystems. Each subsystem has an independent water source and water use structure, and the subsystems are connected through key nodes to form a hierarchical structure.
[0051] In S2, the system starts from the subsystems at the bottom layer of the network and uses water allocation rules to allocate the initial water volume. The specific process of the water allocation rules is as follows:
[0052] S21: Calculate the total inflow of the target subsystem (including water supply from upstream reservoirs and local water inflow) and the classified water demand of all water-using units within it (domestic, ecological, agricultural, and industrial), and perform initial water allocation. The initial allocation is based on a combination of the following three basic rules:
[0053] Priority rules: Based on user-input configuration, the order of each priority level is determined, and a water allocation method is set for each priority level. The configuration file can include the order of each priority level, the water allocation method (on-demand ratio or weighted ratio), and the weight value (if weighted allocation is used). The priority levels participating in the allocation are determined sequentially. Within each priority level, allocation is performed according to the configuration, choosing between on-demand ratio or weighted ratio. When available water is sufficient, the demand for that level can be fully met. After higher priority types are fully satisfied, the remaining water can be used for the next priority level.
[0054] On-demand ratio rule: Under priority, the total water supply is strictly allocated to all water use types according to their water demand ratio. If the on-demand water demand is less than the water supply, the on-demand water demand is fully met; if the on-demand water demand is greater than the water supply, the water supply is allocated according to the calculation formula.
[0055] Type water distribution = Type water demand / Total water demand of type on demand * Inflow.
[0056] Weighted Allocation Rule: Under priority, if weighted allocation is selected, water is allocated according to the weight ratio of each water-using unit. The weights for each priority level can be configured by the user. First, the weighted calculation is performed. For water types where the allocated water volume exceeds the demand, the allocation is cut off to the demand. The excess water is then redistributed among the types whose demand has not yet been met, based on their weights and remaining demand. This ensures that the allocated water volume does not exceed the respective demand, and the total allocated volume is as close as possible to the available water volume.
[0057] Water allocation by type = available water volume * weight of water use type.
[0058] Combined application: Read the user's input priority and water allocation method (on-demand allocation or weighted allocation). In one allocation round, first use the "priority" rule and the "on-demand ratio" or "weighted ratio" rule to ensure that the first priority water type is satisfied first. Then, the remaining water is allocated to the second priority water type using the "on-demand ratio" or "weighted ratio" rule, and so on, to obtain the initial water allocation plan.
[0059] S22: During the allocation process, if the actual allocated amount to a water-using unit is less than its demand, then record that the unit is short of water, and the amount of water shortage. The formula is: Water shortage = Demand - Actual allocation.
[0060] Record the water distribution deviation for each water-using unit, i.e., the difference between the actual allocated water volume and the required water volume. This deviation is used for subsequent optimization calculations. Deviation = Actual water distribution - Demand.
[0061] S23: Generate initial water distribution schemes for different levels of subsystems and tables of water shortage and deviation for the entire system.
[0062] In S3, a cost vector based on hierarchical priority and deviation sensitivity is further constructed. Building upon the initial water allocation results in S2, a hierarchical priority coefficient and a deviation sensitivity coefficient are introduced for each water-using unit to construct a lexicographically ordered hierarchical optimization objective. This function aims to ensure that high-priority water demand is absolutely met and optimize overall water supply stability through differentiated penalties. The specific steps are as follows:
[0063] S31: Hierarchical Priority Coefficient: For situations where a single water-using unit contains multiple water types with different priorities, all water demands are divided into several levels according to the user-configured priorities. Level 1 represents the highest priority water demand, Level 2 represents the second highest priority water demand, and so on. For water-using units... The Priority water use types introduce weighting coefficients only within the same priority level. This is used to distinguish the importance of different water use types within the same priority level.
[0064] S32: Layered Water Shortage Cost Function: For water use type t of priority level i, the water shortage cost of this priority level is defined as follows:
[0065] ;
[0066] ;
[0067] ;
[0068] in,
[0069] : Indicates the water-using unit number;
[0070] k: indicates the priority level number (the first priority is 1);
[0071] t: Indicates the specific water use type (e.g., domestic) within this priority level;
[0072] : Represents the water demand of the i-th water-using unit, the k-th priority layer, and the t-th water-using type;
[0073] : Represents the actual water allocation obtained by the i-th water-using unit, the k-th priority layer, and the t-th water-using type under the current scheme;
[0074] : Represents the water shortage of the i-th water-using unit, the k-th priority layer, and the t-th water-using type;
[0075] : Represents the nonlinear penalty function for the i-th water use unit, the k-th priority layer, and the t-th water use type; used to characterize the severity of water shortage, and its value increases monotonically with the water shortage.
[0076] : Represents the weight coefficient of the i-th water use unit, the k-th priority layer, and the t-th water use type;
[0077] : Represents the water shortage cost of the i-th water-using unit and the k-th priority layer water-using type.
[0078] S33: Layered Deviation Cost Function: To improve water supply stability, a deviation cost term is introduced within each priority layer to penalize the deviation between the actual water distribution and the water demand.
[0079] ;
[0080] ;
[0081] ;
[0082] : Represents the water allocation deviation for the i-th water-using unit, the k-th priority layer, and the t-th water-using type;
[0083] : Represents the secondary water allocation deviation penalty function for the i-th water use unit, the k-th priority layer, and the t-th water use type. This function is used to penalize the deviation between the actual water allocation and the water demand. Regardless of whether the deviation is positive or negative, the larger the absolute value of the deviation, the greater the corresponding penalty cost.
[0084] : Represents the deviation sensitivity coefficient of the i-th water use unit, the k-th priority layer, and the t-th water use type, which only plays a role within the same priority layer;
[0085] : Represents the water use type stratification deviation cost function for the i-th water use unit and the k-th priority layer.
[0086] S34: Construction of Hierarchical Cost Vector for a Single Node:
[0087] The water shortage cost and deviation cost of the i-th water-using unit at each priority level are combined to construct its hierarchical total cost vector:
[0088] ;
[0089] in:
[0090] ;
[0091] in, The deviation cost weighting coefficient is used to adjust the relative importance between water shortage cost and water allocation deviation cost within the k-th priority layer. It only plays a role within the same priority layer and does not participate in the comparison between different priority layers. Therefore, it will not affect the absoluteness of priority guaranteed by the hierarchical lexicographical optimization structure.
[0092] S35: Lexicographical hierarchical optimization objective.
[0093] The global optimization objective of the entire irrigation district's water resource allocation network is defined as: among all feasible water allocation schemes, minimizing the sum of the total hierarchical cost vectors of the entire system according to the lexicographical order criterion, that is:
[0094] ;
[0095] Specifically, the system first minimizes the total cost of water use for the first priority; then, among all schemes with the minimum total cost for the first priority, it minimizes the total cost of water use for the second priority; and so on, until the lowest priority. Since the hierarchical cost vectors of each subsystem are additive at the same priority level, and lexicographical comparisons are only performed within the same dimension, summing the components of the subsystem cost vectors and then comparing them lexicographically still satisfies the Bellman optimality principle.
[0096] In S4, based on the irrigation district water resource allocation network (DAG) constructed in S1 and the total cost vector function defined in S3, a post-order traversal dynamic programming method is further adopted to merge and optimize layer by layer starting from the downstream subsystem, ultimately obtaining the globally optimal water allocation scheme that satisfies the network topology and water resource constraints. The specific steps are as follows:
[0097] S41: Dynamic Programming: State Definition and Optimization Objective.
[0098] The core of dynamic programming (DP) is to decompose a complex global optimization problem into a series of hierarchical subproblems. For each node in the network, i.e., a subsystem, its state and value function are defined. In actual computation, continuous water volume is discretized into a set of water volume states with finite step sizes to ensure that the state space of dynamic programming is finite and computable.
[0099] State variables This represents the total available water allocated to the subtree rooted at node j (i.e., that node and all its downstream water-using units). This water comes from its upstream distribution nodes.
[0100] Decision variables , :exist Of the total water volume, This represents the amount of water that node j retains for its own consumption; This represents the amount of water that node j sends to its direct child node c.
[0101] S uses water at node j itself. and the amount of water obtained by each sub-node The water volume is allocated among the water sources to satisfy the water balance constraint. .
[0102] Value function The value function is a k-dimensional vector representing the total water volume. Under the given conditions, the minimum total cost vector of the subtree rooted at node j is the minimum level that can be achieved; its comparison and minimization are performed according to the lexicographical criterion of S35.
[0103] ;
[0104] Given S, the minimum total cost vector for each level that can be reached within a subtree, with the vectors being lexicographically ordered.
[0105] The global optimization objective is formally expressed as: obtaining the total water volume at the root node (the upstream node). Under the given conditions, find its value function (i.e., the minimum hierarchical total cost vector of the entire system) and the corresponding optimal water allocation scheme. This objective is equivalent to minimizing the sum of the cost vectors of all water-using units in lexicographical order, i.e.:
[0106] .
[0107] S42: Dynamic programming recurrence equation.
[0108] The solution employs a bottom-up recursive approach. For any node j in the network, its value function... The recursive calculation depends on its type:
[0109] Leaf nodes (lowest-level subsystem):
[0110] leaf node It has no child nodes, and all the water it receives... It is entirely used for itself. Its value function is directly given by the total cost function of the cell in S3:
[0111] ;
[0112] in, The calculation requires calling the cost vector in S3, and... As the actual water supply Substitute. This calculation implicitly includes its internal optimized allocation of different water use types (domestic, ecological, agricultural, and industrial).
[0113] Non-leaf nodes (subsystems / water distribution nodes):
[0114] Non-leaf nodes The total amount of water obtained needs to be The resource allocation is performed among itself and all its child nodes to minimize the total cost of the subtree. Its value function is obtained by solving a resource allocation subproblem:
[0115] ;
[0116] Constraints:
[0117] ;
[0118] ;
[0119] in: It is the water consumption of node j itself. The resulting cost vector, It is the child node c that obtains the water volume The vector-valued function at time, with constraints ensuring that the allocated water volume does not exceed the total available water volume. lexmin represents all feasible water allocation schemes ( In the lexicographical order, select the vector that results in the desired outcome. The minimum value.
[0120] S43: Steps of the dynamic programming algorithm.
[0121] Based on the above recursive relationship, the algorithm performs the following steps:
[0122] S431: Initialize leaf node calculation.
[0123] For all leaf nodes (lowest-level subsystem) , iterate through all possible discrete water volumes .
[0124] For each possible Calculate its cost It calculates and stores the optimal cost vector and its optimal decision under this water volume, and completes the independent optimization of all the lowest-level subsystems.
[0125] S432: Merge layer by layer from bottom to top.
[0126] Starting from the bottom layer of the network, each non-leaf node is processed sequentially in reverse topological order. First, the optimal water allocation scheme for its downstream child nodes is calculated, i.e., the optimal cost for each child node. Then, the nodes are traversed, and the total cost for each water volume is calculated. Specifically, water volume is allocated to child nodes, the water volume of each child node is updated, and the cost of each child node is calculated by combining the results.
[0127] Taking node G as an example (its child nodes are N, O, and P):
[0128] Total water volume that can be obtained by traversing G ;
[0129] For each Solving the optimization problem: How to... Assigned to itself and three child nodes , making Minimum, and meets water quantity constraints;
[0130] Record the corresponding minimum cost and optimal allocation scheme .
[0131] This process recursively moves upwards. Next, node D is processed, with child nodes (J, K, G). At this point, child node G... The function has already been calculated in the previous step and can be called directly to solve the resource allocation subproblem of D, yielding the results. And the optimal solution.
[0132] And so on, calculating the value function for each node in each layer.
[0133] S433: Root node solution and global solution backtracking.
[0134] After calculating the optimal water distribution schemes for all leaf nodes and non-leaf nodes, calculate the value function of root node A. ,in This represents the total available water volume in the irrigation district. The value of is the global minimum total cost, and the corresponding allocation scheme is the global optimal water allocation scheme.
[0135] Starting from root node A, based on the optimal decision stored at each step... By tracing back down, we can obtain the optimal water allocation for each node in the network and all water-using units. Ultimately, a detailed and optimized water distribution plan is obtained.
[0136] To explain the present invention more clearly, a specific embodiment is provided below to illustrate the specific implementation method of the present invention.
[0137] Step 1: Topology Modeling. Construct a water resource allocation network, represented using a directed acyclic graph (DAG), such as... Figure 3 As shown, nodes (AI) represent water-using units, and edges represent water flow paths. Each node contains information such as water inflow, water demand, and water distribution rules. Multiple subsystems are connected through key nodes, forming a hierarchical network.
[0138] The lowest level subsystem: the leaf-level subsystem, the starting point of dynamic programming calculation, the smallest water-using unit group, is the starting point of dynamic programming calculation.
[0139] Subsystem _D = {D} (D is a leaf node, which itself constitutes a subsystem);
[0140] Subsystem _E = {E, H, I} (E is the watershed node, and H and I are its direct child nodes);
[0141] Subsystem _F = {F} (F is a leaf node);
[0142] Subsystem _G = {G} (G is a leaf node);
[0143] The intermediate layer subsystem is formed by the merging of the water distribution node and its downstream leaf system.
[0144] Subsystem _B = {B, D, E, H, I} (B is the watershed node, and D and E are its direct child nodes);
[0145] Subsystem _C = {C, F, G} (C is the watershed node, and F and G are its direct child nodes);
[0146] Global System:
[0147] The global system = {A, B, C, D, E, F, G, H, I} (A is the root node, and B and C are its direct child nodes); the root node A merges with all downstream subsystems to form a complete irrigation district network.
[0148] Step 2: Based on the statistical data of water inflow and demand, allocate water according to traditional water distribution rules, and record the water shortage and deviation.
[0149] The calculation process is as follows: First, the traditional water allocation schemes for the bottom-level subsystems D, E (H, I), F, and G are calculated to obtain the water shortage and deviation amounts. Then, the water allocation schemes for the intermediate-level systems B and C are calculated, and new water shortage and deviation amounts are recorded. Finally, node A receives the water shortage summary table from its downstream subsystems B and C, and, combining its own inflow and demand, performs an initial allocation among B, C, and itself according to the water allocation rules. This allocation result may prevent subsystems B and C from obtaining sufficient water, thus generating new, global water shortage and deviation amounts. These final water shortage and deviation amounts are the inputs for calculating the "water shortage cost" and "deviation cost" in S3.
[0150] The final output of step S2 is a table showing the total water shortage and deviation of the entire system. This table clearly shows where the "insufficiency" of water is manifested under the traditional rules (water shortage) and the distance between the actual allocation and the ideal demand (deviation). Based on this, step S3 will apply different penalties to different water shortages, and then step S4 will use dynamic programming to find a global optimization scheme that minimizes the total penalty.
[0151] Step 3: Based on the initial water allocation results of S2, construct a hierarchical optimization structure based on absolute priority for this model. For cases where a single water-using unit contains multiple water-using types (domestic, ecological, agricultural, industrial) with varying priorities, define the following for the k-th water-using type in water-using unit H:
[0152] 1. Calculation of the hierarchical cost vector (taking water-using unit H as an example):
[0153] For water-using unit H, its optimal state is described by a K-dimensional cost vector. The cost components for each priority level k are calculated. .
[0154] 2. Calculate the cost of stratified water shortage. :
[0155] ;
[0156] ;
[0157] ;
[0158] Name of the water-using unit;
[0159] Priority level number (first priority is 1);
[0160] : The specific water usage type within this priority level (e.g., domestic);
[0161] : The water demand of the k-th priority level and the t-th water type in water use unit H;
[0162] : The actual water allocation obtained by the k-th priority level and t-th water type in water use unit H under the initial water allocation scheme;
[0163] : In water use unit H, the water shortage of the k-th priority layer and the t-th water use type;
[0164] : A nonlinear penalty function for the severity of water shortage, whose value increases monotonically with the amount of water shortage;
[0165] Water supply unit In the middle, the first Weighting coefficient of water type t within the priority layer;
[0166] : In water use unit H, the water shortage cost of water use type stratification in the k-th priority layer.
[0167] 3. Calculate the cost of stratification bias. :
[0168]
[0169]
[0170]
[0171] : In water use unit H, the water distribution deviation of the k-th priority level and the t-th water use type;
[0172] Secondary water distribution deviation penalty function: This function is used to penalize the deviation between the actual water distribution and the water demand. Regardless of whether the deviation is positive or negative, the larger the absolute value of the deviation, the greater the corresponding penalty cost.
[0173] The bias sensitivity coefficient only applies within the same priority level.
[0174] : Water use type stratification deviation cost within the k-th priority layer of water use unit H.
[0175] 4. Merge into hierarchical total cost components:
[0176] ;
[0177] Setting it to 0.1 indicates that within the same k-priority layer, while ensuring that water demand is met first, a moderate penalty is imposed on water allocation deviations.
[0178] Finally, the cost vector for water-using unit H is obtained (assuming there are N priorities): ;
[0179] 5. Global lexicographical order optimization goal:
[0180] The global optimization objective for the entire irrigation district is to minimize the sum of the cost vectors of all water-using units in lexicographical order.
[0181] ;
[0182] The meaning of lexicographical comparison: The system first searches among all feasible solutions for the one that minimizes the total cost of the first priority solution. A set of solutions. Then, within this set, find the solution that minimizes the total cost of the second priority. The smallest subset of solutions, and so on. This ensures that optimizations of the first priority are absolutely unaffected by the cost of optimizations of the second priority.
[0183] Step 4: In this step, based on the irrigation district water resource allocation network (DAG) constructed in S1 and the total cost vector defined in S3, a bottom-up post-order traversal dynamic programming method will be used to merge and optimize layer by layer starting from the downstream subsystem, and finally obtain the globally optimal water allocation scheme that satisfies the network topology and water resource constraints.
[0184] Calculate the bottom-level leaf node (H, I, D, F, G) This yields the function table.
[0185] These nodes have no downstream, and the water they receive... All used for itself. Traversal. For each possible volume of water Calculate its cost vector .
[0186] Post-order traversal merging:
[0187] Merge intermediate subsystem E (node E merges H, I), the total water volume of subsystem E It is necessary to allocate resources among E itself, H, and I to minimize the sum of the cost vectors of all water-using units. Given... And assuming no additional water is obtained from upstream B initially, the initial total cost is: For different Calculate its minimum cost.
[0188] ;
[0189] ;
[0190] During calculation, it is necessary to traverse all possible allocation combinations. For each combination, look up the function from the pre-calculated function table. These three vectors are then added together component by component to obtain a single vector.
[0191] Finally, among all allocation schemes that satisfy the water quantity constraint, the scheme with the smallest result vector is selected in lexicographical order. The water allocation corresponding to this scheme is the allocation of node E in a given area with a total water quantity of [missing value]. The optimal decision at that time, the smallest result vector is .
[0192] Merge node B (node B merges with D and subsystem E), node B is a water distribution node, and its total water volume It needs to be allocated among B itself, D, and subsystem E.
[0193] The optimization issues are as follows:
[0194] ;
[0195] constraint: , here, and It's a known function (from the previous step). We need to iterate through all possible functions. and to ( The search is performed to find the solution. In this way, the value of node B can be calculated. The resulting vector. Similarly, merging node C yields... The resulting vector.
[0196] Global optimization: The optimization problem of root node A, i.e., global optimization:
[0197] ;
[0198] constraint: , here, and It's a known function (from the previous step). We need to iterate through all possible functions. In this way, the value of node A can be calculated. Function result vector.
[0199] The final water distribution plan was obtained by tracing back:
[0200] Starting with the optimal decision at root node A, we backtrack downwards to query the optimal sub-allocation at each step, and finally obtain a detailed optimized water allocation scheme from A to I.
[0201] By using a dynamic programming-based intelligent water allocation model based on topological relationships, a water allocation scheme with the minimum global cost is obtained under the constraint of limited total water volume.
[0202] The intelligent water allocation method based on topological relationships and dynamic programming provided in this application constructs a vectorized hierarchical cost function and a lexicographical dynamic programming optimization framework, forming a logically rigorous and computationally efficient technical solution. By employing a hierarchical cost vector and defining priority coefficients for different water use types, a multi-dimensional cost vector is constructed for each water use unit, ensuring at the mathematical model level that high-priority water use demands are absolutely prioritized. Simultaneously, this solution innovatively uses lexicographical optimization as the global objective, performing state recursion and decision-making through lexicographical comparison. Starting from the downstream subsystem, a post-order traversal dynamic programming algorithm is used to decompose the complex global optimization problem into a series of hierarchical subproblems for recursive solution. This process strictly adheres to the Bellman optimality principle, ensuring that the final water allocation scheme is the globally optimal solution satisfying network topology and water quantity constraints. This scheme not only avoids computational explosion by discretizing the state space, achieving solvability of large-scale problems, but also fits the tree-like or DAG network structure of irrigation districts, ultimately achieving a scientifically optimized allocation that balances security, fairness, and efficiency under water scarcity conditions.
[0203] Based on the above method embodiments, this application also provides an intelligent water quantity optimization and allocation device based on topological relationships and dynamic programming. See [link to relevant documentation]. Figure 5 As shown, the device includes: a topology construction module 51, used to construct a water resource allocation topology network within the irrigation area; the topology network is a multi-level structure containing a global system, intermediate subsystems, and the lowest-level subsystem; each node in the topology network represents a water-using unit; each edge represents a water flow transmission path; the information of each node includes water demand, water inflow, water use priority, and water allocation rules; an initial water allocation module 52, used to perform initial water allocation based on the information of each node in the topology network, and to determine and record the water shortage and water allocation deviation of each water-using unit under each water use type in each priority layer; and a cost vector determination module 53. The first module is used to determine the total cost vector of each water-using unit based on the water shortage and deviation of each water-using type in each priority layer. The second module is used to construct a lexicographically ordered hierarchical optimization objective based on the total cost vector of each water-using unit. It adopts a dynamic programming method with post-order traversal to merge and optimize the water allocation schemes of each system from the bottom subsystem of the topology network layer by layer to obtain the optimal water allocation result of the whole system. The optimization objective is to minimize the sum of the total cost vector of the whole system according to the lexicographical criterion among all feasible water allocation schemes.
[0204] Furthermore, the aforementioned initial water allocation module 52 is used to calculate the total water inflow of the target subsystem and the classified water demand of all water-using units within the target subsystem based on the information of each node in the water resource allocation topology network, and to perform initial water allocation according to the following three basic rules: priority rule, demand-based ratio rule, and weighted ratio rule. During the initial water allocation process, for each water-using unit in each priority layer and for each water-using type, it is determined whether the actual allocation amount of the water-using unit under the water-using type in the priority layer is less than the demand amount. If so, the difference between the demand amount and the actual allocation amount is determined as the water shortage amount of the water-using unit under the water-using type in the priority layer; if not, the difference between the actual allocation amount and the demand amount is determined as the water allocation deviation amount of the water-using unit under the water-using type in the priority layer.
[0205] Furthermore, the aforementioned initial water allocation module 52 is used in one allocation round to first use a priority rule, an on-demand ratio rule, or a weighted ratio rule to ensure that the first priority water use type is satisfied first; then, the remaining water volume is further allocated to the second priority water use type using an on-demand ratio rule or a weighted ratio rule, and so on, to obtain the initial water allocation scheme.
[0206] Further, the aforementioned cost vector determination module 53 is used to perform the following steps for each priority layer of each water-using unit: The square of the water shortage amount of the water-using unit under each water-using type within the priority layer is used as the nonlinear penalty function for the water-using unit under each water-using type within the priority layer; the square of the water allocation deviation amount of the water-using unit under each water-using type within the priority layer is used as the quadratic water allocation deviation penalty function for the water-using unit under each water-using type within the priority layer; a weighted sum is performed based on the nonlinear penalty function of the water-using unit under each water-using type within the priority layer and the weight coefficient of the water-using unit under each water-using type within the priority layer to obtain the water shortage cost of the water-using unit in the priority layer; a weighted sum is performed based on the quadratic water allocation deviation penalty function of the water-using unit under each water-using type within the priority layer and the deviation sensitivity coefficient of the water-using unit under each water-using type within the priority layer to obtain the water allocation deviation cost of the water-using unit in the priority layer; the water shortage cost and the water allocation deviation cost of the water-using unit in each priority layer are merged to construct the total cost vector of the water-using unit.
[0207] Furthermore, the aforementioned cost vector determination module 53 is used to calculate, for each priority layer, the product of the water use type stratification deviation cost of the water use unit in the priority layer and the corresponding penalty coefficient; calculate the sum of the product and the water use type stratification water shortage cost of the water use unit in the priority layer to obtain the stratification cost vector of the water use unit in the priority layer; and merge the stratification cost vectors of the water use unit in each priority layer to obtain the total stratification cost vector of the water use unit.
[0208] Furthermore, the aforementioned water allocation optimization module 54 is used to: take the lowest-level subsystem as the current system and execute the following water allocation scheme optimization steps: construct a value function based on the hierarchical total cost vector of each water-using unit in the current system; the value function is used to represent the value that minimizes the sum of the hierarchical cost vectors among all feasible water allocation schemes under the total water volume constraint of the current system, selected in lexicographical order; based on the value function, traverse all feasible water allocation schemes to determine the optimal sub-water allocation scheme corresponding to the current system; take the upper-level intermediate subsystem of the current system as the current system again and continue to execute the water allocation scheme solution steps until the entire global system is traversed; starting from the global system, backtrack downwards and determine the optimal water allocation amount for each water-using unit based on the optimal sub-water allocation scheme determined at each level to obtain the optimal water allocation result for the entire system.
[0209] Furthermore, the aforementioned water distribution optimization module 54 determines the value function according to the following formula if the current system is the lowest-level subsystem:
[0210] ;
[0211] in, S represents the total water volume of the current system. l Value function when used entirely for itself; S represents l Substitute the actual allocation amount into the hierarchical total cost vector of the water-using unit corresponding to the current system;
[0212] If the current system is not a bottom-level subsystem, the value function is determined according to the following formula:
[0213] ;
[0214] Constraints:
[0215] ;
[0216] ;
[0217] in, S represents the total water volume of the current system. j Value function used for itself and downstream water-using units; This indicates that the current system will use water volume w j The total cost vector of the hierarchical structure when used for itself; This indicates the optimal water allocation w for downstream water users. c The value function at time.
[0218] The device provided in this application embodiment has the same implementation principle and technical effect as the aforementioned method embodiment. For the sake of brevity, any parts of the device embodiment not mentioned can be referred to the corresponding content in the aforementioned method embodiment.
[0219] This application also provides an electronic device, such as... Figure 6 The diagram shows the structure of the electronic device, which includes a processor 61 and a memory 60. The memory 60 stores computer-executable instructions that can be executed by the processor 61, and the processor 61 executes the computer-executable instructions to implement the above-described method.
[0220] exist Figure 6 In the illustrated embodiment, the electronic device further includes a bus 62 and a communication interface 63, wherein the processor 61, the communication interface 63, and the memory 60 are connected via the bus 62.
[0221] The memory 60 may include high-speed random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 63 (which can be wired or wireless), such as the Internet, wide area network, local area network, metropolitan area network, etc. The bus 62 may be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus, etc. The bus 62 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.
[0222] Processor 61 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of processor 61 or by instructions in software form. Processor 61 can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of this application can be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in the memory, and the processor 61 reads the information in the memory and, in conjunction with its hardware, completes the steps of the method described in the foregoing embodiment.
[0223] This application also provides a computer-readable storage medium storing computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions cause the processor to implement the above-described method. For specific implementation details, please refer to the foregoing method embodiments, which will not be repeated here.
[0224] The computer program products of the methods, apparatus, and electronic devices provided in the embodiments of this application include a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the preceding method embodiments. For specific implementations, please refer to the method embodiments, which will not be repeated here.
[0225] Unless otherwise specifically stated, the relative steps, numerical expressions, and values of the components and steps described in these embodiments do not limit the scope of this application.
[0226] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0227] In the description of this application, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this application. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0228] Finally, it should be noted that the above-described embodiments are merely specific implementations of this application, used to illustrate the technical solutions of this application, and not to limit them. The protection scope of this application is not limited thereto. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the technical scope disclosed in this application. Such modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be covered within the protection scope of this application. Therefore, the protection scope of this application should be determined by the protection scope of the claims.
Claims
1. A smart water allocation optimization method based on topological relationships and dynamic programming, characterized in that, The method includes: Construct a water resource allocation topology network within the irrigation district; the topology network is a multi-level structure containing a global system, intermediate subsystems, and the lowest-level subsystem; each node in the topology network represents a water-using unit; each edge represents a water flow transmission path; the information of each node includes water demand, water inflow, water use priority, and water allocation rules. Based on the information of each node in the topology network, the initial water allocation is carried out, and the water shortage and water allocation deviation of each water-using unit under each water-using type in each priority layer are determined and recorded. Based on the water shortage and deviation of each water-using unit under each water-using type in each priority layer, determine the hierarchical total cost vector for each water-using unit, including: for each priority layer of each water-using unit, perform the following steps: use the square of the water shortage of the water-using unit under each water-using type in the priority layer as the nonlinear penalty function of the water-using unit under each water-using type in the priority layer; use the square of the water allocation deviation of the water-using unit under each water-using type in the priority layer as the quadratic water allocation deviation penalty function of the water-using unit under each water-using type in the priority layer; and perform a weighted summation based on the nonlinear penalty function of the water-using unit under each water-using type in the priority layer and the weight coefficient of the water-using unit under each water-using type in the priority layer. The water-use unit is then assigned a stratified water shortage cost for each water use type within the priority layer. Based on the quadratic water allocation deviation penalty function for each water use type within the priority layer, a weighted sum is calculated with the deviation sensitivity coefficient for each water use type within the priority layer to obtain the stratified deviation cost for each water use type within the priority layer. For each priority layer, the product of the stratified deviation cost for each water use type within the priority layer and the corresponding penalty coefficient is calculated. The sum of this product and the stratified water shortage cost for each water use type within the priority layer is then calculated to obtain the stratified cost vector for each water use unit within the priority layer. Finally, the stratified cost vectors for each water use unit within each priority layer are merged to obtain the total stratified cost vector for each water use unit. Based on the hierarchical total cost vector of each water user unit, a lexicographically ordered hierarchical optimization objective is constructed. Using a post-order traversal dynamic programming method, starting from the lowest-level subsystem of the topology network, the water allocation schemes of each system are merged and optimized layer by layer upwards to obtain the optimal water allocation result for the entire system. This includes: taking the lowest-level subsystem as the current system, and performing the following water allocation scheme optimization steps: Based on the hierarchical total cost vector of each water user unit in the current system, a value function is constructed; the value function represents the lexicographically ordered selection of the feasible water allocation schemes among all feasible water allocation schemes under the total water constraint of the current system. The minimum value of the layer cost vector is obtained; based on the value function, all feasible water allocation schemes are traversed to determine the optimal sub-water allocation scheme corresponding to the current system; the intermediate subsystem above the current system is taken as the current system again, and the water allocation scheme solution steps are continued until the entire global system is traversed; starting from the global system, backtracking downwards, the optimal water allocation for each water-using unit is determined according to the optimal sub-water allocation scheme determined at each layer, and the optimal water allocation result of the entire system is obtained; the optimization objective is to minimize the sum of the total layer cost vector of the entire system among all feasible water allocation schemes, according to the lexicographical order criterion.
2. The method according to claim 1, characterized in that, Based on the information of each node in the topology network, the steps of initial water allocation, determining and recording the water shortage and water allocation deviation of each water-using unit under each water use type in each priority layer include: Based on the information of each node in the water resource allocation topology network, the total water inflow of the target subsystem and the classified water demand of all water-using units within the target subsystem are statistically analyzed, and the initial water allocation is combined according to the following three basic rules: priority rule, demand ratio rule, and weight ratio rule. During the initial water allocation process, for each water user unit in each priority layer and for each water type, it is determined whether the actual allocation amount of the water user unit under the water type in the priority layer is less than the demand amount. If yes, the difference between the demand amount and the actual allocation amount is determined as the water shortage amount of the water user unit under the water type in the priority layer. If no, the difference between the actual water allocation amount and the demand amount is determined as the water allocation deviation amount of the water user unit under the water type in the priority layer.
3. The method according to claim 2, characterized in that, The steps for combining initial water allocation based on the following three categories of basic rules include: In one allocation round, priority rules are first applied, and on-demand ratio rules or weighted ratio rules are used to ensure that the first priority water use type is satisfied first. Then, the remaining water is further allocated to the second priority water use type using on-demand ratio rules or weighted ratio rules, and so on, to obtain the initial water allocation plan.
4. The method according to claim 1, characterized in that, The steps for determining the value function based on the hierarchical total cost vector of each water-using unit in the current system include: If the current system is the lowest-level subsystem, the value function is determined according to the following formula: ; in, The total water volume S of the current system is represented by the following. l Value function when used entirely for itself; express Substitute the actual allocation amount into the hierarchical total cost vector of the water-using unit corresponding to the current system; If the current system is not the lowest-level subsystem, the value function is determined according to the following formula: ; Constraints: ; ; in, This indicates the total water volume of the current system. Value function used for itself and downstream water-using units; This indicates that the current system will use water volume The total cost vector of the hierarchical structure when used for itself; This indicates the optimal water allocation for downstream water users. The value function at time.
5. A smart water allocation optimization device based on topological relationships and dynamic programming, characterized in that, The apparatus for implementing the method as described in any one of claims 1-4 includes: The topology construction module is used to construct a water resource allocation topology network within the irrigation district. The topology network is a multi-level structure containing a global system, intermediate subsystems, and the lowest-level subsystem. Each node in the topology network represents a water-using unit. Each edge represents a water flow transmission path. The information of each node includes water demand, water inflow, water use priority, and water allocation rules. The initial water allocation module is used to perform initial water allocation based on the information of each node in the topology network, and to determine and record the water shortage and water allocation deviation of each water-using unit under each water-using type in each priority layer. The cost vector determination module is used to determine the hierarchical total cost vector for each water use unit based on the water shortage and deviation of each water use type in each priority layer. The water allocation optimization module is used to construct a lexicographically ordered hierarchical optimization objective based on the hierarchical total cost vector of each water-using unit. It adopts a post-order traversal dynamic programming method to merge and optimize the water allocation schemes of each system from the bottom subsystem of the topology network layer by layer to obtain the optimal water allocation result of the whole system. The optimization objective is to minimize the sum of the hierarchical total cost vectors of the whole system according to the lexicographical criterion among all feasible water allocation schemes.
6. An electronic device, characterized in that, The method includes a processor and a memory, the memory storing computer-executable instructions executable by the processor, the processor executing the computer-executable instructions to implement the method of any one of claims 1 to 4.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions that, when invoked and executed by a processor, cause the processor to perform the method described in any one of claims 1 to 4.