Software automatic testing method based on Rainbow channel attention network

By applying an agent-environmental interaction system based on Rainbow's channel attention network in game software testing, the existing testing methods are solved, and more efficient automatic testing and more comprehensive testing coverage are achieved.

CN114880243BActive Publication Date: 2025-04-08GUANGDONG UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210666256.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-14
Publication Date
2025-04-08
Estimated Expiration
2042-06-14

AI Technical Summary

Technical Problem

Existing game software testing methods rely on manual and scripts, with short test cycles and high cost, and cannot fully explore various scenarios or environments in the software. Moreover, script writing requires a lot of manpower and material resources, making it difficult to cover all path branches of the software.

Method used

Using the software automatic testing method of the channel attention network based on Rainbow, an agent-environment interaction system is built, a priori sample data is collected, decision-making network is built and trained, and software testing is carried out through the interactive search strategy between the agent and the environment.

Benefits of technology

It improves the efficiency of automatic testing of game software, saves time and costs, solves the problem of slow convergence of reinforcement learning strategy search, and achieves faster strategy search and more comprehensive test coverage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114880243B_ABST
    Figure CN114880243B_ABST
Patent Text Reader

Abstract

The present invention discloses a software automatic testing method based on a channel attention network of Rainbow, comprising the following steps: S1, building an intelligent agent-environment interaction system including a data pool; S2, collecting prior sample data, and putting the collected prior sample data into the data pool of the intelligent agent-environment interaction system; S3, building a decision network based on a channel attention mechanism fusion competition module; S4, training the decision network based on the channel attention mechanism fusion competition module built in step S3; S5, combining the decision network based on the channel attention mechanism fusion competition module completed by training to perform software testing. The present invention effectively improves the efficiency of automatic testing of game software and saves time cost. Compared with traditional Q learning or other reinforcement learning paradigms, the present invention further improves the speed of strategy search, and solves the dilemma of slow convergence speed of reinforcement learning strategy search to a certain extent.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software testing, and in particular to a software automatic testing method based on a Rainbow channel attention network. Background Art

[0002] Since the birth of software, the testing phase before the software goes online has been a stage that cannot be skipped in the software development stage. Especially for the game industry, the software even needs multiple testing phases to find bugs in the game software in order to facilitate long-term operation after the smooth launch. Most of the current game software testing is based on manual testing (alpha / beta testing) and script-based testing. However, due to the limitation of economic benefits, the cycle of the software testing phase is often very short, resulting in manual testing that cannot fully reflect the deficiencies in the software, and manual and script-based software testing cannot fully explore various scenarios or environments in the software. In addition, the design and writing of the script-based software testing method itself requires a lot of manpower and material resources, and because the script testers have certain limitations in their understanding of the software itself, they cannot cover all the path branches of the software well. Although more path branches can be covered by using a large number of people to write scripts, this will invisibly increase the cost of testing. Summary of the invention

[0003] The purpose of the present invention is to overcome the shortcomings of the prior art and provide a software automatic testing method for a channel attention network based on Rainbow.

[0004] To achieve the above purpose, the technical solution provided by the present invention is:

[0005] The software automatic testing method of the channel attention network based on Rainbow includes the following steps:

[0006] S1. Build an agent-environment interaction system including a data pool;

[0007] S2, collect prior sample data, and put the collected prior sample data into the data pool of the agent-environment interaction system;

[0008] S3. Build a decision network based on the channel attention mechanism and fusion competition module;

[0009] S4, training the decision network based on the channel attention mechanism fusion competition module built in step S3;

[0010] S5. Perform software testing based on the trained decision network fused with the competition module based on the channel attention mechanism.

[0011] Furthermore, the constructed agent-environment interaction system also includes an agent and an environment;

[0012] The intelligent agent is the subject for interacting with the environment and is the sender of actions. It makes corresponding actions by observing the state of the environment and the rewards fed back by the environment, and the actions sent act on the environment.

[0013] The environment is an object that receives the actions of the agent. It updates its own state by receiving the actions issued by the agent and feeds back rewards to the agent.

[0014] The data pool is used to record the past interaction process between the agent and the environment; a sample in the data pool includes: the state s of the environment at a certain moment t , the agent according to the state s t Action taken t , the environment is based on the current state s t and action a t Generated feedback r t and the environment according to the state s t and action a t The next state to transfer to is s t+1 .

[0015] Furthermore, collecting prior sample data includes:

[0016] S2-1. Capture the state s of the environment where the current agent is located t ;

[0017] S2-2. According to the current state of the environment where the agent is located, artificially mark the action that the agent should take, denoted as a t ;

[0018] S2-3, collect the feedback from the environment after the current agent takes action t and action a t The next state after the transition is s t+1 ;

[0019] S2-4, the current state of the agent, the action taken, the feedback from the environment and the state after the transfer are taken as a four-tuple (s t ,a t ,r t ,s t+1 ) and added to the data pool as a data source.

[0020] Furthermore, when capturing the state of the environment in which the current agent is located:

[0021] For non-image data, the collected environment will be input into the hash function for encoding to obtain the state s t ;

[0022] For image data, it will be directly used as state s t .

[0023] Furthermore, the decision network is a convolutional neural network, including an attention mechanism structure and a competitive network structure.

[0024] Furthermore, the attention mechanism structure compresses the feature map, and the sparse dimension in the feature map of the residual block is squeezed from H×W×C to 1×1×C;

[0025] The compression operation is performed using a pooling operation, and the pooling uses a global average pooling layer, which compresses each two-dimensional feature channel to a corresponding single real number. The real number obtained after compression has a global view, and the output dimension matches the number of input feature channels. The corresponding mathematical basis is as follows:

[0026]

[0027] Among them, z c is the result after compression, F sq is the compression function, u c (i, j) is the element of the i-th row and j-th column of a channel in the corresponding feature map, and H×W is the height and width of a channel;

[0028] The cross-correlation between channels is captured through a bottleneck structure; finally, the output weight of the structure serves as the importance of each feature channel after network feature selection. The previous feature map is weighted by channel in the form of vector dot multiplication to complete the importance evaluation of the original feature map in the channel dimension and realize the attention mechanism.

[0029] Furthermore, the convolutional neural network is recorded as the agent network Q. One of the tasks of the agent network Q learning is to continuously update the agent network Q, and the elements in it are recorded as Q(s,a);

[0030] The updated rules satisfy the Bellman optimality equation, and the rules are as follows:

[0031]

[0032] a 1 is a hyperparameter used to control the step size of each update; γ is a hyperparameter used to control the importance of future gains; when γ = 1, future gains are considered to be as important as current gains; when γ = 0, only current gains are considered to be the most important; It means finding a that maximizes Q 1, and bring it into Q; s′ is the next jump state of the current state;

[0033] The agent network Q is split so that it satisfies the following formula:

[0034]

[0035] Among them, θ, μ, ν correspond to the structural weights of the neural network before the competition network, the weights in the value network structure, and the weights in the advantage network structure respectively; s, a, R correspond to the state of the current environment, the actions taken by the agent in this state, and the rewards given by the current environment based on the agent's actions respectively; V(s; θ, μ) represents the optimal state value network; A(s, a; θ, ν) represents the optimal advantage network; a′ is the intermediate variable involved in the process of finding the average output value of the optimal advantage network under a certain state s.

[0036] Furthermore, the step S4 comprises:

[0037] S4-1. Initialize the agent network Q and the fixed network Q target , data pool size N, number of cycles K, batch size k, fixed network update length L, hyperparameter β, number of iterations Epochs, weight change Δ = 0;

[0038] S4-2, apply Gaussian noise to the Q weight of the agent network;

[0039] S4-3. Make the agent take action a 1 ;

[0040] S4-4. Observe the current status t , observe the return r t and the next state s t+1 ;

[0041] S4-5, the four-tuple (s t ,a t ,r t ,s t+1 ) is stored in the data pool with the current highest priority ρ;

[0042] S4-6, if the number of data in the data pool is greater than N, the data tuples are eliminated according to the priority ρ of the data tuple with a probability of 1-ρ; otherwise, jump directly to S4-7;

[0043] S4-7. Sample the samples in the data pool according to the current highest priority ρ as the training samples of the agent network Q, and calculate the weight w of the jth sample in the data pool according to the following formula: j :

[0044] w j=(N·P(j)) -β / maxw i

[0045] Where N is the size of the data pool; P(j) is the function for calculating the priority of the jth sample in the data pool; w i is the weight of the i-th sample in the data pool; maxw i Represents the sample weight w i The largest value among

[0046] S4-8. Calculate TD error δ j And according to this error, the highest priority ρ of the current training sample is updated; TD error δ j Calculate according to the following formula:

[0047] δ j =R j +γQ target (S j ,argmax a Q(S j ,a))-Q(S j-1 ,A j-1 )

[0048] R j S represents the reward given by the current environment in the jth sample based on the agent's action and the state of the environment; j Indicates that the jth sample environment is currently in state; A j-1 represents the action taken by the j-1th sample agent; argmax a Q(S j ,a) represents taking the value such that Q(S j ,a) the value of parameter a at maximum;

[0049] S4-9. Calculate the weight change It means Q(s t ,a t ) Find the gradient of θ;

[0050] S4-10, if the sampled data size = k, jump directly to S4-11, otherwise jump to step S4-13;

[0051] S4-11, train the network, update the weight θ←θ+η·Δ in the network Q, reset Δ=0; η is the step size of weight update, and K increases by 1;

[0052] S4-12, if the number of cycles KMODL = 0, copy the weights in network Q to Q target ; When the number of loops K reaches Epochs, terminate the program, otherwise the number of iterations + 1;

[0053] S4-13. Make the agent take action a t , and jump to step S4-4.

[0054] Furthermore, the step S5 comprises:

[0055] S5-1, initialize the time trajectory queue Q, which is used to store the process of interaction between the model and the environment in chronological order, and test Epochs;

[0056] S5-2. Observe the current state of the environment t , and makes the agent take action a t ;

[0057] S5-3. Observe the reward of environmental feedback t and the next state s of the environment t+1 ;

[0058] S5-4, the four-tuple (s t ,a t ,r t ,s t+1 ) is stored in the time trajectory queue Q;

[0059] S5-5. If the current cycle round is less than or equal to Epochs, jump to step S5-3, otherwise continue;

[0060] S5-6, output time trajectory queue Q;

[0061] S5-7. Based on the time trajectory queue Q, the tester uses the data collected in it to determine under what conditions the program may crash; and further analysis of the trajectory data can obtain statement coverage, branch coverage, and condition coverage data results to help testers find deficiencies in the software.

[0062] Compared with the existing technology, the principle and advantages of this solution are as follows:

[0063] This solution builds an interactive system between the agent and the environment based on the design characteristics of the test game software, and manually samples a certain number of high-quality samples in advance to add to the data pool for strategy search. Finally, the optimal strategy is searched through the continuous interaction between the agent and the environment.

[0064] This solution effectively improves the efficiency of automatic testing of game software and saves time costs. Compared with traditional Q learning or other reinforcement learning paradigms, this solution further improves the speed of strategy search, and to a certain extent solves the dilemma of slow convergence speed of reinforcement learning strategy search. BRIEF DESCRIPTION OF THE DRAWINGS

[0065] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the services required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0066] Figure 1 It is a principle flow chart of the software automatic testing method of the channel attention network based on Rainbow of the present invention;

[0067] Figure 2 Schematic diagram of the structure of the attention mechanism in the network. DETAILED DESCRIPTION

[0068] The present invention will be further described below in conjunction with specific embodiments:

[0069] like Figure 1 As shown, the software automatic testing method of the channel attention network based on Rainbow described in this embodiment includes the following steps:

[0070] S1. Build an agent-environment interaction system;

[0071] In this step, the agent-environment interaction system includes the agent, the environment, and the data pool;

[0072] The agent is the subject for interacting with the environment and the sender of actions. It makes corresponding actions by observing the state of the environment and the rewards fed back by the environment, and the actions sent act on the environment. The environment is the object that receives the actions of the agent. It updates its own state by accepting the actions sent by the agent and feeds back rewards to the agent. The data pool is used to record the past interaction process between the agent and the environment. A sample in the data pool contains: the state s of the environment at a certain moment t , the agent according to the state s t Action taken t , the environment is based on the current state s t and action a t Generated feedback r t and the environment according to the state s t and action a t The next state to transfer to is s t+1 .

[0073] S2, collect prior sample data, and put the collected prior sample data into the data pool of the agent-environment interaction system;

[0074] In this step, collecting prior sample data includes:

[0075] S2-1. Capture the state s of the environment where the current agent is located t :in,

[0076] For non-image data, the collected environment will be input into the hash function for encoding to obtain the state s t ;

[0077] For image data, it will be directly used as state s t .

[0078] S2-2. According to the current state of the environment where the agent is located, artificially mark the action that the agent should take, denoted as a t ;

[0079] S2-3, collect the feedback from the environment after the current agent takes action t and action a t The next state after the transition is s t+1 ;

[0080] S2-4, the current state of the agent, the action taken, the feedback from the environment and the state after the transfer are taken as a four-tuple (s t ,a t ,r t ,s t+1 ) and added to the data pool as a data source.

[0081] By introducing human prior sample data, the speed of strategy search can be accelerated. However, the introduction of priors usually limits the direction of strategy search, thereby losing the diversity of strategies. Therefore, this embodiment limits the influence of priors on strategy search by introducing a decay factor ρ, that is, a certain prior sample has a probability of 1-ρ being eliminated (i.e., being removed from the sample pool) in each round, thereby reducing the influence of priors on strategy search.

[0082] By encoding the collected environment through a hash function, the complex operation of encoding the environment before testing is effectively avoided, which improves the efficiency of software testing. And due to the infinite number of states, it is often impossible to encode all states. Using a hash function for encoding also solves this problem.

[0083] S3. Build a decision network based on the channel attention mechanism and fusion competition module;

[0084] In this step, the decision network is a convolutional neural network, including an attention mechanism structure and a competitive network structure;

[0085] Among them, the attention mechanism structure compresses the feature map, and the sparse dimension in the feature map of the residual block is squeezed from H×W×C to 1×1×C; Figure 2 shown.

[0086] The compression operation is performed using a pooling operation, and the pooling uses a global average pooling layer, which compresses each two-dimensional feature channel to a corresponding single real number. The real number obtained after compression has a global view, and the output dimension matches the number of input feature channels. The corresponding mathematical basis is as follows:

[0087]

[0088] Among them, z c is the result after compression, F sq is the compression function, u c (i, j) is the element of the i-th row and j-th column of a channel in the corresponding feature map, and H×W is the height and width of a channel;

[0089] The cross-correlation between channels is captured through a bottleneck structure; finally, the output weight of the structure serves as the importance of each feature channel after network feature selection. The previous feature map is weighted by channel in the form of vector dot multiplication to complete the importance evaluation of the original feature map in the channel dimension and realize the attention mechanism.

[0090] Competitive network structure:

[0091] The convolutional neural network is denoted as the agent network Q. One of the tasks of the agent network Q learning is to continuously update the agent network Q, where the elements are denoted as Q(s,a);

[0092] The updated rules satisfy the Bellman optimality equation, and the rules are as follows:

[0093]

[0094] a 1 is a hyperparameter used to control the step size of each update; γ is a hyperparameter used to control the importance of future gains; when γ = 1, future gains are considered to be as important as current gains; when γ = 0, only current gains are considered to be the most important; It means finding a that maximizes Q 1 , and bring it into Q; s′ is the next jump state of the current state;

[0095] The agent network Q is split so that it satisfies the following formula:

[0096]

[0097] Among them, θ, μ, ν correspond to the structural weights of the neural network before the competition network, the weights in the value network structure, and the weights in the advantage network structure respectively; s, a, R correspond to the state of the current environment, the actions taken by the agent in this state, and the rewards given by the current environment based on the agent's actions respectively; V(s; θ, μ) represents the optimal state value network; A(s, a; θ, ν) represents the optimal advantage network; a′ is the intermediate variable involved in the process of finding the average output value of the optimal advantage network under a certain state s.

[0098] S4, training the decision network based on the channel attention mechanism fusion competition module built in step S3, specifically including:

[0099] S4-1. Initialize the agent network Q and the fixed network Q target , data pool size N, number of cycles K, batch size k, fixed network update length L, hyperparameter β, number of iterations Epochs, weight change Δ = 0;

[0100] S4-2, apply Gaussian noise to the Q weight of the agent network;

[0101] S4-3. Make the agent take action a 1 ;

[0102] S4-4. Observe the current status t , observe the return r t and the next state s t+1 ;

[0103] S4-5, the four-tuple (s t ,a t ,r t ,s t+1 ) is stored in the data pool with the current highest priority ρ;

[0104] S4-6, if the number of data in the data pool is greater than N, the data tuples are eliminated according to the priority ρ of the data tuple with a probability of 1-ρ; otherwise, jump directly to S4-7;

[0105] S4-7. Sample the samples in the data pool according to the current highest priority ρ as the training samples of the agent network Q, and calculate the weight w of the jth sample in the data pool according to the following formula: j :

[0106] w j =(N·P(j)) -β / maxw i

[0107] Where N is the size of the data pool; P(j) is the function for calculating the priority of the jth sample in the data pool; w iis the weight of the i-th sample in the data pool; maxw i Represents the sample weight w i The largest value among

[0108] S4-8. Calculate TD error δ j And according to this error, the highest priority ρ of the current training sample is updated; TD error δ j Calculate according to the following formula:

[0109] δ j =R j +γQ target (S j ,argmax a Q(S j ,a))-Q(S j-1 ,A j-1 )

[0110] R j S represents the reward given by the current environment in the jth sample based on the agent's action and the state of the environment; j Indicates that the jth sample environment is currently in state; A j-1 represents the action taken by the j-1th sample agent; argmax a Q(S j ,a) represents taking the value such that Q(S j ,a) the value of parameter a at maximum;

[0111] S4-9. Calculate the weight change It means Q(s t ,a t ) Find the gradient of θ;

[0112] S4-10, if the sampled data size = k, jump directly to S4-11, otherwise jump to step S4-13;

[0113] S4-11, train the network, update the weight θ←θ+η·Δ in the network Q, reset Δ=0; η is the step size of weight update, and K increases by 1;

[0114] S4-12, if the number of cycles KMODL = 0, copy the weights in network Q to Q target ; When the number of loops K reaches Epochs, terminate the program, otherwise the number of iterations + 1;

[0115] S4-13. Make the agent take action a t , and jump to step S4-4.

[0116] S5. Combined with the trained decision network based on the channel attention mechanism fusion competition module, software testing is performed. The testing process includes:

[0117] S5-1, initialize the time trajectory queue Q, which is used to store the process of interaction between the model and the environment in chronological order, and test Epochs;

[0118] S5-2. Observe the current state of the environment t , and makes the agent take action a t ;

[0119] S5-3. Observe the reward of environmental feedback t and the next state s of the environment t+1 ;

[0120] S5-4, the four-tuple (s t ,a t ,r t ,s t+1 ) is stored in the time trajectory queue Q;

[0121] S5-5. If the current cycle round is less than or equal to Epochs, jump to step S5-3, otherwise continue;

[0122] S5-6, output time trajectory queue Q;

[0123] S5-7. Based on the time trajectory queue Q, the tester uses the data collected in it to determine under what conditions the program may crash; and further analysis of the trajectory data can obtain statement coverage, branch coverage, and condition coverage data results to help testers find deficiencies in the software.

[0124] The embodiments described above are only preferred embodiments of the present invention and are not intended to limit the scope of implementation of the present invention. Therefore, all changes made according to the shape and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A software automatic testing method based on Rainbow's channel attention network, characterized in that: The following steps are involved: S1. Build an agent-environment interaction system including a data pool; S2, collect prior sample data, and put the collected prior sample data into the data pool of the agent-environment interaction system; S3. Build a decision network based on the channel attention mechanism and fusion competition module; S4, training the decision network based on the channel attention mechanism fusion competition module built in step S3; S5. Perform software testing based on the trained decision network fused with the competition module based on the channel attention mechanism; Collecting prior sample data includes: S2-1. Capture the state s of the environment where the current agent is located t ; S2-2. According to the current state of the environment where the agent is located, artificially mark the action that the agent should take, denoted as a t ; S2-3. Collect the feedback from the environment after the current agent takes action. t and action a t The next state after the transition is s t+1 ; S2-4, the current state of the agent, the action taken, the feedback from the environment and the state after the transfer are taken as a four-tuple (s t ,a t ,r t ,s t+1 ), added to the data pool as a data source; When capturing the state of the environment where the current agent is located: For non-image data, the collected environment will be input into the hash function for encoding to obtain the state s t ; For image data, it will be directly used as state s t ; The decision network is a convolutional neural network, including an attention mechanism structure and a competitive network structure; The attention mechanism structure compresses the feature map, and the sparse dimension in the feature map of the residual block is squeezed from H×W×C to 1×1×C; The compression operation is performed using a pooling operation, and the pooling uses a global average pooling layer, which compresses each two-dimensional feature channel to a corresponding single real number. The real number obtained after compression has a global view, and the output dimension matches the number of input feature channels. The corresponding mathematical basis is as follows: Among them, z c is the result after compression, F sq is the compression function, u c (i, j) is the element of the i-th row and j-th column of a channel in the corresponding feature map, and H×W is the height and width of a channel; The cross-correlation between channels is captured through a bottleneck structure; finally, the output weight of the structure serves as the importance of each feature channel after network feature selection. The previous feature map is weighted by channel in the form of vector dot multiplication to complete the importance evaluation of the original feature map in the channel dimension and realize the attention mechanism.

2. The software automatic testing method of the Rainbow-based channel attention network according to claim 1 is characterized in that: The constructed agent-environment interaction system also includes an agent and an environment; The agent is the subject for interacting with the environment and is the sender of actions. It makes corresponding actions by observing the state of the environment and the rewards of environmental feedback, and the actions sent act on the environment. The environment is an object that receives the actions of the agent. It updates its own state by receiving the actions issued by the agent and feeds back rewards to the agent. The data pool is used to record the past interaction process between the agent and the environment; a sample in the data pool includes: the state s of the environment at a certain moment t , the agent according to the state s t Action taken t , the environment is based on the current state s t and action a t Generated feedback r t and the environment according to the state s t and action a t The next state to transfer to is s t+1 .

3. The software automatic testing method of the Rainbow-based channel attention network according to claim 1 is characterized in that: The convolutional neural network is denoted as the agent network Q. One of the tasks of the agent network Q learning is to continuously update the agent network Q, where the elements are denoted as Q(s,a); The updated rules satisfy the Bellman optimality equation, and the rules are as follows: a1 is a hyperparameter used to control the step size of each update; γ is a hyperparameter used to control the importance of future gains; when γ = 1, future gains are considered to be as important as current gains; when γ = 0, only current gains are considered to be the most important; It means finding a1 that makes Q the largest and bringing it into Q; s' is the next jump state of the current state; The agent network Q is split to satisfy the following formula: Among them, θ, μ, ν correspond to the structural weights of the neural network before the competition network, the weights in the value network structure, and the weights in the advantage network structure; s, a, R correspond to the state of the current environment, the actions taken by the agent in this state, and the rewards given by the current environment based on the agent's actions; V(s; θ, μ) represents the optimal state value network; A(s, a; θ, ν) represents the optimal advantage network; a' is the intermediate variable involved in the process of finding the average output value of the optimal advantage network under a certain state s.

4. The method for automatic software testing based on the Rainbow channel attention network according to claim 3, characterized in that: The step S4 comprises: S4-1. Initialize the agent network Q and the fixed network Q target , data pool size N, number of cycles K, batch size k, fixed network update length L, hyperparameter β, number of iterations Epochs, weight change Δ = 0; S4-2, apply Gaussian noise to the Q weight of the agent network; S4-3, make the agent take action a1; S4-4. Observe the current status t , observe the return r t and the next state s t+1 ; S4-5, the four-tuple (s t ,a t ,r t ,s t+1 ) is stored in the data pool with the current highest priority ρ; S4-6, if the number of data in the data pool is greater than N, the data tuples are eliminated according to the priority ρ with a probability of 1-ρ; otherwise, jump directly to S4-7; S4-7. Sample the samples in the data pool according to the current highest priority ρ as the training samples of the agent network Q, and calculate the weight w of the jth sample in the data pool according to the following formula: j : w j =(N·P(j)) -β / maxw i Where N is the size of the data pool; P(j) is the function for calculating the priority of the jth sample in the data pool; w i is the weight of the i-th sample in the data pool; maxw i Represents the sample weight w i The largest value among S4-8. Calculate TD error δ j And according to this error, the highest priority ρ of the current training sample is updated; TD error δ j Calculate according to the following formula: δ j =R j +γQ target (S j ,argmax a Q(S j ,a))-Q(S j-1 ,A j-1 ) R j S represents the reward given by the current environment in the jth sample based on the agent's action and the state of the environment; j Indicates that the jth sample environment is currently in state; A j-1 represents the action taken by the j-1th sample agent; argmax a Q(S j ,a) represents taking the value such that Q(S j ,a) the value of parameter a at maximum; S4-9. Calculate the weight change It means Q(s t ,a t ) Find the gradient of θ; S4-10, if the sampled data size = k, jump directly to S4-11, otherwise jump to step S4-13; S4-11, train the network, update the weight θ←θ+η·Δ in the network Q, reset Δ=0; η is the step size of weight update, and K increases by 1; S4-12, if the number of cycles KMOD L = 0, copy the weights in network Q to Q target ; When the number of loops K reaches Epochs, terminate the program, otherwise the number of iterations + 1; S4-13. Make the agent take action a t , and jump to step S4-4.

5. The method for automatic software testing based on the Rainbow channel attention network according to claim 4, characterized in that: The step S5 comprises: S5-1, initialize the time trajectory queue Q, which is used to store the process of interaction between the model and the environment in chronological order, and test Epochs; S5-2. Observe the current state of the environment t , and makes the agent take action a t ; S5-3. Observe the reward of environmental feedback t and the next state s of the environment t+1 ; S5-4, the four-tuple (s t ,a t ,r t ,s t+1 ) is stored in the time trajectory queue Q; S5-5. If the current cycle round is less than or equal to Epochs, jump to step S5-3, otherwise continue; S5-6, output time trajectory queue Q; S5-7. Based on the time trajectory queue Q, the tester uses the data collected in it to determine under what conditions the program may crash; and further analyzes the trajectory data to obtain statement coverage, branch coverage, and condition coverage data results to help testers find deficiencies in the software.

Citation Information

Patent Citations

  • Incomplete information game strategy optimization method based on double deep Q network learning

    CN114089627A

  • Landslide identification method and system based on attention mechanism and multi-modal representation learning

    CN114170533A