A method for selecting network edges of routing nodes for secure testing based on pointer networks and genetic algorithms

By combining pointer networks and genetic algorithms, the importance of routing node network edges is evaluated and optimized, and the problem of insufficient efficiency and interpretability in the existing technology is solved, efficient routing node network edge selection is achieved, and the security testing is significantly improved. Efficiency and effect.

CN118740527BActive Publication Date: 2024-11-15HUNAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411236391.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-04
Publication Date
2024-11-15
Estimated Expiration
2044-09-04

AI Technical Summary

Technical Problem

The existing security test routing node network edge selection method has limitations in terms of efficiency, generalization and interpretability, especially when dealing with large-scale problems, it is difficult to quickly obtain the global optimal solution.

Method used

Using a method based on pointer network and genetic algorithm, by constructing a routing node network data model, evaluating the importance of edges and filtering out key edge combinations, using pointer network to generate initial test schemes, and then iteratively optimized through genetic algorithms to generate the most evaluation values. The final test plan that is excellent and complies with traffic constraints.

Benefits of technology

It reduces the computational complexity, improves the solution efficiency, can quickly lock high-quality test edge combinations, approximate the optimal solution, and significantly improves the efficiency and effect of network security testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118740527B_ABST
    Figure CN118740527B_ABST
Patent Text Reader

Abstract

A method for selecting network edges of routing nodes for security testing based on pointer networks and genetic algorithms includes step S1, constructing a routing node network data model; step S2, evaluating and screening the importance of routing node network edges: based on the network topology and node attributes, using edge average degree, edge betweenness, and edge contribution to measure the importance of edges, and screening out a batch of important edges as a candidate set of test objects; step S3, inputting the important edge set preliminarily screened by step S2 into the pointer network model, comprehensively considering the node importance and the test cost, and generating multiple groups of edge combinations with the highest cost performance as the initial test plan; step S4, using the initial test plan generated by the pointer network model in step S3 as the initial population, performing iterative optimization based on the genetic algorithm, and generating a routing node network edge combination with the best evaluation value and meeting the flow constraint as the final test plan. The present invention can reduce the computational complexity and improve the solution efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of network security testing, and in particular to a network edge selection method for routing nodes in a security test based on a pointer network and a genetic algorithm. Background Art

[0002] As a means of network security assessment, security testing identifies potential security vulnerabilities and tests the effectiveness of existing defense measures by simulating the behavior of testers. Routing node networks are the hub of network communications, and detailed security testing is an indispensable part of ensuring the robustness of network architecture and maintaining network security. When conducting security tests on routing node networks, depending on the test object, testers need to quickly obtain the test link combination that can maximize the test effect from thousands or even hundreds of thousands of links. If it is considered as an integer programming problem, the main ways to solve the problem are: greedy algorithm, dynamic programming, branch and bound, and neural network methods.

[0003] The greedy algorithm selects the link with the highest benefit in the current state each time, but it cannot guarantee the global optimal solution; dynamic programming can obtain the global optimal solution, but it is difficult to handle large-scale problems; the branch and bound algorithm obtains the optimal solution by searching the decision tree, but the complexity is relatively high. The neural network methods mainly include pointer networks and attention mechanism models. Vinyals et al. first proposed the pointer network model in 2015, which was used to solve combinatorial optimization problems by learning the conditional probability between input sequences. Bello et al. further combined the pointer network with reinforcement learning in 2016 to improve the performance of the algorithm. Kool et al. designed the attention mechanism model in 2019 and achieved end-to-end solution through the Encoder-Decoder framework. Compared with the above other methods, the neural network method has better scalability and generalization, can automatically learn the feature representation of the problem, and reduce the reliance on manual feature engineering. However, the neural network method also has certain limitations, such as the need for a large amount of data for model training and the low interpretability of the prediction results. Therefore, in practical applications, it is necessary to select a suitable solution paradigm based on the scale, constraints, data and other conditions of the specific problem. In summary, in actual security testing tasks, the existing test object selection methods have limitations in efficiency, generalization, and interpretability to varying degrees. Summary of the invention

[0004] In order to reduce computational complexity and improve solution efficiency, the present invention provides a network edge selection method for secure test routing nodes based on pointer networks and genetic algorithms.

[0005] In order to solve the above technical problems, the present invention adopts the following technical method: a method for selecting network edges of secure test routing nodes based on pointer networks and genetic algorithms, comprising:

[0006] Step S1, constructing a routing node network data model;

[0007] Step S2, evaluation and screening of the importance of routing node network edges: Based on the network topology and node attributes, the importance of edges is measured using multiple indicators such as edge average degree, edge betweenness, and edge contribution, and a group of important edges are screened out as a candidate set of test objects;

[0008] Step S3, inputting the important edge set preliminarily screened in step S2 into the pointer network model, comprehensively considering the importance of nodes and the test cost, and generating multiple sets of edge combinations with the highest cost-effectiveness as the initial test plan;

[0009] Step S4, using the initial test plan generated by the pointer network model in step S3 as the initial population, performing iterative optimization based on a genetic algorithm, and generating a routing node network edge combination with the best evaluation value and meeting the traffic constraints as the final test plan.

[0010] Furthermore, the routing node network data model constructed in step S1 records the undirected weighted network composed of the routing nodes of the test object and their connection relationships as ,in, is the set of all nodes in the network, representing the routing device. For each node Each has a unique serial number ; It is the set of all edges in the network, representing the physical or logical links between nodes. For each edge , For edge The two nodes connected by .

[0011] Furthermore, in step S4, the evaluation value is calculated using the following formula: (1)

[0012] In step S4, the flow constraints are as follows: (2)

[0013] in, For the test plan X The performance evaluation value of Representative side Whether it is selected for testing, the value is 0 or 1, 0 is not selected, 1 is selected; For edge Load; is the total test resource flow.

[0014] Furthermore, the step S2 includes: S201, based on the network topology and node attributes, using edge average degree, edge betweenness, edge contribution and multiple indicators to measure the importance of the edge, wherein:

[0015] 1) The calculation formula of edge average degree is as follows: (3); among which, Represents edge The edge average degree of

[0016] 2) The calculation formula of edge betweenness is as follows: (4); among which, Represents edge The edge betweenness of represents any two nodes in the network, excluding the edges Connected Nodes ; Represents a slave node The shortest path through the edge The number of paths; Represents a slave node The total number of shortest paths of all node pairs passed;

[0017] 3) Calculate the edge contribution of the routing node network link based on the Fiedler vector as follows:

[0018] ①Convert the routing node network into a Laplace matrix L , as follows: (5); among which, A is the adjacency matrix, representing a Matrix, if there is a slave node With Node directly connected, then the elements of the adjacency matrix is 1, otherwise it is 0; D is the degree matrix, expressed as a A matrix with diagonal elements Representation Node The degree of the node The number of connected edges, other elements are 0;

[0019] ②Calculate the Laplace matrix L The Fiedler value and its corresponding vector, the eigenvector corresponding to the Fiedler value is the Fiedler vector; due to For an undirected network, the Laplacian matrix L The eigenvector of It complies with the following formula: (6); among which, is the matrix eigenvalue. After solving formula (17), have The number of solutions is consistent with the number of rows and columns of the matrix. The values ​​are sorted from small to large, with the smallest Must be 0, select the smallest eigenvalue greater than 0 , as the Laplacian matrix L Fiedler value of

[0020] ③Calculate the Fiedler vector ; (7); among which, is the Laplace matrix L Fiedler value of is the corresponding Fiedler vector, ;

[0021] ④ Calculate the contribution of the edge to the Fiedler value: For the network In terms of , each edge The contribution to the Fiedler value is recorded as ;

[0022] (8)

[0023] in, Respectively Connecting two nodes In the Fiedler vector The corresponding value in ;

[0024] S202, using the topsis entropy weight method to obtain the indicator weights of edge average degree, edge betweenness, and edge contribution;

[0025] S2021 standardizes the original data as follows:

[0026] (9)

[0027] in, Represents the standardized Indicators on the edge The value on Indicates Indicators on the edge The original value on Indicates Indicators on the edge The original value on =1, 2, 3 correspond to the three indicators of edge average degree, edge betweenness, and edge contribution, that is, Represents edge The edge average degree of Represents edge The edge betweenness of Represents edge The contribution of based on Fiedler vector;

[0028] S2022, calculate the Indicators on the edge The proportion of , as follows:

[0029] (10)

[0030] S2023, calculate the The entropy value of the index , as follows:

[0031] (11)

[0032] in, represents the natural logarithm, is the total number of edges in the network, when When, define ;

[0033] S2024, calculate the The coefficient of variation of the index , as follows:

[0034] (12)

[0035] Among them, the coefficient of variation Reflects the The amount of information provided by each indicator, The larger the value, the The greater the amount of information provided by an indicator, the greater its impact on the evaluation results;

[0036] S2025, calculate the The weight of the indicator , as follows:

[0037] (13)

[0038] S203, construct a weighted normalization matrix, as follows:

[0039] (14)

[0040] in, Represents edge In the The weighted standardized value of the indicators, Indicates The weight of the indicator, Represents the normalized edge In the The value of an indicator;

[0041] S204, determine the ideal solution according to the weighted normalization matrix and negative ideal solution , the ideal solution represents the optimal situation of each indicator value, and the negative ideal solution represents the worst situation of each indicator value. The calculation formula is as follows:

[0042] (15)

[0043] (16)

[0044] Among them, the ideal solution , negative ideal solution , k =1, 2, 3;

[0045] S205, use the Euclidean distance formula to calculate the distance between each edge and the ideal solution , and the distance to the negative ideal solution , as follows:

[0046] (17)

[0047] (18)

[0048] S206, calculating the relative proximity of each edge according to the distance between the ideal solution and the negative ideal solution, as shown in the following formula:

[0049] (19)

[0050] in, is the relative proximity of the edge, which is between 0 and 1. The larger the value, the closer the edge is to the ideal solution.

[0051] S207, with relative proximity Evaluate the importance of edges and sort all edges from large to small. The larger the value, the higher the priority.

[0052] S208, after the importance is calculated, the edge is added with a sequence number and a comprehensive importance index as attributes, and the overall routing node network edge data structure is:

[0053] (20)

[0054] in, For each edge in the edge set, the edge has the associated attribute as the edge in the initial edge set The serial number within; is the relative proximity of the edge, indicating the importance of the edge;

[0055] S209, setting the candidate edge screening condition to the top t% in importance ranking, where t is a parameter determined by the user. , take the top t% of edges ranked from most important to least important, and generate a set of important edges , , remove data that is irrelevant to subsequent calculations, The data structure is:

[0056] (twenty one)

[0057] in, , is the number of edges in the important edge set, is the sequence number of the edge in the initial edge set; That is , represents the load of the edge; That is , which indicates the importance value of the edge.

[0058] Furthermore, the step S3 includes: S301, pointer network pre-training: including generating a training data set, initializing a module, loading a data module, generating a pointer network model, training a network, and evaluating a model;

[0059] The generated pointer network model includes an embedding layer, an attention mechanism, and an output layer. The input of the model is 3 lines N The matrix of columns is N The three attributes of the edge; the output is a row and column N +1 matrix, after removing the first column and the last row, can point to the selected edge combination;

[0060] When training the network, the network weights are updated through the back-propagation algorithm. For each training sample, the network calculates the selection probability of each edge and evaluates the error through the loss function, and updates the weights to minimize the loss.

[0061] S302, input data processing: The bandwidth of each routing node network edge is regarded as the test cost, and the importance of the edge is regarded as the benefit. The bandwidth attribute of the important edge set data is processed to form an important edge set in the following input data format:

[0062] (twenty two)

[0063] In the formula, Represents the set of important edges that serve as input data for the pointer network;

[0064] The input sequence of the pointer network is expressed as , where the important edge set includes N edges, the input sequence is 3 lines long N After obtaining the important edge data after preprocessing, the Fisher-Yates shuffle algorithm is used to shuffle the input order in columns to obtain multiple groups of pointer network input data;

[0065] S303, the pointer network selects a test solution:

[0066] 1) Input the pointer network input data processed by S302 into the pre-trained pointer network to generate multiple output sequences with the number of rows and columns being N +1 Matrix :

[0067] (twenty three)

[0068] In the formula, the matrix It is the 01 matrix after the softmax of the attention matrix for the entire input sequence at each output. The first column and the last row of the matrix are used to indicate stop. The matrix is ​​used to represent the number from 1 to N Is the edge selected?

[0069] for i =1,2..., N , j =2,3,..., N +1 for the part:

[0070] (twenty four)

[0071] for j =1 part:

[0072] (25)

[0073] for i = N +1 for the part:

[0074] (26)

[0075] 2) Matrix After removing the first column and the last row, read the input position index corresponding to the only 1 value in each row in turn, add it to the pointer for output, and get a column containing N The pointer sequence of the input position index is extracted according to the pointer data to obtain the combination of the selected edges;

[0076] 3) The matrix Remove the first column of , and perform the operation of taking the maximum value by column on the remaining matrix to obtain a 1-row N A matrix of columns, indicating whether each edge is selected, and the 1 row N The matrix of columns is concatenated onto the top of the input data matrix to form the output matrix with the following output data format:

[0077] (27)

[0078] In the formula, Indicates whether to select, 0 or 1;

[0079] S304, test scheme variation processing: the pointer network layer output by the pointer algorithm is directly loaded onto the input data set to obtain a set of edges as the target edge set for security testing, whose structure is:

[0080] (28)

[0081] In the formula, The target edge set represents the security test;

[0082] For each edge in the set of edges to be tested , with random probability Perform mutation and take a random number for each edge , value range ,if , then the edge attribute remains unchanged, such as , then the selected state of the edge is reversed. Perform a 0 / 1 reversal;

[0083] S305, test scheme arrangement processing: the test edge set processed by S304 is arranged according to Arrange them in order from small to large, and output multiple sets of edge combinations under given traffic resource constraints as the initial test plan.

[0084] Furthermore, step S4 includes:

[0085] S401, based on the initial test scheme generated by the pointer network, generate an initial population; take the first line of each initial test scheme as the individual code C , each individual code C is a string of length N The binary encoding is:

[0086] (29)

[0087] S402 defines the fitness function and penalty function; the fitness function is defined as the degree of network performance degradation after the test, for a single individual codeC , and its fitness calculation formula is as follows:

[0088] Assume the original test object routing node network is , after removing the test edge and cascading failure effect through the test scheme, the remaining network that can operate normally is , the test scheme performance evaluation index is:

[0089] (30)

[0090] (31)

[0091] in, is the performance evaluation value of the test scheme, that is, the fitness function value; For the network Initial overall network efficiency, For the network after cascading failure Overall network efficiency; is the number of nodes in the network, It is arbitrary The shortest path distance between two nodes; if some nodes are isolated points after testing, the distance between them and other nodes is is infinite, That is 0;

[0092] Define that if the total bandwidth consumption exceeds the test resource flow constraint, the penalty is the excess, otherwise, the penalty is 0. For a single individual code C , its penalty The calculation formula is as follows:

[0093] (32)

[0094] The final evaluation value is:

[0095] (33)

[0096] In the formula, is the proportional factor of the penalty degree;

[0097] S403, selection operation: selecting a solution in the population as a parent solution;

[0098] 1) Calculate the fitness values ​​of all individuals in the current solution set and obtain the fitness value sequence as follows:

[0099] (34)

[0100] 2) Calculate the selection probability of each individual, that is, divide its fitness value by the sum of all individual fitness values, as follows:

[0101] (35)

[0102] in, Indicates individual code The probability of being selected;

[0103] 3) Calculate the cumulative probability of each individual, that is, add up the selection probabilities of all previous individuals, as follows:

[0104] (36)

[0105] in, Indicates individual code The cumulative probability of all previous individuals being selected, and the cumulative probability of the last individual ;

[0106] 4) Generate a random number , and find the first one that satisfies Individual code , taking it as the selected individual;

[0107] 5) Repeat the previous step 4) until the required number of parent individuals are selected;

[0108] S404, crossover operation;

[0109] 1) Pair the parent individuals in pairs. If the population size is an odd number, the last individual can be directly copied to the offspring;

[0110] 2) For a pair of individuals that need to be crossover, randomly select a crossover point ;

[0111] 3) Exchange two individuals at the intersection The latter gene fragment generates two new offspring individuals;

[0112] 4) Process all parent individuals in turn and return a set of child individuals;

[0113] S405, mutation operation: random mutation of offspring solutions;

[0114] 1) For each offspring individual, traverse all its gene positions, that is, the selection state of each edge;

[0115] 2) For each gene position, generate a random number ,if If the value is less than a fixed preset value, the gene position is mutated; otherwise, the gene position remains unchanged.

[0116] 3) The mutation operation uses bit flipping, that is, changing the value of the position from 0 to 1, or from 1 to 0;

[0117] 4) Repeat steps 2) and 3) until all gene positions on the offspring individuals have been processed;

[0118] S406, screening operation: remove some solutions according to the fitness evaluation value; after each crossover mutation process is completed, adopt a probability retention strategy to decide which solutions to keep for the next round of iteration; the solution set contains all parent solutions and child solutions corresponding to the parent solutions, each solution has a fitness evaluation value, and the parent individual evaluation value is , the offspring individuals are , the difference between them is:

[0119] (37)

[0120] if , indicating that the fitness of the offspring individual is better than that of the parent individual, and this offspring individual is retained;

[0121] if , indicating that the fitness of the offspring individual is not as good as that of the parent individual, and the probability of accepting this offspring individual is:

[0122] (38)

[0123] in, t is a parameter value that decreases as the number of iterations increases;

[0124] Generate a random number each time you decide whether to decide on the next generation individual ,if , the offspring individuals are retained;

[0125] S407, after the generation of offspring individuals that meet the constraints is generated, a new generation of population needs to be selected from the parent individuals and offspring individuals, an elite retention strategy is adopted, a fixed number of individual codes with the highest evaluation values ​​are retained, and the population is updated;

[0126] S408, determine whether the current number of iterations has reached the preset maximum number of iterations. If not, go to S403. If it has, the iteration ends and the individual encoding with the highest fitness value is selected from the last generation population and combined with its corresponding important edge set as the optimal test solution.

[0127] Furthermore, in S402, when evaluating the performance of the test scheme, a test scheme evaluation method based on cascading failure simulation is used to calculate the degradation of routing network performance before and after the test scheme is implemented to achieve test scheme performance evaluation; the process of the test scheme evaluation method based on cascading failure simulation is as follows:

[0128] 1) The routing network is tested. After a batch of edges fail, the load on the edge is propagated to the adjacent edges.

[0129] 2) Determine the state of the adjacent edge after the new load is added based on whether the adjacent edge load exceeds the capacity after the new load is added;

[0130] ① If the sum of the newly added load and the original load is less than the capacity of the edge, as shown in the following formula (39), it means that the adjacent edge after the newly added load does not exceed the capacity, and the adjacent edge will carry the newly added load and operate normally;

[0131] (39)

[0132] in, It is the edge After failure, it is assigned to the adjacent edge The load, that is The additional load; yes The original load; for Capacity;

[0133] ② If the sum of the newly added load and the original load is greater than the capacity of the edge and lower than the maximum elastic capacity of the edge, as shown in the following formula (40), it means that the adjacent edge after the newly added load exceeds the capacity but is within the highest elastic range;

[0134] (40)

[0135] (41)

[0136] in, for The maximum elastic capacity of is the overload factor; is a random number between 0 and 1; is the failure probability; is the distribution coefficient of failure probability;

[0137] According to formula (40), the failure or overload of the adjacent edge is determined; if the adjacent edge fails, the load on it will be propagated to the surrounding area again according to the load distribution calculation method of the failed edge, triggering a subsequent cascade failure reaction; if the adjacent edge is overloaded, the load on it that exceeds the capacity will be propagated to the surrounding area according to the load distribution calculation method of the overloaded edge, triggering a subsequent cascade failure reaction;

[0138] ③ If the newly added load is higher than the maximum elastic capacity of the edge, as shown in the following formula (42), it means that the adjacent edge after the newly added load exceeds the maximum elastic range of the capacity, and the adjacent edge fails. The load on it will be redistributed again according to the load distribution calculation method of the failed edge;

[0139] (42)

[0140] 3) After the cascading failure process ends, the number of normal edges and overloaded edges is calculated, and the performance of the network composed of the remaining normal edges is evaluated using formulas (30) and (31).

[0141] Preferably, in the test scheme evaluation method based on cascading failure simulation:

[0142] 1) Using the Motter-Lai model, the load and capacity of the edges in the routing node network are calculated as follows:

[0143] (43)

[0144] (44)

[0145] in, yes Load; yes Capacity; and Respectively represent nodes The degree of a node is the number of edges connected to it. and It is the parameter to adjust the network structure;

[0146] 2) The load redistribution calculation method of the failed edge is as follows:

[0147] (45)

[0148] in, It is the edge After failure, it is assigned to the adjacent edge The load, that is The additional load; yes The original load; Is a node The set of all adjacent nodes of For Node The load of the adjacent nodes; Is a node The set of all adjacent nodes of For Node The load of the adjacent nodes;

[0149] 3) The load redistribution method of the overload side is as follows:

[0150] (46)

[0151] (47)

[0152] in, yes After overload, it is assigned to the adjacent edge Loads exceeding capacity; for Capacity; yes The original load; Is a node All adjacent nodes that can be normally connected; Is a node All adjacent nodes that can be normally connected.

[0153] Preferably, in step S305, the output initial test plan needs to satisfy the following constraints:

[0154] (48).

[0155] The method for selecting network edges of secure test routing nodes based on pointer networks and genetic algorithms proposed by the present invention can quickly lock a group of edge combinations with high importance in the early stage through connectivity analysis, thereby narrowing the solution space for subsequent optimization; on this basis, a group of high-quality test edge combinations are quickly generated using the pointer network, and the pointer network can complete training in advance before the task process, thereby reducing the on-the-spot solution time; finally, a genetic algorithm is used to optimize the preliminary test solution generated by the pointer network, approximate the optimal solution, and obtain the final test solution. The entire process of the present invention is carried out in a pipelined and progressive way, combining a variety of optimization methods, achieving complementary advantages, greatly reducing the computational complexity, and improving the solution efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0156] Figure 1 A flow chart of a method for selecting network edges of routing nodes for security testing based on pointer networks and genetic algorithms according to the present invention;

[0157] Figure 2 This is a schematic diagram of the main interface of the routing node network data model in an embodiment of the present invention;

[0158] Figure 3 It is a flow chart of edge load distribution in the process of cascading failure simulation of routing node network in the present invention;

[0159] Figure 4It is a load distribution principle diagram of the failure edge in the process of cascading failure simulation of the routing node network in the present invention;

[0160] Figure 5 A flowchart of importance evaluation and screening of routing node network edges in the present invention;

[0161] Figure 6 Schematic diagram of calculation results of edge average degree, edge betweenness, and edge contribution in an embodiment of the present invention;

[0162] Figure 7 The flowchart of edge combination selection based on pointer network in the present invention;

[0163] Figure 8 A flow chart of generating an optimal test solution based on a genetic algorithm in the present invention;

[0164] Fig. 9 A flowchart of processing individual codes in the process of generating an optimal test solution based on a genetic algorithm in the present invention;

[0165] Fig.10 Schematic diagram of the final test target set generated based on the pointer network and genetic algorithm in an embodiment of the present invention. DETAILED DESCRIPTION

[0166] In order to facilitate the understanding of those skilled in the art, the present invention is further described below in conjunction with embodiments and drawings. The contents mentioned in the implementation modes are not intended to limit the present invention.

[0167] like Figure 1 As shown, a method for selecting network edges of routing nodes for security testing based on pointer networks and genetic algorithms includes the following four steps.

[0168] Step S1, constructing a routing node network data model.

[0169] This step is to model the task requirements, constraints, evaluation criteria, and initial routing network information. In the security test scenario for the routing node network, the tester needs to test specific links in the network based on the test resources, which reduces the network performance. This process can be defined as a combinatorial optimization problem for the links in the routing node network under the constraints of the test resources.

[0170] like Figure 2 As shown in the figure, users can manually input the tasks of this target planning on the main interface of the model, and fill in the task elements related to the task according to the input task description, including: task name, task number, task type, target area, expected direct test effect (expected damage effect), task time limit and task restriction. For most of the task elements, the system has default parameters, and users only need to modify the parts that need to be modified according to the task description. Figure 2 As shown, below the task element input area, the user can manually select the data source of the task target. In this embodiment, the system provides data sources of different years contained in the CAIDA database for the user to choose.

[0171] The initial input data includes the test resource flow value and the test object routing node network topology data. The undirected weighted network composed of the test object routing nodes and their connection relationships is denoted as ,in, is the set of all nodes in the network, representing the routing device. For each node Each has a unique serial number ; It is the set of all edges in the network, representing the physical or logical links between nodes. For each edge , For edge The two nodes connected by .

[0172] Since the information flow of the routing node network will be borne by other edges after a certain link fails, if the information flow is too large, other edges will also fail, causing cascading failures; therefore, when evaluating the test plan, it is necessary not only to consider the performance degradation caused by the failure of the link of the test object, but also to consider the cascading failure caused by these failed edges, in order to maximize the impact on the performance of the routing node network. Therefore, when evaluating the effectiveness of the test plan, a test plan evaluation method based on cascading failure simulation is adopted to calculate the degree of degradation of the routing network performance before and after the implementation of the test plan, so as to achieve the effectiveness evaluation of the test plan. Based on the average efficiency Representation Network Overall network efficiency:

[0173] (31)

[0174] in, For the network Initial overall network efficiency, For the network after cascading failure Overall network efficiency; is the number of nodes in the network, It is arbitrary The shortest path distance between two nodes; since damage effects will remove a large number of available edges in the network, even for the same pair of nodes , the shortest distance between pairs of nodes in the network The value will rise sharply. If some nodes are isolated points after the test, the distance between them and other nodes will be is infinite, That is 0.

[0175] When studying the state of the routing node network after receiving the test, it is necessary to consider the cascading failure phenomenon after the test edge is removed. Cascading failure means that when an edge fails, its load will be propagated to the surrounding nodes, which may cause further failure of the surrounding nodes, and the layer-by-layer propagation is similar to a chain reaction, which has a significant impact. In the process of simulating cascading failure, it is necessary to consider not only the propagation process of failure, but also the elasticity of the link. The link load has a certain elasticity. When the adjacent link fails, the traffic will flow into the link that is still running. When the load just exceeds its carrying capacity, packet loss may occur, but the link will not fail immediately. As the load continues to increase, the probability of failure will also increase significantly.

[0176] 1) The Motter-Lai model is used to calculate the load and capacity of the edges in the routing node network. The Motter-Lai model sets each edge in the routing node network to have its load value and capacity value. There is a linear relationship between the edge and the capacity value, while the load value is related to the importance of the node associated with the edge.

[0177] Therefore, the calculation formula for load value and capacity value is as follows:

[0178] (43)

[0179] (44)

[0180] in, yes Load; yes Capacity; and Respectively represent nodes The degree of a node is the number of edges connected to it. and It is a parameter to adjust the network structure.

[0181] 2) Calculation method of load redistribution on the failed edge

[0182] When the routing network is tested and a group of edges fail, the load on them is propagated to the adjacent edges. The process is as follows: Figure 3 , 4 As shown in Figure 1, the distribution of failed edges is based on the weighted flow local redistribution principle, which redistributes the load of failed edges based on the weights of adjacent edges. The weight of an edge is positively correlated with the load it has borne. After failure, assign to adjacent edges The load is:

[0183] (45)

[0184] in, It is the edge After failure, it is assigned to the adjacent edge The load, that is The additional load; yes The original load; Is a node The set of all adjacent nodes of For Node The load of the adjacent nodes; Is a node The set of all adjacent nodes of For Node The load of the adjacent nodes.

[0185] 3) Determine the state of adjacent edges after adding load

[0186] After the adjacent edge load increases, the sum of the new load and the original load , and the theoretical capacity of the edge and maximum elastic capacity The relationship is determined by is the overload factor, which describes the ability of the edge to handle short-term additional loads. yes capacity.

[0187] There are three possible developments:

[0188] ① Normal operation: If the sum of the newly added load and the original load is less than the capacity of the edge, as shown in the following formula (39), it means that the adjacent edge after the newly added load does not exceed the capacity, and the adjacent edge will carry the newly added load and operate normally;

[0189] (39)

[0190] in, It is the edge After failure, it is assigned to the adjacent edge The load, that is The additional load; yes The original load; for Capacity;

[0191] ② Overload or failure of adjacent edges: If the sum of the newly added load and the original load is greater than the capacity of the edge and lower than the maximum elastic capacity of the edge, as shown in the following formula (40), it means that the adjacent edge after the newly added load exceeds the capacity but is within the highest elastic range;

[0192] (40)

[0193] in, for The maximum elastic capacity of is the overload factor; is a random number between 0 and 1;

[0194] When the new load plus the original load is higher than the capacity of the edge and lower than the short-term elastic capacity of the edge, the adjacent edge may fail or continue to carry the load. The specific failure probability depends on the range of the load exceeding the capacity. Each edge has different abilities to handle additional load. Sometimes, the edge is more sensitive to overload in a small range, and the failure probability increases rapidly, but there are also cases where the failure probability increases slowly. Therefore, the distribution coefficient is introduced To characterize this feature. Adjust the probability distribution of failed edges ,in The failure probability is calculated as follows:

[0195] (41)

[0196] in, is the failure probability; is the distribution coefficient of failure probability;

[0197] The failure or overload of the adjacent edge is determined according to formula (40); if the adjacent edge fails, the load on it will be propagated to the surrounding area again according to the load distribution calculation method of the failed edge, triggering a subsequent cascade failure reaction; if the adjacent edge is overloaded, the load on it that exceeds the capacity will be propagated to the surrounding area according to the load distribution calculation method of the overloaded edge, triggering a subsequent cascade failure reaction.

[0198] ③ Failure of adjacent edge: If the newly added load is higher than the maximum elastic capacity of the edge, as shown in the following formula (42), it means that the adjacent edge after the newly added load exceeds the maximum elastic range of the capacity. The adjacent edge fails, and the load on it will be redistributed again according to the load distribution calculation method of the failed edge;

[0199] (42)

[0200] 4) Load redistribution method on the overloaded side

[0201] When an edge is overloaded, the edge will not fail, but the excess load on the edge needs to be quickly evacuated to ensure the normal operation of the system. The surplus load distribution strategy is adopted to continue to distribute the load that exceeds the capacity to the adjacent edges. The distribution method is:

[0202] (46)

[0203] The additional load assigned to each adjacent edge is positively related to its residual load. The calculation is as follows:

[0204] (47)

[0205] in, yes After overload, it is assigned to the adjacent edge Loads exceeding capacity; for Capacity; yes The original load; Is a node All adjacent nodes that can be normally connected; Is a node All adjacent nodes that can be normally connected.

[0206] In order to study the impact of the test scheme on the cascade model and evaluate the cost-effectiveness of link combinations selected in the test scheme, the test edge combination is cut off from the routing network node and the subsequent cascade failure process is simulated. Once the cascade failure process is over, the number of normal edges and overloaded edges is calculated, and the performance of the network composed of the remaining normal edges is evaluated.

[0207] Assume the original test object routing node network is , after removing the test edge and cascading failure effect through the test scheme, the remaining network that can operate normally is , the test scheme performance evaluation index is:

[0208] (30)

[0209] in, It is the performance evaluation value of the test program.

[0210] The test edge selection problem under the test resource flow constraint is transformed into a combinatorial optimization problem, and the test resource flow constraint conditions are obtained as follows:

[0211] (1)

[0212] (2)

[0213] in, For the test plan The performance evaluation value of Representative side Whether it is selected for testing, the value is 0 or 1, 0 is not selected, 1 is selected; For edge Load; Total test resource flow. The total load value of all selected test edges The traffic resources that need to be consumed by the overall solution. Due to limited test resources, it is required that the resources do not exceed a fixed value within the test solution. , The value of is determined by the tester.

[0214] Step S2: Importance evaluation and screening of routing node network edges

[0215] A routing node network consists of a large number of edges / links, but not all edges have equal importance.

[0216] The routing node network has the following characteristics: a large number of nodes and edges, a small network diameter (average distance is about 5-10 hops); a few key hub nodes have significantly higher connection numbers than the average, and most nodes have low connection numbers, and are leaf nodes that connect to a single other router. The purpose of this step is to remove some edges / links that are located at the edge of the network or are not important in the information flow process, and compress the number of candidate edges from hundreds of thousands or even millions to tens of thousands.

[0217] The judgment of the importance of edges / links in a routing network mainly depends on the importance of the nodes connected by the edges, the role of the edges in the network connectivity of routing nodes, and the contribution of the edges to the synchronization of information interaction in the entire network. Therefore, the evaluation criteria for edge importance are defined as three indicators: edge average degree, edge betweenness, and edge contribution. Then, the topsis entropy weight method is used to sort the importance and obtain the final set of important edges, such as Figure 5 shown.

[0218] S201, define edge average degree, edge betweenness and edge contribution as I1, I2, I3, and the definition and calculation formula are as follows:

[0219] 1) Calculate the average degree of the edge of the routing node network link

[0220] Calculate the sum of the degrees of the nodes at both ends of the edge to reflect the degree of connection of the local environment where the edge is located.

[0221] In a routing network, the importance of a link between nodes is related to the node associated with the link. The present invention uses the average edge degree to evaluate the importance of the link-related edges. The calculation formula is as follows:

[0222] (3)

[0223] in, Represents edge The edge average degree of ;

[0224] 2) Calculate the edge betweenness of the routing node network link

[0225] Count the number of times an edge appears in the shortest paths of all node pairs, reflecting the importance of the edge in the global network flow.

[0226] Edge betweenness measures whether an edge is a bridge for many information flows in the network. If a link is on the shortest path between many node pairs, then this edge plays an important role as a bridge in the network. Deleting this edge may increase the shortest path length between some node pairs, affecting the information transmission efficiency of the network. The edge betweenness of an edge is equal to the sum of the number of shortest paths of all node pairs passing through the edge, and is calculated as follows:

[0227] (4)

[0228] in, Represents edge The edge betweenness of represents any two nodes in the network, excluding the edges Connected Nodes ; Represents a slave node The shortest path through the edge The number of paths; Represents a slave node The total number of shortest paths of all node pairs passed;

[0229] 3) Calculate the edge contribution of the routing node network link based on the Fiedler vector

[0230] The difference in the components of the nodes at both ends of the edge in the Fiedler vector is calculated to reflect the influence of the edge on the consistency dynamics of the network.

[0231] The Fiedler value (real part of the smallest non-zero eigenvalue of the Laplacian matrix) measures the importance of the edge from the perspective of the synchronization capability and robustness of the network. The Fiedler value is an important indicator for measuring the synchronization capability and robustness of the network. The greater the difference in the Fiedler vector components of the edge-connected nodes, the more important this edge is for maintaining the algebraic connectivity of the network (related to the Fiedler value). Deleting this edge may lead to a decrease in the synchronization capability and robustness of the network. The evaluation method for the edge contribution is calculated by the components of the starting point and end point of the edge in the Fiedler vector. The calculation steps are as follows:

[0232] ①Convert the routing node network into a Laplace matrix L , as follows:

[0233] (5)

[0234] in, A is the adjacency matrix, representing a Matrix, if there is a slave node With Node directly connected, then the elements of the adjacency matrix is 1, otherwise it is 0; D is the degree matrix, expressed as a A matrix with diagonal elements Representation Node The degree of the node The number of connected edges, other elements are 0;

[0235] ②Calculate the Laplace matrix L The Fiedler value and its corresponding vector, the eigenvector corresponding to the Fiedler value is the Fiedler vector; due to For an undirected network, the Laplacian matrix L The eigenvector of The formula is as follows:

[0236] (6)

[0237] in, is the matrix eigenvalue. After solving formula (17), have The number of solutions is consistent with the number of rows and columns of the matrix. The values ​​are sorted from small to large, with the smallest Must be 0, select the smallest eigenvalue greater than 0 , as the Laplacian matrix L Fiedler value of

[0238] ③Calculate the Fiedler vector ;

[0239] (7)

[0240] in, is the Laplace matrix L Fiedler value of is the corresponding Fiedler vector, ;

[0241] ④Calculate the contribution of the edge to the Fiedler value

[0242] For Network In terms of , each edge The contribution to the Fiedler value is recorded as ;

[0243] (8)

[0244] in, Respectively Connecting two nodes In the Fiedler vector The corresponding value in .

[0245] In this embodiment, the calculation results of the edge average degree, edge betweenness, and edge contribution of all nodes in the region are as follows: Figure 6 shown.

[0246] S202, use the topsis entropy weight method to obtain the indicator weights of edge average degree, edge betweenness, and edge contribution

[0247] Calculate the information entropy of each indicator and objectively determine the importance weight of each indicator in the comprehensive evaluation.

[0248] The evaluation indicators of routing node network links include the average degree of related edges, edge betweenness, and edge contribution based on Fiedler vector. Due to the large differences in dimensions and numerical ranges between indicators, the topsis entropy weight method is used to calculate the weights of each indicator.

[0249] The topsis entropy weight method believes that if the values ​​of an indicator on all edges are very different, it means that the indicator provides a large amount of information and contributes more to distinguishing the importance of edges, so it should be given a larger weight; conversely, if the values ​​of an indicator on all edges are relatively close, it means that the indicator provides a small amount of information and contributes less to distinguishing the importance of edges, so it should be given a smaller weight; the calculation steps are:

[0250] S2021 Standardize the raw data

[0251] Since the dimensions and numerical ranges of the three indicators are quite different, they need to be standardized to eliminate the dimension effect. The standardized formula is:

[0252] (9)

[0253] in, Represents the standardized Indicators on the edge The value on Indicates Indicators on the edge The original value of Indicates Indicators on the edge The original value of =1, 2, 3 correspond to the three indicators of edge average degree, edge betweenness, and edge contribution, that is, Represents edge The edge average degree of Represents edge The edge betweenness of Represents edge The contribution of based on Fiedler vector;

[0254] S2022, calculate the Indicators on the edge The proportion of , as follows:

[0255] (10)

[0256] S2023, calculate the The entropy value of the index , as follows:

[0257] (11)

[0258] in, represents the natural logarithm, is the total number of edges in the network, when When, define ;

[0259] S2024, calculate the The coefficient of variation of the index , as follows:

[0260] (12)

[0261] Among them, the coefficient of variation Reflects the The amount of information provided by each indicator, The larger the value, the The greater the amount of information provided by an indicator, the greater its impact on the evaluation results;

[0262] S2025, calculate the The weight of the indicator , as follows:

[0263] (13)

[0264] Through the above five steps, three indicators (edge ​​average degree, , edge betweenness and edge contribution based on Fiedler vector Weight , and These weights reflect the contribution of each indicator to the importance of evaluating the edge.

[0265] After the TOPSIS entropy weight method is used to obtain the index weights, the TOPSIS (Technique for Order Preference by Similarity to an Ideal Solution) method is further applied to comprehensively evaluate the network links of routing nodes. The TOPSIS method is a multi-attribute decision analysis method that ranks the objects to be evaluated by comparing their closeness to the ideal solution and the negative ideal solution.

[0266] S203, construct weighted normalization matrix

[0267] In the topsis entropy weight method step, the original data has been standardized and the weight of each indicator has been calculated. Multiply the standardized data by the corresponding indicator weight to obtain the weighted standardized decision matrix. The formula is as follows:

[0268] (14)

[0269] in, Represents edge In the The weighted standardized value of the indicators, Indicates The weight of the indicator, Represents the normalized edge In the The value of an indicator;

[0270] S204, determining an ideal solution and a negative ideal solution

[0271] Determine the ideal solution based on the weighted normalization matrix and negative ideal solution , the ideal solution represents the optimal situation of each indicator value, and the negative ideal solution represents the worst situation of each indicator value. The calculation formula is as follows:

[0272] (15)

[0273] (16)

[0274] Among them, the ideal solution , negative ideal solution , k =1, 2, 3;

[0275] The three indicators for evaluating the routing node network edge are all efficiency indicators. The larger the value, the better. Therefore, the ideal solution , negative ideal solution .

[0276] S205, calculate the distance between each edge and the ideal solution and the negative ideal solution

[0277] Use the Euclidean distance formula to calculate the distance between each edge and the ideal solution. , and the distance to the negative ideal solution , as follows:

[0278] (17)

[0279] (18)

[0280] S206, calculate the relative proximity of each edge

[0281] According to the distance between the ideal solution and the negative ideal solution, the relative proximity of each edge is calculated as follows:

[0282] (19)

[0283] in, is the relative proximity of the edge, which is between 0 and 1. The larger the value, the closer the edge is to the ideal solution.

[0284] S207, edge importance ranking

[0285] With relative proximity Evaluate the importance of edges and sort all edges from large to small. The larger the value, the higher the priority.

[0286] S208, calculate edge importance by weighted index

[0287] The network edge set of routing nodes is screened to obtain the important edge set.

[0288] After the importance is calculated, the edge is given a new sequence number and a comprehensive importance index as attributes, and the overall routing node network edge data structure is:

[0289] (20)

[0290] in, For each edge in the edge set, the edge has the associated attribute as the edge in the initial edge set The serial number within; It is the relative proximity of the edge, indicating the importance of the edge.

[0291] S209, setting the candidate edge screening condition to the top t% in importance ranking, where t is a parameter determined by the user. , take the top t% of edges ranked from most important to least important, and generate a set of important edges , , remove data that is irrelevant to subsequent calculations, The data structure is:

[0292] (twenty one)

[0293] in, , N is the number of edges in the important edge set, is the sequence number of the edge in the initial edge set; That is , represents the load of the edge; That is , which indicates the importance value of the edge.

[0294] Step S3: edge combination selection based on pointer network

[0295] The purpose of this step is to achieve high-quality test strategy selection under resource constraints. By comprehensively considering the test benefits and costs of each edge, multiple groups of test edge combinations are generated under given resource constraints to provide a high-quality initial solution set for subsequent genetic algorithm tuning.

[0296] The edge selection problem in the routing network can be regarded as a knapsack problem in integer programming problems, which is an NP problem. As the number of edges increases, the solution time will also increase significantly. However, the neural network can solve quickly after training, greatly reducing the on-site calculation time. The pointer network is specially designed to handle problems where the output is a subset of the input. The length of its output sequence is variable and does not depend on the specific parameters of the model. The trained pointer network model can be applied to the test edge combination problem of routing networks of different sizes.

[0297] In order to generate multiple different test edge combination solutions for the trained pointer network, the following strategy is adopted:

[0298] Each time an edge is input into the pointer network, the input order of the edges is randomly disrupted so that the pointer network generates different test edge combinations.

[0299] The output of the pointer network is the information of whether the important edge set is selected. Each edge corresponds to a 0 / 1 attribute, indicating whether the edge is selected (1 means selected, 0 means unselected). In order to further increase the diversity of solutions, for each test edge combination, a part of the edges are randomly selected and their selection status is reversed (that is, 0 becomes 1, 1 becomes 0). In this way, new test edge combinations can be generated based on the output solution of the pointer network.

[0300] In the routing network task scenario, the advantages of pointer networks are: the pre-training step is in advance; once the training is completed, it can operate on actual data that is inconsistent with the size of the training data set, and quickly generate test edge sets for multiple security test scenarios. Pointer networks can quickly adapt to new data sets and efficiently and massively provide better test solutions in practical applications, thereby providing a high-quality initial population for genetic algorithms.

[0301] In the process of training the pointer network, using the difference between the cascading failure effect and the ideal value as the loss function will greatly increase the training time, and because the degree of cascading failure is a more complex indicator, it will affect the convergence speed of the model in the early stage of training. Therefore, in the pointer network stage, using the total value of the edge importance in the combination as the evaluation standard for training can be used as a progressive optimization strategy before the final step of the genetic algorithm. After using the pointer network to obtain multiple good initial solutions, the genetic algorithm is used to perform the final optimization according to the degree of cascading failure, thereby achieving a balance between efficiency and performance.

[0302] The premise of cascading failure in the network is: 1. The network exhibits highly heterogeneous load distribution, and the routing network has this characteristic; 2. The removed nodes are nodes with high load. The edge importance index includes three branch tables: edge average degree, edge betweenness, and edge contribution. The first two indicators represent whether the edge is a key hub of the network and whether it is located on the key path. The greater the edge contribution, the greater the failure of the edge will affect the key structure of the network. Therefore, the higher the importance value of the edge, the greater the magnitude of cascading failure after removal.

[0303] The test edge selection problem under the test flow constraint is transformed into a 0-1 knapsack problem. The problem definition is as follows:

[0304] (48)

[0305] in, Representative side Whether it is selected for testing.

[0306] like Figure 7 As shown, this step includes:

[0307] S301, pointer network pre-training

[0308] Pointer network pre-training includes generating training data sets, initializing modules, loading data modules, generating network models, training networks, and model evaluation.

[0309] Step 1: Generate training dataset

[0310] The knapsack problem instances provided in (https: / / github.com / JorikJooken / knapsackProblemInstances) are used as the training data set.

[0311] Step 2: Initialize the module

[0312] Define the optimizer as Adam and the loss function as the difference between the generated solution and the solution in the training dataset.

[0313] Step 3: Load the data module

[0314] Implement a data loader to batch the generated training dataset and input it into the network for training. Each batch may include multiple samples.

[0315] Step 4: Generate network model

[0316] Construct the structure of the pointer network model, including the embedding layer, attention mechanism, output layer, etc. The input of the model is 3 lines N The matrix of columns is N The three attributes of the edge; the output is a row and column N The +1 matrix, after removing the first column and the last row, can point to the selected edge combination.

[0317] Step 5: Train the network

[0318] The network is trained and the network weights are updated through the back-propagation algorithm. For each training sample, the network calculates the selection probability of each edge and evaluates the error through the loss function, and updates the weights to minimize the loss.

[0319] Step 6: Model Evaluation

[0320] Use the validation set or test set to evaluate the trained model and calculate its performance on new data.

[0321] S302, input data processing

[0322] The bandwidth of each routing node network edge is regarded as the test cost, and the importance of the edge is regarded as the benefit. The bandwidth attribute of the important edge set data is processed to form an important edge set in the following input data format:

[0323] (twenty two)

[0324] In the formula, Represents the set of important edges that serve as input data for the pointer network; For edge Number, For edge The importance value of For edge The load, since the bearing capacity of the edge is proportional to the load in theory, The value is regarded as the traffic resource value required for the test edge to be paralyzed. For edge The ratio of the resources required for the test to the total test resource flow.

[0325] An example with 5 edges is as follows: .

[0326] The first row indicates the edge numbers, which are 1, 3, 5, 6, and 9.

[0327] The second row indicates the importance of the corresponding edges, which are 0.8, 0.6, 0.9, 0.5, and 0.7 respectively.

[0328] The third row shows the ratio of the traffic of the corresponding edge to the total test resource traffic, which are 0.3, 0.4, 0.3, 0.15, and 0.25 respectively.

[0329] The input sequence of the pointer network is expressed as , where the important edge set includes N edges, the input sequence is 3 lines long N After obtaining the important edge data after preprocessing, the Fisher-Yates shuffle algorithm is used to shuffle the input order in columns to obtain multiple groups of pointer network input data;

[0330] S303, pointer network performs test scheme selection

[0331] 1) Input the pointer network input data processed by S302 into the pre-trained pointer network to generate multiple output sequences with the number of rows and columns being N +1 Matrix :

[0332] (twenty three)

[0333] In the formula, the matrix It is the 01 matrix after the softmax of the attention matrix for the entire input sequence at each output. The first column and the last row of the matrix are used to indicate stop. The matrix is ​​used to represent the number from 1 to N Is the edge selected?

[0334] for i =1,2..., N , j =2,3,..., N +1 for the part:

[0335] (twenty four)

[0336] for j =1 part:

[0337] (25)

[0338] for i = N +1 for the part:

[0339] (26)

[0340] 2) Matrix After removing the first column and the last row, read the input position index corresponding to the only 1 value in each row in turn, add it to the pointer for output, and get a column containing N The pointer sequence of the input position index is extracted according to the pointer data to obtain the combination of the selected edges;

[0341] 3) The matrix Remove the first column of , and perform the operation of taking the maximum value by column on the remaining matrix to obtain a 1-row N A matrix of columns, indicating whether each edge is selected, and the 1 row N The matrix of columns is concatenated onto the top of the input data matrix to form the output matrix with the following output data format:

[0342] (27)

[0343] In the formula, Indicates whether it is selected, which can be 0 or 1.

[0344] S304, test scheme variation processing

[0345] The output of the pointer network is a combination of test links, which represents the optimal test path. In order to further improve the diversity and quality of the solution, it is necessary to mutate the output results, and use the unmutated test scheme and the mutated test scheme as the initial parent solution set for the next step of the genetic algorithm.

[0346] The pointer network layer output by the pointer algorithm is directly loaded onto the input data set to obtain a set of edges, which is used as the target edge set for security testing. Its structure is:

[0347] (28)

[0348] In the formula, The target edge set represents the security test.

[0349] For each edge in the set of edges to be tested , with random probability Perform mutation and take a random number for each edge , value range ,if , then the edge attribute remains unchanged, such as , then the selected state of the edge is reversed. Perform a 0 / 1 reversal.

[0350] S305, test scheme arrangement processing

[0351] Since the test plans are input in disorder, the output test plans are not arranged in a uniform order, which will result in different edges in the same position when the genetic algorithm performs crossover changes later. Arrange them in order from small to large, and output multiple sets of edge combinations under given traffic resource constraints as initial test plans to facilitate crossover mutation in subsequent genetic algorithms.

[0352] Step S4: Generate the optimal test solution based on genetic algorithm

[0353] The test scheme generation speed based on the pointer network is fast and highly versatile, but the larger the original edge set, the more difficult it is to generate the optimal solution. Therefore, the solution set generated based on the pointer network is used as the initial solution space of the genetic algorithm for further optimization to obtain a higher quality test scheme.

[0354] like Figure 8 , 9 As shown, step S4 includes:

[0355] S401, generating an initialization population based on an initial test scheme generated by a pointer network.

[0356] The test plan is a set of important edges, expressed as a Each edge of the matrix contains four attributes: whether the test is selected, the edge number, the benefit, and the ratio of the cost to the total cost. Since the last three rows of different test schemes are the same, in order to reduce space complexity, the first row of each test scheme is taken as the individual code for subsequent genetic algorithm operations. Specifically, the first row of each initial test scheme is taken as the individual code C , each individual code C is a string of length N The binary encoding is:

[0357] (29)

[0358] S402 defines fitness function and penalty function

[0359] Define the fitness function and constraint penalty function used in the genetic algorithm to evaluate the quality of each solution and remove solutions that violate the constraints (the overall traffic consumption is greater than the traffic resources).

[0360] The goal of the genetic algorithm is to maximize the sum of the edge importances of the test edge combination. Therefore, the fitness function is defined as the degree of network performance degradation after the test. C The fitness calculation formula refers to formula (5) and (6).

[0361] Define that if the total bandwidth consumption exceeds the test resource flow constraint, the penalty is the excess, otherwise, the penalty is 0. For a single individual code C , its penalty The calculation formula is as follows:

[0362] (32)

[0363] The final evaluation value is:

[0364] (33)

[0365] In the formula, is the scaling factor of the penalty degree.

[0366] S403, selection operation: Based on the existing solution set, select some individuals as the parents of the next generation, perform crossover and mutation operations, and generate offspring individuals. This is implemented using the Roulette Wheel Selection algorithm. The basic idea of ​​the Roulette Wheel Selection algorithm is to make the probability of each individual being selected proportional to its fitness value. The higher the fitness value of an individual, the greater the probability of being selected. The specific steps are as follows:

[0367] 1) Calculate the fitness values ​​of all individuals in the current solution set and obtain the fitness value sequence as follows: (34)

[0368] 2) Calculate the selection probability of each individual, that is, divide its fitness value by the sum of all individual fitness values, as follows: (35); among them, Indicates individual code The probability of being selected;

[0369] 3) Calculate the cumulative probability of each individual, that is, add up the selection probabilities of all previous individuals, as follows: (36); among them, Indicates individual code The cumulative probability of all previous individuals being selected, and the cumulative probability of the last individual ;

[0370] 4) Generate a random number , and find the first one that satisfies Individual code , taking it as the selected individual;

[0371] 5) Repeat the previous step 4) until the required number of parent individuals are selected.

[0372] The roulette wheel selection algorithm ensures that individuals with higher fitness values ​​are more likely to be selected, while also giving individuals with lower fitness values ​​a certain chance to maintain the diversity of the population. This helps the algorithm to explore new solution spaces while also utilizing existing high-quality solutions.

[0373] S404, crossover operation: In this step, a crossover operation is performed on the parent individuals. In the crossover operation, a single-point crossover method is used to pair the parent individuals in pairs, and a crossover operation is performed with a certain probability to generate new offspring individuals.

[0374] 1) Pair the parent individuals in pairs. If the population size is an odd number, the last individual can be directly copied to the offspring. 2) For a pair of individuals that need to be crossovered, randomly select a crossover point. ; 3) Exchange two individuals at the intersection The following gene fragments generate two new offspring individuals; 4) process all parent individuals in turn and return a set of offspring individuals;

[0375] S405, mutation operation: perform mutation operation on each gene position in the offspring individual with a certain probability. If mutation occurs, the value of the gene position is reversed (0 becomes 1, 1 becomes 0). Mutation operation The mutation operation is to randomly modify each offspring individual with a certain probability after the offspring individual is generated by the crossover operation, introduce new genetic features, so as to maintain the diversity of the population and prevent the algorithm from converging to the local optimal solution too early.

[0376] 1) For each offspring individual, traverse all its gene positions, that is, the selection state of each edge; 2) For each gene position, generate a random number ,if If the value of the position is less than a fixed preset value, the gene position is mutated; otherwise, the gene position remains unchanged; 3) The mutation operation uses bit flipping, that is, changing the value of the position from 0 to 1, or from 1 to 0, which is equivalent to changing the selection state of a certain edge; 4) Repeat steps 2) and 3) until the gene positions on all offspring individuals have been processed.

[0377] Through mutation operations, new genetic features can be introduced into offspring individuals to increase the diversity of the population. This helps the algorithm to jump out of the local optimal solution and explore a wider solution space. At the same time, since the mutation probability is usually set low, the mutation operation will not interfere too much with the convergence of the algorithm.

[0378] S406, screening operation: After each crossover and mutation process is completed, a probability retention strategy (Stoffa improved method) is used to decide which solutions to keep for the next iteration; at this time, the solution set contains all parent solutions and child solutions corresponding to the parent solutions. Each solution has a fitness evaluation value. Let the parent individual evaluation value be , the offspring individuals are , the difference between them is:

[0379] (37)

[0380] if , indicating that the fitness of the offspring individual is better than that of the parent individual, and this offspring individual is retained;

[0381] if , indicating that the fitness of the offspring individual is not as good as that of the parent individual, and the probability of accepting this offspring individual is:

[0382] (38)

[0383] in, tIt is a parameter value that decreases as the number of iterations increases. The higher the acceptance of poor solutions at the beginning is to avoid the algorithm falling into the local optimal solution and provide more possibilities. The closer to the last iteration, the greater the convergence strength, the stricter the review of the solution, and the smaller the probability of accepting poor solutions.

[0384] Generate a random number each time you decide whether to decide on the next generation individual ,if , the offspring individuals are retained.

[0385] S407, update the population: after generating offspring individuals that meet the constraints, it is necessary to select a new generation of population from the parent individuals and offspring individuals, adopt an elite retention strategy, retain a fixed number of individual codes with the highest evaluation values, and update the population.

[0386] S408, termination condition judgment: judge whether the current number of iterations reaches the preset maximum number of iterations. If not, go to S403. If it reaches, the iteration ends, and the individual code with the highest fitness value is selected from the last generation of population and combined with its corresponding important edge set as the optimal test solution, such as Fig.10 As shown, the final test target set generated by the present embodiment based on the pointer network and the genetic algorithm.

[0387] The above embodiments are preferred implementation schemes of the present invention. In addition, the present invention may also be implemented in other ways. Any obvious replacement without departing from the concept of the present technical solution is within the protection scope of the present invention.

Claims

1. A method for selecting network edges of routing nodes for secure testing based on pointer networks and genetic algorithms, characterized in that: include: Step S1, constructing a routing node network data model; Step S2, evaluation and screening of the importance of routing node network edges: Based on the network topology and node attributes, the importance of edges is measured using multiple indicators such as edge average degree, edge betweenness, and edge contribution, and a group of important edges are screened out as a candidate set of test objects; Step S3, inputting the important edge set preliminarily screened in step S2 into the pointer network model, comprehensively considering the node importance and test cost, and generating multiple sets of edge combinations with the highest cost performance as the initial test plan, specifically including: S301, pointer network pre-training: including generating training data set, initializing module, loading data module, generating pointer network model, training network, and model evaluation; The generated pointer network model includes an embedding layer, an attention mechanism, and an output layer. The input of the model is 3 lines N The matrix of columns is N The three attributes of the edge; the output is a row and column N +1 matrix, after removing the first column and the last row, can point to the selected edge combination; When training the network, the network weights are updated through the back-propagation algorithm. For each training sample, the network calculates the selection probability of each edge and evaluates the error through the loss function, and updates the weights to minimize the loss. S302, input data processing: The bandwidth of each routing node network edge is regarded as the test cost, and the importance of the edge is regarded as the benefit. The bandwidth attribute of the important edge set data is processed to form an important edge set in the following input data format: (22) In the formula, Represents the set of important edges that serve as input data for the pointer network; , N is the number of edges in the important edge set; represents an edge; is the sequence number of the edge in the initial edge set; represents the load of the edge; Indicates the importance value of the edge; is the total test resource flow; The input sequence of the pointer network is expressed as , where the important edge set includes N edges, the input sequence is 3 lines long N After obtaining the important edge data after preprocessing, the Fisher-Yates shuffle algorithm is used to shuffle the input order in columns to obtain multiple groups of pointer network input data; S303, the pointer network selects a test solution: 1) Input the pointer network input data processed by S302 into the pre-trained pointer network to generate multiple output sequences with the number of rows and columns being N +1 Matrix : (23) In the formula, the matrix It is the 01 matrix after the softmax of the attention matrix for the entire input sequence at each output. The first column and the last row of the matrix are used to indicate stop. The matrix is ​​used to represent the number from 1 to N Is the edge selected? for i =1,2..., N , j =2,3,..., N +1 for the part: (24) for j =1 part: (25) for i = N +1 for the part: (26) 2) Matrix After removing the first column and the last row, read the input position index corresponding to the only 1 value in each row in turn, add it to the pointer for output, and get a column containing N The pointer sequence of the input position index is extracted according to the pointer data to obtain the combination of the selected edges; 3) The matrix Remove the first column of , and perform the operation of taking the maximum value by column on the remaining matrix to obtain a 1-row N A matrix of columns, indicating whether each edge is selected, and the 1 row N The matrix of columns is concatenated onto the top of the input data matrix to form the output matrix with the following output data format: (27) In the formula, Indicates whether to select, 0 or 1; S304, test scheme variation processing: The pointer network layer output by the pointer algorithm is directly loaded onto the input data set to obtain a set of edges as the target edge set for security testing. Its structure is as follows: (28) In the formula, The target edge set represents the security test; For each edge in the set of edges to be tested , with random probability Perform mutation and take a random number for each edge , value range ,if , then the edge attribute remains unchanged, such as , then the selected state of the edge is reversed. Perform a 0 / 1 reversal; S305, test scheme arrangement processing: the test edge set processed by S304 is arranged according to Arrange them in order from small to large, and output multiple sets of edge combinations under given traffic resource constraints as the initial test plan; Step S4, using the initial test plan generated by the pointer network model in step S3 as the initial population, performing iterative optimization based on a genetic algorithm, and generating a routing node network edge combination with the best evaluation value and meeting the traffic constraints as the final test plan.

2. The method for selecting network edges of routing nodes for secure testing based on pointer networks and genetic algorithms according to claim 1, characterized in that: The routing node network data model constructed in step S1 records the undirected weighted network composed of the routing nodes of the test object and their connection relationships as ,in, is the set of all nodes in the network, representing the routing device. For each node Each has a unique serial number ; It is the set of all edges in the network, representing the physical or logical links between nodes. For each edge , For edge The two nodes connected by .

3. The method for selecting network edges of routing nodes for secure testing based on pointer networks and genetic algorithms according to claim 2, characterized in that: In step S4, the evaluation value is calculated using the following formula: (1) In step S4, the flow constraints are as follows: (2) in, For the test plan X The effectiveness evaluation value of Representative side Whether it is selected for testing, the value is 0 or 1, 0 is not selected, 1 is selected; For edge Load; is the total test resource flow.

4. The method for selecting network edges of routing nodes for secure testing based on pointer networks and genetic algorithms according to claim 3, characterized in that: The step S2 comprises: S201, based on the network topology and node attributes, uses edge average degree, edge betweenness, and edge contribution to measure edge importance, where: 1) The calculation formula of edge average degree is as follows: (3) in, Represents edge The edge average degree of 2) The calculation formula of edge betweenness is as follows: (4) in, Represents edge The edge betweenness of represents any two nodes in the network, excluding the edges Connected Nodes ; Represents a slave node The shortest path through the edge The number of paths; Represents a slave node The total number of shortest paths through all node pairs; 3) Calculate the edge contribution of the routing node network link based on the Fiedler vector as follows: ①Convert the routing node network into a Laplace matrix , as follows: (5) in, A is the adjacency matrix, representing a Matrix, if there is a slave node With Node directly connected, then the elements of the adjacency matrix is 1, otherwise it is 0; D is the degree matrix, expressed as a A matrix with diagonal elements Representation Node The degree of the node The number of connected edges, other elements are 0; ②Calculate the Laplace matrix L The Fiedler value and its corresponding vector, the eigenvector corresponding to the Fiedler value is the Fiedler vector; due to For an undirected network, the Laplacian matrix L The eigenvector of It complies with the following formula: (6) in, is the matrix eigenvalue. After solving formula (17), have The number of solutions is consistent with the number of rows and columns of the matrix. The values ​​are sorted from small to large, with the smallest Must be 0, select the smallest eigenvalue greater than 0 , as the Laplacian matrix L Fiedler value of ③Calculate the Fiedler vector : (7) in, is the Laplace matrix L Fiedler value of is the corresponding Fiedler vector, ; ④Calculate the contribution of the edge to the Fiedler value For Network In terms of , each edge The contribution to the Fiedler value is recorded as : (8) in, Respectively Connecting two nodes In the Fiedler vector The corresponding value in ; S202, using the topsis entropy weight method to obtain the indicator weights of edge average degree, edge betweenness, and edge contribution; S2021 standardizes the original data as follows: (9) in, Represents the standardized Indicators on the edge The value on Indicates Indicators on the edge The original value of Indicates Indicators on the edge The original value of =1, 2, 3 correspond to the three indicators of edge average degree, edge betweenness, and edge contribution, that is, Represents edge The edge average degree of Represents edge The edge betweenness of Represents edge The contribution of based on Fiedler vector; S2022, calculate the Indicators on the edge The proportion of , as follows: (10) S2023, calculate the The entropy value of the index , as follows: (11) in, represents the natural logarithm, is the total number of edges in the network, when When, define ; S2024, calculate the The coefficient of variation of the index , as follows: (12) Among them, the coefficient of variation Reflects the The amount of information provided by each indicator The larger the value, the The greater the amount of information provided by an indicator, the greater its impact on the evaluation results; S2025, calculate the The weight of the indicator , as follows: (13) S203, construct a weighted normalization matrix, as follows: (14) in, Represents edge In the The weighted standardized value of the indicators, Indicates The weight of the indicator, Represents the normalized edge In the The value of an indicator; S204, determine the ideal solution according to the weighted normalization matrix and negative ideal solution , the ideal solution represents the optimal situation of each indicator value, and the negative ideal solution represents the worst situation of each indicator value. The calculation formula is as follows: (15) (16) Among them, the ideal solution , negative ideal solution , k =1, 2, 3; S205, use the Euclidean distance formula to calculate the distance between each edge and the ideal solution , and the distance to the negative ideal solution , as follows: (17) (18) S206, calculating the relative proximity of each edge according to the distance between the ideal solution and the negative ideal solution, as shown in the following formula: (19) in, is the relative proximity of the edge, which is between 0 and 1. The larger the value, the closer the edge is to the ideal solution. S207, with relative proximity Evaluate the importance of edges and sort all edges from large to small. The larger the value, the higher the priority. S208, after the importance is calculated, the edge is added with a sequence number and a comprehensive importance index as attributes, and the overall routing node network edge data structure is: (20) in, For each edge in the edge set, the edge has the associated attribute as the edge in the initial edge set The serial number within; is the relative proximity of the edge, indicating the importance of the edge; S209, setting the candidate edge screening condition to the top t% in importance ranking, where t is a parameter determined by the user. , take the top t% of edges ranked from most important to least important, and generate a set of important edges , , remove data that is irrelevant to subsequent calculations, The data structure is: (21) in, , N is the number of edges in the important edge set, is the sequence number of the edge in the initial edge set; That is , represents the load of the edge; That is , which indicates the importance value of the edge.

5. The method for selecting network edges of routing nodes for secure testing based on pointer networks and genetic algorithms according to claim 4, characterized in that: Step S4 includes: S401, generating an initialization population based on an initial test scheme generated by a pointer network; Take the first line of each initial test solution as the individual code C , each individual code C is a string of length N The binary encoding is: (29) S402 defines a fitness function and a penalty function; The fitness function is defined as the degree of network performance degradation after the test. For a single individual encoding C , and its fitness calculation formula is as follows: Assume the original test object routing node network is , after removing the test edge and cascading failure effect through the test scheme, the remaining network that can operate normally is , the test scheme performance evaluation index is: (30) (31) in, is the performance evaluation value of the test scheme, that is, the fitness function value; For the network Initial overall network efficiency, For the network after cascading failure Overall network efficiency; is the number of nodes in the network, It is arbitrary The shortest path distance between two nodes; if some nodes are isolated points after testing, the distance between them and other nodes is is infinite, That is 0; Define that if the total bandwidth consumption exceeds the test resource flow constraint, the penalty is the excess, otherwise, the penalty is 0. For a single individual code C , its penalty The calculation formula is as follows: (32) The final evaluation value is: (33) In the formula, is the proportional factor of the penalty degree; S403, selection operation: selecting a solution in the population as a parent solution; 1) Calculate the fitness values ​​of all individuals in the current solution set and obtain the fitness value sequence as follows: (34) 2) Calculate the selection probability of each individual, that is, divide its fitness value by the sum of all individual fitness values, as follows: (35) in, Indicates individual code The probability of being selected; 3) Calculate the cumulative probability of each individual, that is, add up the selection probabilities of all previous individuals, as follows: (36) in, Indicates individual code The cumulative probability of all individuals before it being selected, and the cumulative probability of the last individual ; 4) Generate a random number , and find the first one that satisfies Individual code , taking it as the selected individual; 5) Repeat the previous step 4) until the required number of parent individuals are selected; S404, crossover operation; 1) Pair the parent individuals in pairs. If the population size is an odd number, the last individual can be directly copied to the offspring; 2) For a pair of individuals that need to be crossover, randomly select a crossover point ; 3) Exchange two individuals at the intersection The latter gene fragment generates two new offspring individuals; 4) Process all parent individuals in turn and return a set of child individuals; S405, mutation operation: random mutation of offspring solutions; 1) For each offspring individual, traverse all its gene positions, that is, the selection state of each edge; 2) For each gene position, generate a random number ,if If the value is less than a fixed preset value, the gene position is mutated; otherwise, the gene position remains unchanged. 3) The mutation operation uses bit flipping, that is, changing the value of the position from 0 to 1, or from 1 to 0; 4) Repeat steps 2) and 3) until all gene positions on the offspring individuals have been processed; S406, screening operation: removing some solutions according to the adaptation evaluation value; After each crossover and mutation process is completed, a probability retention strategy is used to decide which solutions to keep for the next iteration; the solution set contains all parent solutions and the child solutions corresponding to the parent solutions. Each solution has a fitness evaluation value. Let the parent individual evaluation value be , the offspring individuals are , the difference between them is: (37) if , indicating that the fitness of the offspring individual is better than that of the parent individual, and this offspring individual is retained; if , indicating that the fitness of the offspring individual is not as good as that of the parent individual, and the probability of accepting this offspring individual is: (38) in, is a parameter value that decreases as the number of iterations increases; Generate a random number each time you decide whether to decide on the next generation individual ,if , the offspring individuals are retained; S407, after the generation of offspring individuals that meet the constraints is generated, a new generation of population needs to be selected from the parent individuals and offspring individuals, an elite retention strategy is adopted, a fixed number of individual codes with the highest evaluation values ​​are retained, and the population is updated; S408, determine whether the current number of iterations has reached the preset maximum number of iterations. If not, go to S403. If it has, the iteration ends and the individual encoding with the highest fitness value is selected from the last generation population and combined with its corresponding important edge set as the optimal test solution.

6. The method for selecting network edges of routing nodes for secure testing based on pointer networks and genetic algorithms according to claim 5, characterized in that: In S402, when evaluating the performance of the test scheme, a test scheme evaluation method based on cascading failure simulation is used to calculate the degradation of routing network performance before and after the test scheme is implemented, thereby implementing the test scheme performance evaluation; The process of the test scheme evaluation method based on cascading failure simulation is as follows: 1) The routing network is tested. After a batch of edges fail, the load on the edge is propagated to the adjacent edges. 2) Determine the state of the adjacent edge after the new load is added based on whether the adjacent edge load exceeds the capacity after the new load is added; ① If the sum of the newly added load and the original load is less than the capacity of the edge, as shown in the following formula (39), it means that the adjacent edge after the newly added load does not exceed the capacity, and the adjacent edge will carry the newly added load and operate normally; (39) in, It is the edge After failure, it is assigned to the adjacent edge The load, that is The additional load; yes The original load; for Capacity; ② If the sum of the newly added load and the original load is greater than the capacity of the edge and lower than the maximum elastic capacity of the edge, as shown in the following formula (40), it means that the adjacent edge after the newly added load exceeds the capacity but is within the highest elastic range; (40) (41) in, for The maximum elastic capacity of is the overload factor; is a random number between 0 and 1; is the failure probability; is the distribution coefficient of failure probability; According to formula (40), the adjacent edge failure or overload is determined; If an adjacent edge fails, the load on it will again propagate to the surrounding area according to the load distribution calculation method of the failed edge, triggering subsequent cascading failure reactions; If an adjacent edge is overloaded, the load that exceeds the capacity on it will propagate to the surrounding areas according to the load distribution calculation method of the overloaded edge, triggering subsequent cascading failure reactions; ③ If the newly added load is higher than the maximum elastic capacity of the edge, as shown in the following formula (42), it means that the adjacent edge after the newly added load exceeds the maximum elastic range of the capacity, and the adjacent edge fails. The load on it will be redistributed again according to the load distribution calculation method of the failed edge; (42) 3) After the cascading failure process ends, the number of normal edges and overloaded edges is calculated, and the performance of the network composed of the remaining normal edges is evaluated using formulas (30) and (31).

7. The method for selecting network edges of routing nodes for secure testing based on pointer networks and genetic algorithms according to claim 6, characterized in that: In the test scheme evaluation method based on cascading failure simulation: 1) Using the Motter-Lai model, the load and capacity of the edges in the routing node network are calculated as follows: (43) (44) in, yes Load; yes Capacity; and Respectively represent nodes The degree of a node is the number of edges connected to it. and It is the parameter to adjust the network structure; 2) The load redistribution calculation method of the failed edge is as follows: (45) in, It is the edge After failure, it is assigned to the adjacent edge The load, that is The additional load; yes The original load; Is a node The set of all adjacent nodes of For Node The load of the adjacent nodes; Is a node The set of all adjacent nodes of For Node The load of the adjacent nodes; 3) The load redistribution method of the overload side is as follows: (46) (47) in, yes After overload, it is assigned to the adjacent edge Loads exceeding capacity; for Capacity; yes The original load; Is a node All adjacent nodes that can be normally connected; Is a node All adjacent nodes that can be normally connected.

8. The method for selecting network edges of routing nodes for secure testing based on pointer networks and genetic algorithms according to claim 7, characterized in that: In step S305, the output initial test plan must meet the following constraints: (48)。