A method and system for automatic decomposition of software requirements based on multi-agent collaboration
Patent Information
- Application Number
- CN202611177948.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-05
- Publication Date
- 2026-09-01
AI Technical Summary
[0005]然而,该技术方案侧重于多智能体在执行层面的任务分配与冲突协调,并未涉及软件需求分解场景中跨片段依赖关系的有界传递问题
[0038] 1. This invention proposes a bounded transit mechanism for cross-segment dependencies based on dual-granularity visibility annotation at the interface and internal levels. By forcibly annotating visibility attributes during the generation stages of sub-requirements and local dependencies, and extracting the interface dependency contracts of each segment accordingly, the calculation of cross-segment dependency transitive closures is limited to the interface boundaries. Only when the complete dependency path consists entirely of interface-level elements is it considered a valid cross-segment indirect dependency. This fundamentally cuts off the false diffusion of internal implementation-level dependencies to the global scope, eliminates the problem of amplified false indirect dependencies, and ensures that the dependency relationships on which cross-segment conflict detection is based are true and reliable.
Smart Images

Figure CN122672756A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of software development technology, specifically relating to a method and system for automatic decomposition of software requirements based on multi-agent collaboration. Background Technology
[0002] With the continuous growth in the scale and complexity of software systems, the need for automated requirements analysis and decomposition in the software development process is becoming increasingly urgent. Traditional requirements engineering methods rely heavily on manual analysis, which is not only inefficient but also struggles to guarantee the consistency, completeness, and traceability of decomposition results when faced with massive, heterogeneous, and multi-domain overlapping software requirements. In recent years, multi-agent systems, due to their inherent advantages in collaborative processing of complex tasks, have been gradually introduced into the field of software engineering, becoming an important technical path for achieving automated requirements decomposition.
[0003] A search revealed that patent application CN121349876A discloses an automated software development system based on multi-agent collaboration, including a requirements analysis agent, a detailed design agent, and a project development agent. Each agent sequentially transmits requirements specifications, design specifications, and executable code through a shared workspace. This scheme constructs an automated pipeline from requirements to code, improving development efficiency to some extent. However, the system employs a sequential transmission mode between agents, with the output of the previous stage directly serving as the input for the next. It lacks the ability to proactively detect and resolve conflicts related to cross-stage requirements dependencies. When inconsistencies or conflicts exist between the requirements decomposition results of different stages or domains, the system lacks an effective feedback and adjustment mechanism.
[0004] Patent application CN120849051A discloses a multi-agent collaboration method, system, device, and storage medium. It identifies conflicts through resource contention detection, task overlap detection, and behavioral conflict detection, and then coordinates these conflicts. This scheme introduces a division of roles among observers, coordinators, and executors, improving task completion efficiency through conflict detection and coordination.
[0005] However, this technical solution focuses on task allocation and conflict coordination at the execution level for multiple agents, and does not address the bounded propagation of cross-segment dependencies in software requirement decomposition scenarios. In software requirement decomposition scenarios, there are often complex temporal dependencies, data reduction dependencies, and conditional constraints between sub-requirements from different domains or modules. If these cross-segment indirect dependencies cannot be accurately identified and boundedly propagated, dependencies at the internal implementation detail level will spread unrestricted globally, generating a large number of false indirect dependencies. This leads to subsequent conflict detection and requirement integration processes making decisions based on unreliable dependencies, severely affecting the correctness and usability of the requirement decomposition results.
[0006] Furthermore, existing solutions generally treat task decomposition, conflict detection, and negotiation and resolution as separate and independent stages, lacking a unified conflict modeling framework and a closed-loop negotiation and optimization mechanism, which makes it difficult to guarantee the global consistency of cross-domain requirement decomposition.
[0007] Therefore, there is an urgent need for a technical solution that can achieve bounded propagation of cross-segment dependencies, unified detection of heterogeneous conflicts, and global optimization and resolution during the decomposition of multi-agent collaborative requirements, so as to effectively solve the above problems. Summary of the Invention
[0008] In view of the shortcomings of the existing technology, the purpose of this invention is to provide a method and system for automatic decomposition of software requirements based on multi-agent collaboration.
[0009] The objective of this invention is achieved through the following technical solution: an automatic decomposition method for software requirements based on multi-agent collaboration, comprising the following steps:
[0010] S1: Obtain the software requirement text to be decomposed and construct a requirement knowledge hypergraph with requirement elements as nodes and semantic relationships and specification dependencies as edges;
[0011] S2: Perform structural clustering on the demand knowledge hypergraph, and send each subgraph obtained by clustering as an independent demand package to the corresponding domain decomposition agent;
[0012] S3: The domain decomposition agent performs granular decomposition of the requirement package, generates candidate solution fragments consisting of sub-requirements and local dependencies between sub-requirements, marks the visibility attributes of sub-requirements and local dependencies in each candidate solution fragment, and generates interface dependency contracts for the interaction between the fragment and external fragments for sub-requirements and dependencies marked as interface level.
[0013] S4: The coordinating agent detects direct conflicts and cross-segment indirect dependency conflicts based on the interface dependency contract of candidate solution fragments, abstracts the conflicts into nodes and associates conflict edges to construct a global conflict hypergraph; if the global conflict hypergraph is empty or there is no change in two iterations, proceed to S6; otherwise, encapsulate each connected conflict subgraph into a coordination and resolution task and distribute it to the relevant domain decomposition agents, proceed to S5.
[0014] S5: The domain decomposition agent generates local adjustment proposals based on the coordinated task. The coordinating agent solves the globally optimal combination of operations based on all local adjustment proposals and decomposes it into a sequence of operation execution instructions, which is then sent to the domain decomposition agent. The domain decomposition agent modifies the candidate solution fragments and returns to the S4 iteration.
[0015] S6: Perform global sub-requirement deduplication and identifier unification on all candidate solution fragments, establish a complete traceability chain from each sub-requirement to the original requirement knowledge hypergraph node, and generate a structured requirement decomposition document.
[0016] Further, step S1 includes: performing semantic dependency parsing and named entity recognition on the software requirement text, extracting functional subjects, operation objects, condition constraints and interaction relationships, and completing the implicit relationships of the extracted requirement elements.
[0017] Furthermore, the step of sending each subgraph obtained from clustering as an independent demand package to the corresponding domain decomposition agent includes: sending each demand package to the corresponding domain decomposition agent through a task allocation agent based on the domain processing capabilities pre-registered by each domain decomposition agent.
[0018] Furthermore, the visibility attributes of the sub-requirements and local dependencies include not only the interface level but also the internal level. The internal level indicates that the sub-requirement or dependency is only valid within the current fragment and cannot be passed to external fragments. The interface level indicates that the sub-requirement or dependency is visible to external fragments and can be passed across fragments.
[0019] Furthermore, the interface dependency contract lists the interface information that this candidate solution fragment needs to be provided by other external fragments, as well as the interface information provided to other external fragments.
[0020] Furthermore, in step S4, the cross-segment indirect dependency conflict includes:
[0021] For candidate solution fragments from decomposed agents in different domains, bounded dependency transitive closure computation is performed based on the interface dependency contract.
[0022] Among them, a dependency path is only counted as a valid cross-fragment indirect dependency if it starts from the source interface-level sub-requirement, passes through all interface-level dependency edges, and finally reaches the target interface-level sub-requirement. Dependency transit terminates when it encounters an internal-level dependency edge.
[0023] The coordinating agent detects circular dependency loops formed by cross-segment indirect dependencies based on effective cross-segment indirect dependencies.
[0024] Furthermore, step S5 specifically includes:
[0025] Based on the conflict context in the coordination and resolution task, the domain decomposition agent performs heuristic evolutionary operations within the local scope of the corresponding candidate solution fragment to generate a local adjustment proposal containing the proposed sub-requirement merging, splitting, renaming, attribute value migration, or dependency edge reconnection adjustment operations, and returns the local adjustment proposal to the coordinating agent.
[0026] The coordinating agent collects all local adjustment proposals, constructs a multi-objective combinatorial optimization model with the joint objectives of maximizing the global conflict resolution rate, minimizing the loss of demand semantic information, and maintaining the uniformity of decomposition granularity, solves the globally optimal operation combination, and decomposes the globally optimal operation combination into an operation execution instruction sequence for decomposition agents in each domain and issues it.
[0027] Each domain-specific decomposition agent performs write-back modifications on the managed candidate solution fragments based on the received operation execution instruction sequence, and maintains or updates the visibility attributes of sub-requirements and dependencies, as well as the interface dependency contracts of the corresponding fragments during the modification process.
[0028] Furthermore, in step S6, the structured requirement decomposition document includes sub-requirement numbers, natural language descriptions, priority weights, dependency matrices, and a recommendation responsibility module.
[0029] Further, in step S3, candidate solution fragments containing interface dependency contracts are written to the shared knowledge blackboard; in step S4, the coordinating agent reads candidate solution fragments from the shared knowledge blackboard; in step S5, the domain decomposition agent performs write-back modifications on the candidate solution fragments and republishes them to the shared knowledge blackboard; in step S6, global sub-requirement deduplication and identifier unification are performed on all candidate solution fragments in the shared knowledge blackboard.
[0030] This invention also provides an automatic software requirements decomposition system based on multi-agent collaboration, comprising:
[0031] The hypergraph construction module is used to parse software requirement text and construct a requirement knowledge hypergraph with requirement elements as nodes and semantic relationships and reduction dependencies as edges.
[0032] The task allocation module is used to perform structural clustering on the demand knowledge hypergraph and send each subgraph obtained by clustering as an independent demand package to the corresponding domain decomposition agent.
[0033] The attribute annotation module is configured to perform granular decomposition of the requirement package according to the domain decomposition agent, generate candidate solution fragments consisting of sub-requirements and local dependencies between sub-requirements, annotate the visibility attributes of sub-requirements and local dependencies in each candidate solution fragment, and generate interface dependency contracts for the interaction between the fragment and external fragments for sub-requirements and dependencies annotated as interface level.
[0034] The iterative decision module is configured to detect direct conflicts and cross-segment indirect dependency conflicts of the interface dependency contracts of candidate solution segments according to the coordinating agent, abstract the conflicts into nodes and associate conflict edges to construct a global conflict hypergraph; if the global conflict hypergraph is empty or there is no change in two iterations, it enters the result output module; otherwise, it encapsulates each connected conflict subgraph into a coordination and resolution task and distributes it to the relevant domain decomposition agents, and enters the segment modification module.
[0035] The fragment modification module is configured to generate local adjustment proposals based on the domain decomposition agent. The coordinating agent solves the globally optimal operation combination based on all local adjustment proposals and decomposes it into an operation execution instruction sequence, which is then sent to the domain decomposition agent. The domain decomposition agent modifies the candidate solution fragments and returns to the iterative judgment module.
[0036] The results output module is used to perform global sub-requirement deduplication and identification unification on all candidate solution fragments, establish a complete traceability chain from each sub-requirement to the original requirement knowledge hypergraph node, and generate a structured requirement decomposition document.
[0037] The beneficial effects of this invention are as follows:
[0038] 1. This invention proposes a bounded transit mechanism for cross-segment dependencies based on dual-granularity visibility annotation at the interface and internal levels. By forcibly annotating visibility attributes during the generation stages of sub-requirements and local dependencies, and extracting the interface dependency contracts of each segment accordingly, the calculation of cross-segment dependency transitive closures is limited to the interface boundaries. Only when the complete dependency path consists entirely of interface-level elements is it considered a valid cross-segment indirect dependency. This fundamentally cuts off the false diffusion of internal implementation-level dependencies to the global scope, eliminates the problem of amplified false indirect dependencies, and ensures that the dependency relationships on which cross-segment conflict detection is based are true and reliable.
[0039] 2. This invention proposes a hierarchical processing architecture for cross-domain conflict detection and multi-agent negotiation resolution, with interface dependency contract matching as the core. In the conflict detection layer, the coordinating agent performs structural conflict identification based on semantic comparison between the required interface and the providing interface, and cyclic dependency loop identification under bounded transitive closure, respectively, unifying heterogeneous conflicts into a global conflict hypergraph. In the negotiation resolution layer, the conflict subgraph is encapsulated into a directed distribution of coordination tasks. Each domain decomposition agent generates proposed adjustment proposals within a local scope. The coordinating agent then constructs a 0-1 integer programming model with the joint objectives of maximizing the conflict resolution rate, minimizing semantic loss, and maintaining granularity uniformity, combined with the independent set constraints of the operation conflict graph, to obtain the globally optimal combination of operations, thus achieving global consistency and optimization convergence of cross-domain requirement decomposition.
[0040] 3. This invention proposes an iterative termination judgment and deadlock breaking strategy based on conflict hypergraph state comparison. After each round of negotiation, the coordinating agent constructs the current global conflict hypergraph and compares it with the hypergraph of the previous round at the set level. When the conflict hypergraph is empty or the set of conflict nodes and conflict edges has not changed in two consecutive rounds, the termination condition is determined to be met, and the iteration is actively exited to prevent infinite loops caused by unresolved conflicts. This ensures that the decomposition process converges within a finite number of steps, while retaining the processing path that outputs the best usable result when it is not empty but has no change, thus ensuring the robustness and feasibility of the method. Attached Figure Description
[0041] Figure 1 This is a diagram of the overall system architecture of the present invention;
[0042] Figure 2 This is a flowchart illustrating the construction of the knowledge hypergraph and the division of requirement packages for this invention.
[0043] Figure 3 This is a flowchart of the candidate solution fragment generation and interface contract construction process of the present invention;
[0044] Figure 4 This is a flowchart of the global conflict detection and bounded dependency transitivity of the present invention;
[0045] Figure 5 This is a flowchart of the collaborative negotiation resolution and global optimization output process of the present invention. Detailed Implementation
[0046] To enable those skilled in the art to better understand the technical solutions in the embodiments of this application, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art should fall within the protection scope of the embodiments of this application.
[0047] like Figure 1 As shown, this invention provides a method for automatic decomposition of software requirements based on multi-agent collaboration, comprising the following steps:
[0048] S1: Obtain the software requirement text to be decomposed and construct a requirement knowledge hypergraph with requirement elements as nodes and semantic relationships and specification dependencies as edges.
[0049] S2: Perform structural clustering on the aforementioned demand knowledge hypergraph, and send each subgraph obtained from the clustering as an independent demand package to the corresponding domain decomposition agent.
[0050] S3: The domain decomposition agent performs granular refinement decomposition on the requirement package, generates candidate solution fragments consisting of sub-requirements and local dependencies between sub-requirements, marks the visibility attributes of sub-requirements and local dependencies in each candidate solution fragment, and generates interface dependency contracts for the interaction between the fragment and external fragments for sub-requirements and dependencies marked as interface level.
[0051] S4: The coordinating agent detects direct conflicts and cross-segment indirect dependency conflicts based on the interface dependency contract of candidate solution fragments, abstracts the conflicts into nodes and associates conflict edges to construct a global conflict hypergraph; if the global conflict hypergraph is empty or there is no change in two iterations, proceed to S6; otherwise, encapsulate each connected conflict subgraph into a coordination and resolution task and distribute it to the relevant domain decomposition agents, proceed to S5.
[0052] S5: The domain decomposition agent generates local adjustment proposals based on the coordinated task. The coordinating agent solves the globally optimal combination of operations based on all local adjustment proposals and decomposes it into a sequence of operation execution instructions, which are then sent to the domain decomposition agent. The domain decomposition agent modifies the candidate solution fragments and returns to the S4 iteration.
[0053] S6: Perform global sub-requirement deduplication and identifier unification on all candidate solution fragments, establish a complete traceability chain from each sub-requirement to the original requirement knowledge hypergraph node, and generate a structured requirement decomposition document.
[0054] As a preferred embodiment, such as Figure 2 As shown, in step S1, after obtaining the software requirement text to be decomposed, the steps include: performing semantic dependency parsing and named entity recognition on the software requirement text, extracting functional subjects, operation objects, condition constraints and interaction relationships, and calling a pre-built software engineering knowledge graph to complete the implicit relationships of the extracted requirement elements.
[0055] Specifically, a pre-built software engineering knowledge graph is invoked to complete the implicit relationships of the extracted requirement elements, including:
[0056] The software engineering knowledge graph is stored as a set of triples. In this context, h represents the head entity in the triple, r represents the association between the entities, and t represents the tail entity in the triple. It is an entity set, containing functional entities, operational objects, data entities, and constraint types. It is a set of relations, including temporal dependencies, data reductions, condition conflicts, and implementation prerequisites.
[0057] The implicit relation completion is based on each extracted requirement element. To query the anchor point, in Perform subgraph matching and retrieve data based on... The length of all paths originating from is The reachable paths within, where, The value is a preset integer; for each retrieved relation path, the entity at its end is... Relationships along the path Combine to generate a candidate implicit relation. ,in, Semantic composition function of relations in the path This function maps relation sequences to composite relation labels based on a predefined table of combination rules.
[0058] The implicit relation candidates are selected using a pre-trained language model. , and Encode into vectors respectively , , Calculate the consistency score of the relationship. ,in, This represents vector concatenation. and The mapping parameters obtained during training, For the sigmoid function; if Greater than the preset threshold Then, the implicit relation candidates are added as completion edges to the requirement knowledge hypergraph to supplement the implicit temporal dependencies, data reductions and conditional constraints.
[0059] As a preferred embodiment, such as Figure 2 As shown, in step S2, a community detection algorithm based on modularity is used to perform structural clustering on the demand knowledge hypergraph. Each subgraph obtained by clustering is treated as an independent demand package. The task allocation agent dispatches each demand package to the corresponding domain decomposition agent according to the domain processing capabilities pre-registered by each domain decomposition agent.
[0060] Specifically, a modularity-based community detection algorithm is used to perform structural clustering on the demand knowledge hypergraph, including:
[0061] Transform the aforementioned knowledge hypergraph into a weighted undirected graph. ,in, For the set of required element nodes, This is a set of edges representing semantic relations and reduction dependencies, where each edge... weight Based on the corresponding semantic relation strength coefficient and regulation dependency strength coefficient The weighted sum is calculated to obtain, that is , and This is a preset weighting factor.
[0062] The community detection algorithm based on modularity employs the Louvain algorithm, defining modularity... for ,in, The total weight of the graph, For nodes The weighting degree, and They are nodes and The assigned community tags Let Kronecker function be used when At that time Otherwise .
[0063] The Louvain algorithm initially treats each node as an independent community, and then attempts to move nodes into neighboring communities sequentially, calculating the process. Change , choose to Maximize the movement, iterate until... No further improvement is made; after convergence, the set of nodes in each community is exported as a subgraph, which is treated as an independent demand package, and the original hyperedges between nodes in the demand package are recorded as the initial structure of the package.
[0064] As a preferred embodiment, such as Figure 3 As shown in S3, after each domain decomposition agent receives the corresponding requirement package, it calls the locally stored domain terminology dictionary and the built-in decomposition pattern library to perform granular refinement decomposition on the requirement elements in the requirement package, generating candidate solution fragments composed of fine-grained sub-requirements and local dependencies between sub-requirements.
[0065] In the process of generating the candidate solution fragments, the domain decomposition agent marks each sub-requirement and each local dependency with visibility attributes. The visibility attributes are divided into interface level and internal level. The interface level indicates that the sub-requirement or dependency is visible to external fragments and can be passed across fragments. The internal level indicates that the sub-requirement or dependency is only valid within the current fragment and cannot be passed to external fragments.
[0066] Simultaneously, the domain decomposition agent generates an interface dependency contract for this fragment based on interface-level sub-requirements and interface-level dependencies. The interface dependency contract explicitly lists the required interfaces that this fragment needs to provide from other external fragments, as well as the interfaces that this fragment promises to provide to other external fragments. The domain decomposition agent writes candidate solution fragments containing sub-requirements, local dependencies, visibility annotations, and interface dependency contracts into a shared knowledge blackboard accessible to all agents.
[0067] Specifically, after completing the granular refinement decomposition, the domain decomposition agent processes each generated sub-requirement. Perform visibility determination, the determination rule is: if In the requirement package, it is directly referenced by other fragments through the original hyperedge, or If the required element that is depended upon or depends on matches the interface entity identified globally, then... The visibility attribute is marked as interface-level, otherwise as internal-level; for each local dependency... Its visibility attribute is determined based on the visibility of the two end requirements. and When all are interface level Mark as interface level, otherwise mark as internal level.
[0068] The process of generating the interface dependency contract is as follows: Collect all sub-requirements marked as interface level in this segment; for each interface-level sub-requirement, extract the external interface identifiers it depends on from its outgoing edge dependencies to form a list of required interfaces. Each required interface description includes the required interface name and the required interface semantic vector. And constraint templates; extract the interfaces that this fragment promises to the outside from its incoming edge dependencies, forming a list of interfaces provided. Each provided interface description includes the provided interface name and the provided interface semantic vector. The semantic vector is obtained by encoding the natural language description of the interface-related sub-requirements by a pre-trained language model, and the constraint template records the preconditions, postconditions and data specifications associated with the interface.
[0069] As a preferred embodiment, such as Figure 4 As shown, in step S4, the coordinating agent reads candidate solution fragments written by all domain decomposition agents from the shared knowledge blackboard and performs direct conflict detection based on interface dependency contracts, including: comparing the semantic similarity between the required interface and the provided interface of each fragment column, and identifying one-way dependency breaks and naming ambiguity conflicts caused by interface mismatch, interface missing or interface redundancy.
[0070] Simultaneously, for any two candidate solution fragments from decomposition agents in different domains, bounded dependency transitive closure computation is performed based on the interface dependency contract. The bounded dependency transitive closure computation is only counted as a valid cross-fragment indirect dependency if a dependency path starts from the source interface-level sub-requirement, passes through all interface-level dependency edges, and finally reaches the target interface-level sub-requirement. Dependency transitivity terminates when an internal-level dependency edge is encountered. The coordinating agent detects circular dependency cycles formed by cross-fragment indirect dependencies based on the valid cross-fragment indirect dependencies.
[0071] The coordinating agent abstracts each type of conflict identified by the direct conflict detection and cyclic dependency loop detection into a conflict node, connects conflict nodes with causal or co-occurrence relationships into conflict edges, and constructs a global conflict hypergraph.
[0072] The coordinating agent determines whether the iteration termination condition is met: if the global conflict hypergraph is empty, or if it is not the first iteration and the set of conflict nodes and the set of conflict edges in the global conflict hypergraph have not changed compared to the global conflict hypergraph constructed in the previous iteration, then it jumps to step S6; otherwise, the coordinating agent analyzes each independent connected conflict subgraph in the global conflict hypergraph, encapsulates it into a coordination and resolution task carrying conflict context data and the identifier of the domain decomposition agent involved, and distributes the coordination and resolution task to the relevant domain decomposition agents, then proceeds to step S5.
[0073] Specifically, bounded dependency transitive closure computation, direct conflict detection, and circular dependency cycle detection include:
[0074] The input to the bounded dependency transitive closure computation is the set of interface-level sub-requirements for all candidate solution fragments. and interface-level dependency set Construct a directed graph ,exist The modified Floyd-Warshall algorithm is executed, with the state transition condition set to be determined by the node. via intermediate nodes To the node The path exists and and If all edges are interface-level dependencies, then... Mark as valid cross-segment indirect dependencies; otherwise, do not transitive. For any two different segments, enumerate their interface-level sub-requirement pairs. If a reachable path is obtained through the above transitive calculation, then establish a cross-segment indirect dependency record.
[0075] The direct conflict detection is achieved by iterating through the list of required interfaces for each segment. List of interfaces provided with all global fragments During matching, the required interface semantic vector is calculated. With providing interface semantic vectors cosine similarity If for a given required interface, there is no interface that provides a cosine similarity greater than a preset matching threshold. If multiple fragments provide interfaces that meet the matching threshold for the same required interface, and the cosine similarity between the semantic vectors of their respective provided interfaces is greater than 1%, then it is identified as an interface missing conflict. If the similarity is between 0 and 1, it is identified as an interface redundancy conflict and overlapping sub-requirements are marked; interface mismatch conflicts are identified by similarity between 0 and 1. and The naming ambiguity conflict is triggered when there is no better alternative between the two; it is detected by semantic vector analysis of the clustering interface names, and those with similarity higher than the specified value are grouped together. However, interfaces from different segments are grouped into the same cluster. If the interface names within the cluster are inconsistent, ambiguity and conflict will occur.
[0076] The cycle dependency detection method constructs a cross-segment dependency graph using all valid cross-segment indirect dependencies and direct cross-segment dependencies as edges. The nodes are interface-level sub-requirements. The Tarjan strongly connected component algorithm is used to extract strongly connected components containing more than 1 node. Each strongly connected component outputs a circular dependency cycle conflict.
[0077] All identified conflicts are encapsulated as conflict nodes, and each conflict node records the conflict type, the identifier of the involved fragment, and the identifier of the related sub-requirement or interface.
[0078] As a preferred embodiment, such as Figure 5 As shown, in step S5, the domain decomposition agent that receives the task of coordinating and resolving the conflict context in the task extracts the conflict context in the task. Within the local range of the candidate solution fragments it manages, it performs heuristic evolutionary operations based on the local preset domain adjustment rules and cost functions to generate a local adjustment proposal that includes the proposed sub-requirement merging, splitting, renaming, attribute value migration, or dependency edge reconnection adjustment operations. The local adjustment proposal is then returned to the coordinating agent.
[0079] After the coordinating agent collects the local adjustment proposals returned by all involved domain decomposition agents, it constructs a multi-objective combinatorial optimization model with the joint objectives of maximizing the global conflict resolution rate, minimizing the loss of semantic information of requirements, and maintaining the uniformity of decomposition granularity. The globally optimal operation combination is obtained by using an algorithm that combines graph editing distance matching based on the conflict resolution effect with 0-1 integer programming. The globally optimal operation combination is then decomposed into a sequence of operation execution instructions for each involved domain decomposition agent and issued.
[0080] Each domain-specific decomposition agent performs write-back modifications on the candidate solution fragments it manages based on the received operation execution instruction sequence. During the modification process, it maintains or updates the visibility annotations of sub-requirements and dependencies, as well as the interface dependency contracts of the corresponding fragments. The modified candidate solution fragments are then redistributed to the shared knowledge blackboard, and the process returns to step S4.
[0081] Specifically, the coordinating agent constructs and solves a multi-objective combinatorial optimization model, including: the coordinating agent collecting local adjustment proposals returned by all involved domain decomposition agents, each proposal... Contains a set of operations Each operation The type is one of sub-requirement merging, splitting, renaming, attribute value migration, or dependency edge reconnection, and includes a list of conflict nodes that are expected to be resolved after performing this operation. The amount of semantic information loss caused by demand and the resulting change in particle size uniformity. Among them, the amount of semantic information loss The change in granularity uniformity is obtained by weighted summation of the cosine distance changes between the semantic vectors of relevant sub-requirements before and after the operation and the semantic vectors of the original requirement elements. This is obtained by calculating the variance change in the demand quantity of each segment.
[0082] The objective function of the multi-objective combined optimization model is to maximize... ,in, For the proposal Whether to be selected is a decision variable. This represents the total number of conflicting nodes in the current global conflict hypergraph. The preset weighting coefficients are used; the constraint is that no two proposals in the selected proposal set can contain conflicting operations. A conflicting operation is defined as performing different modifications on the same sub-requirement or performing opposite operations on the same dependency edge; the determination of conflicting operations is achieved by constructing an operation conflict graph. Nodes are proposals, edges connect proposal pairs with conflicting operations, and constraints are equivalent to the selected node set being... An independent set, that is, for all edges satisfy The independent set constraints and objective function are combined to transform the problem into a 0-1 integer programming problem, which is then solved using the branch and bound method. The optimal assignment.
[0083] Will The proposed operation set is merged into the globally optimal operation combination, and then broken down into operation execution instruction sequences according to the fragment affiliation.
[0084] As a preferred embodiment, such as Figure 5 As shown, in step S6, when the coordinating agent determines in step S4 that the iteration termination condition is met, it collects all final candidate solution fragments from the shared knowledge blackboard, performs global sub-requirement deduplication and identifier unification, establishes a complete traceability chain from each sub-requirement to the original requirement knowledge hypergraph node, and generates a structured requirement decomposition document containing sub-requirement number, natural language description, priority weight, dependency matrix and recommendation responsible module according to the preset output template.
[0085] Specifically, perform global sub-requirement deduplication and identifier unification, and establish a complete traceability chain from each sub-requirement to the original requirement knowledge hypergraph node, including:
[0086] The coordinating agent obtains candidate solution fragments finally published by all domain decomposition agents from the shared knowledge blackboard, and extracts all sub-requirements to form a global sub-requirement set. Each sub-requirement Include its semantic vector And source fragment identifier.
[0087] When deduplicating, calculate the cosine similarity between all sub-requirement pairs. Construct a similarity matrix; for pairs of pairs with similarity greater than a preset deduplication threshold... For each pair of sub-requirements, the disjoint-set data structure algorithm is used to group them into the same equivalence cluster. For each equivalence cluster, the sub-requirement with the longest semantic vector or the highest source priority within the cluster is selected as the representative sub-requirement. The internal attributes of the remaining sub-requirements are merged into the representative sub-requirement, and the dependencies of the merged sub-requirements are redirected to the representative sub-requirement.
[0088] The identifiers adopt a hierarchical coding rule, assigning a unique identifier to each final sub-requirement in the format of "domain package identifier-fragment identifier-sub-requirement sequence number". The domain package identifier and fragment identifier come from the requirement package allocation record, and the sub-requirement sequence number is an auto-incrementing number within the fragment.
[0089] When establishing a traceability chain, a mapping table is constructed from the node identifiers of the original requirement knowledge hypergraph to the final sub-requirement identifiers, based on the mapping relationship between the sub-requirements and the original requirement elements recorded by the decomposition agents in each domain. At the same time, the intermediate decomposition operations experienced in the decomposition path are recorded to form a traceability graph structure. The output in the structured requirement decomposition document is a requirement traceability matrix. Each row of the matrix contains the original requirement element identifier, the corresponding list of final sub-requirement identifiers, and the decomposition type identifier.
[0090] As a preferred embodiment, the present invention also provides an automatic software requirements decomposition system based on multi-agent collaboration, comprising:
[0091] The hypergraph building module is used to parse software requirement text and construct a requirement knowledge hypergraph with requirement elements as nodes and semantic relationships and specification dependencies as edges.
[0092] The task allocation module is used to perform structural clustering on the requirement knowledge hypergraph and send each subgraph obtained by clustering as an independent requirement package to the corresponding domain decomposition agent.
[0093] The attribute annotation module is configured to perform granular decomposition of the requirement package based on the domain decomposition agent, generate candidate solution fragments consisting of sub-requirements and local dependencies between sub-requirements, annotate the visibility attributes of sub-requirements and local dependencies in each candidate solution fragment, and generate interface dependency contracts for the interaction between the sub-requirements and dependencies annotated as interface level and external fragments.
[0094] The iterative decision module is configured to detect direct conflicts and cross-segment indirect dependency conflicts in the interface dependency contracts of candidate solution segments according to the coordinating agent, abstract the conflicts into nodes and associate conflict edges to construct a global conflict hypergraph; if the global conflict hypergraph is empty or there is no change in two iterations, it enters the result output module; otherwise, it encapsulates each connected conflict subgraph into a coordination and resolution task and distributes it to the relevant domain decomposition agents, and enters the segment modification module.
[0095] The fragment modification module is configured to generate local adjustment proposals based on the domain decomposition agent. The coordinating agent solves the globally optimal combination of operations based on all local adjustment proposals and decomposes it into a sequence of operation execution instructions, which are then sent to the domain decomposition agent. The domain decomposition agent modifies the candidate solution fragments and returns to the iterative judgment module.
[0096] The results output module is used to perform global sub-requirement deduplication and identification unification on all candidate solution fragments, establish a complete traceability chain from each sub-requirement to the original requirement knowledge hypergraph node, and generate a structured requirement decomposition document.
[0097] It should be understood that the specific order or hierarchy of steps in the disclosed process is an example of an exemplary method. Based on design preferences, it should be understood that the specific order or hierarchy of steps in the process may be rearranged without departing from the scope of this disclosure. The appended method claims provide elements of various steps in an exemplary order and are not intended to limit the scope to the specific order or hierarchy described.
Claims
1. A method for automatic decomposition of software requirements based on multi-agent collaboration, characterized in that, Includes the following steps: S1: Obtain the software requirement text to be decomposed and construct a requirement knowledge hypergraph with requirement elements as nodes and semantic relationships and specification dependencies as edges; S2: Perform structural clustering on the demand knowledge hypergraph, and send each subgraph obtained by clustering as an independent demand package to the corresponding domain decomposition agent; S3: The domain decomposition agent performs granular decomposition of the requirement package, generates candidate solution fragments consisting of sub-requirements and local dependencies between sub-requirements, marks the visibility attributes of sub-requirements and local dependencies in each candidate solution fragment, and generates interface dependency contracts for the interaction between the fragment and external fragments for sub-requirements and dependencies marked as interface level. S4: The coordinating agent detects direct conflicts and cross-segment indirect dependency conflicts based on the interface dependency contract of candidate solution fragments, abstracts the conflicts into nodes and associates conflict edges to construct a global conflict hypergraph. If the global conflict hypergraph is empty or there is no change after two iterations, proceed to S6; otherwise, encapsulate each connected conflict subgraph into a coordination and resolution task and distribute it to the relevant domain decomposition agents, then proceed to S5. S5: The domain decomposition agent generates local adjustment proposals based on the coordinated task. The coordinating agent solves the globally optimal combination of operations based on all local adjustment proposals and decomposes it into a sequence of operation execution instructions, which is then sent to the domain decomposition agent. The domain decomposition agent modifies the candidate solution fragments and returns to the S4 iteration. S6: Perform global sub-requirement deduplication and identifier unification on all candidate solution fragments, establish a complete traceability chain from each sub-requirement to the original requirement knowledge hypergraph node, and generate a structured requirement decomposition document.
2. The method according to claim 1, characterized in that, Step S1 includes: performing semantic dependency parsing and named entity recognition on the software requirement text, extracting functional subjects, operation objects, condition constraints and interaction relationships, and completing the implicit relationships of the extracted requirement elements.
3. The method according to claim 1, characterized in that, The step of sending each subgraph obtained from clustering as an independent demand package to the corresponding domain decomposition agent includes: sending each demand package to the corresponding domain decomposition agent through the task allocation agent according to the domain processing capabilities pre-registered by each domain decomposition agent.
4. The method according to claim 1, characterized in that, The visibility attributes of the sub-requirements and local dependencies include not only the interface level but also the internal level. The internal level indicates that the sub-requirement or dependency is only valid within the current fragment and cannot be passed to external fragments. The interface level indicates that the sub-requirement or dependency is visible to external fragments and can be passed across fragments.
5. The method according to claim 4, characterized in that, The interface dependency contract lists the interface information that this candidate solution fragment needs to be provided by other external fragments, as well as the interface information that it provides to other external fragments.
6. The method according to claim 4, characterized in that, In step S4, the cross-segment indirect dependency conflict includes: For candidate solution fragments from decomposed agents in different domains, bounded dependency transitive closure computation is performed based on the interface dependency contract. Among them, a dependency path is only counted as a valid cross-fragment indirect dependency if it starts from the source interface-level sub-requirement, passes through all interface-level dependency edges, and finally reaches the target interface-level sub-requirement. Dependency transit terminates when it encounters an internal-level dependency edge. The coordinating agent detects circular dependency loops formed by cross-segment indirect dependencies based on effective cross-segment indirect dependencies.
7. The method according to claim 1, characterized in that, Step S5 is as follows: Based on the conflict context in the coordination and resolution task, the domain decomposition agent performs heuristic evolutionary operations within the local scope of the corresponding candidate solution fragment to generate a local adjustment proposal containing the proposed sub-requirement merging, splitting, renaming, attribute value migration, or dependency edge reconnection adjustment operations, and returns the local adjustment proposal to the coordinating agent. The coordinating agent collects all local adjustment proposals, constructs a multi-objective combinatorial optimization model with the joint objectives of maximizing the global conflict resolution rate, minimizing the loss of demand semantic information, and maintaining the uniformity of decomposition granularity, solves the globally optimal operation combination, and decomposes the globally optimal operation combination into an operation execution instruction sequence for decomposition agents in each domain and issues it. Each domain-specific decomposition agent performs write-back modifications on the managed candidate solution fragments based on the received operation execution instruction sequence, and maintains or updates the visibility attributes of sub-requirements and dependencies, as well as the interface dependency contracts of the corresponding fragments during the modification process.
8. The method according to claim 1, characterized in that, In step S6, the structured requirement decomposition document includes sub-requirement numbers, natural language descriptions, priority weights, dependency matrices, and a recommendation responsibility module.
9. The method according to claim 1, characterized in that, In step S3, candidate solution fragments containing interface dependency contracts are written to the shared knowledge blackboard; in step S4, the coordinating agent reads candidate solution fragments from the shared knowledge blackboard; in step S5, the domain decomposition agent performs write-back modifications on the candidate solution fragments and republishes them to the shared knowledge blackboard; in step S6, global sub-requirement deduplication and identifier unification are performed on all candidate solution fragments in the shared knowledge blackboard.
10. A software requirement automatic decomposition system based on multi-agent collaboration, used to implement the method described in any one of claims 1-9, characterized in that, include: The hypergraph construction module is used to parse software requirement text and construct a requirement knowledge hypergraph with requirement elements as nodes and semantic relationships and reduction dependencies as edges. The task allocation module is used to perform structural clustering on the demand knowledge hypergraph and send each subgraph obtained by clustering as an independent demand package to the corresponding domain decomposition agent. The attribute annotation module is configured to perform granular decomposition of the requirement package according to the domain decomposition agent, generate candidate solution fragments consisting of sub-requirements and local dependencies between sub-requirements, annotate the visibility attributes of sub-requirements and local dependencies in each candidate solution fragment, and generate interface dependency contracts for the interaction between the fragment and external fragments for sub-requirements and dependencies annotated as interface level. The iterative decision module is configured to detect direct conflicts and cross-segment indirect dependency conflicts of candidate solution fragments based on the interface dependency contract of the coordinating agent, abstract the conflicts into nodes and associate conflict edges to construct a global conflict hypergraph. If the global conflict hypergraph is empty or there is no change after two iterations, proceed to the result output module; Otherwise, each connected conflict subgraph is encapsulated as a coordination and resolution task and distributed to the relevant domain decomposition agents, and then proceeds to the fragment modification module; The fragment modification module is configured to generate local adjustment proposals based on the domain decomposition agent. The coordinating agent solves the globally optimal operation combination based on all local adjustment proposals and decomposes it into an operation execution instruction sequence, which is then sent to the domain decomposition agent. The domain decomposition agent modifies the candidate solution fragments and returns to the iterative judgment module. The results output module is used to perform global sub-requirement deduplication and identification unification on all candidate solution fragments, establish a complete traceability chain from each sub-requirement to the original requirement knowledge hypergraph node, and generate a structured requirement decomposition document.
Citation Information
Patent Citations
Multi-agent cooperation method, system and device and storage medium
CN120849051A
Automatic software development system based on multi-agent cooperation
CN121349876A