Dag-based swarm intelligence task scheduling method and system
By using a DAG-based swarm intelligence task scheduling method, the problems of redundant dependencies and physical collisions in complex process scheduling are solved, achieving efficient and safe production process recovery and shortening production cycle time.
Patent Information
- Application Number
- CN202610669978.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-15
- Publication Date
- 2026-08-25
AI Technical Summary
Existing technologies cannot respond to industrial production needs in real time when dealing with complex process scheduling, resulting in high computational overhead, redundant dependency edges, logical deadlocks and physical collisions, and a lack of effective production process recovery mechanisms.
A DAG-based swarm intelligence task scheduling method is adopted. Through redundant dependency elimination, Kahn algorithm topology sorting and thread-safe event flags, a hierarchical execution plan is generated and the task is executed asynchronously in an edge computing sandbox. Combined with JSON checkpoints and dynamic parameter compensation, efficient recovery of the production process is achieved.
It effectively reduces scheduling complexity, shortens total production time by 25%, avoids the risks of physical interference and mechanical collisions, and ensures the continuity and safety of production.
Smart Images

Figure CN122632891A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of industrial automation, artificial intelligence and distributed task scheduling technology, and in particular to a swarm intelligence task scheduling method and system based on DAG. Background Technology
[0002] With the increasing demand for flexible manufacturing, multi-agent collaborative systems have shown great potential in the field of dynamic task orchestration. However, existing technologies still have significant shortcomings when dealing with complex process scheduling: First, existing static flow or manually defined DAG schemes cannot respond in real time to industrial production demands described in natural language. Furthermore, when automatically generating large-scale, complex task graphs, they are prone to generating transitive redundant dependencies (e.g., process C depends on processes A and B, which are sequential). This not only leads to an exponential increase in the computational overhead of the scheduling system but also causes invalid logical deadlocks between physical workstations. Second, in multi-machine collaborative asynchronous / synchronous hybrid execution environments, traditional forced process termination mechanisms often cause mechanical actuators to fail to reset in time due to inertia, remaining in the interference zone and triggering serious physical collisions. Finally, existing schemes lack effective physical state backtracking and dynamic compensation mechanisms after execution interruptions, making production process recovery difficult. Summary of the Invention
[0003] The purpose of this invention is to address the shortcomings of existing technologies by proposing a DAG-based swarm intelligence task scheduling method and system.
[0004] To achieve the above objectives, the present invention adopts the following technical solution: A swarm intelligence task scheduling method based on DAG includes the following steps: Upon receiving industrial production instructions, the leader agent parses the instructions, extracts the process steps and physical dependencies between each process node, and generates an initial directed acyclic graph (DAG) task list. Redundant dependency elimination is performed on the initial DAG task list to obtain the reduced task DAG; wherein, the set of all predecessor nodes of each process node is calculated by depth-first traversal and cached; if there is a direct dependency edge between the first process node and the second process node, and the first process node belongs to the set of predecessor nodes of another dependent node of the second process node, then the direct dependency edge is determined to be a redundant path and removed. Based on the Kahn algorithm, the reduced task DAG is topologically sorted, and a hierarchical execution plan is constructed according to the in-degree state of each process node. Process nodes with zero in-degree and no physical interference are grouped into the same parallel execution level. According to the hierarchical execution plan, the intelligent agent actuator creates sub-intelligent agent instances in mutually isolated edge computing sandboxes, and asynchronously calls each of the sub-intelligent agent instances through multi-threading to control the corresponding industrial actuators to complete the process tasks within the parallel execution level.
[0005] Furthermore, the execution process of the hierarchical execution plan also includes a condition checkpoint persistence step: After each parallel execution level of the process task is completed, the task status, environment variables, and end pose data of each of the industrial actuators are written into a checkpoint file in JSON format. When the production process is interrupted and resumed, the checkpoint file is read, the first level containing the task to be executed is located as the starting point, and the downstream process instructions are dynamically compensated based on the feedback data of the current physical sensors.
[0006] Furthermore, the method also includes a collaborative cancellation step: Register a global cancellation signal based on thread-safe event flags in the asynchronous event loop thread; When a cancellation request is received, the global cancellation signal is set to the triggered state; Before the logical loop of executing the process task begins, each of the sub-smart agent instances polls the global cancellation signal. If the global cancellation signal is detected to be in the triggered state, after completing the currently executing underlying hardware I / O instruction, the instance drives the corresponding industrial actuator to perform a preset physical reset operation and exit.
[0007] Furthermore, each process node in the initial DAG task list includes the following fields: Node ID, process title, type identifier of the industrial actuator responsible for execution, physical control command, array of upstream dependent task IDs, and task execution status.
[0008] Furthermore, before performing redundant dependency elimination on the initial DAG task list, the method further includes: The task process continuity check is performed by comparing the structure signature generated by the industrial production instruction with the structure signature of the historical production process to determine whether the industrial production instruction is a continuation of the historical production process. If there is a conflict, an exception prompt is triggered.
[0009] A swarm intelligence task scheduling system based on Directed Acyclic Graph (DAG) includes: The leader agent module is used to parse industrial production instructions and generate an initial DAG task list; The task distribution module is used to perform redundant dependency elimination and topological sorting based on the Kahn algorithm on the initial DAG task list to generate a hierarchical execution plan; The intelligent agent actuator module is used to allocate isolated edge computing sandboxes to each process node and control multiple industrial actuators to work in parallel. The cooperative cancellation module is used to propagate a global cancellation signal in a mixed asynchronous and synchronous environment via thread-safe event flags.
[0010] Compared with the prior art, the beneficial effects of the present invention are as follows: By using a redundant dependency elimination algorithm based on the cache of predecessor node sets, the system can automatically eliminate transitive logical redundancy between physical processes, keep the scheduling complexity low, and effectively eliminate the invalid waiting of workpieces at physical workstations caused by redundant signal locking.
[0011] By generating hierarchical execution plans through topological sorting based on the Kahn algorithm, the maximum asynchronous parallelism of processes without physical interference is achieved. In complex flexible assembly scenarios, the total production time (production cycle time) can be reduced by more than 25%.
[0012] By using a cooperative cancellation mechanism based on thread-safe event flags (threading.Event), the system allows the underlying actuator to complete the current I / O instruction cycle before resetting after a cancellation signal is triggered, thus avoiding the risk of sudden stop of the robotic arm during movement and ensuring the safety of the physical reset path.
[0013] Through JSON status checkpoints and dynamic parameter compensation logic, the system can accurately locate the interruption level and perform pose correction in conjunction with real-time sensor feedback, enabling rapid resumption of operation without resetting the entire process line, effectively avoiding damage to semi-finished workpieces and material waste.
[0014] By leveraging isolated edge computing sandboxes and structured signature version management, the system supports high-concurrency collaboration among multiple agents while ensuring the absolute security of instruction sets and file environments at each workstation. Furthermore, it provides a complete logical chain for production accident analysis through version backtracking capabilities. Attached Figure Description
[0015] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used together with the embodiments of the invention to explain the invention and do not constitute a limitation thereof.
[0016] Figure 1 An architectural block diagram of a DAG-based swarm intelligence task scheduling system provided in an embodiment of the present invention; Figure 2 The main flowchart of a DAG-based swarm intelligence task scheduling method provided in this embodiment of the invention; Figure 3 A detailed flowchart of the redundant dependency elimination steps provided in the embodiments of the present invention; Figure 4 A flowchart of a collaborative cancellation step provided for an embodiment of the present invention.
[0017] In the picture: U1 - Leader agent module; U2 - Task distribution module; U3 - Agent executor module; U4 - Collaboration cancellation module. Detailed Implementation
[0018] like Figure 1 As shown, the core architecture of the DAG-based swarm intelligence task scheduling system provided by this invention adopts a strategy that combines cloud planning with edge execution. Figure 2 As shown, during execution, the leader agent module U1, deployed on the central server, receives and parses the industrial production instructions input by the user. When a complex production task involving multiple processes is received, the leader agent module U1 first extracts the specific process steps through natural language processing or structured instruction parsing technology, and identifies the physical and logical sequence relationships between the processes, thereby constructing an initial directed acyclic graph containing multiple process nodes, i.e., the initial DAG task list.
[0019] like Figure 3 As shown, to optimize scheduling efficiency and eliminate logical redundancy caused by complex physical dependencies, the system initiates a redundancy dependency elimination program through the task distribution module U2. This program uses a depth-first traversal algorithm to perform full computation on the predecessor node set of each node in the task graph and caches the results in memory. During the verification process, if it is found that although there is a direct dependency connection between two process nodes, one node has indirectly become the predecessor node of the other node through other paths, the system will determine the direct dependency edge as transitive redundancy and perform physical removal. This reduction process not only significantly reduces the computational overhead of subsequent topology sorting but also effectively prevents unnecessary waiting time for industrial actuators at material transfer points, ensuring the simplification of the production flow path.
[0020] After the specification is completed, the task distribution module U2 uses the Kahn algorithm to process the graph structure, dynamically constructing a hierarchical execution plan by statistically analyzing the in-degree status of each process node. Specifically, the system prioritizes extracting tasks with an in-degree of zero to form the first-level execution sequence. After these tasks are processed, the in-degree of their connected downstream nodes decreases accordingly until a new zero-in-degree node is generated and assigned to the next level. In the actual execution phase, the agent actuator module U3 allocates an isolated edge computing sandbox environment to each process node. This physical isolation ensures that the underlying instruction sets and workspace files of different sub-agents do not interfere with each other when controlling their respective industrial robots, AGVs, or machining centers.
[0021] like Figure 4 As shown, to address potential sudden interruptions in industrial environments, this solution employs a collaborative cancellation mechanism based on thread-safe event flags, implemented through the collaborative cancellation module U4. By maintaining a global cancellation signal in the asynchronous event loop thread, the system can propagate stop commands to all running sub-agents within milliseconds. Unlike traditional methods of brute-force process termination, the sub-agents in this solution poll this signal and, upon confirming the completion of the currently running low-level hardware I / O instruction cycle, proactively drive the robotic arm or motion axis to execute a preset physical reset operation. This avoids the risk of physical collisions caused by the equipment remaining in a dangerous interference zone due to inertia.
[0022] Furthermore, to ensure production continuity, the system persists the real-time task status and end-effector pose data to a JSON-formatted checkpoint file after each task level is completed. In the event of a planned downtime or unexpected interruption, the task continuation module can automatically locate the first pending task level by reading this file and, based on real-time sensor feedback data, dynamically compensate for the parameters of downstream processes that have not yet been executed. In typical scenarios involving flexible assembly across multiple processes, the parallel scheduling strategy of this solution can reduce the originally completely sequential production cycle time by more than 25%.
[0023] In complex industrial robot collaborative operation scenarios, the redundancy dependency elimination logic described in this invention can be directly transformed into the optimization of physical operation paths. Assume that on an automotive chassis assembly line, a first actuator is needed for bolt positioning, a second actuator for pre-tightening, a third actuator for torque verification, and a fourth actuator for overall visual quality inspection. When performing redundancy verification, the system identifies that the second actuator is physically dependent on the first actuator, and the third actuator is physically dependent on the second actuator. By performing a depth-first traversal to calculate the predecessor node set, the system determines that the direct dependency of the quality inspection task on the positioning and pre-tightening tasks is logically transitive redundancy and removes it from the DAG graph. This operation eliminates unnecessary signal locking by the central control system for the quality inspection process, allowing the quality inspection mechanism to trigger only by listening to the signal indicating completion of torque verification.
[0024] In terms of security, the cooperative cancellation mechanism implemented through thread-safe event flags in this invention is particularly crucial in multi-machine collaboration. When the production line detects foreign object intrusion and triggers a cancellation request, the global cancellation signal is set to the triggered state. Because a cross-thread communication mechanism based on thread-safe event flags is used, the sub-agents running in the asynchronous event loop can immediately sense the state change. At this time, the actuator performing precision milling maintains its current low-level I / O instructions until the current cutting feed is completed, and then drives the stepper motor to move the tool to the preset zero-position safety coordinate.
[0025] Ultimately, this strategy, combined with checkpoint technology, ensures that after foreign objects are removed or faults are resolved, the system can accurately restore the task level from the JSON checkpoint file and dynamically compensate subsequent processes based on the physical pose fed back by sensors in real time, thereby achieving smooth resumption of production on the flexible production line without the need for a complete manual reset.
[0026] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.
Claims
1. A swarm intelligence task scheduling method based on DAG, characterized in that, Includes the following steps: Upon receiving industrial production instructions, the leader agent parses the instructions, extracts the process steps and physical dependencies between each process node, and generates an initial directed acyclic graph (DAG) task list. Redundant dependency elimination is performed on the initial DAG task list to obtain the reduced task DAG; wherein, the set of all predecessor nodes of each process node is calculated by depth-first traversal and cached; if there is a direct dependency edge between the first process node and the second process node, and the first process node belongs to the set of predecessor nodes of another dependent node of the second process node, then the direct dependency edge is determined to be a redundant path and removed. Based on the Kahn algorithm, the reduced task DAG is topologically sorted, and a hierarchical execution plan is constructed according to the in-degree state of each process node. Process nodes with zero in-degree and no physical interference are grouped into the same parallel execution level. According to the hierarchical execution plan, the intelligent agent actuator creates sub-intelligent agent instances in mutually isolated edge computing sandboxes, and asynchronously calls each of the sub-intelligent agent instances through multi-threading to control the corresponding industrial actuators to complete the process tasks within the parallel execution level.
2. The method according to claim 1, characterized in that, The execution process of the hierarchical execution plan also includes a condition checkpoint persistence step: After each parallel execution level of the process task is completed, the task status, environment variables, and end pose data of each of the industrial actuators are written into a checkpoint file in JSON format. When the production process is interrupted and resumed, the checkpoint file is read, the first level containing the task to be executed is located as the starting point, and the downstream process instructions are dynamically compensated based on the feedback data of the current physical sensors.
3. The method according to claim 1, characterized in that, The method also includes a collaborative cancellation step: Register a global cancellation signal based on thread-safe event flags in the asynchronous event loop thread; When a cancellation request is received, the global cancellation signal is set to the triggered state; Before the logical loop of executing the process task begins, each of the sub-smart agent instances polls the global cancellation signal. If the global cancellation signal is detected to be in the triggered state, after completing the currently executing underlying hardware I / O instruction, the instance drives the corresponding industrial actuator to perform a preset physical reset operation and exit.
4. The method according to claim 1, characterized in that, Each process node in the initial DAG task list contains the following fields: Node ID, process title, type identifier of the industrial actuator responsible for execution, physical control command, array of upstream dependent task IDs, and task execution status.
5. The method according to claim 1, characterized in that, Before performing redundant dependency elimination on the initial DAG task list, the following is also included: The task process continuity check is performed by comparing the structure signature generated by the industrial production instruction with the structure signature of the historical production process to determine whether the industrial production instruction is a continuation of the historical production process. If there is a conflict, an exception prompt is triggered.
6. A swarm intelligence task scheduling system based on DAG, characterized in that, include: The leader agent module is used to parse industrial production instructions and generate an initial DAG task list; The task distribution module is used to perform redundant dependency elimination and topological sorting based on the Kahn algorithm on the initial DAG task list to generate a hierarchical execution plan; The intelligent agent actuator module is used to allocate isolated edge computing sandboxes to each process node and control multiple industrial actuators to work in parallel. The cooperative cancellation module is used to propagate a global cancellation signal in a mixed asynchronous and synchronous environment via thread-safe event flags.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the program implements the steps of the method described in any one of claims 1 to 5.