A water flow path planning method and system based on an improved Manhattan algorithm

By improving the Manhattan algorithm and combining it with a multidimensional evaluation cost function and the principle of water conservation, the water flow path planning is optimized, solving the problem that water balance diagram drawing relies on human experience, and realizing efficient, accurate and aesthetically pleasing water balance diagram generation.

CN122242903APending Publication Date: 2026-06-19SHANXI HUARUIXIN INFORMATION TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHANXI HUARUIXIN INFORMATION TECH CO LTD
Filing Date
2026-05-25
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

In existing technologies, the creation of water balance diagrams relies on human experience, which makes it difficult to ensure logical consistency, results in inconsistent chart quality, and lacks sufficient intelligence, making it difficult to achieve fully automated modeling and high-quality generation.

Method used

An improved Manhattan algorithm is adopted, which constructs a multidimensional evaluation cost function and combines path length, cross-penalty term, overlap suppression factor and spatial distribution uniformity index for path planning, and optimizes the path by combining the principle of water conservation.

Benefits of technology

It improves the efficiency and accuracy of water balance map production, ensures that the path search process conforms to professional mapping standards, reduces manual adjustments, enhances aesthetics and mapping efficiency, and ensures physical rationality and business accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122242903A_ABST
    Figure CN122242903A_ABST
Patent Text Reader

Abstract

This invention relates to the fields of water resource management and intelligent mapping technology, and discloses a method and system for water flow path planning based on an improved Manhattan algorithm. The method includes the following steps: obtaining an initial layout of a water balance diagram; obtaining the first node cell in the initial layout diagram, and determining the starting and ending coordinates of each water flow path based on the basic information of the source-sink cell pairs corresponding to all water flow paths with that node cell as the source cell; sequentially obtaining each node cell in the initial layout diagram, and repeatedly determining the starting and ending coordinates of all water flow paths; sequentially performing path planning for each water flow path based on an improved A-search algorithm that selects the optimal path with total evaluation cost; and redrawing all water flow paths based on the planning results to update the layout diagram and obtain the water balance diagram. This invention can improve the mapping efficiency and accuracy of water balance diagrams.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of water resource management and intelligent mapping technology, specifically to a water flow path planning method and system based on an improved Manhattan algorithm. Background Technology

[0002] In the fields of water resource management and engineering design, water balance analysis is a crucial step in assessing the rationality of water use and identifying water-saving potential, and its results are typically presented in the form of a water balance diagram. However, there are significant bottlenecks in the current technology for drawing water balance diagrams: 1. High dependence on manual labor: The drawing of water balance diagrams is highly dependent on the experience of professionals. It requires manually sorting out the complex water and drainage nodes and their connection relationships. The process is tedious and time-consuming, usually taking several hours or even longer.

[0003] 2. Difficulty in ensuring logical consistency: Due to the lack of an automated verification mechanism, logical loopholes such as water volume non-conservation and node connection errors are very likely to occur during manual drawing, leading to distorted analysis conclusions and affecting report quality and project review.

[0004] 3. Inconsistent chart quality: The drawing style, layout, and flow expression are highly dependent on personal habits, making it difficult to guarantee the professionalism and readability of the charts, which is not conducive to standardized output and cross-departmental collaboration.

[0005] 4. Insufficient level of intelligence: Existing CAD or drawing software only provides basic drawing functions, cannot understand the business logic of water balance, and lacks the ability to intelligently identify and process key elements such as node type, water flow direction, and total balance.

[0006] Given the aforementioned problems, there is an urgent need in water resource management for a systematic solution that can achieve fully automated modeling, intelligent calculation, and one-click high-quality generation of water balance diagrams. Summary of the Invention

[0007] To address the technical problems of high reliance on manual labor and insufficient intelligence in existing water balance maps, this invention proposes a water flow path planning method and system based on an improved Manhattan algorithm. By constructing an evaluation function composed of multiple indicators for path planning, the path search process can simultaneously consider obstacle avoidance capability, visual clarity, and global layout balance, thereby improving the mapping efficiency and accuracy of water balance maps.

[0008] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is: a water flow path planning method based on an improved Manhattan algorithm, comprising the following steps: Step 1: Obtain the initial layout of the water balance diagram, and decompose the drawing plane into a two-dimensional grid space. Each grid cell corresponds to a fixed-size area in the physical coordinate system. Then, in the two-dimensional grid space, map the graphic entities corresponding to all node cells in the initial layout diagram to the corresponding grids, and mark the corresponding grids as a set of impassable obstacles. Step 2: Obtain the first node unit in the initial layout diagram. Based on the basic information of the source-sink unit pairs corresponding to all water flow paths with the first node unit as the source unit, determine the starting point and ending point of each water flow path. Step 3: Sequentially obtain each unit in the initial layout diagram, repeat step 2, and determine the starting point coordinates and ending point coordinates corresponding to all water flow paths; Step 4: Determine the starting and ending points of each water flow path based on the coordinates of the starting and ending points; based on the improved A... The search algorithm performs path planning for each water flow path sequentially, and the improved A The search algorithm selects the optimal water flow path based on the total evaluation cost, which is: ; in, This represents the distance from the starting point to the current node. The actual cumulative movement cost, Indicates starting from the current node Manhattan distance to the destination Indicates the current node The total value of cross-penalties, Indicates the current node The overlap suppression function, Indicates the current node Spatial distribution uniformity index; Step 5: Based on the optimal water flow path obtained from path optimization, redraw the water flow path between all source-sink unit pairs and update the layout diagram to obtain the water balance diagram.

[0009] In step 4, the total value of the cross-penalty The calculation formula is: ; in, Indicates from candidate successor node To the finish line The estimated shortest path in Manhattan, This represents the set of planned paths. This represents the cross-counting function. This represents the cross-penalty coefficient.

[0010] Cross-penalty coefficient Use a segmented dynamic adjustment strategy: set the initial value to 1, and if the cross-counting function value is greater than 3, then... Adjust to twice the initial value. If the cross-count function value is greater than 5, then... Adjusted to 4 times the initial value.

[0011] In step 4, the overlap suppression function The value can be: when hour, ; when At that time, =0; in, This represents the set of grid cells occupied by the planned path. This represents the overlap penalty value.

[0012] In step 4, the spatial distribution uniformity index The calculation method is as follows: The drawing area is divided into several logical sub-regions, and the number of grid cells occupied by paths in each sub-region is counted as the path density d of the sub-region. Obtain the path density d and baseline density threshold of each logical sub-region containing the current node n. ,like ,but = ,like ,but = ;in, , , Indicates the intensity of encouragement. Indicates the severity of the punishment.

[0013] Step 2 specifically includes the following steps: Step 2.1: For the first node unit in the initial layout diagram, obtain the basic information of the source-sink unit pairs corresponding to all water flow paths with the first node unit as the source unit, and determine the connection direction rules corresponding to each water flow path; Step 2.2: Determine the priority of the water flow path based on the priority of the connection direction rule; Step 2.3: Based on the priority of the water flow path and the corresponding connection direction rules, determine the starting point coordinates and ending point coordinates of each water flow path in sequence.

[0014] In step 2.1, the connection direction rule includes: a first rule and a second rule; The first rule includes the principle of evaporation / water consumption exiting upwards, the principle of prioritizing reuse and aligning vertically, and the principle of self-circulation exiting from the right and entering from the top. The second rule includes the left-in-right-out principle and a global four-way compatibility strategy; In step 2.2, the priority of the connection direction rules is as follows: evaporation / water consumption upward principle > self-circulation right-out upward principle > reuse priority top-bottom alignment principle > left-in right-out principle > global four-way compatibility strategy; In step 2.3, the corresponding connection direction rule is the water flow path of the first rule, and the starting point and the ending point are directly determined by the corresponding connection direction rule; For water flow paths with the connection direction rule as the second rule, the initial start and end point set is first determined based on the connection direction rule and the remaining ports. The initial start and end point set includes one or more candidate start point-end point pairs. Then, based on the relative positional relationship between the source unit and each sink unit in the initial layout diagram, and the comprehensive adaptation score of each candidate start point-end point pair, the start point and end point of the water flow path are determined. The formula for calculating the comprehensive adaptation score is as follows: ; in, This represents the preset weight of the starting point in the candidate start-end point pair. This represents the preset weight of the endpoint in the candidate start-end point pair.

[0015] Step 1 also includes the following steps: based on the principle of water conservation, perform a consistency check on the water conservation of all node units in real time.

[0016] Furthermore, this invention also provides a water flow path planning system based on an improved Manhattan algorithm, used to implement the aforementioned water flow path planning method based on an improved Manhattan algorithm, comprising: Interactive interface module: used to input hydraulic attribute information of each node unit and create the initial layout diagram; Mapping configuration unit: used to decompose the drawing plane into a two-dimensional grid space, each grid unit corresponds to a fixed-size area in the physical coordinate system; also used to map the graphic entities corresponding to all node units in the initial layout diagram to the corresponding grid in the two-dimensional grid space, and mark the corresponding grid as a set of impassable obstacles; Port coordinate determination unit: used to sequentially obtain each node unit in the initial layout diagram, and based on the basic information of the source-sink unit pairs corresponding to all water flow paths with the current node unit as the source unit, sequentially determine the starting point coordinates and ending point coordinates of all water flow paths corresponding to each node unit. Path optimization unit: used to determine the starting and ending points of each flow path based on the coordinates of the starting and ending points; based on improved A The search algorithm performs path planning for each water flow path sequentially, and the improved A The search algorithm selects the optimal water flow path based on the total evaluation cost, which is: ; in, This represents the distance from the starting point to the current node. The actual cumulative movement cost, Indicates starting from the current node Manhattan distance to the destination Indicates the current node The total value of cross-penalties, Indicates the current node The overlap suppression function, Indicates the current node Spatial distribution uniformity index; Graphics output unit: Used to redraw the flow paths between all source-sink unit pairs based on the optimal flow paths obtained by the path optimization unit, and then update the layout diagram to obtain the water balance diagram.

[0017] The water flow path planning system based on the improved Manhattan algorithm further includes a consistency verification unit, which is used to perform real-time water conservation verification on all node units based on the water conservation formula.

[0018] Compared with the prior art, the present invention has the following advantages: 1. This invention proposes a water flow path planning method and system based on an improved Manhattan algorithm. Addressing the limitation of traditional Manhattan path planning algorithms that rely solely on axial distance as a single heuristic function, it constructs a comprehensive evaluation cost that integrates path length cost, crossover penalty term, overlap suppression factor, and spatial distribution uniformity index as a measure of A... The search algorithm (A-Star, a heuristic graph search algorithm) has been improved. By optimizing the objectives in multiple dimensions, the path search process can simultaneously take into account obstacle avoidance, visual clarity and global layout balance, thereby generating a water flow connection network that is more in line with the professional mapping specifications of water balance maps, thus improving the mapping efficiency and accuracy of water balance maps. 2. Based on the basic information of source-sink unit pairs, this invention determines the connection direction rules and priorities corresponding to each water flow path. Based on the priority of the water flow path and the corresponding connection direction rules, the coordinates of the starting point and ending point of each water flow path are determined in sequence. This achieves accurate determination of the starting point and ending point of water flow path planning, avoids line intersections, reduces manual adjustments, and further improves the aesthetics and mapping efficiency of the water balance diagram. 3. Based on the principle of water conservation, this invention performs water balance consistency correction on all nodes, which can ensure the physical rationality and business correctness of subsequent path planning and further improve the mapping efficiency of water balance diagrams. Attached Figure Description

[0019] Figure 1 This is a flowchart illustrating a water flow path planning method based on an improved Manhattan algorithm, provided in Embodiment 1 of the present invention. Figure 2 This is a schematic diagram of a water flow path planning system based on an improved Manhattan algorithm, provided in Embodiment 2 of the present invention. Figure 3 A schematic diagram of the water balance diagram of the two-dimensional grid space generated in this invention; Figure 4 This is a schematic diagram of the initial layout after editing some node units in this invention; Figure 5 This is a schematic diagram of the initial layout diagram generated after editing all node units in this invention; Figure 6 This is a schematic diagram of the optimized water balance diagram in this invention; Figure 7 This is a schematic diagram of the final water balance diagram derived in this invention. Detailed Implementation

[0020] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below. Obviously, the described embodiments are some embodiments of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0021] Example 1 like Figure 1 As shown, Embodiment 1 of the present invention provides a water flow path planning method based on an improved Manhattan algorithm, comprising the following steps: Step 1: Obtain the initial layout of the water balance diagram, and decompose the drawing plane into a two-dimensional grid space. Each grid cell corresponds to a fixed-size area in the physical coordinate system. Then, in the two-dimensional grid space, map the graphic entities corresponding to all node cells in the initial layout diagram to the corresponding grids, and mark the corresponding grids as a set of impassable obstacles.

[0022] Specifically, this embodiment also includes the step of drawing an initial layout diagram of the water balance diagram, the method of which is as follows: 1. Project initialization and topology construction.

[0023] Users create new projects through the interactive interface module, entering a project name and configuring basic topology parameters, including the number of water supply units, primary water consumption units, and drainage units. The system automatically creates an independent workspace and generates a corresponding initial layout diagram in the drawing area, forming the basic framework of the water balance network. This step provides a structured foundation for subsequent water volume entry, sub-node expansion, and path connection, significantly reducing the modeling threshold.

[0024] Specifically, after creating a new project, the user sequentially enters the basic information of the water supply unit, primary water consumption unit, and drainage unit, and sets the quantity of each type of node unit. Then, based on the user's input, the corresponding initial set of node units is generated in the graphical interface. Next, the user selects any node unit, invokes the edit function, and modifies the display name of that node unit. After confirmation, clicking the "Save" button persists the updated node unit information to the system data model. Subsequently, the user can expand sub-node units. For example, for the primary water consumption node unit, the user selects either "Add horizontal sub-node units" or "Add vertical sub-node units," and specifies the number of new sub-node units.

[0025] 2. Water balance parameter settings.

[0026] Once the topology is constructed, users can click on any node unit and sequentially enter the hydraulic attribute information for each node unit. For example, for a water supply unit, the entered information includes the total water supply and water source type (such as municipal water supply, surface water, reclaimed water, etc.); for a water consumption / drainage unit, the entered information includes key parameters such as inflow, actual water consumption, evaporation loss, discharge, and reuse.

[0027] Specifically, to access the node unit editing interface, complete the following steps in sequence: First, input the attributes of the node unit; then click the "Settings" button to activate the water quantity parameter configuration panel; in the water quantity parameter configuration panel, define key water balance parameters such as inflow node unit, inflow, water consumption, evaporation, circulating water consumption, outflow node unit, and outflow; after completing the parameter input, click "Save" and trigger the "Draw" command, then the system will establish the logical connection relationship between the node unit and its associated node units in the diagram based on the set parameters.

[0028] By repeatedly performing the above operations, users can refine and configure the parameters of all water supply, water consumption, and drainage node units step by step. After each save, the system automatically parses the input / output relationships between nodes and dynamically generates the corresponding directed water flow paths in the graphical interface, thereby gradually building a complete water balance topology network.

[0029] In step 1, after obtaining the initial layout diagram, the continuous two-dimensional drawing plane is first... Discretized into a high-resolution two-dimensional raster space G, that is: (1) in This represents the raster cell corresponding to the i-th row and j-th column, where M and N represent the number of rows and columns of the raster, respectively. Each raster cell... This corresponds to a fixed-size region in the physical coordinate system (e.g., measured in pixels or preset logical units). This discretization process satisfies spatial order preservation and finite coverage, forming a regular... Matrix topology.

[0030] In this grid space, all laid-out graphic entities—including node frames, legends, titles, annotation text, etc.—are projected and precisely mapped to their corresponding grid sets, and uniformly marked as a set of impassable obstacles. ,in, The remaining unoccupied grid cells constitute a passable free space. , .

[0031] The connection ports of each node unit are based on the geometric coordinates of its outer frame in a continuous plane. Through discrete mapping function These are positioned as specific cells in the raster map, serving as the starting point 's' and ending point 't' for the water flow path planning task, respectively. , .

[0032] Step 1 also includes the following steps: based on the principle of water conservation, perform a consistency check on the water conservation of all node units in real time.

[0033] Step 2: Obtain the first node unit in the initial layout diagram. Based on the basic information of the source-sink unit pairs corresponding to all water flow paths with the first unit as the source unit, determine the starting point and ending point of each water flow path. These will serve as the basis for subsequent water flow path planning.

[0034] In this embodiment, the basic information includes the water flow path type, unit type, unit location, and unit border coordinates. Based on this basic information, the connection direction rules corresponding to each water flow path are determined. Furthermore, in this embodiment, the node units can be acquired sequentially from top to bottom and from left to right.

[0035] Specifically, in step 2, determining the starting and ending points corresponding to each water flow path includes the following steps: Step 2.1: For the first node unit in the initial layout diagram, obtain the basic information of the source-sink unit pairs corresponding to all water flow paths with this unit as the source unit, and determine the connection direction rules corresponding to each water flow path.

[0036] Step 2.2: Determine the priority of the water flow path based on the priority of the connection direction rule.

[0037] Specifically, in this embodiment, the corresponding connection direction rule needs to be determined according to the source unit and sink unit type of each water flow path; the priority of the connection direction rule determines the priority of determining the start and end points of the water flow path, that is, the start and end points of the water flow path with the higher priority of the connection direction rule are determined first, and then the start and end points of the water flow path with the lower priority of the connection direction rule are determined.

[0038] Step 2.3: Based on the priority of the water flow path and the corresponding connection direction rules, determine the coordinates of the starting point and the ending point of each water flow path in sequence.

[0039] The starting point and the ending point are located on the borders of the source unit and the sink unit, respectively. Specifically, each border of each unit can be divided equally, and each candidate starting point and candidate ending point are evenly distributed symmetrically on the border of the corresponding unit.

[0040] In this embodiment, the connection direction rule includes a first rule and a second rule. The first rule directly determines the start and end points of the corresponding water flow path. The first rule includes: ① Evaporation / Water Consumption Top-Out Principle: For terminal loss-type nodes (such as "cooling tower evaporation"), only water is discharged, and its unique starting point is forcibly set at the upper right end; ② The principle of prioritizing reuse and aligning vertically: When there is a reuse relationship (such as reclaimed water being reused in the flushing system), the starting point of the source unit and the ending point of the sink unit should be located at the same upper or lower boundary to form vertically aligned streamlines; ③ Self-circulating right-out-top-in principle: If a unit also supplies water to itself (such as a "circulating cooling system"), the starting point is placed on the right and the ending point is placed on the top to avoid self-intersection of paths; For each rule in the second rule, firstly, an initial set of start and end points is determined, and each initial set of start and end points includes one or more start-end point pairs; the second rule specifically includes: ① Left-in, right-out principle: For regular water use units (taking "production workshop" as an example), strict flow control is implemented: when it is a sink unit, the termination point is located at the left boundary, and when it is a source unit, the starting point is located at the right boundary to avoid reverse or cross connections; ② Global four-way compatibility strategy: Multiple connection ports are preset as candidate start points or candidate end points in each of the four borders. For example, you can choose from (top, bottom, left, right, top left, top right, bottom left, bottom right) or set more ports as candidate start points or candidate end points according to the complexity of the graphic, but the consistency of the main flow direction of "top out, bottom in" or "left in, right out" must be met; that is, if the end point corresponding to the sink unit is located at the bottom, the start point corresponding to the source unit should be located at the top; if the end point corresponding to the sink unit is located on the left, the start point corresponding to the source unit should be located on the right.

[0041] Specifically, in this embodiment, the priority of the connection direction rules is as follows: evaporation / water consumption upward exit principle > self-circulation right exit upward entry principle > reuse priority top-bottom alignment principle > left entry right exit principle > global four-way compatibility strategy. Therefore, the port occupied by the water flow path corresponding to a higher priority rule cannot be used as the water flow path corresponding to a lower priority rule.

[0042] In this embodiment, after determining the start and end points of the water flow path corresponding to the first rule, an initial set of start and end points can be determined for the water flow path corresponding to the left-in-right-out principle in the second rule based on the remaining ports. Each initial set of start and end points includes one or more candidate start-end point pairs as subsequent candidates. Then, based on the relative positional relationship between the source units and each sink unit related to this rule in the initial layout diagram, and the comprehensive adaptation score of each candidate start-end point pair, the start and end points of the water flow path are determined. The initial set of start and end points has already removed ports occupied by water flow paths corresponding to the evaporation / water consumption upward exit principle, the self-circulation right-out upward entry principle, and the reuse priority vertical alignment principle. After the water flow path corresponding to the left-in-right-out principle is determined, the initial set of start and end points corresponding to the water flow path conforming to the global four-way compatibility strategy is determined based on the remaining ports, and the determination method is the same as that for the left-in-right-out principle.

[0043] In this embodiment, the method for determining the starting and ending points of the water flow path that conforms to the second rule is as follows: (1) First, based on the relative positional relationship between the source unit and each sink unit in the initial layout diagram, determine the border to which the starting point on the source unit and the ending point on the sink unit belong. Then, remove the starting point-ending point pairs that are not in the border from the initial set of starting and ending points.

[0044] The specific method for determining the bounding box to which the starting point on the source unit and the ending point on the sink unit belong is as follows: establish a coordinate system with the center coordinates of the source unit as the origin and the horizontal direction as the x-axis, obtain the center point angle θ corresponding to each sink node (i.e., the angle between the line connecting the center points of the source and sink nodes and the x-axis), and determine the bounding box to which the starting point on the source unit and the ending point on the sink unit belong based on the magnitude of θ and the corresponding quadrant.

[0045] Specifically, if θ = 0 degrees, the sink cell is located on the right side, with the starting point at the right edge of the source cell and the ending point at the left edge of the sink cell. If 0° < θ < 90°, the starting point is at the top edge of the source cell and the ending point is at the left edge of the sink cell. If 90° < θ < 180°, the starting point is at the top edge of the source cell and the ending point is at the right edge of the sink cell. If 180° < θ < 270°, the starting point is at the bottom edge of the source cell and the ending point is at the right edge of the sink cell. If 270° < θ < 360°, the starting point is at the bottom edge of the source cell and the ending point is at the left edge of the sink cell.

[0046] (2) Determine whether there are two sink units belonging to the same quadrant. If so, further filter the set of start and end points of each water flow path according to the size of θ.

[0047] Specifically, if both sink units satisfy the condition that their corresponding center point angles are 0° < θ < 90° (i.e., both belong to the first quadrant), then the starting points of both sink units should be on the upper border of the source unit. Furthermore, the starting point of the sink unit with the larger center point angle θ should be relatively to the left, and the starting point of the sink unit with the smaller center point angle θ should be relatively to the right, to avoid intersections of the flow paths corresponding to different sink units. If both sink units satisfy the condition that their corresponding center point angles are 270° < θ < 360° (i.e., both belong to the fourth quadrant), then the starting point of the sink unit with the larger center point angle θ should be relatively to the right, and the starting point of the sink unit with the smaller center point angle θ should be relatively to the left.

[0048] Through the above screening, each water flow path can be assigned at least one candidate start-end point pair that will not intersect.

[0049] (3) Then, for flow paths that still have multiple candidate start-end point pairs, the coordinates of the start and end points of each flow path are determined by calculating the comprehensive fit score of each candidate start-end point pair. Specifically, the candidate start-end point pair with the highest comprehensive fit score is selected as the final choice of the flow path, and the calculation formula is as follows: (2) in, This represents the preset weight of the starting point in the candidate start-end point pair. This represents the preset weight of the endpoint in the candidate start-end point pair.

[0050] Step 3: Sequentially obtain each node unit in the initial layout diagram, repeat step 2, and determine the starting point coordinates and ending point coordinates corresponding to all water flow paths.

[0051] Furthermore, in this embodiment, after determining the coordinates of the starting and ending points corresponding to all water flow paths, the coordinates of the starting and ending points can be further optimized according to the number of connection ports on the four borders of each unit. For example, if a side corresponds to the starting or ending point of multiple water flow paths, these multiple connection ports will be evenly arranged.

[0052] Step 4: Determine the starting and ending points of each water flow path based on the coordinates of the starting and ending points; based on the improved A... The search algorithm performs path planning for each water flow path sequentially, and the improved A The search algorithm selects the optimal water flow path based on the total evaluation cost, which is: (3) in, This represents the distance from the starting point to the current node. The actual cumulative movement cost, Indicates starting from the current node Manhattan distance to the destination This represents the total crossover penalty value of the current node. Indicates the current node The overlap suppression function, This represents the spatial distribution uniformity index of the current node n.

[0053] In this embodiment, the current node n corresponds to a grid, and its candidate successor node in its four-connected neighborhood is represented as m. , This represents the four-connected neighborhood of the current node n. In this embodiment, instead of directly evaluating whether the generated local path segments intersect with existing paths, it proactively estimates the complete orthogonal path from the candidate successor node m to the endpoint t as the estimated path. Typically, the Manhattan shortest path is used as the estimated path, and it is then checked whether the estimated path intersects with the set of planned paths. Geometric intersections occur at non-endpoint locations.

[0054] For each detected crossover, the crossover count is linearly incremented, and a crossover penalty coefficient is added to the crossover count. , If the value is greater than 0, then the total crossover penalty value corresponding to the current node n is expressed as: (4) in: Indicates the current node The corresponding total cross-penalty value, specifically for the current node. The sum of the crossover penalty values ​​up to all successor nodes m; Indicates from candidate successor node To the finish line The estimated shortest path to Manhattan; This represents the set of planned paths; This represents the cross-counting function, and its value is equal to... and The total number of non-endpoint intersections of all paths in the sequence; This represents the cross-penalty coefficient.

[0055] Furthermore, the cross-penalty coefficient Use a segmented dynamic adjustment strategy: Set the initial value to 1. If the total number of crossovers exceeds 3, i.e., the crossover count function value is greater than 3, then... Adjust to twice the initial value. If the total number of crossovers exceeds 5, i.e., the crossover count function value is greater than 5, then... Adjusted to four times the initial value, this mechanism aims to gradually strengthen the suppression of crossover behavior as the risk of crossover increases, thereby guiding the search process towards generating layout schemes with no or low crossover.

[0056] Among them, the overlap suppression function This is used to detect and prevent two or more paths from overlapping on the same grid cell between the current node n and planned paths. In this embodiment, for each candidate current node n, it is checked whether it is located in the grid cell set occupied by any planned path. If so, apply a large penalty value to the node to prevent it from choosing that path.

[0057] Specifically, overlap suppression function The value can be: (1) When If the current grid cell is already occupied by another path, an overlap penalty value is applied. ,Right now: (5) in, This represents the set of grid cells occupied by the planned path. Indicates the overlap penalty value. >0, its value can be the number of times the current node n overlaps with the planned path on the same grid.

[0058] (2) When When there is no overlap, no additional penalty is applied, i.e.: =0; (6) In this embodiment, the spatial distribution uniformity index Used to measure the path to be planned corresponding to the current node n. The impact on the uniformity of path density distribution within the overall drawing area. Its core objective is to guide paths towards lower-density areas, avoiding excessive path concentration in localized areas, thereby improving the aesthetics, visual balance, and compliance with professional cartographic standards of the balance map layout. Specifically, spatial distribution uniformity index... The calculation method is as follows: (1) Divide the drawing area into several logical sub-regions, such as K×K logical sub-regions, where K is a positive integer, and count the number of grid cells occupied by paths in each logical sub-region, which is used as the path density d of the corresponding logical sub-region; set a baseline density threshold. It can be set to the average density of all sub-regions; (2) Obtain the path density of the logical sub-region where the current node n is located. d ,like ,but = ,like ,but = ;in, , , Indicates the intensity of encouragement. Indicates the severity of the punishment.

[0059] In this embodiment, improvement A Based on the aforementioned total evaluation cost, the search algorithm automatically finds the optimal flow path connecting source and sink units in the discretized grid map. This process uses the composite total evaluation cost function as the decision-making basis to ensure that the generated path, while satisfying orthogonal routing constraints, comprehensively optimizes multiple objectives such as obstacle avoidance, anti-crossing, anti-overlapping, and spatial distribution balance.

[0060] Specifically, improve A The steps of path planning in a search algorithm are as follows: ① Initialize the search state: Determine an initial movement direction based on the relative positions of the source and sink nodes. Starting from the starting point, proceed according to the normal A... The search algorithm calculates that the corresponding actual cumulative movement cost is g=0 and the initial total evaluation cost is f=0. ② Each time, traverse the four orthogonal neighbors (up, down, left, right) of the current parent node to find an expansion node, and select the node with the minimum total evaluation cost as the current expansion node. Specifically, select legal neighbor nodes, i.e., nodes not occupied by obstacles, as candidate successor nodes of the current parent node, and take one of the candidate successor nodes as the current node n. Calculate the actual cumulative movement cost from the starting point through the current parent node to the current node n. If the direction from the current parent node to the current node has not changed, then: If the direction from the current parent node to the current node n changes, then: This increases the actual cumulative movement cost from the current parent node to the candidate successor node. This represents the actual cumulative movement cost corresponding to the current parent node. Based on formula (3), calculate the total evaluated cost corresponding to the candidate successor nodes of the four orthogonal neighborhoods when they are the current node, and obtain the total evaluated cost. The smallest candidate successor node is used as the actual successor node, and this node is updated as the parent node. The above steps are repeated until the target node, i.e. the end point, is reached. ③ Termination condition: When a successor node reaches the destination for the first time, it indicates that a feasible path that satisfies all constraints has been found, and the search terminates successfully; ④ Path backtracking and solidification: After successfully finding the path, backtrack from the end point to the starting point along the parent node pointer to generate a complete water flow path sequence; Through the above mechanism, the path planning method in this embodiment, while ensuring path orthogonality, connectivity and physical rationality, comprehensively weighs multiple objectives such as obstacle avoidance, reduction of intersections, reduction of overlaps and spatial balance, and finally outputs a water flow path with optimal global cost, clear visuals and conforming to the professional mapping specifications of water balance diagrams.

[0061] Step 5: Redraw the flow paths between all source-sink unit pairs based on the optimal flow paths obtained from path optimization, and then update the layout diagram to obtain the water balance diagram.

[0062] Example 2 like Figure 2 As shown, Embodiment 2 of the present invention provides a water flow path planning system based on an improved Manhattan algorithm, used to implement the water flow path planning method based on an improved Manhattan algorithm described in Embodiment 1, including: an interactive interface module, a mapping configuration unit, a port coordinate determination unit, a path optimization unit, and a graphical output unit.

[0063] The interactive interface module is used to input the hydraulic attribute information of each node unit and create the initial layout diagram.

[0064] In this embodiment, the interactive interface module is used to create new projects, input project names, and configure basic topology parameters, including the number of water supply units, the number of primary water consumption units, and the number of drainage units. Based on this, the system automatically creates an independent workspace and generates a corresponding initial layout diagram in the drawing area, forming the basic framework of the water balance network. Creating the initial layout diagram provides a structured foundation for subsequent water volume entry, sub-node expansion, and path connection, significantly reducing the modeling threshold.

[0065] The interactive interface module supports flexible expansion of multi-level sub-node units. Users can add, delete, or edit sub-node units (such as workshops, equipment, processes, etc.) for any water-consuming unit and select their arrangement (horizontal or vertical). The interactive interface module can automatically adjust the node position, size, and hierarchical relationship according to the selected strategy, enabling accurate modeling of complex scenarios such as cascade water use, recycling, and multi-branch drainage, thus improving the system's applicability and expressive capabilities.

[0066] The mapping configuration unit is used to decompose the drawing plane into a two-dimensional grid space, where each grid cell corresponds to a fixed-size region in the physical coordinate system; it is also used to map the graphic entities corresponding to all node cells in the initial layout diagram to the corresponding grid in the two-dimensional grid space, and to mark the corresponding grid as a set of impassable obstacles.

[0067] After users complete the node and water volume configuration through the interactive interface module, they can also trigger the "global optimization" command through the interactive interface module. Then the mapping configuration unit will perform the following operations: discretize the drawing area into a high-resolution two-dimensional raster map, and map the laid-out graphic elements (node ​​unit boxes, legends, text, etc.) into impassable obstacles.

[0068] The port coordinate determination unit is used to sequentially obtain each node unit in the initial layout diagram. Based on the basic information of the source-sink unit pairs corresponding to all water flow paths with the current node unit as the source unit, including the node unit type, node unit position and node unit border coordinates, the unit sequentially determines the starting point coordinates and ending point coordinates of all water flow paths corresponding to each node unit.

[0069] The path optimization unit is used to determine the starting and ending points of the path based on the starting and ending point coordinates of each water flow path; and based on the improved A... The search algorithm performs path planning for each water flow path sequentially, and the improved A The search algorithm selects the optimal water flow path based on the total evaluation cost, which is: (7) in, This represents the distance from the starting point to the current node. The actual cumulative movement cost, Indicates starting from the current node Manhattan distance to the destination Indicates the current node Cross-penalty terms, Indicates the current node The overlap suppression function, Indicates the current node Spatial distribution uniformity index.

[0070] Among them, cross-penalty items overlap suppression function Spatial distribution uniformity index The calculation formula is the same as in Example 1.

[0071] In this embodiment, after the port coordinate determination unit determines the port coordinates of the source-sink unit pair, the path optimization unit calls the improved A. The search algorithm performs path planning for each water flow path based on the total evaluation cost, and automatically searches for the optimal water flow path. The optimized optimal water flow path has the characteristics of no intersection, orthogonal lines, low redundancy, and uniform spatial distribution, and strictly conforms to engineering drawing specifications. At the same time, the system automatically optimizes the direction of connecting arrows, label positions, line styles and legend layouts, and supports one-click application of industry standard beautification templates.

[0072] The graphics output unit is used to redraw the water flow paths between all source-sink unit pairs based on the optimal water flow path obtained by the path optimization unit, and then update the layout diagram to obtain the water balance diagram.

[0073] In addition, the graphics output unit is also used for interactive fine-tuning of the horizontal graph, including but not limited to dragging node units to improve local layout. After adjustment, clicking the "Export Image" function will render the current view as a high-resolution image file (such as PNG, SVG, etc.) for reporting, archiving, or approval purposes.

[0074] Furthermore, such as Figure 2 As shown in the figure, a water flow path planning system based on an improved Manhattan algorithm in this embodiment also includes a consistency verification unit. This unit performs real-time water conservation verification on all nodes based on the water conservation formula. The water conservation principle is: input water volume = output water volume + loss. If the water conservation principle is not met, an anomaly is automatically indicated or a one-click correction is provided; if the water conservation formula is met, logical connection relationships between units are automatically generated to ensure that subsequent path planning has both physical rationality and business correctness.

[0075] The following describes the operation process of a water flow path planning system based on an improved Manhattan algorithm, provided in Embodiment 2 of the present invention.

[0076] 1. Create a new project through the interactive interface module and fill in the following information: Water supply unit information: including: number of water supply units: 1; name of water supply unit: municipal water supply.

[0077] Number of primary water-consuming units: 5.

[0078] Drainage unit information: Number of drainage units: 1, Drainage unit name: Wastewater treatment station.

[0079] Click "OK" to generate a two-dimensional raster space as follows: Figure 3 As shown.

[0080] 2. Select the node element, click Edit, modify the node element name, and then click Node to save.

[0081] Select the first-level water-consuming node "Level 1_1", click [Add] to add two horizontal sub-nodes, click [Edit] to modify the node name (Cooling System), and set the inflow water volume (100). Select the outflow node "Level 2_11" and set the outflow water volume (55.15). Select the outflow node "Level 3_12" and set the outflow water volume (44.85). Click [Save Nodes], click [Draw], and generate the diagram as shown below. Figure 4 As shown.

[0082] Then, repeat the above operation for the remaining node units in sequence. This continues until all node units are set up. During the setup process, the consistency verification unit performs real-time water conservation checks. If the inflow or outflow of water in a node unit does not meet the water conservation principle, an error message is displayed or a correction is initiated. The final generated initial layout diagram is as follows: Figure 5 As shown.

[0083] 3. Finally, click on "Global Optimization." The port coordinate determination unit first determines the starting and ending coordinates of each water flow path, and the path optimization unit calls the improved A. The search algorithm sequentially plans the water flow path between every two node units, returns the optimal water flow path, and then re-establishes the water flow path between these two nodes. After optimizing and adjusting all water flow paths in the graph, the graphical output unit forms an optimized water balance diagram, such as... Figure 6 As shown.

[0084] 4. For the optimized water flow path water balance diagram, you can also manually drag and drop to fine-tune it using the graphics output unit. Then click "Export Image" to export the final water balance diagram, as shown below. Figure 7 As shown.

[0085] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A water flow path planning method based on an improved Manhattan algorithm, characterized in that, Includes the following steps: Step 1: Obtain the initial layout of the water balance diagram, and decompose the drawing plane into a two-dimensional grid space. Each grid cell corresponds to a fixed-size area in the physical coordinate system. Then, in the two-dimensional grid space, map the graphic entities corresponding to all node cells in the initial layout diagram to the corresponding grids, and mark the corresponding grids as a set of impassable obstacles. Step 2: Obtain the first node unit in the initial layout diagram. Based on the basic information of the source-sink unit pairs corresponding to all water flow paths with the first node unit as the source unit, determine the coordinates of the starting point and the ending point of each water flow path. Step 3: Sequentially obtain each node unit in the initial layout diagram, repeat Step 2, and determine the starting and ending coordinates of all water flow paths; Step 4: Determine the starting and ending points of each water flow path based on the coordinates of the starting and ending points; based on the improved A... The search algorithm performs path planning for each water flow path sequentially, and the improved A The search algorithm selects the optimal water flow path based on the total evaluation cost, which is: ; in, This represents the distance from the starting point to the current node. The actual cumulative movement cost, Indicates starting from the current node Manhattan distance to the destination Indicates the current node The total value of cross-penalties, Indicates the current node The overlap suppression function, Indicates the current node Spatial distribution uniformity index; Step 5: Based on the optimal water flow path obtained from path optimization, redraw the water flow path between all source-sink unit pairs and update the layout diagram to obtain the water balance diagram.

2. The water flow path planning method based on the improved Manhattan algorithm according to claim 1, characterized in that, In step 4, the total value of the cross-penalty The calculation formula is: ; in, Indicates from candidate successor node To the finish line The estimated shortest path in Manhattan, This represents the set of planned paths. This represents the cross-counting function. This represents the cross-penalty coefficient.

3. The water flow path planning method based on the improved Manhattan algorithm according to claim 2, characterized in that, Cross-penalty coefficient Use a segmented dynamic adjustment strategy: set the initial value to 1, and if the cross-counting function value is greater than 3, then... Adjust to twice the initial value. If the cross-count function value is greater than 5, then... Adjusted to 4 times the initial value.

4. The water flow path planning method based on the improved Manhattan algorithm according to claim 1, characterized in that, In step 4, the overlap suppression function The value can be: when hour, ; when At that time, =0; in, This represents the set of grid cells occupied by the planned path. This represents the overlap penalty value.

5. A water flow path planning method based on an improved Manhattan algorithm according to claim 1, characterized in that, In step 4, the spatial distribution uniformity index The calculation method is as follows: The drawing area is divided into several logical sub-regions, and the number of grid cells occupied by paths in each sub-region is counted as the path density d of the sub-region. Get the path density of the current node n in each logical sub-region. d and baseline density threshold ,like ,but = ,like ,but = ;in, , , Indicates the intensity of encouragement. Indicates the severity of the punishment.

6. A water flow path planning method based on an improved Manhattan algorithm according to claim 1, characterized in that, Step 2 specifically includes the following steps: Step 2.1: For the first node unit in the initial layout diagram, obtain the basic information of the source-sink unit pairs corresponding to all water flow paths with the first node unit as the source unit, and determine the connection direction rules corresponding to each water flow path; Step 2.2: Determine the priority of the water flow path based on the priority of the connection direction rule; Step 2.3: Based on the priority of the water flow path and the corresponding connection direction rules, determine the starting point coordinates and ending point coordinates of each water flow path in sequence.

7. A water flow path planning method based on an improved Manhattan algorithm according to claim 6, characterized in that, In step 2.1, the connection direction rule includes: a first rule and a second rule; The first rule includes the principle of evaporation / water consumption exiting upwards, the principle of prioritizing reuse and aligning vertically, and the principle of self-circulation exiting from the right and entering from the top. The second rule includes the left-in-right-out principle and a global four-way compatibility strategy; In step 2.2, the priority of the connection direction rules is as follows: evaporation / water consumption upward principle > self-circulation right-out upward principle > reuse priority top-bottom alignment principle > left-in right-out principle > global four-way compatibility strategy; In step 2.3, the connection direction rule is the water flow path of the first rule, and the starting point and the ending point are directly determined by the corresponding connection direction rule; For water flow paths with the connection direction rule as the second rule, the initial start and end point set is first determined based on the connection direction rule and the remaining ports. The initial start and end point set includes one or more candidate start point-end point pairs. Then, based on the relative positional relationship between the source unit and each sink unit in the initial layout diagram, and the comprehensive adaptation score of each candidate start point-end point pair, the start point and end point of the water flow path are determined. The formula for calculating the comprehensive adaptation score is as follows: ; in, This represents the preset weight of the starting point in the candidate start-end point pair. This represents the preset weight of the endpoint in the candidate start-end point pair.

8. A water flow path planning method based on an improved Manhattan algorithm according to claim 6, characterized in that, Step 1 also includes the following steps: based on the principle of water conservation, perform a consistency check on the water conservation of all node units in real time.

9. A water flow path planning system based on an improved Manhattan algorithm, characterized in that, A method for implementing a water flow path planning method based on an improved Manhattan algorithm as described in any one of claims 1-8 includes: Interactive interface module: used to input hydraulic attribute information of each node unit and create the initial layout diagram; Mapping configuration unit: used to decompose the drawing plane into a two-dimensional grid space, each grid unit corresponds to a fixed-size area in the physical coordinate system; also used to map the graphic entities corresponding to all node units of the initial layout diagram to the corresponding grid in the two-dimensional grid space, and mark the corresponding grid as a set of impassable obstacles; Port coordinate determination unit: used to sequentially obtain each node unit in the initial layout diagram, and based on the basic information of the source-sink unit pairs corresponding to all water flow paths with the current node unit as the source unit, sequentially determine the starting point coordinates and ending point coordinates of all water flow paths corresponding to each node unit. Path optimization unit: used to determine the starting and ending points of the path based on the starting and ending point coordinates of each water flow path; and based on improved A... The search algorithm performs path planning for each water flow path sequentially, and the improved A The search algorithm selects the optimal water flow path based on the total evaluation cost, which is: ; in, This represents the distance from the starting point to the current node. The actual cumulative movement cost, Indicates starting from the current node Manhattan distance to the destination Indicates the current node The total value of cross-penalties, Indicates the current node The overlap suppression function, Indicates the current node Spatial distribution uniformity index; Graphics output unit: Used to redraw the flow paths between all source-sink unit pairs based on the optimal flow paths obtained by the path optimization unit, and then update the layout diagram to obtain the water balance diagram.

10. A water flow path planning system based on an improved Manhattan algorithm according to claim 9, characterized in that, It also includes a consistency verification unit, which is used to perform real-time water conservation verification on all node units based on the water conservation formula.