A robust internet of things topology optimization method based on knowledge-guided relation reasoning
Patent Information
- Application Number
- CN202611476573.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-22
- Publication Date
- 2026-10-27
AI Technical Summary
[0006]为解决现有物联网拓扑优化方法存在候选重连边组合数量大、搜索效率低、容易陷入局部最优以及难以适应不同规模网络等问题,本发明提出了一种基于知识引导关系推理的鲁棒物联网拓扑优化方法
[0015]1. 本发明将全局边对组合搜索转换为线图上的局部多步关系推理,每一步仅从当前边节点的邻域中选择下一动作,避免显式枚举全部候选边对,可显著缩小动作空间并提高拓扑优化的搜索效率。
Smart Images

Figure CN122994183A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of Internet of Things (IoT) topology optimization technology, and relates to a robust IoT topology optimization method based on knowledge-guided relational reasoning. Background Technology
[0002] The Internet of Things (IoT), through the interconnection of numerous sensing nodes, communication devices, and edge terminals, provides continuous data collection and collaborative services for applications such as intelligent transportation, smart cities, industrial IoT, and smart oceans. As the number of nodes and the scale of business continue to expand, node energy depletion, random failures, communication link interruptions, and malicious attacks can all disrupt network connectivity, leading to data transmission failures or even partial network paralysis. Therefore, optimizing network connectivity and improving the structural robustness of the IoT topology under fault and attack conditions while meeting actual communication constraints are crucial issues for ensuring the stable operation of large-scale IoT systems.
[0003] Real-world IoT topologies typically exhibit scale-free characteristics, meaning the node degree distribution follows a power-law distribution. While these topologies are highly tolerant of random failures, when highly connected nodes are subjected to targeted attacks, the maximum connected subgraph of the network shrinks rapidly, making it prone to cascading collapse. To improve robustness while maintaining scale-free characteristics and the node degree sequence, current techniques often employ adjusting the topology by selecting two edges and swapping their endpoints.
[0004] Traditional heuristic methods typically enumerate candidate edge pairs in the global edge set, perform reconnection, and calculate network robustness to select operations that can improve the topology. As the network size increases, the number of candidate edge pairs grows exponentially, and each candidate evaluation requires node attack simulation and connected subgraph computation, resulting in high computational overhead. Furthermore, these methods are prone to getting trapped in local optima due to limitations imposed by local search paths. Deep reinforcement learning-based methods can learn edge selection behavior through policy networks, reducing the cost of manually designing search rules. However, most existing methods still model topology reconnection as a direct combination and selection problem of global edge pairs, resulting in a large action space and limited exploration efficiency and sample utilization.
[0005] Furthermore, some existing reinforcement learning methods use adjacency matrices or fixed-length global topology vectors as state representations, which strongly couples the policy with the node size, node numbering, and topology distribution during training, making it difficult to directly transfer to networks of different sizes or dynamically changing networks. Current technologies lack a solution that can explicitly utilize the latent structural relationships between edges, progressively infer effective reconnection relationships in the local action space, and balance cross-scale generalization ability with optimization efficiency. Summary of the Invention
[0006] To address the problems of existing IoT topology optimization methods, such as a large number of candidate reconnection edge combinations, low search efficiency, susceptibility to local optima, and difficulty in adapting to networks of different sizes, this invention proposes a robust IoT topology optimization method based on knowledge-guided relational reasoning. By introducing knowledge reasoning, it finds edge combinations that improve robustness, thereby increasing the efficiency of robustness enhancement. The effectiveness is fully demonstrated through comparison with other topology optimization algorithms.
[0007] This invention provides a robust IoT topology optimization method based on knowledge-guided relational reasoning, comprising:
[0008] Step 1: Randomly deploy a preset number of IoT device nodes within the target area and construct a connected original IoT topology according to the scale-free network generation rules;
[0009] Step 2: Convert the connected original IoT topology into a line graph;
[0010] Step 3: Detect the triangular and four-node phantom structures in the original IoT topology, and add different types of network phantoms as phantom supernodes to the line graph;
[0011] Step 4: Construct a virtual global node, add the virtual global node to the line graph, and connect the virtual global node to all edge nodes in the line graph;
[0012] Step 5: Construct structural type representations for edge nodes, module super nodes, virtual global nodes, and relationships between nodes in the line graph. Initialize learnable embedding vectors for each structural type instance to obtain the structural embeddings of the line graph nodes and the structural embeddings of the relationships between nodes.
[0013] Step 6: Using the line graph, the structural embedding of line graph nodes, the structural embedding of relationships between nodes, and the state information of virtual global nodes as input, the Actor-Critic framework is used to perform multi-step relationship reasoning on the line graph to determine two candidate original edges. After filtering by communication distance, self-loops, repeated edges, and connectivity constraints, endpoint swapping is implemented, and the strategy is trained according to robustness changes. After training, the strategy is frozen, and reasoning and feasible reconnection are repeatedly performed on the topology to be optimized. The optimized topology is output after achieving the preset reconnection budget or the target robustness improvement ratio.
[0014] The robust IoT topology optimization method based on knowledge-guided relational reasoning of the present invention has the following beneficial effects:
[0015] 1. This invention transforms the global edge pair combination search into local multi-step relation reasoning on a line graph. Each step selects the next action only from the neighborhood of the current edge node, avoiding explicit enumeration of all candidate edge pairs. This can significantly reduce the action space and improve the search efficiency of topology optimization.
[0016] 2. This invention encodes the prior structure of a multi-level structure, such as node degree, degree difference between endpoints, average network core level between two endpoints, triangles and four-node motifs, into the structural embedding of nodes, and introduces motif supernodes, so that local connection patterns, global core importance and high-order subgraph information jointly participate in reconnection decision-making, thereby improving policy representation ability and cross-network scale generalization ability.
[0017] 3. This invention employs edge swapping while maintaining the degree, and simultaneously checks communication distance, self-loops, repeated edges, and network connectivity constraints. This improves robustness while preserving the node degree sequence and basic network deployment feasibility, making it suitable for IoT topologies with scale-free characteristics.
[0018] 4. This invention preserves inference history information through GRU and uses joint training with Actor-Critic and entropy regularization, enabling the agent to gradually discover edge combinations with potential structural relationships, reducing local optima and invalid exploration, improving the speed of robustness improvement, and further enhancing the optimization effect on the topology robustness of the Internet of Things. Attached Figure Description
[0019] Figure 1 This is a flowchart of a robust IoT topology optimization method based on knowledge-guided relational reasoning according to the present invention;
[0020] Figure 2 This is a schematic diagram illustrating the conversion of the original IoT topology into a line graph and the addition of module nodes. Detailed Implementation
[0021] like Figure 1 As shown, a robust IoT topology optimization method based on knowledge-guided relational reasoning according to the present invention includes:
[0022] Step 1: Randomly deploy a preset number of IoT device nodes within the target area, and construct a connected original IoT topology according to the scale-free network generation rules, specifically as follows:
[0023] Step 1.1: Randomly deploy a preset number of IoT device nodes within the target area. For each IoT device node, select neighboring nodes that meet the connection conditions from its communication range to establish a communication link, and ensure that neighboring nodes with higher node degree have a higher connection probability.
[0024] Step 1.2: Simultaneously control the number of communication links in the topology by preset edge density.
[0025] Step 1.3: After completing the initial connection of the main network, perform connectivity testing on the constructed topology. For isolated nodes or isolated subgraphs that are not connected to the main network, select neighboring nodes that meet the communication distance constraints to establish supplementary communication links, thereby obtaining the connected original IoT topology.
[0026] Step 2: Convert the connected original IoT topology into a line graph, specifically:
[0027] Step 2.1: Obtain the current original IoT topology Read the original node set composed of the coordinates of IoT device nodes. The original set of edges formed by communication links And node degree information.
[0028] Step 2.2: Connect each communication link in the original IoT topology, i.e., each edge Mapped to an edge node in a line graph ,in, .
[0029] Step 2.3: Traverse the set of associated edges of nodes in the original IoT topology. If two communication links in the original IoT topology share at least one IoT device node, connect the edge nodes corresponding to the two communication links in the line graph to obtain the line graph. , Represents the set of edge nodes in a line graph. This represents the set of connection relationships in a line graph.
[0030] Step 3: Detect the triangular and four-node phantom structures in the original IoT topology, and add different types of network phantoms as phantom supernodes to the line graph, specifically:
[0031] Step 3.1: Detect the triangular and four-node phantoms in the original IoT topology, and use the detected triangular and four-node phantoms as phantom supernodes; the four-node phantoms include: star phantom, ring phantom, tailed triangular phantom, path phantom, chord ring phantom and cluster phantom.
[0032] Step 3.2: When the edges in the original IoT topology When participating in a certain type of modifier, the edge node of the line graph corresponding to that edge is... Connect to the corresponding phantom supernode; a node on the same side can connect to multiple phantom supernodes simultaneously.
[0033] like Figure 2The diagram illustrates the conversion of the original IoT topology to a line graph and the addition of phantom nodes. In the diagram, A, B, C, D, and E represent the original nodes in the original IoT topology, and the communication links between these nodes are the original edges. Each edge is mapped to an edge node in the line graph, as shown in edge nodes AB, AD, BC, CD, and CE. This transforms the original IoT topology on the left into the line graph in the middle. Finally, the triangular phantom structure and the four-node phantom are connected to the corresponding edge nodes in the line graph, completing the process of adding phantom supernodes to the line graph.
[0034] Step 4: Construct a virtual global node, add the virtual global node to the line graph, and connect the virtual global node to all edge nodes in the line graph, specifically:
[0035] Step 4.1: Construct a virtual global node. The state information of the virtual global node includes: the robustness level of the current IoT topology and the total number of various network modules in the current IoT topology.
[0036]
[0037] in, This indicates the robustness level of the current IoT topology, where L represents the total number of original nodes in the current IoT topology. This indicates the round in which nodes are removed according to the target attack rules after the current Internet of Things (IoT) is attacked. MCS ( ) indicates the first The number of original nodes contained in the largest connected subgraph after the removal of the secondary node; the state information of the virtual global node is used to represent the overall structural state of the current IoT topology.
[0038] Step 4.2: Connect the virtual global node to all line graph nodes as the starting state for each inference trajectory.
[0039] Step 5: Construct structure type representations for edge nodes, modal supernodes, virtual global nodes, and relationships between nodes in the line graph. Initialize learnable embedding vectors for each structure type instance to obtain the structure embeddings of line graph nodes and relationships between nodes. Specifically:
[0040] Step 5.1: Establish the structure type representation of the edge nodes in the line graph.
[0041] For each communication link in the original IoT topology, extract the node degree of its two endpoints, the degree difference between the two endpoints, the average network core level of the two endpoints, the number of times the communication link participates in various four-node modules, and the number of times it participates in triangular modules to form the structure type of the edge node.
[0042] Step 5.2: Establish the structural type representation of the supernodes of the module in the line graph.
[0043] For a motif supernode, set its corresponding motif category to the structure type of the corresponding motif supernode.
[0044] Step 5.3: Construct the structure type representation of the virtual global node.
[0045] The robustness level of the current IoT topology is discretized at intervals of 0.01 and together with the total number of various types of modal nodes in the current IoT topology, it constitutes the structure type of the virtual global node.
[0046] Step 5.4: Construct a structural type representation of the relationships between nodes.
[0047] For the relationships between nodes in the line graph, the shared IoT device node relationship between edge nodes, the number of times the module participates between edge nodes and module nodes, and the global connection relationship between virtual global nodes and edge nodes are set to the corresponding structure types.
[0048] Step 5.5: Initialize a learnable embedding vector for each structure type instance of a node in the line graph, and perform mean pooling on all embedding vectors of that node to obtain the structure embedding of that line graph node:
[0049]
[0050] in, Represents line graph nodes The structure is embedded; i represents the index of the line graph node. This represents the i-th line graph node; Represents the complete set of structure types. Represents nodes A collection of associated structure type instances, | | Represents a collection of instances The number of instances of the structure type contained therein; express An instance of a structure type, Represents a structure type instance The corresponding learnable embedding vector, ∑ represents the pair of learnable embedding vectors. Summing all instances of the structure type in the array.
[0051] The structural embedding of the relationships between nodes is obtained from the following formula:
[0052]
[0053] in, Represents line graph nodes and The relationship between them Representing relations The structural embedding, Representation and relation A collection of associated structure type instances, Represents a collection of instances The number of instances of the structure type contained therein.
[0054] Step 6: Using the line graph, the structural embeddings of line graph nodes, the structural embeddings of relationships between nodes, and the state information of virtual global nodes as input, the Actor-Critic framework is used to perform multi-step relationship reasoning on the line graph. Two candidate original edges are determined, and after filtering by communication distance, self-loops, repeated edges, and connectivity constraints, endpoint swapping is implemented. The strategy is then trained based on robustness changes. After training, the strategy is frozen, and reasoning and feasible reconnection are repeatedly performed on the topology to be optimized. The optimized topology that achieves the preset reconnection budget or the target robustness improvement ratio is output. Specifically:
[0055] Step 6.1: Initialize the multilayer fully connected networks Actor network, Critic network, and GRU network using random initialization; set the reward discount factor, Critic loss weight, and entropy regularization weight. Parameter updates are performed using the AdamW optimizer, with the optimization objective as shown in the following formula:
[0056]
[0057] Where, π θ Let θ represent the Actor policy with parameter θ, where θ represents the Actor network parameters; Indicates from strategy π θ A reasoning trajectory obtained from sampling; [·] indicates the expectation of the trajectory obtained by policy sampling; T represents the total number of inference steps of the trajectory, and t represents the index of the inference step. Let θ represent the reward obtained at step t, γ represent the reward discount factor, and max represent maximizing the expected cumulative reward by optimizing θ.
[0058] Step 6.2: In one inference step, the Actor network first calculates the action probability of the starting point for all edge nodes of the line graph based on the state information of the virtual global node and selects the starting edge node. Subsequently, in each step, a set of local candidate actions for the current node in the line graph is generated according to formula (5), including adjacent edge node transfer, module super node transfer and STOP action.
[0059]
[0060] in, Indicates the index of the current inference step. Indicates the first The reasoning state of the step, Representing state The set of candidate actions; Indicates the current line graph node. express Online graph G L The set of neighboring nodes in the middle, Indicates the candidate target node. express and The relationship between them; Indicates the relationship Transfer to node The action is indicated by the vertical bar "|" to indicate that the set condition following it is satisfied, ∈ to indicate belonging to, ∪ to indicate the union of sets, and STOP to indicate that the current reasoning trajectory is terminated and the reconnection decision is entered.
[0061] Step 6.3: For each candidate action, the structural embedding of the relationship between nodes and the structural embedding of the target node are concatenated according to formula (6). The candidate next hidden state is calculated using GRU through formula (7). The Actor score is calculated according to formula (8) and normalized to the action probability. The trajectory hidden state is updated after selecting the next action until STOP is selected or the maximum inference steps are reached.
[0062]
[0063]
[0064]
[0065] in, Indicates candidate actions, Indicates the relation type of candidate transition. Represents candidate target line graph nodes; Indicates action The observation vector; Representing relations The structural embedding, Represents the target node The structural embedding of , ∥ represents vector concatenation; Let GRU represent the current inference state at step t, and GRU represent the gated recurrent unit. Indicates the state Execute candidate actions The candidate next hidden state obtained by GRU is the candidate action representation for state awareness. Indicates the Actor's action Output score; (·) represents an Actor network with parameter θ.
[0066] Step 6.4: Extract the first and last edges of the trajectory, generate two endpoint swap operations according to formula (9), and check in turn whether the length of the new edge is less than or equal to the communication radius, whether a self-loop is generated, whether it is repeated with the existing edge, and whether the topology remains connected after the swap. Only operations that satisfy all constraints are added to the feasible set. .
[0067]
[0068] in, and These represent the two original edges corresponding to the starting and ending nodes of the reasoning trajectory, namely the first edge and the last edge; Indicates the two endpoints of the first side; The two endpoints of the tail are represented; t represents the index of the trajectory termination step; Indicates ( , )and( , This represents the first endpoint swap operation for the new edge. Indicates with ( , )and( , This represents the second type of endpoint swap operation for the new edge; This represents the set of feasible swap operations that have been checked for communication distance, self-loops, repeated edges, and connectivity. The arrow "→" indicates that the two original edges on the left are replaced with the two new edges on the right.
[0069] Step 6.5: Remove nodes sequentially according to the target attack rules, and calculate the number of nodes in the largest connected subgraph after each round of attack. Obtain the robustness of the current topology and each feasible reconnection topology based on the robustness index R. Then calculate the robustness gain of each feasible operation according to formula (10). Select the feasible operation with the largest robustness gain according to formula (11) and execute it. If there is no feasible operation or the gain is not positive, do not change the topology and assign a penalty.
[0070]
[0071]
[0072] in, This indicates the topology before reconnection. express One of the feasible swap operations, Indicates the execution of an operation The subsequent topology, and These represent the robustness of the two topologies, respectively. Indicates operation The resulting robustness gain This represents the maximum robustness gain within the feasible set. This indicates taking the maximum value among all feasible swap operations.
[0073] Step 6.6: Generate trajectory termination reward according to the segmented reward function of formula (12);
[0074]
[0075] In the early stage of training, the attack order of nodes of the same degree is fixed to complete the pre-training; when the strategy can stably generate effective reconnection, the attack order of nodes of the same degree is randomized to continue training; for consecutive successful trajectories in a topology optimization sequence, the reward of the subsequent successful trajectory is backpropagated to the earlier trajectory according to the reward discount factor.
[0076] Step 6.7: Construct a small batch of data D from the sampling trajectory, calculate the Critic loss and Actor loss as shown in formula (13) and formula (14) respectively using empirical rewards and advantage estimation, and add the entropy regularization term through formula (15); update the embedding parameters of Actor, Critic, GRU and structure type through backpropagation.
[0077]
[0078]
[0079]
[0080] Where D represents a mini-batch dataset consisting of trajectory samples, |D| represents the number of samples in the mini-batch, and t represents the inference step index corresponding to the sample; Critic loss is represented by Critic loss, and SmoothL1 loss function is represented by SmoothL1 loss function. The parameter is The Critic network for state The value estimate, This represents the experience reward at step t; Represents the Actor loss, π θ This represents a policy with parameter θ in state θ. Select Action The probability, This represents the action actually performed in step t. This represents the advantage estimate of the action, where log represents the natural logarithm. Indicates the total loss. Indicates the Critic loss weight. H represents the entropy regularization weight. Representing state The entropy of the policy distribution is given by the dot "·", which indicates that all candidate actions in the current state have been traversed.
[0081] Step 6.8: After training is completed, freeze the policy parameters and perform inference on the topology to be optimized; after each successful reconnection, recalculate the structural embedding of the affected nodes, update the line graph and the virtual global node state, and then start the next inference trajectory. After reaching the preset reconnection budget or the target robustness improvement ratio, output the final topology.
[0082] The above description is only a preferred embodiment of the present invention and is not intended to limit the ideas of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A robust IoT topology optimization method based on knowledge-guided relational reasoning, characterized in that, include: Step 1: Randomly deploy a preset number of IoT device nodes within the target area and construct a connected original IoT topology according to the scale-free network generation rules; Step 2: Convert the connected original IoT topology into a line graph; Step 3: Detect the triangular and four-node phantom structures in the original IoT topology, and add different types of network phantoms as phantom supernodes to the line graph; Step 4: Construct a virtual global node, add the virtual global node to the line graph, and connect the virtual global node to all edge nodes in the line graph; Step 5: Construct structural type representations for edge nodes, module super nodes, virtual global nodes, and relationships between nodes in the line graph. Initialize learnable embedding vectors for each structural type instance to obtain the structural embeddings of the line graph nodes and the structural embeddings of the relationships between nodes. Step 6: Using the line graph, the structural embedding of line graph nodes, the structural embedding of relationships between nodes, and the state information of virtual global nodes as input, the Actor-Critic framework is used to perform multi-step relationship reasoning on the line graph, determine two candidate original edges, and implement endpoint swapping after filtering by communication distance, self-loop, repeated edges and connectivity constraints, and train the strategy according to robustness changes. After training, the strategy is frozen, and the reasoning and feasible reconnection are repeatedly performed on the topology to be optimized. The optimized topology is output after the preset reconnection budget or the target robustness improvement ratio is achieved.
2. The robust IoT topology optimization method based on knowledge-guided relational reasoning according to claim 1, characterized in that, Step 1 specifically involves: Step 1.1: Randomly deploy a preset number of IoT device nodes within the target area. For each IoT device node, select neighboring nodes that meet the connection conditions from its communication range to establish a communication link. Step 1.2: Simultaneously control the number of communication links in the topology by preset edge density; Step 1.3: After completing the initial connection of the main network, perform connectivity testing on the constructed topology. For isolated nodes or isolated subgraphs that are not connected to the main network, select neighboring nodes that meet the communication distance constraints to establish supplementary communication links, thereby obtaining the connected original IoT topology.
3. The robust IoT topology optimization method based on knowledge-guided relational reasoning according to claim 1, characterized in that, Step 2 specifically involves: Step 2.1: Obtain the current original IoT topology Read the original node set composed of the coordinates of IoT device nodes. The original set of edges formed by communication links and node degree information; Step 2.2: Connect each communication link in the original IoT topology, i.e., each edge Mapped to an edge node in a line graph ,in, ; Step 2.3: Traverse the set of associated edges of nodes in the original IoT topology. If two communication links in the original IoT topology share at least one IoT device node, connect the edge nodes corresponding to the two communication links in the line graph to obtain the line graph. , Represents the set of edge nodes in a line graph. This represents the set of connection relationships in a line graph.
4. The robust IoT topology optimization method based on knowledge-guided relational reasoning according to claim 1, characterized in that, Step 3 specifically involves: Step 3.1: Detect the triangular and four-node phantoms in the original IoT topology, and use the detected triangular and four-node phantoms as phantom supernodes; The four-node phantoms include: star-shaped phantom, ring-shaped phantom, tailed triangle phantom, path phantom, chord ring phantom, and cluster phantom; Step 3.2: When the edges in the original IoT topology When participating in a certain type of modifier, the edge node of the line graph corresponding to that edge is... Connect to the corresponding phantom supernode; a node on the same side can connect to multiple phantom supernodes simultaneously.
5. The robust IoT topology optimization method based on knowledge-guided relational reasoning according to claim 1, characterized in that, Step 4 specifically involves: Step 4.1: Construct a virtual global node. The state information of the virtual global node includes: the robustness level of the current IoT topology and the total number of various network modules in the current IoT topology. in, This indicates the robustness level of the current IoT topology, where L represents the total number of original nodes in the current IoT topology. This indicates the round in which nodes are removed according to the target attack rules after the current Internet of Things (IoT) is attacked. MCS ( ) indicates the first The number of original nodes contained in the largest connected subgraph after the removal of the secondary node; the state information of the virtual global node is used to represent the overall structural state of the current IoT topology; Step 4.2: Connect the virtual global node to all line graph nodes as the starting state for each inference trajectory.
6. The robust IoT topology optimization method based on knowledge-guided relational reasoning according to claim 1, characterized in that, Step 5 specifically involves: Step 5.1: Establish the structural type representation of the edge nodes in the line graph; For each communication link in the original IoT topology, extract the node degree of its two endpoints, the degree difference between the two endpoints, the average network core level of the two endpoints, the number of times the communication link participates in various four-node modules, and the number of times it participates in triangular modules to form the structure type of the edge node. Step 5.2: Establish the structural type representation of the supernodes of the module in the line graph; For a phantom supernode, set its corresponding phantom category to the structure type of the corresponding phantom supernode; Step 5.3: Construct the structure type representation of the virtual global node; The robustness level of the current IoT topology is discretized at intervals of 0.01 and together with the total number of various types of modal nodes in the current IoT topology, it constitutes the structure type of the virtual global node. Step 5.4: Construct a structural type representation of the relationships between nodes; For the relationships between nodes in the line graph, the shared IoT device node relationship between edge nodes, the number of times the module participates between edge nodes and module nodes, and the global connection relationship between virtual global nodes and edge nodes are set to the corresponding structure types. Step 5.5: Initialize a learnable embedding vector for each structure type instance of a node in the line graph, and perform mean pooling on all embedding vectors of the node to obtain the structure embedding of the line graph node; in, Represents line graph nodes The structure is embedded; i represents the index of the line graph node. This represents the i-th line graph node; Represents the complete set of structure types. Represents nodes A collection of associated structure type instances, | | Represents a collection of instances The number of instances of the structure type contained therein; express An instance of a structure type, Represents a structure type instance The corresponding learnable embedding vector, ∑ represents the pair of learnable embedding vectors. Summing all instances of the structure type in the array; The structural embedding of the relationships between nodes is obtained from the following formula: in, Represents line graph nodes and The relationship between them Representing relations The structural embedding, Representation and relation A collection of associated structure type instances, Represents a collection of instances The number of instances of the structure type contained therein.
7. The robust IoT topology optimization method based on knowledge-guided relational reasoning according to claim 1, characterized in that, Step 6 specifically involves: Step 6.1: Initialize the multilayer fully connected networks Actor network, Critic network, and GRU network using random initialization; set the reward discount factor, Critic loss weight, and entropy regularization weight. Parameter updates are performed using the AdamW optimizer, with the optimization objective as shown in the following formula: Where, π θ Let θ represent the Actor policy with parameter θ, where θ represents the Actor network parameters; Indicates from strategy π θ A reasoning trajectory obtained from sampling; [·] indicates the expectation of the trajectory obtained by policy sampling; T represents the total number of inference steps of the trajectory, and t represents the index of the inference step. Let θ represent the reward obtained at step t, γ represent the reward discount factor, and max represent maximizing the expected cumulative reward by optimizing θ. Step 6.2: In one inference step, the Actor network first calculates the action probability of the starting point for all edge nodes of the line graph based on the state information of the virtual global node and selects the starting edge node. Subsequently, in each step, a set of local candidate actions for the current node in the line graph is generated according to formula (5), including adjacent edge node transfer, module super node transfer and STOP action; in, Indicates the index of the current inference step. Indicates the first The reasoning state of the step, Representing state The set of candidate actions; Indicates the current line graph node. express Online graph G L The set of neighboring nodes in the middle, Indicates the candidate target node. express and The relationship between them; Indicates the relationship Transfer to node The action is indicated by the vertical bar "|" to indicate that the set condition following it is satisfied, ∈ to indicate belonging to, ∪ to indicate the union of sets, and STOP to indicate that the current reasoning trajectory is terminated and the reconnection decision is entered. Step 6.3: For each candidate action, the structural embedding of the relationship between nodes and the structural embedding of the target node are concatenated according to formula (6). The candidate next hidden state is calculated using GRU according to formula (7). The Actor score is calculated according to formula (8) and normalized to the action probability. The trajectory hidden state is updated after selecting the next action until STOP is selected or the maximum inference steps are reached. in, Indicates candidate actions, Indicates the relation type of candidate transition. Represents candidate target line graph nodes; Indicates action The observation vector; Representing relations The structural embedding, Represents the target node The structural embedding of , ∥ represents vector concatenation; Let GRU represent the current inference state at step t, and GRU represent the gated recurrent unit. Indicates the state Execute candidate actions The candidate next hidden state obtained by GRU is the candidate action representation for state awareness. Indicates the Actor's action Output score; (·) represents an Actor network with parameter θ; Step 6.4: Extract the first and last edges of the trajectory, generate two endpoint swap operations according to formula (9), and check in turn whether the length of the new edge is less than or equal to the communication radius, whether a self-loop is generated, whether it is repeated with the existing edge, and whether the topology remains connected after the swap. Only operations that satisfy all constraints are added to the feasible set. ; in, and These represent the two original edges corresponding to the starting and ending nodes of the reasoning trajectory, namely the first edge and the last edge; Indicates the two endpoints of the first side; The two endpoints of the tail are represented; t represents the index of the trajectory termination step; Indicates with ( , )and( , This represents the first endpoint swap operation for the new edge. Indicates with ( , )and( , This represents the second type of endpoint swap operation for the new edge; This represents the set of feasible swap operations that pass the checks of communication distance, self-loops, repeated edges, and connectivity. The arrow "→" indicates that the two original edges on the left are replaced with the two new edges on the right. Step 6.5: Remove nodes sequentially according to the target attack rules, and calculate the number of nodes in the largest connected subgraph after each round of attack. Obtain the robustness of the current topology and each feasible reconnection topology based on the robustness index R. Then calculate the robustness gain of each feasible operation according to formula (10). Select the feasible operation with the largest robustness gain according to formula (11) and execute it. If there is no feasible operation or the gain is not positive, do not change the topology and assign a penalty. in, This indicates the topology before reconnection. express One of the feasible swap operations, Indicates the execution of an operation The subsequent topology, and These represent the robustness of the two topologies, respectively. Indicates operation The resulting robustness gain This represents the maximum robustness gain within the feasible set. This indicates taking the maximum value among all feasible swap operations; Step 6.6: Generate trajectory termination reward according to the segmented reward function of formula (12); In the early stage of training, the attack order of nodes of the same degree is fixed to complete the pre-training; when the strategy can stably generate effective reconnection, the attack order of nodes of the same degree is randomized to continue training; for consecutive successful trajectories in a topology optimization sequence, the reward of the subsequent successful trajectory is backpropagated to the earlier trajectory according to the reward discount factor. Step 6.7: Construct a small batch of data D from the sampling trajectory, calculate the Critic loss and Actor loss as shown in formula (13) and formula (14) respectively using empirical rewards and advantage estimation, and add the entropy regularization term through formula (15); update the embedding parameters of Actor, Critic, GRU and structure type through backpropagation; Where D represents a mini-batch dataset consisting of trajectory samples, |D| represents the number of samples in the mini-batch, and t represents the inference step index corresponding to the sample; Critic loss is represented by Critic loss, and SmoothL1 loss function is represented by SmoothL1 loss function. The parameter is The Critic network for state The value estimate, This represents the experience reward at step t; Represents the Actor loss, π θ This represents a policy with parameter θ in state θ. Select Action The probability, This represents the action actually performed in step t. This represents the advantage estimate of the action, where log represents the natural logarithm. Indicates the total loss. Indicates the Critic loss weight. H represents the entropy regularization weight. Representing state The entropy of the policy distribution, where the dot "·" indicates traversing all candidate actions in the current state; Step 6.8: After training is completed, freeze the policy parameters and perform inference on the topology to be optimized; after each successful reconnection, recalculate the structural embedding of the affected nodes, update the line graph and the virtual global node state, and then start the next inference trajectory. After reaching the preset reconnection budget or the target robustness improvement ratio, output the final topology.
