A differential testing method for network protocol implementation
By using the ash box fuzzy thought, UCB algorithm, and firefly algorithm in the differential test implemented by the network protocol, the problem of insufficient seed selection and mutation operation strategies in the existing differential testing method, improved the test efficiency and differential discovery capabilities.
Patent Information
- Application Number
- CN202411566306.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-05
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2044-11-05
AI Technical Summary
The differential testing methods implemented by existing network protocols have problems such as poor differential capabilities and insufficient testing, especially the lack of effective strategies in seed selection and mutation operation.
The gray box fuzzy idea is used to generate test cases, the upper confidence limit algorithm (UCB algorithm) is used to guide seed selection, and the firefly algorithm is used to optimize the selection probability distribution of mutation operations to improve the effectiveness of test cases and the ability to discover differences.
Improve the efficiency of differential testing and the ability to find differences to ensure that the test tools can more efficiently discover the potential vulnerabilities and behavioral differences in the implementation of the network protocol.
Smart Images

Figure CN119094407B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of network communication protocol testing, in particular to a differential testing method oriented to network protocol implementation. Background Art
[0002] Network protocols refer to a set of rules, standards, or conventions established in computer networks for secure and reliable data exchange. Network protocol implementations refer to specific protocol software programs written based on these network protocol specifications. However, the implementation process of network protocols is very complex, and different developers may use different interpretations and methods. This diverse implementation makes various network protocol implementations vulnerable to security vulnerabilities. For example, the "Heartbleed" vulnerability in OpenSSL in 2014 put about 17% of trusted websites at risk. Therefore, the study of the security of network protocol implementations has always been a hot topic in the field of software testing.
[0003] Currently, many studies are devoted to automatically discovering hidden vulnerabilities in code. Among them, differential testing, also known as differential fuzz testing, has been widely used in combination with fuzz testing technology. Differential testing is used to detect "logical vulnerabilities" or "semantic errors" that do not trigger program crashes or assertion failures. In differential testing, the same test case is simultaneously input to multiple programs under test with similar functions. If there are differences after they execute the test case, it may mean that there is a "logical vulnerability" or "semantic error" in a program. There are multiple software implementations of the same network protocol. Although the implementation process is different, the input and output are usually similar. Therefore, differential testing can effectively detect behavioral differences between these implementations, which often stem from potential vulnerabilities. In order to improve the effectiveness of differential testing, a large number of test cases are required as input, which are usually generated through fuzz testing technology.
[0004] Traditional differential testing methods for network protocol implementations use the idea of black box fuzziness to detect behavioral differences between different protocol implementations by randomly generating a large number of test cases. According to the different ways of generating test cases, such methods can be divided into generation-based differential testing and mutation-based differential testing. Generation-based testing methods use strategies to generate a large number of test cases based on protocol grammar descriptions. However, such methods rely on protocol knowledge and the process of generating test cases requires a lot of computing resources and time. Therefore, mutation-based testing methods have gradually gained attention.
[0005] Mutation-based differential testing methods mutate seeds according to mutation strategies to generate new test cases. Compared with generation-based differential testing methods, this type of method has a higher degree of automation and does not require complete protocol knowledge. However, this type of method has the following problems: (1) Although black-box fuzzy-based differential testing methods can generate a large number of test cases in a short period of time, they often contain many invalid and redundant cases. This will lead to inefficient difference discovery by the test tool. (2) Blind seed selection problem: Each time a seed is randomly selected from the corpus for mutation, this method is relatively blind. Since each seed has different abilities to discover differences in code behavior, in order to ensure that the test is carried out in the direction of discovering more behavioral differences, the seed that can best discover behavioral differences should be selected each time to improve the test effect. (3) Blind seed mutation problem: The selection of mutation operations is mainly based on randomness, and lacks specific consideration of the applicability of specific seeds. This means that different mutation operations may have different effects on seeds, and existing methods do not effectively distinguish and utilize these differences.
[0006] In order to improve mutation efficiency, the selection mechanism of mutation operations needs to be optimized to ensure that they can make more effective mutation decisions based on the characteristics of the seed and the behavior of the target program. Summary of the invention
[0007] The purpose of the present invention is to solve the defects of poor differential capability and insufficient testing in the differential testing method in the prior art, and to provide a differential testing method oriented to network protocol implementation to solve the above problems.
[0008] In order to achieve the above object, the technical solution of the present invention is as follows:
[0009] A differential testing method for network protocol implementation includes the following steps:
[0010] 11) Prepare for the test: compile and insert all the protocol implementation programs to be tested, and build the initial seed corpus;
[0011] 12) Generate test cases: Use the idea of gray box fuzziness to generate test cases, and use the behavioral difference information between different network protocol implementations to guide the test case generation process;
[0012] 13) Perform differential testing on network protocol implementations: Use the test cases generated in step 12) to test different network protocol implementation programs and monitor the behaviors of different network protocol implementation programs. If different network protocol implementation programs produce different behaviors for the test cases, they will be retained in the seed corpus for subsequent testing.
[0013] The test preparation comprises the following steps:
[0014] 21) Deploy the protocol implementation program to be tested:
[0015] Before testing the network protocol implementation program, first use the instrumentation tool AFL++ to instrument each network protocol implementation program; then compile the instrumented program, and the compilation process includes preprocessing, compilation, assembly, and linking; finally, deploy the compiled program to the target environment, establish a communication connection with the test tool, set the network protocol, port, and authentication mechanism for accurate data transmission and reception during the test, and obtain the behavioral difference information generated after executing the test case;
[0016] 22) Build the initial seed corpus:
[0017] First, use the packet capture tool tcpdump to obtain the real-time communication data between the client and the protocol server and save it as a Pcap format file. The Pcap format file records the detailed information of the network communication, including the source address, destination address, port number, and the content of the transmitted data packet;
[0018] Then, a request sequence parser is used to parse the collected Pcap format files and extract all request sequences as the initial seed corpus.
[0019] Generating a test case comprises the following steps:
[0020] 31) Set the seed selection algorithm of the seed selector: Use the confidence upper bound algorithm to design the selection algorithm of the seed selector;
[0021] 32) Select the target seed: The seed selector selects a target seed from the initial seed corpus for subsequent mutation operations according to the seed selection algorithm;
[0022] 33) Set the mutation operation of the seed mutator: Use the firefly algorithm to optimize the selection probability distribution of the mutation operation;
[0023] 34) After the mutation operation is selected, the seed mutator mutates the seed to generate test cases.
[0024] The differential testing of the network protocol implementation comprises the following steps:
[0025] 41) Send the generated test cases to multiple servers with the same network protocol but different implementations for differential testing;
[0026] 42) Each server responds according to the test case received;
[0027] 43) When analyzing these responses, if it is found that different servers respond differently to the same test case, the response differences between different servers affect the test case generation process, that is, the seed selection and mutation process. Use the seed retainer to record these test cases. These test case records are used for further differential testing to help identify and resolve potential implementation difference issues.
[0028] The seed selection algorithm for setting the seed selector comprises the following steps:
[0029] 51) Perform initialization operations for each seed Initialize the average return rate and the number of selections , in In the differential test, each seed is calculated UCB value, UCB value The calculation formula is as follows:
[0030] ,
[0031] in, Refers to the Round of testing so far The average rate of return, Refers to Round of testing so far The number of times selected, is the logarithm of t;
[0032] 52) Calculate each seed based on its UCB value In the The probability of being selected in the round difference test , and randomly select a seed for subsequent mutation operations based on the probability distribution. The calculation formula is as follows:
[0033] ,
[0034] in, is a parameter that controls the balance between exploration and exploitation. When larger, they tend to explore. When smaller, they tend to use is the total number of test cases;
[0035] 53) After selecting a seed, the average return rate and number of selections of the seed are updated according to the results of the differential test. The updated return rate is:
[0036] ,
[0037] in, Refers to seeds In the The return obtained during the differential test is that if new code coverage is found, ,otherwise ; Update times:
[0038] .
[0039] The mutation operation of setting the seed mutator includes the following steps:
[0040] 61) Initialize multiple fireflies for each seed. Each firefly represents the selection probability distribution of a mutation operation. The selection probability of the mutation operation is the position of the firefly in different dimensions. According to the probability distribution, the selection probability of all operations should be Within the interval, the position value of the firefly component in each dimension is Within the interval, any movement of the firefly ensures that the sum of the position components is always algebraically equal to 1;
[0041] 62) Calculate the brightness of each firefly,
[0042] Fireflies in specific locations The brightness of ,and ,
[0043] in represents fitness,
[0044] The brightness is represented by the fitness function, which is calculated as: ,in represents the number of differences found by the mutation operation, Indicates the number of times the mutation operation is performed;
[0045] 63) According to the position update formula of the standard firefly algorithm, fireflies are attracted to move towards brighter fireflies. The position update formula is as follows:
[0046] ,
[0047] in, refers to the location where the fireflies will move. refers to the current location, is the attraction parameter, which varies with the firefly With fireflies The distance between is the distance decay parameter, It's a firefly and The distance between is the randomization parameter, is a random vector that follows a Gaussian or uniform distribution;
[0048] In the process of seed mutation, the position update means that the selection probability of the mutation operation is closer to the probability distribution of discovering more behavioral differences. As the number of iterations increases, the randomization parameter is gradually reduced. The influence of to promote convergence is calculated as follows:
[0049] ,
[0050] in, is the initial randomization parameter, , represents the random descent factor, is the number of iterations; since the sum of the selection probabilities of all mutation operations may not be equal to 1 after the position is updated, normalization is performed and the normalization formula is calculated as:
[0051] ,
[0052] in, Represents a mutation operation. Indicates the total number of mutation operations;
[0053] 64) After multiple iterations, the fireflies move their positions, and among these positions, the position with the strongest brightness is selected as the final optimization result;
[0054] 65) When mutating a seed, choose brightness The highest firefly,the firefly with the highest brightness corresponds to the optimal,probability distribution of mutation operations for the seed, and a mutation operation is,selected based on the distribution to mutate the seed to generate a test case.
[0055] Beneficial Effects
[0056] The differential testing method for network protocol implementation of the present invention uses behavioral differences to guide the differential testing process compared with the prior art, utilizes the upper confidence limit algorithm (UCB algorithm) in reinforcement learning to guide the seed selection process, and uses the firefly algorithm to optimize the seed mutation process; the method of the present invention can solve the problems existing in the traditional network protocol differential testing method in terms of seed selection, seed mutation, etc., and improve the testing efficiency and the ability to discover differences.
[0057] The present invention takes into account the importance of seed selection in the differential test process, models the seed selection process as a MAB problem, and designs a customized UCB algorithm to guide the seed selection process in the network protocol differential test. This method can give priority to selecting high-potential seeds for mutation, thereby improving the efficiency of differential testing and the ability to find differences. At the same time, the present invention takes into account the impact of mutation operations on seed mutation, and uses the firefly algorithm to solve the problems existing in the seed mutation process. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] Figure 1 is a method sequence diagram of the present invention;
[0059] Figure 2 A framework diagram of the method involved in the present invention;
[0060] Figure 3 The firefly algorithm flow chart involved in the present invention;
[0061] Figure 4 This is a schematic diagram of a scenario involved in the present invention. DETAILED DESCRIPTION
[0062] In order to have a further understanding and recognition of the structural features and the effects achieved by the present invention, a preferred embodiment and accompanying drawings are used for detailed description as follows:
[0063] like Figure 1 and Figure 2 As shown, the differential testing method for network protocol implementation described in the present invention is mainly divided into three stages. The first stage is the test preparation stage, which mainly performs some preparatory operations before the test, including compiling and plugging all protocol implementation programs to be tested and building an initial seed corpus. The second stage is the test case generation stage, which is used to generate test cases for differential testing. The third stage is the differential testing stage, which uses test cases to test different protocol implementation programs. Each stage will be introduced in detail below. The specific steps are as follows:
[0064] The first step is to prepare for the test: compile and insert all the protocol implementation programs to be tested and build the initial seed corpus.
[0065] (1) Deploy the protocol implementation program to be tested:
[0066] Before testing the network protocol implementation program, first use the instrumentation tool AFL++ to instrument each network protocol implementation program to monitor and collect running information during the test; then, compile the instrumented program, and the compilation process includes preprocessing, compilation, assembly and linking to ensure that they can run stably in the target environment; finally, deploy the compiled program to the target environment, establish a communication connection with the test tool, set the network protocol, port and authentication mechanism for accurate transmission and reception of data during the test, so as to ensure accurate transmission and reception of data during the test, and obtain the behavioral difference information generated after executing the test case.
[0067] (2) Constructing the initial seed corpus:
[0068] First, use the packet capture tool tcpdump to obtain the real-time communication data between the client and the protocol server, and save it as a Pcap format file. The Pcap format file records detailed information about network communications, including the source address, destination address, port number, and the content of the transmitted data packet; tcpdump is a powerful tool that allows us to set specific filtering rules to capture the required network traffic and save this data as a Pcap format file.
[0069] Then, a request sequence parser is used to parse the collected Pcap format files and extract all request sequences as the initial seed corpus.
[0070] The second step is to generate test cases: the idea of gray box fuzziness is used to generate test cases, and the behavioral difference information between different network protocol implementations is used to guide the test case generation process.
[0071] The test case generation phase is a phase of generating test cases for differential testing. The present invention adopts the idea of gray box fuzzification to generate test cases. Unlike the gray box fuzzification oriented to code coverage, the present invention uses the behavioral differences between different network protocol implementations to guide the test case generation process. In order to improve the efficiency of differential testing and the ability to find differences, the present invention improves and optimizes the seed selection and mutation process, thereby improving the effectiveness of test cases.
[0072] The specific steps are as follows:
[0073] (1) Setting the seed selection algorithm of the seed selector: Design the selection algorithm of the seed selector using the confidence upper bound algorithm.
[0074] When performing differential testing on a network protocol implementation, the seed selector selects a seed from the seed corpus for subsequent mutation according to the seed selection algorithm. However, how to select seeds with high test efficiency and strong ability to discover behavioral differences is a difficulty in differential testing of network protocols. The traditional method randomly selects a seed from the corpus for mutation each time, which is relatively blind. This makes it difficult to select high-potential seeds, which in turn affects the effectiveness and efficiency of the test. The high-potential seeds here refer to those seeds that can discover new behavioral differences. In order to solve this problem, the present invention designs and implements a seed selection algorithm based on the upper confidence limit (UCB) algorithm, so that each round of differential testing selects seeds with strong ability to discover behavioral differences as much as possible.
[0075] The UCB algorithm is a common method for solving the MAB problem in reinforcement learning. The present invention models the seed selection process in the form of a MAB. Because the seed selection process can be regarded as a process of fully "utilizing" known high-potential seeds and "exploring" unknown high-potential seeds, this is a typical MAB process: the seeds available for selection at each iteration are used as the "arms" of the MAB to make decisions. With the continuous iteration of the test, the potential of various seeds in the seed corpus is in a changing process. Therefore, the present invention designs a customized UCB algorithm to guide the seed selection process.
[0076] A1) Perform initialization operation for each seed Initialize the average return rate and the number of selections , in In the differential test, each seed is calculated UCB value, UCB value The calculation formula is as follows:
[0077] ,
[0078] in, Refers to the Round of testing so far The average rate of return, Refers to Round of testing so far The number of times selected, is the logarithm of t;
[0079] A2) Calculate each seed based on its UCB value In the The probability of being selected in the round difference test , and randomly select a seed for subsequent mutation operations based on the probability distribution. The calculation formula is as follows:
[0080] ,
[0081] in, is a parameter that controls the balance between exploration and exploitation. When larger, they tend to explore. When smaller, they tend to use is the total number of test cases;
[0082] A3) After selecting a seed, the average return rate and number of selections of the seed are updated according to the results of the differential test. The updated return rate is:
[0083] ,
[0084] in, Refers to seeds In the The return obtained during the differential test is that if new code coverage is found, ,otherwise ; Update times:
[0085] .
[0086] (2) Selecting a target seed: The seed selector selects a target seed from the initial seed corpus according to the seed selection algorithm for subsequent mutation operations. Here, the seed has been selected, and in the next step, the corresponding parameters are updated according to the results of the differential test.
[0087] (3) Set the mutation operation of the seed mutator: Use the firefly algorithm to optimize the selection probability distribution of the mutation operation. After the seed is selected, the seed mutator will perform the corresponding mutation operation on the seed to generate a test case. The traditional mutation-based differential testing method selects the mutation operation randomly or sequentially. However, it does not take into account the impact of different mutation operations on seed mutation, which may miss some valuable test cases. The present invention uses the firefly algorithm to optimize the selection probability distribution of the mutation operation. By doing so, the seed mutation efficiency can be improved, thereby improving the efficiency of differential testing and the ability to detect differences. The flowchart of the firefly algorithm is shown in the figure. Figure 3 shown.
[0088] B1) Initialize multiple fireflies for each seed. Each firefly represents the selection probability distribution of a mutation operation. The selection probability of the mutation operation is the position of the firefly in different dimensions. According to the probability distribution, the selection probability of all operations should be Within the interval, the position value of the firefly component in each dimension is Within the interval, any movement of the firefly ensures that the sum of the position components is always algebraically equal to 1;
[0089] B2) Calculate the brightness of each firefly,
[0090] Fireflies in specific locations The brightness of ,and ,
[0091] in represents fitness,
[0092] The brightness is represented by the fitness function, which is calculated as: ,in represents the number of differences found by the mutation operation, Indicates the number of times the mutation operation is performed;
[0093] B3) According to the position update formula of the standard firefly algorithm, the fireflies are attracted to move towards brighter fireflies. The position update formula is as follows:
[0094] ,
[0095] in, refers to the location where the fireflies will move. refers to the current location, is the attraction parameter, which varies with the firefly With fireflies The distance between is the distance decay parameter, It's a firefly and The distance between is the randomization parameter, is a random vector that follows a Gaussian or uniform distribution;
[0096] In the process of seed mutation, the position update means that the selection probability of the mutation operation is closer to the probability distribution of discovering more behavioral differences. As the number of iterations increases, the randomization parameter is gradually reduced. The influence of to promote convergence is calculated as follows:
[0097] ,
[0098] in, is the initial randomization parameter, , represents the random descent factor, is the number of iterations; since the sum of the selection probabilities of all mutation operations may not be equal to 1 after the position is updated, normalization is performed and the normalization formula is calculated as:
[0099] ,
[0100] in, Represents a mutation operation. Indicates the total number of mutation operations;
[0101] B4) After multiple iterations, the fireflies move positions, and among these positions, the position with the strongest brightness is selected as the final optimization result; ideally, each seed will eventually obtain a stable probability distribution in this step, and the distribution is saved to select mutation operations in subsequent testing. When the differential test encounters the seed again in the next round, the mutation operation is selected according to the saved distribution result, the test case is generated, and the differential test is performed.
[0102] B5) When mutating a seed, choose brightness The highest firefly,the firefly with the highest brightness corresponds to the optimal,probability distribution of mutation operations for the seed, and a mutation operation is,selected based on the distribution to mutate the seed to generate a test case.
[0103] (4) After selecting the mutation operation, the seed mutator performs mutation operation on the seed to generate test cases. After each round of differential testing, the seed retainer will retain the test cases. However, not all test cases will be retained. In the present invention, the seed retainer will retain those test cases that have found behavioral differences, while those test cases that have not found behavioral differences will be discarded.
[0104] The third step is to perform differential testing on the network protocol implementation: use the test cases generated in the second step to test different network protocol implementation programs and monitor the behaviors of different network protocol implementation programs. If different network protocol implementation programs produce different behaviors for the test cases, they will be retained in the seed corpus for subsequent testing.
[0105] (1) The generated test cases are sent to multiple servers with the same network protocol but different implementations for differential testing.
[0106] (2) Each server responds based on the test case it receives.
[0107] (3) When analyzing these responses, if it is found that different servers respond differently to the same test case, the response differences between different servers affect the test case generation process, that is, the seed selection and mutation process. Use the seed retainer to record these test cases. These test case records are used for further differential testing to help identify and resolve potential implementation difference problems.
[0108] The method proposed in the present invention can be well deployed on intelligent network detection equipment to more efficiently discover "logical loopholes" and "semantic errors" in network protocol implementations, thereby improving differential testing efficiency and performance. Figure 4 As shown in the figure, it includes intelligent network detection equipment, clients and multiple servers with different implementations of the same network protocol. The intelligent network detection equipment is mainly used to send test cases to the client and collect response information from different network protocol servers. And generate test reports based on these response information to provide support and decision-making basis for the improvement and optimization of network protocol implementation programs.
[0109] The above shows and describes the basic principles, main features and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The above embodiments and descriptions only describe the principles of the present invention. The present invention may be subject to various changes and improvements without departing from the spirit and scope of the present invention. These changes and improvements fall within the scope of the present invention. The scope of protection claimed by the present invention is defined by the attached claims and their equivalents.
Claims
1. A differential testing method for network protocol implementation, characterized in that: The following steps are involved: 11) Prepare for the test: compile and insert all the protocol implementation programs to be tested, and build the initial seed corpus; 12) Generate test cases: Use the idea of gray box fuzziness to generate test cases, and use the behavioral difference information between different network protocol implementations to guide the test case generation process; Generating a test case comprises the following steps: 121) Setting the seed selection algorithm of the seed selector: Designing the selection algorithm of the seed selector using the confidence upper bound algorithm; The seed selection algorithm for setting the seed selector comprises the following steps: 1211) to perform initialization operations for each seed Initialize the average return rate and the number of selections , in In the differential test, each seed is calculated UCB value, UCB value The calculation formula is as follows: , in, Refers to the Round of testing so far The average rate of return, Refers to Round of testing so far The number of times selected, is the logarithm of t; 1212) Calculate each seed based on its UCB value In the The probability of being selected in the round difference test , and randomly select a seed for subsequent mutation operations according to the probability distribution. The calculation formula is as follows: , in, is a parameter that controls the balance between exploration and exploitation. is the total number of test cases; 1213) After a seed is selected, the average return rate and number of selections of the seed are updated according to the result of the differential test. The updated return rate is: , in, Refers to seeds In the The return obtained during the differential test is that if new code coverage is found, ,otherwise ; Update times: ; 122) Selecting a target seed: The seed selector selects a target seed from the initial seed corpus for subsequent mutation operations according to the seed selection algorithm; 123) Set the mutation operation of the seed mutator: Use the firefly algorithm to optimize the selection probability distribution of the mutation operation; 124) After the mutation operation is selected, the seed mutator performs mutation operation on the seed to generate test cases; 13) Perform differential testing on network protocol implementations: Use the test cases generated in step 12) to test different network protocol implementation programs and monitor the behaviors of different network protocol implementation programs. If different network protocol implementation programs produce different behaviors for the test cases, they will be retained in the seed corpus for subsequent testing.
2. The differential testing method for network protocol implementation according to claim 1, characterized in that: The test preparation comprises the following steps: 21) Deploy the protocol implementation program to be tested: Before testing the network protocol implementation program, first use the instrumentation tool AFL++ to instrument each network protocol implementation program; then compile the instrumented program, and the compilation process includes preprocessing, compilation, assembly, and linking; finally, deploy the compiled program to the target environment, establish a communication connection with the test tool, set the network protocol, port, and authentication mechanism for accurate data transmission and reception during the test, and obtain the behavioral difference information generated after executing the test case; 22) Build the initial seed corpus: First, use the packet capture tool tcpdump to obtain the real-time communication data between the client and the protocol server and save it as a Pcap format file. The Pcap format file records detailed information about network communications, including the source address, destination address, port number, and the contents of the transmitted data packet. Then, a request sequence parser is used to parse the collected Pcap format files and extract all request sequences as the initial seed corpus.
3. The differential testing method for network protocol implementation according to claim 1, characterized in that: The differential testing of the network protocol implementation comprises the following steps: 31) Send the generated test cases to multiple servers with the same network protocol but different implementations for differential testing; 32) Each server responds according to the test case received; 33) When analyzing these responses, if it is found that different servers respond differently to the same test case, the response differences between different servers affect the test case generation process, that is, the seed selection and mutation process. Use the seed retainer to record these test cases. These test case records are used for further differential testing to help identify and resolve potential implementation difference issues.
4. The differential testing method for network protocol implementation according to claim 1, characterized in that: The mutation operation of setting the seed mutator includes the following steps: 41) Initialize multiple fireflies for each seed. Each firefly represents the selection probability distribution of a mutation operation. The selection probability of the mutation operation is the position of the firefly in different dimensions. According to the probability distribution, the selection probability of all operations should be Within the interval, the position value of the firefly component in each dimension is Within the interval, any movement of the firefly ensures that the sum of the position components is always algebraically equal to 1; 42) Calculate the brightness of each firefly, Fireflies in specific locations The brightness of ,and , in represents fitness, The brightness is represented by the fitness function, which is calculated as: ,in represents the number of differences found by the mutation operation, Indicates the number of times the mutation operation is performed; 43) According to the position update formula of the standard firefly algorithm, the fireflies are attracted to move towards brighter fireflies. The position update formula is as follows: , in, refers to the location where the fireflies will move. refers to the current location, is the attraction parameter, which varies with the firefly With Fireflies The distance between is the distance decay parameter, It's a firefly and The distance between is the randomization parameter, is a random vector that follows a Gaussian or uniform distribution; In the process of seed mutation, the position update means that the selection probability of the mutation operation is closer to the probability distribution of discovering more behavioral differences. As the number of iterations increases, the randomization parameter is gradually reduced. The influence of to promote convergence is calculated as follows: , in, is the initial randomization parameter, , represents the random descent factor, is the number of iterations; since the sum of the selection probabilities of all mutation operations may not be equal to 1 after the position is updated, normalization is performed; 44) After multiple iterations, the fireflies move their positions, and among these positions, the position with the strongest brightness is selected as the final optimization result; 45) When mutating a seed, choose brightness The highest firefly,the firefly with the highest brightness corresponds to the optimal,probability distribution of mutation operations for the seed, and a mutation operation is,selected based on the distribution to mutate the seed to generate a test case.
Citation Information
Patent Citations
Fuzzy test seed variation intensity optimization method
CN114185802A
Intelligent fuzzy test method, device and system based on reinforcement learning
CN115309628A