River network cleaning workload distribution method based on dynamic programming algorithm
By combining dynamic programming algorithms with heap data structures, river cleaning task allocation is optimized, and the problem of inefficient allocation in large-scale river networks is solved, the allocation plan with the lowest equipment cost is realized, and the cleaning efficiency and economicality is improved.
Patent Information
- Application Number
- CN202510297671.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-13
- Publication Date
- 2025-07-04
AI Technical Summary
The prior art has low efficiency in river cleaning tasks in large-scale river networks, high computation time complexity, unable to meet real-time requirements, and high equipment costs and lack universality.
The dynamic programming algorithm is combined with the heap data structure to calculate the optimal allocation scheme of the river network from bottom to upward. Through the rapid merger of equipment demand heaps and margin heaps, optimize personnel allocation, and generate the river cleaning task allocation scheme with the lowest total equipment cost.
It significantly reduces the total equipment requirement required for cleaning, improves cleaning efficiency, reduces economic costs, and can handle complex tree-shaped river areas, providing scientific decision-making basis.
Smart Images

Figure CN120258381A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of software algorithms, and in particular, to a method for allocating the workload of river network cleaning based on the dynamic programming algorithm. Background Art
[0002] In the field of river environmental protection, cleaning work is an important measure to maintain water quality and ecological health. However, river cleaning tasks often involve complex issues such as area division, equipment allocation, and staff allocation. The traditional manual allocation method is not only inefficient but also has high economic costs for purchasing and using equipment, making it difficult to ensure the optimal cleaning effect. Especially in large rivers or rivers with complex terrain and hydrological conditions, the river cleaning area has a complex tree structure. Specifically, in the scenario of river environmental protection, it is often necessary to divide the river into several continuous river sections, which are responsible for cleaning by different staff. Each river section has a length (corresponding to the workload) and an equipment requirement level (such as the equipment specifications required for cleaning).
[0003] In the prior art, the task allocation scheme usually adopts dynamic programming algorithms, such as greedy algorithms or heuristic algorithms, models the river network as a tree structure, and recursively divides the tree chain that satisfies the single-section length constraint and has the minimum total equipment cost. However, the time complexity of the existing dynamic programming algorithm is O(n2). When facing a complex river network (the number of nodes n is extremely large), the calculation time increases sharply, resulting in low planning efficiency and being unable to meet the requirements of real-time or large-scale scenarios. In addition, the existing methods are only applicable to specific simplified situations (such as no weight constraint or no distinction between nodes) and lack generality.
[0004] Therefore, with the continuous increase in river cleaning requirements and the increasing complexity of cleaning tasks, the traditional planning method has been difficult to meet the actual needs, and a more efficient solution is needed to optimize the personnel allocation of river cleaning work tasks, reduce the total equipment requirements for cleaning, thereby improving the cleaning efficiency and reducing the economic costs of cleaning.
[0005] Content of the Application
[0006] The present application provides a method for allocating the workload of river network cleaning based on the dynamic programming algorithm, which can quickly generate a river network cleaning task allocation scheme with the lowest total equipment cost and meeting the single-section length constraint in a large-scale river network, thereby improving the cleaning efficiency and reducing the economic costs of the required equipment.
[0007] To achieve the above object, the present application adopts the following technical solutions:
[0008] In the first aspect, the present application provides a method for allocating the workload of river network cleaning based on the dynamic programming algorithm, including:
[0009] S100: Obtain the structure of the river to be cleaned and the lengths of each river section;
[0010] S200: Obtain the work efficiency of the staff, where the work efficiency is the length of the river that each staff can clean per unit time;
[0011] S300: Construct a tree - shaped network structure according to the structure and the lengths of each river section. The root node of the tree - shaped network structure is the river source. Each node contains a length attribute and an equipment requirement level. The length attribute represents the workload of the river section, and the equipment requirement level represents the specification of the equipment required to clean this river section;
[0012] S400: Take the river section with the highest equipment demand among all the river sections assigned to the staff as the equipment demand required by the staff;
[0013] S500: Define the task window and margin for each node. The task window contains the continuous river sections that can be assigned starting from the current node. The margin contains the sub - river sections that need to be assigned due to the upstream river section exceeding the length constraint and the current river section exceeding the length constraint;
[0014] S600: Initialize the equipment demand heap and the margin heap. The equipment demand heap stores the optimal allocation schemes of the child nodes within the task window, and the margin heap stores the allocation schemes of the child nodes within the margin;
[0015] S700: Recursively merge the equipment demand heap and the margin heap of the child nodes from bottom to top, and dynamically adjust the task window and the margin to ensure that the merged heap meets the global length constraint;
[0016] S800: At the root node, extract the allocation scheme with the minimum total equipment demand from the merged equipment demand heap and margin heap, and recursively backtrack to generate a specific river section allocation list.
[0017] In a preferred example of the present application, it can be further set that the key value of the equipment demand heap is the equipment requirement level. The steps of storing the optimal allocation schemes of the child nodes within the task window include:
[0018] During initialization, add the optimal allocation scheme of each child node to the equipment demand heap;
[0019] During recursive merging, merge the equipment demand heap of the child nodes into the equipment demand heap of the current node, and dynamically adjust the heap key value according to the equipment requirement level;
[0020] During the merging process, if the total length of a certain sub - heap exceeds the preset threshold, move this sub - heap to the margin heap.
[0021] In a preferred example of the present application, it can be further set that the key value of the margin heap is the equipment requirement level. The steps of storing the scheme of the child nodes that need to be allocated due to length constraints include:
[0022] During initialization, add the child node solutions that need to be allocated due to length constraints to the margin heap;
[0023] During recursive merging, merge the margin heap of the child nodes into the margin heap of the current node, and dynamically adjust the heap key values according to the device requirement level;
[0024] During the merging process, if the total length of a certain sub-heap exceeds the preset threshold, trigger the sub-heap splitting operation and move the sub-heap to the margin heap.
[0025] In a preferred example of the present application, it can be further set that it also includes the process of dynamically adjusting the heap key values during the recursive merging process, and the steps include:
[0026] During initialization, set the key values of the device requirement heap and the margin heap of each child node to the device requirement level;
[0027] During recursive merging, dynamically adjust the key values of the device requirement heap and the margin heap of the current node according to the device requirement level of the child nodes;
[0028] During the adjustment process, if the total length of a certain sub-heap exceeds the preset threshold, adjust the key value of the sub-heap to the key value of the margin heap.
[0029] In a preferred example of the present application, it can be further set that the steps of dynamically adjusting the task window and the margin include:
[0030] During initialization, add the task window and the margin of each child node to the task window and the margin of the current node respectively;
[0031] During recursive merging, dynamically adjust the task window and the margin of the current node according to the task window and the margin of the child nodes;
[0032] During the adjustment process, if the total length of a certain sub-heap exceeds the preset threshold, move the sub-heap from the task window to the margin.
[0033] In a preferred example of the present application, it can be further set that at the root node, extract the allocation solution with the smallest total device requirement from the merged device requirement heap and margin heap, including:
[0034] At the root node, extract the allocation solution with the smallest total device requirement from the merged device requirement heap and margin heap;
[0035] Recursively backtrack to generate a specific river section allocation list to ensure that the length of each river section does not exceed the preset threshold.
[0036] In a second aspect, the present application provides a device for allocating the workload of river network cleaning based on a dynamic programming algorithm, and the device includes:
[0037] A data acquisition module, configured to obtain the structure of the river to be cleaned and the lengths of each river section; obtain the work efficiency of the staff, where the work efficiency is the length of the river that each staff member can clean per unit time;
[0038] A network construction module, configured to construct a tree-shaped network structure according to the structure and the lengths of each river section, where the root node of the tree-shaped network structure is the river source, and each node includes a length attribute and an equipment requirement level. The length attribute represents the workload of the river section, and the equipment requirement level represents the specification of the equipment required to clean the river section;
[0039] A node module, configured to use the river section with the highest equipment demand among all the river sections assigned to the staff as the equipment demand required by the staff; define the task window and margin of each node. The task window includes the continuous river sections that can be assigned starting from the current node, and the margin includes the sub-river sections that need to be assigned due to the upstream river section exceeding the length constraint and the current river section exceeding the length constraint; define the task window and margin of each node. The task window includes the continuous river sections that can be assigned starting from the current node, and the margin includes the sub-river sections that need to be assigned due to the upstream river section exceeding the length constraint and the current river section exceeding the length constraint;
[0040] A recursive module, configured to recursively merge the equipment demand heap and the margin heap of the sub-nodes from bottom to top, dynamically adjust the task window and the margin, and ensure that the merged heap meets the global length constraint;
[0041] An output module, configured to extract the allocation scheme with the minimum total equipment demand from the merged equipment demand heap and margin heap at the root node, and recursively backtrack to generate a specific river section allocation list.
[0042] In a third aspect, the present application provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the steps of the method for allocating the workload of river network cleaning based on the dynamic programming algorithm as described in any one of the above are implemented.
[0043] In a fourth aspect, the present application provides a computer-readable storage medium, on which a program is stored. When the program is executed by a processor, the method for allocating the workload of river network cleaning based on the dynamic programming algorithm as described in any one of the above is implemented.
[0044] In a fifth aspect, the present application provides a computer program product, including computer instructions, which implement the steps of the method for allocating the workload of river network cleaning based on the dynamic programming algorithm as described in any one of the above when executed by a processor.
[0045] In summary, compared with the prior art, the beneficial effects brought by the technical solution provided by the embodiment of the present application at least include:
[0046] By optimizing the personnel allocation plan, the present application can significantly reduce the total equipment requirements for cleaning, thereby improving the cleaning efficiency. This can not only save human and material resources, but also shorten the cleaning cycle and reduce the impact on the environment.
[0047] The present application adopts an algorithm that combines dynamic programming and binomial heaps. Through the rapid merging and dynamic adjustment of the heap structure, the time complexity is reduced from O(n2) to O(n log n). It can handle ultra-large river networks (such as n≥10^6 nodes), and can ensure to find the optimal personnel allocation plan in the river cleaning area with a complex tree structure. This can not only improve the cleaning effect, but also provide a scientific basis for decision-makers.
[0048] The method of the present application can handle nodes with different cleaning requirements and area sizes, as well as river cleaning areas with complex tree structures, and has strong adaptability and flexibility. It can be widely applied to different types of river cleaning tasks. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 It is a flowchart of a method for allocating river network cleaning workload based on a dynamic programming algorithm provided by an embodiment of the present application.
[0050] Figure 2 It is a maintenance flowchart of a method for allocating river network cleaning workload based on a dynamic programming algorithm provided by an embodiment of the present application.
[0051] Figure 3 It is a partial heap definition diagram of a method for allocating river network cleaning workload based on a dynamic programming algorithm provided by an embodiment of the present application.
[0052] Figure 4 It is a first maintenance process diagram of a method for allocating river network cleaning workload based on a dynamic programming algorithm provided by an embodiment of the present application.
[0053] Figure 5 It is a second maintenance process diagram of a method for allocating river network cleaning workload based on a dynamic programming algorithm provided by an embodiment of the present application.
[0054] Figure 6 It is a module diagram of a device for allocating river network cleaning workload based on a dynamic programming algorithm provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0055] The following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application without creative efforts shall fall within the protection scope of the present application.
[0056] In an embodiment of the present application, a method for allocating the workload of river network cleaning based on the dynamic programming algorithm is provided, which is applied to the scenario of river environmental protection. In this scenario, it is necessary to dispatch staff to clean the river, and it is necessary to reasonably allocate work tasks according to the work efficiency of the staff and equipment requirements, that is, allocate the staff to clean a certain length of river section to minimize the total equipment requirements.
[0057] The method models the obtained river network as a tree structure, where each node corresponds to a river section and includes a length attribute w i and an equipment requirement level s i , and then, through the combination of dynamic programming and heap data structure, recursively calculates the optimal allocation scheme of each subtree from bottom to top, and uses the heap structure to quickly merge the subtask schemes to finally generate a global optimal solution. As shown in Figure 1 , the specific steps of the method include:
[0058] S100: Obtain the structure of the river to be cleaned and the lengths of each river section;
[0059] S200: Obtain the work efficiency of the staff, where the work efficiency is the length of the river that each staff can clean per unit time;
[0060] Specifically, each staff member will be responsible for a continuous part of the river. Since the river has bifurcations, each non-bifurcated river section can be regarded as a vertex of the tree. Assume that each person can clean at most a river with a length of w0, and each river section i has a length w i and an equipment requirement level s i .
[0061] Define the technical indicators during allocation as the time complexity O(n log n) and the space complexity O(n).
[0062] S300: Construct a tree-shaped network structure according to the structure and the lengths of each river section. The root node of the tree-shaped network structure is the source of the river, and each node includes a length attribute and an equipment requirement level. The length attribute represents the workload of the river section, and the equipment requirement level represents the specification of the equipment required to clean the river section;
[0063] Specifically, the river network is converted into a tree structure, with the root node being the river source and the child nodes being the downstream bifurcated river sections. Each node records its length and the equipment requirement level. The river is divided into two parts for processing: window (win v ) and margin (mar v ). The window nodes can serve as the end points of the chains starting from the root node (i.e., the end points that the staff responsible for clearing the river channel v may reach). For the margin nodes, their parent nodes are window nodes while they themselves are not.
[0064] Suppose we use cost(v,i) to represent the optimal solution of the tree with v as the root, containing the division with the end point of the chain starting from the parent node of i being v (i.e., for the river channel v and its downstream, the minimum total equipment requirement of the allocation plan for a staff member specifically responsible for the cleaning work from v to i). The minimum cost of the window nodes and margin nodes is F[v].
[0065] For a certain node on the tree, we define it as s-maximal if and only if there are no nodes with s (equipment requirement level) not less than it on the path to the root node. Assuming the current root node is v (the current problem is the river channel v and its downstream), for a certain node (river section) i, define its first s-maximal ancestor on it as next(v,i).
[0066] S400: Take the river section with the highest equipment demand among all the river sections allocated to the staff as the equipment demand required by the staff;
[0067] Specifically, the equipment required by each staff member is determined by the maximum equipment requirement level s i in the river sections he is responsible for.
[0068] S500: Define the task window and margin for each of the said nodes. The task window includes the continuous river sections that can be allocated starting from the current node, and the margin includes the sub-river sections that need to be allocated due to the upstream river section exceeding the length constraint and the current river section exceeding the length constraint;
[0069] S600: Initialize the equipment demand heap and the margin heap. The equipment demand heap stores the optimal allocation plans of the child nodes within the task window, and the margin heap stores the allocation plans of the child nodes within the margin;
[0070] Specifically, create an equipment demand heap H and a margin heap for each leaf node, and record its allocation plan.
[0071] S700: Recursively merge the equipment demand heap and the margin heap of the child nodes from bottom to top, and dynamically adjust the task window and the margin to ensure that the merged heap meets the global length constraint.
[0072] The specific implementation manners of steps S500 to S700 include:
[0073] Based on several defined small root binomial heaps, assuming the current root node is v, for the s-maximal node x within the window, we have:
[0074] Store the s-maximal node i where x = next(v, i), with the key value being cost(x, i). This key value means that for the x river section and its downstream, there is a staff member specifically responsible for the distribution plan of the river cleaning work from s to i, and the minimum total equipment requirement.
[0075] Store win v All s-maximal nodes within The node i corresponding to the top of the heap, with the key value being cost(v, i). This key value means that for the v river section and its downstream, there is a staff member specifically responsible for the distribution plan of the river cleaning work from v to i, and the minimum total equipment requirement.
[0076] Store the margin node i where x = next(v, i), with the key value being cost(x, i). This key value means that for the x river section and its downstream, there is a staff member specifically responsible for the distribution plan of the river cleaning work from s to i, and the minimum total equipment requirement.
[0077] Store mar v All nodes within The node i corresponding to the top of the heap, with the key value being cost(v, i). This key value means that for the v river section and its downstream, there is a staff member specifically responsible for the distribution plan of the river cleaning work from v to i, and the minimum total equipment requirement.
[0078] Assume that the relevant heaps of each subtree and the optimal values of each node therein have been obtained during the recursive process. The properties of the above heaps are maintained through the following steps.
[0079] First, add each child node of v to Then, maintain process W (v) And process S (x) The maintenance process is as Figure 2 shown.
[0080] During the maintenance process of W (v) We use the max heap W (v) To maintain all nodes in the window and handle the changes regarding the entry and exit of nodes from the margin. W (v)The key value of the middle node is the sum of the weights of all nodes on the chain from it to the root node (i.e., the length of the river channel corresponding to the work at the end point that the staff responsible for cleaning the river channel v may clean to). Initially, it is the sum of W corresponding to each of its child nodes i (i) It is merged and added with v. Before the merger, we based on W (i) Process the nodes entering and leaving mar i And mar v Of the nodes, first for W (i) Uniformly add w v .
[0081] If there is a node in W (i) Whose sum of weights exceeds w0, the node itself corresponds to the corresponding And Enter the corresponding And Its child nodes directly leave all the heaps. And When deleting a node, it is necessary to add nodes that meet the definition according to the corresponding And Of the deleted node.
[0082] Subsequently, And Are respectively merged from the child nodes' And Before the merger, it is necessary to uniformly add the key value to each heap according to the definition, so that the key values in the child nodes And Meet the And Definition.
[0083] Then, in the maintenance process S (x) For each We synchronously define the min-heap S (x) To store the same nodes, and the key value is the cost s of the nodes. After the above maintenance is completed, we start from the smallest and find the y in S (v) Whose s is less than s v Merge its corresponding And Into And Before each merger, update all the key values in the merged heap according to the definition to make them meet the definition of the merged heap. As a node that is no longer s-maximal, y will be deleted from And Its And Optimal value will also be deleted from And .
[0084] For each We synchronously define the min-heap S (x) to store the same nodes, with the key value being the node cost s. After the above maintenance is completed, we start from the smallest one to find the nodes in S (v) whose s is less than s v and the corresponding and are merged into and Before each merge, all key values in the heap to be merged are updated according to the definition to make them conform to the definition of the heap to be merged. As a node that is no longer s-maximal, y will be deleted from and Its and optimal values will also be deleted from and
[0085] After the maintenance is completed, all relevant heaps of the tree with v as the root conform to the above definition and can be recursively called by its ancestors.
[0086] In summary, to calculate the answer F[v] to the problem, we only need to take the minimum value from and Its allocation scheme can be recursively obtained by searching for the corresponding choices of F[*].
[0087] A more detailed description of the heap maintenance process is as follows. The definitions of some heaps are as shown in Figure 3 where the boxes represent the nodes contained in the heap. Taking as an example, contains the s-maximal nodes b and d because the first s-maximal node above b and d is a.
[0088] The maintenance process W (v) is shown in Figure 4 where the boxes represent the nodes contained in the heap. It can be seen that W (v) is composed of the merger of W (a) and W (e) After initialization, it includes a and e. Since c in win i enters mar v with v as the root, c enters and its child nodes leave the margin and are not considered in the algorithm. The same is true for f, which enters
[0089] Figure 5 The maintenance process S (x) is shown in Figure 5 where the boxes represent the nodes contained in the heap. Since a and b lose the s-maximal property due to v in turn, first be incorporated into a is deleted from Then (empty heap) is incorporated into b is deleted from At the same time is also incorporated into
[0090] S800: At the root node, extract the allocation plan with the minimum total equipment requirement from the merged device requirement heap and margin heap, and recursively backtrack to generate a specific river section allocation list.
[0091] Specifically, take the minimum value from and to obtain F[v] (the minimum total equipment requirement for the v river section and its downstream). Since it is a recursive calculation, the above-mentioned heap will automatically adjust all the heaps in the tree to a state that conforms to the definition of the current root node according to the node where F[*] is currently calculated. The allocation plan can also be recursively obtained according to the node selected by F[v].
[0092] In this embodiment, by optimizing the personnel allocation plan, the present application can significantly reduce the total equipment requirement for cleaning, thereby improving the cleaning efficiency. This can not only save human and material resources, but also shorten the cleaning cycle and reduce the impact on the environment. The algorithm combining dynamic programming and binomial heap adopted by the present application can ensure to find the optimal personnel allocation plan in the river cleaning area with a complex tree structure, which can not only improve the cleaning effect, but also provide a scientific basis for decision-makers. The method of the present application can handle nodes with different cleaning requirements and area sizes, as well as river cleaning areas with complex tree structures, and has strong adaptability and flexibility, and can be widely applied to different types of river cleaning tasks.
[0093] In some embodiments, the key value of the device requirement heap is the device requirement level, and the steps of storing the optimal allocation plan of the sub-nodes within the task window include:
[0094] During initialization, add the optimal allocation plan of each sub-node to the device requirement heap;
[0095] During recursive merging, merge the device requirement heap of the sub-node into the device requirement heap of the current node, and dynamically adjust the heap key value according to the device requirement level;
[0096] During the merging process, if the total length of a certain sub-heap exceeds the preset threshold, move the sub-heap to the margin heap.
[0097] In some embodiments, the key value of the margin heap is the device requirement level, and the steps of storing the sub-node plan to be allocated due to length constraints include:
[0098] During initialization, add the child node solutions that need to be allocated due to length constraints to the margin heap;
[0099] During recursive merging, merge the margin heaps of the child nodes into the margin heap of the current node, and dynamically adjust the heap key values according to the device requirement level;
[0100] During the merging process, if the total length of a certain sub-heap exceeds the preset threshold, trigger the sub-heap splitting operation and move the sub-heap to the margin heap.
[0101] In some embodiments, it also includes the process of dynamically adjusting the heap key values during the recursive merging process. The steps include:
[0102] During initialization, set the key values of the device requirement heap and the margin heap of each child node to the device requirement level;
[0103] During recursive merging, dynamically adjust the key values of the device requirement heap and the margin heap of the current node according to the device requirement level of the child nodes;
[0104] During the adjustment process, if the total length of a certain sub-heap exceeds the preset threshold, adjust the key value of the sub-heap to the key value of the margin heap.
[0105] In some embodiments, the steps of dynamically adjusting the task window and the margin include:
[0106] During initialization, add the task window and the margin of each child node to the task window and the margin of the current node respectively;
[0107] During recursive merging, dynamically adjust the task window and the margin of the current node according to the task window and the margin of the child nodes;
[0108] During the adjustment process, if the total length of a certain sub-heap exceeds the preset threshold, move the sub-heap from the task window to the margin.
[0109] In some embodiments, at the root node, extracting the allocation scheme with the smallest total device requirement from the merged device requirement heap and margin heap includes:
[0110] At the root node, extract the allocation scheme with the smallest total device requirement from the merged device requirement heap and margin heap;
[0111] Recursively backtrack to generate a specific river section allocation list to ensure that the length of each river section does not exceed the preset threshold.
[0112] This application also provides a device for allocating the workload of river network cleaning based on the dynamic programming algorithm. Please refer to Figure 6 As shown, the device includes:
[0113] The data acquisition module 100 is used to obtain the structure of the river to be cleaned and the lengths of each river section; obtain the work efficiency of the staff, where the work efficiency is the length of the river that each staff member can clean per unit time.
[0114] The network construction module 200 is used to construct a tree-shaped network structure according to the structure and the lengths of each river section. The root node of the tree-shaped network structure is the river source, and each node includes a length attribute and an equipment requirement level. The length attribute represents the workload of the river section, and the equipment requirement level represents the specification of the equipment required to clean the river section.
[0115] The node module 300 is used to take the river section with the highest equipment demand among all the river sections assigned to the staff as the equipment demand required by the staff; define the task window and margin of each node. The task window includes the continuous river sections that can be assigned starting from the current node, and the margin includes the sub-river sections that need to be assigned due to the upstream river section exceeding the length constraint and the current river section exceeding the length constraint; define the task window and margin of each node. The task window includes the continuous river sections that can be assigned starting from the current node, and the margin includes the sub-river sections that need to be assigned due to the upstream river section exceeding the length constraint and the current river section exceeding the length constraint.
[0116] The recursive module 400 is used to recursively merge the equipment demand heap and the margin heap of the sub-nodes from bottom to top, dynamically adjust the task window and the margin, and ensure that the merged heap meets the global length constraint.
[0117] The output module 500 is used to extract the allocation plan with the minimum total equipment demand from the merged equipment demand heap and margin heap at the root node, and recursively backtrack to generate a specific river section allocation list.
[0118] The function implementation of each module in the above river network cleaning workload allocation device based on the dynamic programming algorithm corresponds to the steps in the embodiment of the above river network cleaning workload allocation method based on the dynamic programming algorithm. Its functions and implementation processes will not be elaborated here one by one.
[0119] This application also provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, it implements the steps of the river network cleaning workload allocation method based on the dynamic programming algorithm as described in any of the above embodiments.
[0120] The present application also provides a computer-readable storage medium, on which a program is stored. Herein, the computer-readable storage medium refers to a carrier for storing data, which may include, but is not limited to, floppy disks, optical discs, hard disks, flash memories, USB flash drives, and / or memory sticks, etc. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. For the working process, working details, and technical effects of the computer-readable storage medium provided in this embodiment, reference may be made to the embodiments of a method for allocating the workload of river network cleaning based on the dynamic programming algorithm in the foregoing text, which will not be elaborated herein.
[0121] The application also provides a computer program product, including computer instructions, which, when executed by a processor, implement the steps of the method for allocating the workload of river network cleaning based on the dynamic programming algorithm as described in any one of the foregoing embodiments.
[0122] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the foregoing embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium, and when the computer program is executed, it may include the processes of the embodiments of the foregoing methods. Among them, any reference to a memory, storage, database, or other medium used in the various embodiments provided in the present application may include non-volatile and / or volatile memories. The non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. The volatile memory may include random access memory (RAM) or an external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and Rambus dynamic RAM (RDRAM).
[0123] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as falling within the scope described in this specification. The above-described embodiments merely represent several implementation manners of the present application. The description is relatively specific and detailed, but it should not be construed as a limitation on the scope of the patent application. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the appended claims.
Claims
1. A workload allocation method for river network cleaning based on the dynamic programming algorithm, characterized in that Including: S100: Obtain the structure of the river to be cleaned and the lengths of each river section. S200: Obtain the work efficiency of the staff, where the work efficiency is the length of the river that each staff member can clean per unit time. S300: Construct a tree network structure based on the structure and the lengths of each river section. The root node of the tree network structure is the source of the river. Each node contains a length attribute and a device requirement level. The length attribute represents the workload of the river section, and the device requirement level represents the specification of the equipment required to clean the river section. S400: Take the river section with the highest equipment demand among all the river sections assigned to the staff as the equipment demand required by the staff. S500: Define the task window and margin for each node. The task window contains the continuous river sections that can be assigned starting from the current node. The margin contains the sub-river sections that need to be assigned due to the upstream river section exceeding the length constraint and the current river section exceeding the length constraint. S600: Initialize the equipment demand heap and the margin heap. The equipment demand heap stores the allocation schemes of the child nodes within the task window, and the margin heap stores the allocation schemes of the child nodes within the margin. S700: Recursively merge the equipment demand heap and the margin heap of the child nodes from bottom to top, and dynamically adjust the task window and the margin to ensure that the merged heap meets the global length constraint. S800: At the root node, extract the allocation scheme with the minimum total equipment demand from the merged equipment demand heap and margin heap, and recursively backtrack to generate a specific river section allocation list.
2. The method for allocating the workload of river network cleaning based on the dynamic programming algorithm according to claim 1, wherein The key value of the equipment demand heap is the equipment demand level. The steps for storing the optimal allocation schemes of the child nodes within the task window include: During initialization, add the optimal allocation schemes of each child node to the equipment demand heap. During recursive merging, merge the equipment demand heap of the child nodes into the equipment demand heap of the current node, and dynamically adjust the heap key value according to the equipment demand level. During the merging process, if the total length of a certain sub-heap exceeds the preset threshold, move the sub-heap to the margin heap.
3. The method for allocating the workload of river network cleaning based on the dynamic programming algorithm according to claim 1, wherein The key value of the margin heap is the equipment demand level. The steps for storing the schemes of the child nodes that need to be assigned due to length constraints include: During initialization, add the schemes of the child nodes that need to be assigned due to length constraints to the margin heap. During recursive merging, merge the margin heap of the child nodes into the margin heap of the current node, and dynamically adjust the heap key value according to the equipment demand level. During the merging process, if the total length of a certain sub-heap exceeds the preset threshold, trigger the sub-heap splitting operation and move the sub-heap to the margin heap.
4. The method for allocating the workload of river network cleaning based on the dynamic programming algorithm according to claim 1, wherein, It also includes the process of dynamically adjusting the heap key value during the recursive merging process. The steps include: During initialization, set the key values of the equipment demand heap and the margin heap of each child node to the equipment demand level. During recursive merging, dynamically adjust the key values of the equipment demand heap and the margin heap of the current node according to the equipment demand level of the child nodes. During the adjustment process, if the total length of a certain sub-heap exceeds the preset threshold, adjust the key value of the sub-heap to the key value of the margin heap.
5. The method for allocating the workload of river network cleaning based on the dynamic programming algorithm according to claim 1, wherein, The steps for dynamically adjusting the task window and the margin include: During initialization, add the task window and the margin of each child node to the task window and the margin of the current node respectively. During recursive merging, dynamically adjust the task window and margin of the current node according to the task window and margin of the child nodes; During the adjustment process, if the total length of a sub-heap exceeds a preset threshold, move the sub-heap from the task window to the margin.
6. The method for allocating the workload of river network cleaning based on the dynamic programming algorithm according to claim 1, wherein At the root node, extract the allocation plan with the minimum total equipment requirement from the merged device requirement heap and margin heap, including: At the root node, extract the allocation plan with the minimum total equipment requirement from the merged device requirement heap and margin heap; Recursively backtrack to generate a specific river section allocation list to ensure that the length of each river section does not exceed the preset threshold.
7. A device for allocating the workload of river network cleaning based on the dynamic programming algorithm, characterized in that, Including: A data acquisition module for obtaining the structure of the river to be cleaned and the lengths of each river section; Obtain the work efficiency of the staff, where the work efficiency is the length of the river that each staff member can clean per unit time; A network construction module for constructing a tree-shaped network structure according to the structure and the lengths of each river section. The root node of the tree-shaped network structure is the source of the river, and each node contains a length attribute and a device requirement level. The length attribute represents the workload of the river section, and the device requirement level represents the specification of the equipment required to clean the river section; A node module for taking the river section with the highest equipment requirement among all the river sections assigned to the staff as the equipment requirement needed by the staff; define the task window and margin of each node. The task window contains the continuous river sections that can be allocated starting from the current node, and the margin contains the sub-river sections that need to be allocated due to the upstream river section exceeding the length constraint and the current river section exceeding the length constraint; define the task window and margin of each node. The task window contains the continuous river sections that can be allocated starting from the current node, and the margin contains the sub-river sections that need to be allocated due to the upstream river section exceeding the length constraint and the current river section exceeding the length constraint; A recursive module for recursively merging the device requirement heap and the margin heap of the child nodes from bottom to top, dynamically adjusting the task window and margin to ensure that the merged heap meets the global length constraint; An output module for extracting the allocation plan with the minimum total equipment requirement from the merged device requirement heap and margin heap at the root node, and recursively backtracking to generate a specific river section allocation list.
8. A computer device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the river network cleaning workload allocation method based on the dynamic programming algorithm as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, A program is stored on the computer-readable storage medium, and when the program is executed by the processor, it implements the river network cleaning workload allocation method based on the dynamic programming algorithm as described in any one of claims 1 to 6.
10. A computer program product comprising computer instructions, characterized in that, When the computer instruction is executed by the processor, it implements the steps of the river network cleaning workload allocation method based on the dynamic programming algorithm as described in claims 1 to 6.