Irrigation area water distribution method based on topology and hierarchical perception graph similarity calculation
By modeling the irrigation district water distribution scenario as a directed unweighted graph and performing multi-dimensional feature encoding, and using a relational graph convolutional network to generate a graph-level representation, the problem of inaccurate similarity calculation in the irrigation district water distribution scenario of existing methods is solved, and fast and accurate water distribution scheme recommendation is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHINA UNIV OF GEOSCIENCES (WUHAN)
- Filing Date
- 2025-12-22
- Publication Date
- 2026-05-08
AI Technical Summary
Existing graph similarity calculation methods fail to adapt to the hierarchical, directional, dynamic topology, and multi-dimensional parameter matching of irrigation district water distribution scenarios, resulting in inaccurate similarity calculations and a disconnect between recommended solutions and actual working conditions.
The historical water allocation scheme and the current water demand subgraph are modeled as a directed unweighted graph, multi-dimensional feature encoding is performed, node embedding is extracted using a relational graph convolutional network, and graph-level representation is generated through hierarchical constraint weighted attention aggregation. The similarity score is calculated, and the optimal water allocation scheme is recommended.
It enables rapid and accurate matching of irrigation district water distribution schemes, improves decision-making efficiency, adapts to the differences in canal system topology of irrigation districts of different sizes, and meets real-time water distribution needs.
Smart Images

Figure CN121998296A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of intelligent water distribution, and in particular to a water distribution method for irrigation districts based on topological and hierarchical perception graph similarity calculation. Background Technology
[0002] In irrigation district water resource allocation, the scientific recommendation of water distribution schemes is a core element in improving water resource utilization efficiency and ensuring agricultural production. For a long time, the mainstream approach to formulating irrigation district water distribution schemes has been a multi-objective optimization method. This involves constructing multiple objective functions, such as water demand satisfaction, water distribution cost, and water resource utilization rate, and combining these with constraints such as canal flow and irrigation time to find the optimal water distribution scheme. However, this method has key limitations in practical applications: Firstly, it requires manual, subjective setting of the weight coefficients for each objective, which is difficult to adjust for different crops and different growth stages, leading to significant human influence on the scheme's adaptability. More importantly, this method fails to effectively utilize existing successful water distribution schemes and cannot reuse historical engineering experience. Instead, it starts from scratch to find the numerically optimal solution each time, ignoring the canal system adaptation logic inherent in historical schemes and resulting in low decision-making efficiency, making it difficult to meet the real-time water distribution needs of the irrigation district.
[0003] In the application scenario of this study, the core requirement of the water distribution scheme is to quickly match a scheme suitable for the current scenario based on historical successful experience. The topological relationships of the canal system, the water demand distribution of each canal system, and the water flow allocation ratio in the irrigation district water distribution scheme are essentially problems of "entities and relationships." Graph structures can naturally reproduce these core characteristics, especially the directional nature of water flow from the main canal to the branch canal, which is the core carrier of the water distribution logic. The graph similarity calculation method, by comparing the graph structure similarity between historical schemes in the knowledge base and the current scenario, can achieve efficient reuse of historical experience. Compared with the approach of solving multi-objective optimization from scratch, this method achieves the reuse of historical experience.
[0004] However, existing graph similarity calculation methods are not adapted to the core features of irrigation district scenarios, making them difficult to apply directly. In traditional graph similarity index calculations, graph edit distance (GED) is a commonly used method, which measures similarity by calculating the minimum number of modification operations between two graphs. However, this method is an NP-hard problem; as the number of nodes in the graph increases, the computational complexity grows exponentially, failing to meet real-time matching requirements. Although pruning strategies and heuristic methods exist for approximate calculations, the uncertainty of suboptimal solutions still limits their application in engineering scenarios.
[0005] With the development of deep learning technology, graph neural network-based methods have emerged. While these methods improve computational efficiency through feature extraction, they still fail to address the core pain points of irrigation district scenarios. SimGNN, as an early representative model, failed to effectively capture the positional information of nodes within the canal system topology. The different positions of branch canals downstream of the main canal directly affect the water distribution ratio, and it also ignored the directionality of edges. However, the directional logic of water flow in irrigation districts is the core of the water distribution scheme; the lack of both leads to incomplete feature representation and insufficient matching accuracy. The recently proposed ERIC framework, while optimizing training efficiency and discriminative ability through alignment regularization modules and multi-scale GED discriminators, is not adapted to the hierarchical characteristics of irrigation district canal systems. It cannot accurately capture the functional differences between main and branch canals and the constraints of water flow direction. Furthermore, its reliance on single-dimensional fusion in similarity calculation makes it difficult to consider the synergistic effects of node attributes, topological location, and engineering parameters, resulting in insufficient comprehensiveness in its suitability assessment.
[0006] To address the aforementioned pain points, this study proposes a graph similarity calculation method adapted to irrigation district scenarios. Relying on historical water allocation schemes in a knowledge base, it obtains node embeddings through random walks to accurately capture topological location and directed edge association information. At the same time, it designs a dual-channel calculation mode to integrate multi-dimensional similarity scores, specifically addressing the core defects of existing methods and achieving fast and accurate matching of water allocation schemes. Summary of the Invention
[0007] The purpose of this invention is to address the problem that existing graph similarity calculation methods fail to adapt to the hierarchical, directional, dynamic topology, and multi-dimensional parameter matching of irrigation district water distribution scenarios, resulting in inaccurate similarity calculations and a disconnect between recommended solutions and actual working conditions. This invention provides an irrigation district water distribution method based on topology and hierarchical perceptual graph similarity calculation.
[0008] The above-mentioned objective of this application is achieved through the following technical solution: S1: Model the historical water distribution scheme and the current water demand subgraph as directed unweighted graphs respectively; the nodes in the directed unweighted graph represent main canals or branch canals, the edges represent the direction of water flow, and the node attributes include canal length, farmland area, design flow rate and water demand; S2: Perform multi-dimensional feature encoding on each node, including hierarchical encoding, attribute encoding, and random walk position encoding, and fuse them to obtain the node augmented representation; S3: Use a relational graph convolutional network to extract multi-scale features from the node augmentation representation, and introduce a gating mechanism to filter invalid node information to obtain the final node embedding; S4: Based on the final node embedding, hierarchical constraint weighted attention is used to aggregate dual-path features to generate a graph-level representation; S5: Calculate the similarity score between two graphs through graph-level representation and final node embedding, and then perform weighted fusion to obtain the predicted graph edit distance; S6: Based on the predicted distance, recommend the optimal water distribution scheme from the historical scheme library.
[0009] Optionally, step S1 includes: enter and Let represent directed unweighted graphs representing the historical water allocation schemes and current water demand subgraphs of a single irrigation district in the knowledge base, respectively. in: for or ; For a set of nodes, Representing the nodes of the main canal, Represents a branch canal node; for or , It is a set of directed edges, meaning that the direction of water flow can only be from the main canal to the branch canal; for or , The adjacency matrix is If satisfied but ,otherwise ; Define the out-degree matrix It is a diagonal matrix, and its diagonal elements are... , For nodes The out-degree, and satisfying , ; for Nodes, settings To ensure Reversibility; The validity of nodes in a directed unweighted graph of historical water distribution schemes is defined as follows: , correspond or The node, This indicates that the node is valid, i.e., the water demand. And design flow ; This indicates that the node is not enabled and the parameters are invalid.
[0010] Optionally, step S2 includes: The random walk position encoding includes: Constructing a random walk matrix ,in It is an adjacency matrix. This is the out-degree matrix; from Step random walk matrix Extract the node self-visit probability from the diagonal elements and use it as the initial position feature; The initial location features are mapped into dense vectors using a multilayer perceptron, and then concatenated with the node attribute features to obtain the node augmented representation.
[0011] Optionally, step S3 includes: The edge relationships of the directed unweighted graph of historical water distribution schemes are uniquely identified as follows: ,in Representative canal node set , Representative branch canal node set ; Assign learnable weight matrices to edge relationships Dimensions and initial node embedding Maintain consistency; Considering the dominant role of the main canal in water allocation decisions, a hierarchical weighting factor is introduced. : When a node in the main canal aggregates neighbor information, the weight matrix is: ; Branch nodes have no outgoing neighbors, and the weight matrix is inherited by default. ; The relational graph convolutional network is the first The aggregation formula for the layer is: in, , Activation function It is the first The self-loop weight matrix of the layer is used to preserve the feature information of the node itself and avoid the loss of original attributes during the aggregation process; It is a node In relationship The set of neighbors below; It is the normalization coefficient; It represents the Hadamardi (or Hadama) stack; The learnable weight matrix for edge relationships; Indicates residual join terms; Use the Sigmoid activation function; It is the gating coefficient; Embed the initial node with The output features of the layered relational graph convolutional network are concatenated to form the final node embedding.
[0012] Optionally, step S4 includes: The mean vector ultimately embedded by the compute nodes serves as the global context feature. :
[0013] in, Let be the set of nodes in the graph. The total number of nodes. For nodes The node is eventually embedded. For node feature dimensions, It reflects the overall attribute distribution and topological association characteristics of the entire irrigation district; Considering the fusion of global semantics and channel priority, compute nodes The attention score is calculated using the following formula:
[0014] in, As a learnable weight matrix, node features and global context are mapped to the same feature space to enhance the rationality of correlation calculation; This is an attention scoring vector used to quantify the correlation strength between node features and the global context; As a hierarchical identifier for the canal system, the main canal branch canals ; The hierarchy enhancement coefficient is used to amplify the score value of the main canal nodes, ensuring that the main canal occupies a dominant weight in the graph-level representation. It is a non-linear activation function; By adopting the above technical solution, a hierarchical enhancement coefficient and a canal system hierarchical identifier are added on the basis of the general attention score, which are specifically adapted to the business characteristics of irrigation districts where "main canals dominate water distribution and branch canals receive flow"; the weight of main canal nodes is amplified by the hierarchical enhancement coefficient.
[0015] The attention score is converted into normalized weights using the softmax function; Based on the normalized attention weights, a weighted sum of all node features is performed to obtain a graph-level representation focusing on the semantics of core nodes, as shown in the formula:
[0016] An unbiased node feature aggregation strategy is introduced, with the following formula:
[0017] in No additional parameters need to be learned; By dynamically fusing dual-path features using dimension-wise learnable weight vectors, the final graph-level representation is obtained. ,as follows:
[0018] in, For a dimension-wise learnable weight vector, the element values range from 1 to 2. The model can be adjusted according to the dynamic changes in the irrigation district water distribution scenario. and The fusion ratio; The Hadamard product ensures that the feature weights of each dimension are independently adjustable during the fusion process; the final generated It combines core water allocation semantics with global scale features for subsequent similarity calculation.
[0019] Optionally, step S5 includes: The node-level similarity score is calculated using the following steps: The cosine similarity metric is used to quantify the attribute matching degree and local topological association strength between any two nodes, which come from different regions. and Simultaneously, invalid node noise is filtered out through a gating mechanism, the specific formula of which is:
[0020] in, The dot product of the vectors embedded in the two nodes. , These are the L2 norms of the two node embeddings, and the calculated values range from [value missing]. ; For indicator functions, This represents a logical AND operation, which occurs only if both nodes are valid. ,otherwise ; By adopting the above technical solution, a logical AND operation for node validity marking is added to the general cosine similarity formula; this specifically addresses the pain point of "partial canal system not in use (water demand = 0)" in irrigation areas, filtering out invalid node noise. The logical AND operation for node validity marking is added. Based on the filtered similarity value Construct a pairwise node interaction matrix , , They are , Total number of nodes, matrix elements It fully preserves the fine-grained matching information of valid nodes, and the dimension is consistent with the total number of nodes in both graphs; Extracting the node interaction matrix Local strong correlation features and global distribution features: Interaction matrix implement The window max pooling operation, with a sliding step of 1, retains the maximum similarity value within each local window, resulting in the pooling matrix. This strengthens the strong correlation between nodes and suppresses interference from weak correlations. For pooling matrix Calculate the row mean and column mean separately to obtain the row feature vector. With column feature vectors ,in, reflect The Middle Each node and Average matching strength of all nodes reflect The Middle Each node and The average matching strength of all nodes; row feature vector With column feature vectors The concatenated data is then fed into a multilayer perceptron (MLP) to perform nonlinear feature fusion and map it to a scalar, as shown in the following formula:
[0021] in, Here is the weight matrix of the hidden layer in the MLP. For hidden layer bias terms; This is the weight matrix of the MLP output layer. Implement a nonlinear transformation for the activation function; final output The score is a scalar node-level score. The value is negatively correlated with the matching degree of node attributes and local topology between the two graphs. The lower the score, the higher the matching degree. The similarity score at the graph level is calculated as follows: Let the water distribution schemes of the two irrigation districts to be matched be as follows: , The corresponding graph-level representations are as follows: , By fusing tensor second-order interactions and linear interactions, complex semantic relationships between graph-level representations are captured, as shown in the formula:
[0022] in, Represents traversing tensors of A two-dimensional slice , ,calculate The second-order interaction values under each slice form 3D tensor interaction features; It is a linear interaction weight matrix; for and The concatenated vector; These are the higher-order interaction features after fusion; Represents the bias vector; Through MLP The dimensional interaction feature mapping is converted into a similarity score, and the formula is:
[0023] in, For the scoring vector, For bias; The similarity score is at the graph level. Node-level similarity scores Similarity score with graph level Through learnable weighted fusion, we obtain and Edit distance of the predicted map The formula is:
[0024] in, These are learnable weights; To ultimately predict the GED value, the numerical value is related to... and The overall matching degree is negatively correlated.
[0025] An electronic device includes a processor, a memory, a user interface, and a network interface. The memory is used to store instructions, the user interface and the network interface are used to communicate with other devices, and the processor is used to execute the instructions stored in the memory to enable the electronic device to perform an irrigation district water distribution method based on topology and hierarchical perception graph similarity calculation.
[0026] A computer-readable storage medium storing instructions that, when executed, perform an irrigation district water distribution method based on topology and hierarchical perception graph similarity calculation.
[0027] The beneficial effects of the technical solution provided in this application are: Multi-dimensional feature encoding is performed on the nodes of the two graphs: hierarchical encoding is used to distinguish the functions of main canals and branch canals, and initial attribute features are formed by combining core water distribution parameters such as canal length, farmland area, design flow, and water demand. At the same time, global topological location information of nodes is captured by random walk, and node enhancement features with both attribute constraints and topological associations are obtained.
[0028] The R-GCN network, which enhances feature input to adapt to the characteristics of irrigation districts, dynamically filters invalid noise from unused canal systems through dedicated directed edge relation encoding and gating mechanisms, and aggregates and extracts multi-scale local attribute associations and global topological semantics to form a comprehensive node feature embedding.
[0029] A dual-path aggregation strategy is adopted to generate graph-level representations: on the one hand, attention aggregation with hierarchical constraints highlights the core water distribution semantics dominated by the main canal; on the other hand, feature aggregation of node features retains the scale features of the entire irrigation area. Then, through dynamic fusion with learnable weights, graph-level features that take into account both business priorities and global integrity are obtained.
[0030] Similarity is quantified through dual-channel feature interaction: the node-level channel focuses on fine-grained parameter matching of effective nodes, while the graph-level channel uses neural tensor networks to characterize the high-order associations of the global water allocation logic of the entire irrigation district. The weighted fusion of the dual-channel scores yields the edit distance of the predicted graph, which measures the matching degree between the two graphs and provides a core basis for intelligent recommendation of irrigation district water allocation schemes. Attached Figure Description
[0031] The present application will be further described below with reference to the accompanying drawings and embodiments. In the accompanying drawings: Figure 1 This is a flowchart of an embodiment of this application; Figure 2 This is a schematic diagram of the electronic device structure in the embodiments of this application. Detailed Implementation
[0032] To provide a clearer understanding of the technical features, objectives, and effects of this application, the specific embodiments of this application will now be described in detail with reference to the accompanying drawings.
[0033] The embodiments of this application provide an irrigation district water distribution method based on topology and hierarchical perception graph similarity calculation.
[0034] Please refer to Figure 1 , Figure 1 This is a flowchart of an irrigation district water distribution method based on topology and hierarchical perception graph similarity calculation in an embodiment of this application, including: S1: Model the historical water distribution scheme and the current water demand subgraph as directed unweighted graphs respectively; the nodes in the directed unweighted graph represent main canals or branch canals, the edges represent the direction of water flow, and the node attributes include canal length, farmland area, design flow rate and water demand; S2: Perform multi-dimensional feature encoding on each node, including hierarchical encoding, attribute encoding, and random walk position encoding, and fuse them to obtain the node augmented representation; S3: Use a relational graph convolutional network to extract multi-scale features from the node augmentation representation, and introduce a gating mechanism to filter invalid node information to obtain the final node embedding; S4: Based on the final node embedding, hierarchical constraint weighted attention is used to aggregate dual-path features to generate a graph-level representation. ; S5: Calculate the similarity score between two graphs through graph-level representation and final node embedding, and then perform weighted fusion to obtain the predicted graph edit distance; S6: Based on the predicted distance, recommend the optimal water distribution scheme from the historical scheme library.
[0035] This application adopts the above-mentioned technical solution to model a single water distribution scheme as an attribute graph structure, with canal system units such as main canals and branch canals as nodes, and the physical connection relationship between canals as directed edges. The node attributes integrate core parameters such as flow threshold, crop water requirement, and water supply coverage area. At the same time, a random walk strategy is introduced to obtain node position encoding, accurately capturing the spatial position information of nodes in the global topology and the directed edge association features, completing a comprehensive structured mapping of the water distribution scenario. In order to fully explore the similarity features between schemes, a node-graph level dual-channel feature interaction architecture is designed: the node level channel calculates the parameter matching degree of each pair of nodes, combines node validity marking to filter invalid information of inactive canals, and after constructing the interaction matrix, extracts fine-grained matching features through local pooling and global aggregation; the graph level channel introduces a neural tensor network (NTN), which integrates tensor second-order interaction and linear interaction operations to deeply characterize the high-order association features of the water distribution logic of the entire irrigation area and output global difference information. By fusing the difference scores from dual-channel outputs with learnable weights, and using the inverse quantization result of graph edit distance (GED) as the scheme similarity index, the method retrieves the optimal matching scheme from the historical scheme database to complete the recommendation. This method breaks away from the inherent path of "scheme generation" in traditional multi-objective optimization and shifts to an efficient mode of "historical scheme reuse." It retains the engineering feasibility of historical schemes while improving the adaptation accuracy between schemes and target scenarios through node position encoding and graph structure representation. At the same time, it can flexibly adapt to the differences in canal system topology of irrigation districts of different sizes, providing a new technical path for the precise allocation of water resources in irrigation districts.
[0036] Step S1 includes: enter and Let represent directed unweighted graphs representing the historical water allocation schemes and current water demand subgraphs of a single irrigation district in the knowledge base, respectively. in: for or ; For a set of nodes, Representing the nodes of the main canal, Represents a branch canal node; for or , It is a set of directed edges, meaning that the direction of water flow can only be from the main canal to the branch canal; for or , The adjacency matrix is If satisfied but ,otherwise ; Define the out-degree matrix It is a diagonal matrix, and its diagonal elements are... , For nodes The out-degree, and satisfying , ; for Nodes, settings To ensure The reversibility of.
[0037] The validity of nodes in a directed unweighted graph of historical water distribution schemes is defined as follows: , correspond or The node, This indicates that the node is valid, i.e., the water demand. And design flow ; This indicates that the node is not enabled and the parameters are invalid.
[0038] Step S2 includes: The random walk position encoding includes: Constructing a random walk matrix ,in It is an adjacency matrix. This is the out-degree matrix; from Step random walk matrix Extract the node self-visit probability from the diagonal elements and use it as the initial position feature; The initial location features are mapped into dense vectors using a multilayer perceptron, and then concatenated with the node attribute features to obtain the node augmented representation.
[0039] As one example, the node hierarchy encoding is as follows: Node original features (2D One-hot vectors used to encode canal system hierarchy: main canal nodes) Branch canal nodes splicing, Indicates the first The initial representation of each node.
[0040] As one example, the channel node attribute encoding is as follows: Based on irrigation district data provided by the management of Yanghe No. 2 Irrigation District, this study selected four core water distribution constraint parameters as follows: Canal system length: denoted as (Unit: m); Farmland area: (unit: Design flow rate: (unit: Water demand: (unit: ), which provides dynamic input parameters for the current scene.
[0041] The above water distribution constraint parameters have different dimensions and large differences in magnitude (e.g. span , Most of them Direct input (within) can lead to an imbalance in feature weights, so Min-Max normalization is used to unify the units. The formula is:
[0042] in, The original value of the parameter. , This represents the global extreme values for 306 historical schemes from 2022 to 2024. This is the normalized value.
[0043] After normalization, we obtain a 4-dimensional core attribute vector:
[0044] By concatenating hierarchical encoding and canal node attribute encoding, initial node features are obtained. To achieve dimensional consistency with location encoding while preserving the core semantics of irrigation district water distribution, these 6-dimensional initial features are directly mapped using an irrigation district scenario MLP. Dimensional attribute characteristics:
[0045] in, The parameters are learnable for the MLP, and the activation function is ReLU to ensure that key water allocation constraint information is not lost during the mapping process.
[0046] As one embodiment, the random walk position encoding representation is as follows: The Yanghe No. 2 Irrigation District selectively allocates water to certain canals under different water demand scenarios, resulting in different canal topologies under different water allocation schemes. Therefore, in addition to node label initialization, this study employs a random walk method to encode the location of canal nodes, capturing the spatial structure information during canal topology encoding. This method characterizes the node's global topological location through the node's random walk self-visit probability. The specific steps are as follows: (1) Construction diagram The random walk matrix describes the transition probabilities between nodes: ,in Indicates from node To the node The transition probability of a single-step random walk.
[0047] To capture nodes Location information, from Step random walk matrix Extracting the self-visit probability (i.e., random walk) from the diagonal elements Return to node after step (The probability of the random walk). (set up =6), node The initial position feature is defined as: .
[0048] in express The 1 element (node) go through (Probability of self-visit after walking).
[0049] (2) Location feature transformation Using a multilayer perceptron (MLP) to generate initial location features Convert to dimension Dense vectors:
[0050] in Learnable parameters of MLP ( , ).
[0051] Node augmentation representation: Representing the original features of nodes and location features By concatenating the elements, we obtain the enhanced initial node representation:
[0052] Should As input to the subsequent feature extraction module.
[0053] Step S3 includes: The edge relationships of the directed unweighted graph of historical water distribution schemes are uniquely identified as follows: ,in Representative canal node set , Representative branch canal node set ; Assign learnable weight matrices to edge relationships Dimensions and initial node embedding Maintain consistency; Considering the dominant role of the main canal in water allocation decisions, a hierarchical weighting factor is introduced. : When a node in the main canal aggregates neighbor information, the weight matrix is: ; Branch nodes have no outgoing neighbors, and the weight matrix is inherited by default. ; The relational graph convolutional network is the first The aggregation formula for the layer is: in, , Activation function It is the first The self-loop weight matrix of the layer is used to preserve the feature information of the node itself and avoid the loss of original attributes during the aggregation process; It is a node In relationship The set of neighbors below; It is the normalization coefficient; It represents the Hadamardi (or Hadama) stack; The learnable weight matrix for edge relationships; Indicates residual join terms; Use the Sigmoid activation function; It is the gating coefficient; Embed the initial node with The output features of the layered relational graph convolutional network are concatenated to form the final node embedding.
[0054] As one example, the core of the feature extraction module is to aggregate the attribute constraints and topological location information of nodes through graph neural networks, while adapting the hierarchical directed edge relationships and dynamic topological structure of the irrigation area, and finally generating node embeddings to support subsequent similarity calculations. This study uses R-GCN as the backbone network.
[0055] As one example, edge relationship encoding: The irrigation district water distribution plan map contains directed edge relationships (main canal, flow direction, branch canal). These relationships directly determine the water flow direction and water distribution authority, requiring dedicated encoding to strengthen hierarchical information transmission; each edge relationship is uniquely identified as... ,in Representative canal node set , Representative branch canal node set To avoid redundancy in multiple relationships.
[0056] Next, a learnable weight matrix is assigned to the relationship. Dimensions and initial node embedding To maintain consistency, a hierarchical weighting factor is introduced, considering the dominant role of the main canal in water allocation decisions. : When a node in the main canal aggregates neighbor information, the weight matrix is: ; Branch nodes have no outgoing neighbors (they are only aggregated objects), and the weight matrix is inherited by default. This highlights the control role of the main canal in the water distribution logic.
[0057] Multi-scale information capture: enhancing node representation enter The layer's R-GCN (an adjustable hyperparameter adapted to irrigation district scenarios; its value needs to be determined based on the canal system topology complexity, data volume, and real-time requirements; specific values are verified through controlled variable experiments). Each layer dynamically filters effective neighbor information through a gating mechanism, and combines residual connections to alleviate gradient vanishing.
[0058] As one example, multi-scale feature fusion: to simultaneously preserve local attribute relationships (such as the flow matching relationship between the main canal and adjacent branch canals) and global topological semantics (such as the water flow distribution logic of the entire irrigation area), the initial node is embedded in... The output features of the R-GCN layers are concatenated to form the final node embedding. The concatenation process is shown below:
[0059] in For feature splicing operations, splicing is performed in the order of initial embedding, shallow R-GCN, and deep R-GCN to ensure that multi-scale information can be called simultaneously when generating subsequent graph-level representations; All are 2d vectors, and the concatenated vectors have the following dimensions: .
[0060] Step S4 includes: As one example, the core objective of weighted attention aggregation is to quantify the contribution of each node to the overall graph water allocation semantics.
[0061] The mean vector ultimately embedded by the compute nodes serves as the global context feature. :
[0062] in, Let be the set of nodes in the graph. The total number of nodes. For nodes The node is eventually embedded. For node feature dimensions, It reflects the overall attribute distribution and topological association characteristics of the entire irrigation district; Considering the fusion of global semantics and channel priority, compute nodes The attention score is calculated using the following formula:
[0063] in, As a learnable weight matrix, node features and global context are mapped to the same feature space to enhance the rationality of correlation calculation; This is an attention scoring vector used to quantify the correlation strength between node features and the global context; As a hierarchical identifier for the canal system, the main canal branch canals ; The hierarchy enhancement coefficient is used to amplify the score value of the main canal nodes, ensuring that the main canal occupies a dominant weight in the graph-level representation. It is a non-linear activation function; The attention score is converted into normalized weights using the softmax function; Based on the normalized attention weights, a weighted sum of all node features is performed to obtain a graph-level representation focusing on the semantics of core nodes, as shown in the formula:
[0064] As one implementation, node feature aggregation is used to balance the risk of "core node overfitting" that may exist in weighted attention aggregation, while fully preserving the basic scale characteristics of the entire irrigation district (such as total irrigated area, total canal length, global topological complexity, etc.). An unbiased node feature aggregation strategy is introduced. This approach is computationally efficient and can retain the total feature information of all nodes without discrimination, avoiding the neglect of water distribution constraints of secondary nodes such as small-flow branch canals and peripheral canals. They form complementary characteristics.
[0065] An unbiased node feature aggregation strategy is introduced, with the following formula:
[0066] in No additional parameters need to be learned; By dynamically fusing dual-path features using dimension-wise learnable weight vectors, the final graph-level representation is obtained. ,as follows:
[0067] in, For a dimension-wise learnable weight vector, the element values range from 1 to 2. The model can be adjusted according to the dynamic changes in the irrigation district water distribution scenario. and The fusion ratio; This uses Hadamard product to ensure that the feature weights of each dimension are independently adjustable during the fusion process. The final generated... It combines core water allocation semantics with global scale features for subsequent similarity calculation.
[0068] As one example, graph-level representation is the core step in aggregating the local features of nodes in an irrigation district's water allocation scheme graph into global semantic features. Its generation quality directly impacts the accuracy of cross-scheme similarity calculations. Addressing the core business characteristic of irrigation districts where "main canals dominate water allocation decisions, and branch canals receive flow distribution," this study abandons the shortcomings of the general graph attention mechanism's "indiscriminate allocation of node weights" and designs a three-stage graph-level representation generation strategy: "hierarchical constraint weighted attention aggregation, node feature sum aggregation, and learnable proportional fusion." Weighted attention aggregation captures the semantic contribution of core nodes such as main canals to the entire graph; sum aggregation preserves the global scale features of the entire irrigation district; and finally, learnable fusion achieves a dynamic balance of dual-path features, generating a graph-level representation that combines business adaptability with global integrity.
[0069] Step S5 includes: The node-level similarity score is calculated using the following steps: The cosine similarity metric is used to quantify the attribute matching degree and local topological association strength between any two nodes, which come from different regions. and Simultaneously, invalid node noise is filtered out through a gating mechanism, the specific formula of which is:
[0070] in, The dot product of the vectors embedded in the two nodes. , These are the L2 norms of the two node embeddings, and the calculated values range from [value missing]. ; For indicator functions, This represents a logical AND operation, which occurs only if both nodes are valid. ,otherwise ; Based on the filtered similarity value Construct a pairwise node interaction matrix , , They are , Total number of nodes, matrix elements It fully preserves the fine-grained matching information of valid nodes, and the dimension is consistent with the total number of nodes in both graphs; Extracting the node interaction matrix Local strong correlation features and global distribution features: Interaction matrix implement The window max pooling operation, with a sliding step of 1, retains the maximum similarity value within each local window, resulting in the pooling matrix. This strengthens the strong correlation between nodes and suppresses interference from weak correlations. For pooling matrix Calculate the row mean and column mean separately to obtain the row feature vector. With column feature vectors ,in, reflect The Middle Each node and Average matching strength of all nodes reflect The Middle Each node and The average matching strength of all nodes; row feature vector With column feature vectors The concatenated data is then fed into a multilayer perceptron (MLP) to perform nonlinear feature fusion and map it to a scalar, as shown in the following formula:
[0071] in, Here is the weight matrix of the hidden layer in the MLP. For hidden layer bias terms; This is the weight matrix of the MLP output layer. Implement a nonlinear transformation for the activation function; final output The score is a scalar node-level score. The value is negatively correlated with the matching degree of node attributes and local topology between the two graphs. The lower the score, the higher the matching degree. The similarity score at the graph level is calculated as follows: As one example, graph-level feature interaction: The graph-level channel realizes the high-order association calculation of the graph-level representation through the Neural Tensor Network (NTN). The core goal is to quantify the high-order semantic association between the graph-level representations of two water allocation schemes, characterize the similarity of the water allocation logic of the entire irrigation area, and avoid the limitation of traditional linear distance, which can only characterize numerical differences.
[0072] Let the water distribution schemes of the two irrigation districts to be matched be as follows: , The corresponding graph-level representations are as follows: , By fusing tensor second-order interactions and linear interactions, complex semantic relationships between graph-level representations are captured, as shown in the formula:
[0073] in, Represents traversing tensors of A two-dimensional slice , ,calculate The second-order interaction values under each slice form 3D tensor interaction features; It is a linear interaction weight matrix; for and The concatenated vector; These are the higher-order interaction features after fusion; Represents the bias vector; Through MLP The dimensional interaction feature mapping is converted into a similarity score, and the formula is:
[0074] in, For the scoring vector, For bias; This represents the similarity score at the graph level.
[0075] Node-level similarity scores Similarity score with graph level Through learnable weighted fusion, we obtain and Edit distance of the predicted map The formula is:
[0076] in, These are learnable weights; To ultimately predict the GED value, the numerical value is related to... and The overall matching degree is negatively correlated.
[0077] As one example, the similarity assessment of irrigation district water distribution schemes needs to simultaneously cover both "hierarchical parameter matching of different canal systems" and "global water distribution logic association of the entire irrigation district": relying solely on a single node-level channel can capture fine-grained attribute differences such as main canal flow and branch canal water supply range, but it cannot characterize the global topology under node attribute matching, which can easily lead to bias in water supply efficiency assessment; relying solely on a single graph-level channel can characterize the system-level association of the entire irrigation district, but it will mask details of core main canal flow threshold exceeding the limit, causing the assessment results to deviate from actual operational needs. Therefore, this study designs a dual-channel architecture of "node-level and graph-level": the node-level channel focuses on the directional attribute alignment between different canal systems, accurately capturing fine-grained differences in hierarchical parameters; the graph-level channel characterizes the global water distribution logic of the entire irrigation district through high-order interactions; the fusion of the two can achieve complementary characterization of micro-attribute details and macro-system constraints, making the similarity assessment results more consistent with the business essence of irrigation district water distribution.
[0078] As an example, MSE (Mean Squared Error) is a commonly used loss function to measure the mean squared error between predicted and true values. In this model, we choose to use the MSE loss function to measure the difference between the predicted and true GED values of the water allocation scheme diagram pair, in order to effectively train and optimize the model. The MSE loss function is as follows:
[0079] in, It refers to the number of training centralized water distribution scheme diagrams. Indicates the first The true GED value of the image set Indicates the first Predicted GED values for map pairs. During model training, the goal is to minimize the MSE loss. By adjusting the model parameters, the difference between the predicted and actual GED values is minimized, allowing the model to learn the similarity features of water allocation scheme maps more accurately and improving the prediction performance of water allocation scheme matching.
[0080] Table 1
[0081] As shown in Table 1, compared to the general graph similarity model SimGNN, this model reduces the MAE by approximately 10% in the irrigation district water allocation scheme graph matching task, while significantly improving the Pearson correlation coefficient (ρ), Kendall correlation coefficient (τ), and the accuracy of the top 10 recommendations. This indicates that this model accurately captures the relative positions of nodes in the irrigation district topology through random walk position encoding and strengthens the semantic contribution of core water allocation nodes by leveraging hierarchical constraints, thus compensating for the shortcomings of general models in terms of scenario adaptability.
[0082] This application also discloses an electronic device. (See reference...) Figure 2 , Figure 2 This is a schematic diagram of the structure of an electronic device disclosed in an embodiment of this application. The electronic device 500 may include: at least one processor 501, at least one network interface 504, a user interface 503, a memory 505, and at least one communication bus 502.
[0083] The communication bus 502 is used to enable communication between these components.
[0084] The user interface 503 may include a display screen, and optionally, the user interface 503 may also include a standard wired interface or a wireless interface.
[0085] The network interface 504 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface).
[0086] This application also discloses a computer-readable storage medium storing multiple instructions adapted for loading by a processor to execute the above-described irrigation district water distribution method based on topology and hierarchical perception graph similarity calculation.
[0087] The above are merely exemplary embodiments of this disclosure and should not be construed as limiting the scope of this disclosure. Any equivalent changes and modifications made in accordance with the teachings of this disclosure shall still fall within the scope of this disclosure.
[0088] This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not described in this disclosure. The specification and embodiments are to be considered exemplary only, and the scope and spirit of this disclosure are defined by the claims.
Claims
1. A method for irrigation district water allocation based on topological and hierarchical sensing graph similarity calculation, characterized in that, The method includes the following steps: S1: Model the historical water distribution scheme and the current water demand subgraph as directed unweighted graphs respectively; the nodes in the directed unweighted graph represent main canals or branch canals, the edges represent the direction of water flow, and the node attributes include canal length, farmland area, design flow rate and water demand; S2: Perform multi-dimensional feature encoding on each node, including hierarchical encoding, attribute encoding, and random walk position encoding, and fuse them to obtain the node augmented representation; S3: Use a relational graph convolutional network to extract multi-scale features from the node augmentation representation, and introduce a gating mechanism to filter invalid node information to obtain the final node embedding; S4: Based on the final node embedding, hierarchical constraint weighted attention is used to aggregate dual-path features to generate a graph-level representation; S5: Calculate the similarity score between two graphs through graph-level representation and final node embedding, and then perform weighted fusion to obtain the predicted graph edit distance; S6: Based on the predicted distance, recommend the optimal water distribution scheme from the historical scheme library.
2. The irrigation district water allocation method based on topology and hierarchical sensing graph similarity calculation as described in claim 1, characterized in that, Step S1 includes: enter and Let represent directed unweighted graphs representing the historical water allocation schemes and current water demand subgraphs of a single irrigation district in the knowledge base, respectively. in: for or ; For a set of nodes, Representing the nodes of the main canal, Represents a branch canal node; for or , It is a set of directed edges, meaning that the direction of water flow can only be from the main canal to the branch canal; for or , The adjacency matrix is If satisfied but ,otherwise ; Define the out-degree matrix It is a diagonal matrix, and its diagonal elements are... , For nodes The out-degree, and satisfying , ; for Nodes, settings To ensure Reversibility; The validity of nodes in a directed unweighted graph of historical water distribution schemes is defined as follows: , correspond or The node, This indicates that the node is valid, i.e., the water demand. And design flow ; This indicates that the node is not enabled and the parameters are invalid.
3. The irrigation district water allocation method based on topological and hierarchical sensing graph similarity calculation as described in claim 2, characterized in that, Step S2 includes: The random walk position encoding includes: Constructing a random walk matrix ,in It is an adjacency matrix. This is the out-degree matrix; from Step random walk matrix Extract the node self-visit probability from the diagonal elements and use it as the initial position feature; The initial location features are mapped into dense vectors using a multilayer perceptron, and then concatenated with the node attribute features to obtain the node augmented representation.
4. The irrigation district water allocation method based on topology and hierarchical sensing graph similarity calculation as described in claim 3, characterized in that, Step S3 includes: The edge relationships of the directed unweighted graph of historical water distribution schemes are uniquely identified as follows: ,in Representative canal node set , Representative branch canal node set ; Assign learnable weight matrices to edge relationships Dimensions and initial node embedding Maintain consistency; Considering the dominant role of the main canal in water allocation decisions, a hierarchical weighting factor is introduced. : When a node in the main canal aggregates neighbor information, the weight matrix is: ; Branch nodes have no outgoing neighbors, and the weight matrix is inherited by default. ; The relational graph convolutional network is the first The aggregation formula for the layer is: in, , Activation function It is the first The self-loop weight matrix of the layer is used to preserve the feature information of the node itself and avoid the loss of original attributes during the aggregation process; It is a node In relationship The set of neighbors below; It is the normalization coefficient; It represents the Hadamardi (or Hadama) stack; The learnable weight matrix for edge relationships; Represents the residual join term; Use the Sigmoid activation function; It is the gating coefficient; Embed the initial node with The output features of the layered relational graph convolutional network are concatenated to form the final node embedding.
5. The irrigation district water allocation method based on topology and hierarchical sensing graph similarity calculation as described in claim 4, characterized in that, Step S4 includes: The mean vector ultimately embedded by the compute nodes serves as the global context feature. : in, Let be the set of nodes in the graph. The total number of nodes. For nodes The node is eventually embedded. For node feature dimensions, It reflects the overall attribute distribution and topological relationship characteristics of the entire irrigation area; Considering the fusion of global semantics and channel priority, compute nodes The attention score is calculated using the following formula: in, As a learnable weight matrix, node features and global context are mapped to the same feature space to enhance the rationality of correlation calculation; This is an attention scoring vector used to quantify the correlation strength between node features and the global context; As a hierarchical identifier for the canal system, the main canal branch canals ; The hierarchy enhancement coefficient is used to amplify the score value of the main canal nodes, ensuring that the main canal occupies a dominant weight in the graph-level representation. It is a non-linear activation function; The attention score is converted into normalized weights using the softmax function. Based on the normalized attention weights, a weighted sum of all node features is performed to obtain a graph-level representation focusing on the semantics of core nodes, as shown in the formula: An unbiased node feature aggregation strategy is introduced, with the following formula: in No additional parameters need to be learned; By dynamically fusing dual-path features using dimension-wise learnable weight vectors, the final graph-level representation is obtained. ,as follows: in, For a dimension-wise learnable weight vector, the element values range from 1 to 2. The model can be adjusted according to the dynamic changes in the irrigation district water distribution scenario. and The fusion ratio; The Hadamard product ensures that the feature weights of each dimension are independently adjustable during the fusion process; the final generated It combines core water allocation semantics with global scale features for subsequent similarity calculation.
6. The irrigation district water allocation method based on topology and hierarchical sensing graph similarity calculation as described in claim 5, characterized in that, Step S5 includes: The node-level similarity score is calculated using the following steps: The cosine similarity metric is used to quantify the attribute matching degree and local topological association strength between any two nodes, which come from different regions. and Simultaneously, invalid node noise is filtered out through a gating mechanism, the specific formula of which is: in, The dot product of the vectors embedded in the two nodes. , These are the L2 norms of the two node embeddings, and the calculated values range from [value missing]. ; For indicator functions, This represents a logical AND operation, which occurs only if both nodes are valid. ,otherwise ; Based on the filtered similarity value Construct a pairwise node interaction matrix , , They are , Total number of nodes, matrix elements It fully preserves the fine-grained matching information of valid nodes, and the dimension is consistent with the total number of nodes in both graphs; Extracting the node interaction matrix Local strong correlation features and global distribution features: Interaction matrix implement The window max pooling operation, with a sliding step of 1, retains the maximum similarity value within each local window, resulting in the pooling matrix. This strengthens the strong correlation between nodes and suppresses interference from weak correlations. For pooling matrix Calculate the row mean and column mean separately to obtain the row feature vector. With column feature vectors ,in, reflect The Middle Each node and Average matching strength of all nodes reflect The Middle Each node and The average matching strength of all nodes; row feature vectors With column feature vectors The concatenated data is then fed into a multilayer perceptron (MLP) to perform nonlinear feature fusion and map it to a scalar, as shown in the following formula: in, Here is the weight matrix of the hidden layer in the MLP. For hidden layer bias terms; This is the weight matrix of the MLP output layer. Implement a nonlinear transformation for the activation function; final output The score is a scalar node-level score. The value is negatively correlated with the matching degree of node attributes and local topology between the two graphs. The lower the score, the higher the matching degree. The similarity score at the graph level is calculated as follows: Let the water distribution schemes of the two irrigation districts to be matched be as follows: , The corresponding graph-level representations are as follows: , By fusing tensor second-order interactions and linear interactions, complex semantic relationships between graph-level representations are captured, as shown in the formula: in, Represents traversing tensors of A two-dimensional slice , ,calculate The second-order interaction values under each slice form 3D tensor interaction features; It is a linear interaction weight matrix; for and The concatenated vector; These are the higher-order interactive features after fusion; Represents the bias vector; Through MLP The dimensional interaction feature mapping is converted into a similarity score, and the formula is: in, For the scoring vector, For bias; The similarity score is at the graph level. Node-level similarity scores Similarity score with graph level Through learnable weighted fusion, we obtain and Edit distance of the predicted map The formula is: in, These are learnable weights; To ultimately predict the GED value, the numerical value is related to... and The overall matching degree is negatively correlated.
7. An electronic device, characterized in that, The device includes a processor, a memory, a user interface, and a network interface. The memory is used to store instructions, and the user interface and network interface are used to communicate with other devices. The processor is used to execute the instructions stored in the memory so that the electronic device performs the irrigation water distribution method based on topology and hierarchical perception graph similarity calculation as described in any one of claims 1-6.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed by a computer, perform the irrigation district water distribution method based on topology and hierarchical perception graph similarity calculation as described in any one of claims 1-6.