Method and device for generating generalized variable force combination test data for UAV flight control computers
By combining the gray wolf optimization algorithm and the particle swarm optimization algorithm to generate generalized variable strength combination test data of flight control computers, the problem of insufficient test data generation in the existing methods is solved, efficient and accurate test data coverage is achieved, and the coverage and efficiency of tests are improved.
Patent Information
- Application Number
- CN202310019373.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-06
- Publication Date
- 2025-08-15
- Estimated Expiration
- 2043-01-06
AI Technical Summary
There are fewer generalized variable-force combination test data generation methods in existing flight control computer systems, and there are many redundant tests, which cannot effectively cover the actual interaction relationship between parameters.
Test data is generated by using the Gray Wolf Optimization Algorithm (GWO) combined with the particle swarm optimization algorithm (PSO). By initializing the individual position of the wolf pack, calculating the adaptation value, updating the position of the head wolf, using PSO to optimize the position of the head wolf, and generating test data covering all targets until the end.
Combined test data with arbitrary variable velocity is generated, with less redundancy in coverage, which improves the accuracy and reliability of the test data, conforms to the actual distribution of parameter states, and improves the efficiency and pertinence of generating data.
Smart Images

Figure CN116048984B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of software testing, and in particular relates to a method and device for generating generalized variable force combination test data of an unmanned aerial vehicle flight control computer. Background Art
[0002] Drone applications are primarily categorized into civilian and military applications. Civilian applications encompass surveillance, mapping, and rescue, while military applications primarily focus on public safety and national defense. The widespread use of drones relies on their flight control computer systems, which handle critical tasks such as computing, control, information processing, and communications.
[0003] Flight control computer systems are extremely complex, primarily due to their intricate structure, numerous integrated functions, tightly coupled functions, diverse communication interfaces, and complex input parameters. Even the slightest error or accidental influence in such a complex system can cause significant financial loss and serious personal injury, with unpredictable consequences. To minimize losses, reduce injuries, and ensure quality and reliability, comprehensive flight control computer system testing is essential.
[0004] The flight control computer system receives a variety of flight status data transmitted by front-end sensors and makes timely and necessary controls based on the flight status. Ensuring the reliability of the flight control computer system requires comprehensive testing. In theory, full-factor testing is required for all possible sensor output data. The data volume for a full-factor test is the product of the number of possible values for each parameter. Table 1 shows some of the state parameters received by the flight control computer and their storage space. Because the range of possible values for each parameter is very large, the data volume required for a full-factor test would be astronomical, making it impossible to implement in practical testing. Combinatorial testing is a scientific and effective black-box testing method that can effectively detect the effects of interactions between flight control computer parameters using relatively small amounts of test data. Combinatorial testing can achieve the same results as full-factor testing using less test data, and therefore is often used in practice instead of full-factor testing.
[0005] Table 1 Some state parameters and storage space input to the flight control computer
[0006]
[0007]
[0008] In actual flight control computers, state parameters often interact with each other. These interactions correspond to actual physical meanings, and different interactions involve different parameters and a varying number of parameters. Sometimes two parameters interact, sometimes three, and sometimes more than three. Traditional methods for generating combinatorial test data treat all these parameter interactions equally, generating test data sets for a fixed number of parameter combinations. They rarely generate test data based on actual parameter interactions. To ensure the reliability of flight control computers, comprehensive testing of these parameter interactions is essential, but this is currently a significant lack.
[0009] Combinatorial test data sets with a variable number of interacting parameters are called variable-force combination test data. Variable-force combination tests are categorized into narrow variable-force and general variable-force. Narrow variable-force adds a t+1-dimensional force to a fixed t-dimensional force; general variable-force, on the other hand, has no fixed force; the overlapping forces between parameters can be arbitrary. While general variable-force is more widely used than narrow variable-force, there are currently fewer methods for generating general variable-force test data, and the generated tests are often redundant. Summary of the Invention
[0010] The present invention aims to solve the problem that there are few existing methods for generating generalized variable force combination test data for flight control computer systems and that the generated test data have much redundancy.
[0011] A method for generating generalized variable force combination test data for a UAV flight control computer includes the following steps:
[0012] First, the optimization target set is generated according to the combination of generalized variable strength values to be covered, and the relevant parameters of the GWO algorithm are initialized, including the parameters of the GWO optimization algorithm itself and the parameters used in the process of generating test data. In the specific initialization process,
[0013] Assume that the flight control computer system inputs k sensor monitoring parameters, namely P1, P2, ..., P k , the test data sets for each parameter selection are g1,g2,...,g k ;
[0014] Initialize the population size and iteration times of GWO optimization, and initialize each group in the population as a k-dimensional vector;
[0015] The generalized variable intensity coverage target value combination is represented by a "Map" data structure. The parameter combination corresponding to each t-dimensional coverage intensity parameter combination "Key" in the target value combination "Map" includes parameters parameter …,parameter i1,...,i t ∈[1,k]; Each index in the "Value" array corresponding to each t-dimensional coverage strength parameter combination represents a coverage target value combination; the integer set is used Represents all possible combinations of values for any t parameters, i.e., indexes;
[0016] Then, initialize the initial position of the wolf pack and calculate the individual fitness values of the wolf pack:
[0017] Initialize each individual position in the population. Each individual position represents a test data, which is a vector of dimension k, where each dimension corresponds to a parameter value. The initial value of the parameter corresponding to each dimension of each individual position is from the value interval [0, g j -1]; in order to prevent the blindness of the random initialization of the wolf pack position, after each individual position is randomly initialized, a target value combination that is not covered by the generated test data is randomly selected and placed in the individual position, so that the initial fitness value of the individual position is at least 1, thereby accelerating the individual optimization process;
[0018] The fitness value of each individual position of the wolf pack is set to the number of uncovered generalized variable strength value combinations contained in the individual position;
[0019] The optimal three alpha wolf positions α, β and δ are selected, the GWO parameters are updated, and the position of the group is updated according to the position of the GWO individual; the optimal three alpha wolf positions are obtained by PSO algorithm optimization, which searches for the optimal position based on the current position of the wolf pack and outputs the positions of the three alpha wolves after iterative update according to the optimization goal; the positions of the individual wolves are updated according to the positions of the three alpha wolves, and a move is completed, that is, an optimal test data is generated; if the generated test data covers all the targets, the algorithm ends, otherwise the process is restarted to generate the next test data until the end.
[0020] Furthermore, it is known that the number of values of each parameter corresponding to each value is g j is the number of values of the corresponding parameter, any combination of values The corresponding index solution process is:
[0021] (1) Order
[0022] (2) Let j be taken from 2 to t, and execute the loop index is the value combination The corresponding index.
[0023] Furthermore, the process of optimizing the positions of the three alpha wolves using the PSO algorithm includes the following steps:
[0024] (1) PSO parameter initialization
[0025] Initialize the number of particles, number of iterations, inertia weight ω and learning factors c1 and c2 of the particle swarm optimization algorithm;
[0026] (2) Evolution of wolf pack positions
[0027] In the optimization process, the position of the particle is used Represents a test data to be optimized, using the particle speed Indicates the current movement trend and degree of change;
[0028] During iterative updates, each particle in the population updates its velocity and position according to the two extreme values pBest and gBest. That is, at the t+1th iteration, particle i is updated by the following formula:
[0029]
[0030]
[0031] Where: ω is the inertia weight; c1 and c2 are learning factors; r1 and r2 are random numbers uniformly distributed between (0, 1); i is the i-th particle, assuming the particle size is M, then the range of i is 1, 2, ..., M; j is the j-th dimension, assuming the number of dimensions of the particle position is k, then the range of j is 1, 2, ..., k; pBest is the individual extreme value, indicating the optimal position of each particle in the entire iterative process; gBest is the global extreme value, indicating the optimal position of all particles in the entire iterative process;
[0032] If the particle's position If the parameter value range is exceeded, the particle returns to the previous position
[0033] (3) Update wolf pack location
[0034] After the population evolves, the individual extreme value and the global extreme value are updated; if the fitness value of the position of each individual particle is greater than its individual extreme value pBest, pBest is replaced, otherwise it is not replaced; after the individual extreme value pBest is updated, the fitness value of the individual extreme value pBest and the global extreme value gBest are compared one by one. If the fitness value is greater than the fitness value of gBest, gBest is replaced, otherwise it is not replaced;
[0035] (4) Disturbing the positions of individual wolves
[0036] For each dimension x in each particle position ij , in the range [0,g j-1] and updates it according to the set probability. The position of the particle after the update is expressed as if The fitness value is greater than The fitness value of Replace the position of particles
[0037] (5) Calculate the fitness value and determine the position of the leader
[0038] The PSO optimization iteratively updates the positions of individual wolves. After multiple iterations, the fitness values of the individual positions of the wolf pack are calculated, and the three positions with the largest fitness values are selected as the positions of the three alpha wolves. When selecting, first select the position of the best individual, denoted as α. Then update the coverage target, remove the value combination that appears in α from the coverage target, and select the best individual position from the remaining individual positions, denoted as β. Finally, use the same method to find the position of the best individual again, denoted as δ.
[0039] Furthermore, in the process of disturbing the positions of individual wolves, updates are performed with a probability of 50%.
[0040] Furthermore, the process of updating the GWO parameters includes the following steps:
[0041] The wolf pack individuals are updated according to formula (3):
[0042] X(t+1)=X(t)-A·D (3)
[0043] Where X(t+1) is the new position of the individual, X(t) is the current position of the individual; A is the coefficient matrix, D = |C·X p (t)-X(t)|, C=2r2, r2 is a random number in [0,1]; X p (t) is one of the three alpha, β, and δ alpha positions of the alpha wolf obtained by PSO optimization.
[0044] Furthermore, the coefficient matrix A=2a·r1-a; wherein, a=2-2t / T, t is the current number of iterations, T is the set number of iterations, and r1 is a random number in [0,1].
[0045] Furthermore, the process of updating the group's location based on the location of the GWO individual includes the following steps:
[0046] Each individual is updated by formula (4):
[0047]
[0048] X1=X α (t)-A1·D α(5)
[0049] X2=X β (t)-A2·D β (6)
[0050] X3=X δ (t)-A3·D δ (7)
[0051] D α =|C1·X α (t)-X(t)| (8)
[0052] D β =|C2·X β (t)-X(t)| (9)
[0053] D δ =|C3·X δ (t)-X(t)| (10)
[0054] Among them, X α (t), X β (t), X δ (t) are the current positions of α, β and δ, A1 to A3 are coefficient matrices, and C1 to C3 are random vectors.
[0055] Furthermore, in the process of judging whether the generated test data covers all targets, each time a test data is recorded, the covered target value combination is removed from the coverage target set, and then it is judged whether the coverage target set is empty. If it is empty, the test data set is output.
[0056] A computer storage medium stores at least one instruction, which is loaded and executed by a processor to implement the method for generating generalized variable force combination test data for a UAV flight control computer.
[0057] A device for generating generalized variable force combination test data for a UAV flight control computer, comprising a processor and a memory, wherein the memory stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the method for generating generalized variable force combination test data for a UAV flight control computer.
[0058] Beneficial effects of the present invention:
[0059] The present invention provides a method for generating generalized variable force combination test data for a flight control computer. The method can generate test data of any variable force combination, and the test coverage redundancy is very low. This not only ensures more comprehensive coverage of the sample space at a minimum cost, thereby making the data more consistent with the actual distribution of parameter states, thereby improving the accuracy and reliability of the generated data test, but also makes the effect of the generated data more consistent with the user's intention, making it more targeted and more convenient to use, and at the same time greatly improves the efficiency of generating data. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] Figure 1 Block diagram of the generalized variable force combination test data generation method based on GWO-PSO optimization. DETAILED DESCRIPTION
[0061] In order to solve the problems existing in the background technology, the present invention proposes a new generalized variable force combination test data generation method, which is intended to generate generalized variable force combination test data for the flight control computer. The present invention adopts the Grey Wolf Optimization (GWO) algorithm to dynamically optimize the combination test data. In view of the problem that the position of the alpha wolf is difficult to determine during the optimization process of the Grey Wolf Optimization algorithm, the Particle Swarm Optimization (PSO) algorithm is used to find the position of the alpha wolf. By fully combining the two algorithms and learning from each other's strengths to offset each other's weaknesses, arbitrary variable force combination test data can be generated, and the test coverage redundancy is very small. The present invention is further described below in conjunction with specific embodiments.
[0062] Specific implementation method 1: Combination Figure 1 To explain this embodiment,
[0063] This embodiment is a method for generating generalized variable force combination test data based on GWO-PSO optimization, which specifically includes the following steps:
[0064] Firstly, the optimization target set is generated according to the combination of generalized variable strength values to be covered, and the relevant parameters of the GWO algorithm are initialized;
[0065] Then, the GWO algorithm generates the position of the wolf pack and calculates the fitness value of each individual;
[0066] The group's position is then updated based on the position of the GWO individuals. During this update, the positions of the three alpha wolves are optimized using the PSO algorithm. The PSO algorithm optimizes based on the current pack's position and, after iterative updates based on the optimization objective, outputs the positions of the three alpha wolves. The positions of the individual wolves are then updated based on the positions of the three alpha wolves. Once this movement is completed, an optimal test data set is generated. If the generated test data covers all objectives, the algorithm terminates; otherwise, the process restarts to generate the next test data set until the algorithm is complete.
[0067] 1. Initialize the relevant parameters of the GWO algorithm
[0068] Initialization includes two parts: one is the initialization of the parameters of the GWO optimization algorithm itself; the other is the initialization of the parameters used in the process of generating test data. Assume that the sensor monitoring parameters input by the flight control computer system are k, namely P1, P2, ..., P k , the test data sets for each parameter selection are g1,g2,...,g k .
[0069] The population size of GWO optimization is initialized to 500, the number of iterations is initialized to 50, and each group in the population is initialized to a k-dimensional vector.
[0070] The generalized variable intensity coverage target value combination is represented by a "Map" data structure. Each t-dimensional coverage intensity parameter combination "Key" (parameter parameter …,parameter )(i1,...,i t Each index in the "Value" array corresponding to ∈[1,k] represents a coverage target value combination. That is, each key has a value array, which stores the specific value combinations in the parameter combination, and each value combination corresponds to an index (the index calculation process is described below).
[0071] Using integer sets Represents all possible combinations of values for any t parameters, i.e., index, g j is the number of values corresponding to the parameter, and the number of values corresponding to each parameter is known. Any combination of values The corresponding index solution process is:
[0072] (1) Order
[0073] (2) Let j be taken from 2 to t, and execute the loop index is the value combination The corresponding index.
[0074] An index is essentially a number, and the solution process involves finding the number corresponding to a value combination. Once this index is established, it will be accessed multiple times during algorithm execution. Each time the fitness value of a wolf pack location is calculated, the query is based on the number of indexes contained in that location. When generating an optimal test case, all target value combinations corresponding to the indexes contained in that location are deleted from the map. This means that any value combinations that have been covered are no longer considered.
[0075] 2. Initialize the initial position of the wolf pack and calculate the individual fitness value of the wolf pack
[0076] Initialize each individual position in the population. Each individual position represents a test data, which is a vector of dimension k, where each dimension corresponds to a parameter value. The initial value of the parameter corresponding to each dimension of each individual position is from the value interval [0, g j -1]. To prevent the blindness of the random initialization of the wolf pack's positions, after each individual position is randomly initialized, a target value combination that is not covered by the generated test data is randomly selected and placed in the individual's position, so that the initial fitness value of the individual position is at least 1, thereby accelerating the individual's optimization process.
[0077] The fitness value of each individual position of the wolf pack is set to the number of uncovered generalized variable strength value combinations contained in the individual position.
[0078] 3. Choose the best positions for the three alpha wolves
[0079] The update of the wolf pack's position is based on the positions of the three alpha wolves, beta wolves, and delta wolves. The positions of the three alpha wolves are optimized by PSO. The steps of finding are as follows:
[0080] (1) PSO parameter initialization
[0081] The number of particles in the particle swarm optimization algorithm is initialized to 200, the number of iterations is initialized to 30, the inertia weight ω = 0.5, and the learning factor c1 = c2 = 1.25.
[0082] (2) Evolution of wolf pack positions
[0083] In the optimization process, the position of the particle is used Represents a test data to be optimized, using the particle speed Indicates the current movement trend and degree of change.
[0084] During iterative updates, each particle in the population updates its velocity and position according to the two extreme values pBest and gBest. That is, at the t+1th iteration, particle i is updated by the following formula:
[0085]
[0086]
[0087] in:
[0088] ω——inertia weight;
[0089] c1, c2 – learning factors;
[0090] r1, r2——random numbers uniformly distributed between (0,1);
[0091] i——the i-th particle. If the particle size is M, then the range of i is 1, 2, ..., M;
[0092] j——jth dimension. If the dimension of particle position is k, then the range of j is 1, 2, ..., k;
[0093] pBest——individual extreme value, indicating the optimal position of each particle in the entire iteration process;
[0094] gBest——global extreme value, indicating the optimal position of all particles in the entire iterative process.
[0095] If the particle's position If the parameter value range is exceeded, the particle returns to the previous position
[0096] (3) Update wolf pack location
[0097] After the population evolves, the individual and global extreme values are updated. If the fitness value of each individual particle's position is greater than its individual extreme value pBest, pBest is replaced; otherwise, it is not replaced. After the individual extreme value pBest is updated, the fitness values of the individual extreme value pBest and the global extreme value gBest are compared one by one. If the fitness value is greater than the fitness value of gBest, gBest is replaced; otherwise, it is not replaced.
[0098] (4) Disturbing the positions of individual wolves
[0099] In the process of algorithm iteration, in order to prevent the population from falling into the local optimum, a global perturbation operation should be performed on the position of each particle. When perturbing, each dimension x in the position of each particle ij , in the range [0,g j -1] and updates it with a probability of 50%. The position of the particle after the update is expressed as if The fitness value is greater than The fitness value of Replace the position of particles
[0100] (5) Calculate fitness value and determine the position of the leader
[0101] The PSO optimization algorithm iteratively updates the positions of individual wolves. After 30 iterations, the fitness values of the individual positions are calculated, and the three positions with the highest fitness values are selected as the positions of the three alpha wolves. The selection process begins by first selecting the optimal individual position, denoted as α. Then, the coverage target is updated, and the value combinations that appear in α are removed from the coverage target. The optimal individual position is selected from the remaining individual positions, denoted as β. Finally, the same method is used to find the optimal individual position, denoted as δ.
[0102] 4. Update GWO parameters
[0103] The wolf pack individuals are updated according to formula (3):
[0104] X(t+1)=X(t)-A·D (3)
[0105] Where X(t+1) is the new position of the individual, and X(t) is the current position of the individual. A = 2a·r1-a is the coefficient matrix, a = 2-2t / T, t is the current iteration number, T is the set number of iterations, and r1 is a random number in [0,1].
[0106] D=|C·X p (t)-X(t)|, C=2r2, r2 is a random number in [0,1]. p (t) is one of the three alpha, β, and δ alpha positions of the alpha wolf obtained by PSO optimization.
[0107] 5. Update individual wolf pack locations
[0108] Each individual is updated by formula (4):
[0109]
[0110] X1=X α (t)-A1·D α (5)
[0111] X2=X β (t)-A2·D β (6)
[0112] X3=X δ (t)-A3·D δ (7)
[0113] D α =|C1·X α(t)-X(t)| (8)
[0114] D β =|C2·X β (t)-X(t)| (9)
[0115] D δ =|C3·X δ (t)-X(t)| (10)
[0116] Among them, X α (t), X β (t), X δ (t) are the current positions of α, β and δ, A1 to A3 are coefficient matrices, and C1 to C3 are random vectors.
[0117] 6. End Condition
[0118] After each test data is recorded, the covered target value combination is removed from the covered target set, and then it is determined whether the covered target set is empty. If it is empty, the test data set is output, otherwise it returns to the population individual initialization and continues to generate the next test data.
[0119] The generalized variable force combination test data generation method based on GWO-PSO optimization proposed in this invention can generate generalized variable force test data using less test data by combining the advantages of the gray wolf optimization algorithm and the particle swarm optimization algorithm, thereby making up for the current lack of an effective generalized variable force combination test data generation method.
[0120] At present, this method has been applied to the field testing of a certain type of UAV flight control computer. It can achieve high coverage and fast system-level testing of the flight control computer, solving the current problem of low test coverage. Specific implementation method two:
[0122] This embodiment is a computer storage medium, in which at least one instruction is stored. The at least one instruction is loaded and executed by a processor to implement the method for generating generalized variable force combination test data for a UAV flight control computer.
[0123] It should be understood that any method described herein may be provided as a computer program product, software, or computerized method, which may include a non-transitory machine-readable medium having instructions stored thereon, the instructions being used to program a computer system or other electronic device. The storage medium may include, but is not limited to, magnetic storage media, optical storage media; magneto-optical storage media including: read-only memory (ROM), random access memory (RAM), erasable programmable memory (e.g., EPROM and EEPROM), and flash memory layers; or other types of media suitable for storing electronic instructions. Specific implementation method three:
[0125] This embodiment is a device for generating generalized variable force combination test data for a UAV flight control computer. The device includes a processor and a memory. It should be understood that the device includes any device including a processor and a memory described in the present invention. The device may also include other units and modules that perform display, interaction, processing, control, and other functions through signals or instructions.
[0126] At least one instruction is stored in the memory, and the at least one instruction is loaded and executed by the processor to implement the method for generating generalized variable force combination test data for the UAV flight control computer.
[0127] The above examples are merely illustrative of the calculation model and process of the present invention and are not intended to limit the embodiments of the present invention. Persons skilled in the art will readily appreciate that other variations or modifications based on the above description are possible. This list of embodiments is not exhaustive; however, any obvious variations or modifications derived from the technical solution of the present invention remain within the scope of protection of the present invention.
Claims
1. A method for generating generalized variable force combination test data for a UAV flight control computer, characterized in that: The following steps are involved: First, the optimization target set is generated according to the combination of generalized variable strength values to be covered, and the relevant parameters of the GWO algorithm are initialized, including the parameters of the GWO optimization algorithm itself and the parameters used in the process of generating test data. In the specific initialization process, Assume that the flight control computer system inputs k sensor monitoring parameters, namely P1, P2, ..., P k , the test data sets for each parameter selection are g1,g2,...,g k ; Initialize the population size and iteration times of GWO optimization, and initialize each group in the population as a k-dimensional vector; The generalized variable intensity coverage target value combination is represented by a "Map" data structure. The parameter combination corresponding to each t-dimensional coverage intensity parameter combination "Key" in the target value combination "Map" includes parameters parameter …,parameter Each index in the "Value" array corresponding to each t-dimensional coverage strength parameter combination represents a coverage target value combination; the integer set Represents all possible combinations of values for any t parameters, i.e., indexes; Then, initialize the initial position of the wolf pack and calculate the individual fitness values of the wolf pack: Initialize each individual position in the population. Each individual position represents a test data, which is a vector of dimension k, where each dimension corresponds to a parameter value. The initial value of the parameter corresponding to each dimension of each individual position is from the value interval [0, g j -1]; in order to prevent the blindness of the random initialization of the wolf pack position, after each individual position is randomly initialized, a target value combination that is not covered by the generated test data is randomly selected and placed in the individual position, so that the initial fitness value of the individual position is at least 1, thereby accelerating the individual optimization process; The fitness value of each individual position of the wolf pack is set to the number of uncovered generalized variable strength value combinations contained in the individual position; The optimal three alpha wolf positions α, β and δ are selected, the GWO parameters are updated, and the position of the group is updated according to the position of the GWO individual; the optimal three alpha wolf positions are obtained by PSO algorithm optimization, which searches for the optimal position based on the current position of the wolf pack and outputs the positions of the three alpha wolves after iterative update according to the optimization goal; the positions of the individual wolves are updated according to the positions of the three alpha wolves, and a move is completed, that is, an optimal test data is generated; if the generated test data covers all the targets, the algorithm ends, otherwise the process is restarted to generate the next test data until the end.
2. The method for generating generalized variable force combination test data for a UAV flight control computer according to claim 1, characterized in that: The number of values of each parameter corresponding to each value is known g j is the number of values of the corresponding parameter, any combination of values The corresponding index solution process is: (1) Order (2) Let j be taken from 2 to t, and execute the loop index is the value combination The corresponding index.
3. The method for generating generalized variable force combination test data for a UAV flight control computer according to claim 2, characterized in that: The process of optimizing the positions of the three alpha wolves using the PSO algorithm includes the following steps: (1) PSO parameter initialization Initialize the number of particles, number of iterations, inertia weight ω and learning factors c1 and c2 of the particle swarm optimization algorithm; (2) Evolution of wolf pack positions In the optimization process, the position of the particle is used Represents a test data to be optimized, using the particle speed Indicates the current movement trend and degree of change; During iterative updates, each particle in the population updates its velocity and position according to the two extreme values pBest and gBest. That is, at the t+1th iteration, particle i is updated by the following formula: Where: ω is the inertia weight; c1 and c2 are learning factors; r1 and r2 are random numbers uniformly distributed between (0, 1); i is the i-th particle, assuming the particle size is M, then the range of i is 1, 2, ..., M; j is the j-th dimension, assuming the number of dimensions of the particle position is k, then the range of j is 1, 2, ..., k; pBest is the individual extreme value, indicating the optimal position of each particle in the entire iterative process; gBest is the global extreme value, indicating the optimal position of all particles in the entire iterative process; If the particle's position If the parameter value range is exceeded, the particle returns to the previous position (3) Update wolf pack location After the population evolves, the individual extreme value and the global extreme value are updated; if the fitness value of the position of each individual particle is greater than its individual extreme value pBest, pBest is replaced, otherwise it is not replaced; after the individual extreme value pBest is updated, the fitness value of the individual extreme value pBest and the global extreme value gBest are compared one by one. If the fitness value is greater than the fitness value of gBest, gBest is replaced, otherwise it is not replaced; (4) Disturbing the positions of individual wolves For each dimension x in each particle position ij , in the range [0,g j -1] and updates it according to the set probability. The position of the particle after the update is expressed as if The fitness value is greater than The fitness value of Replace the position of particles (5) Calculate the fitness value and determine the position of the leader The PSO optimization iteratively updates the positions of individual wolves. After multiple iterations, the fitness values of the individual positions of the wolf pack are calculated, and the three positions with the largest fitness values are selected as the positions of the three alpha wolves. When selecting, first select the position of the best individual, denoted as α. Then update the coverage target, remove the value combination that appears in α from the coverage target, and select the best individual position from the remaining individual positions, denoted as β. Finally, use the same method to find the position of the best individual again, denoted as δ.
4. The method for generating generalized variable force combination test data for a UAV flight control computer according to claim 3, characterized in that: In the process of disturbing the position of individual wolves, the update is performed with a probability of 50%.
5. The method for generating generalized variable force combination test data for a UAV flight control computer according to claim 4, characterized in that: The process of updating the GWO parameters includes the following steps: The wolf pack individuals are updated according to formula (3): X(t+1)=X(t)-A·D (3) Where X(t+1) is the new position of the individual, X(t) is the current position of the individual; A is the coefficient matrix, D = |C·X p (t)-X(t)|, C=2r2, r2 is a random number in [0,1]; X p (t) is one of the three alpha, β, and δ alpha positions of the alpha wolf obtained by PSO optimization.
6. The method for generating generalized variable force combination test data for a UAV flight control computer according to claim 5, characterized in that: The coefficient matrix A=2a·r1-a; wherein a=2-2t / T, t is the current iteration number, T is the set iteration number, and r1 is a random number in [0,1].
7. The method for generating generalized variable force combination test data for a UAV flight control computer according to claim 5 or 6, characterized in that: The process of updating the group's location based on the location of the GWO individual includes the following steps: Each individual is updated by formula (4): X1=X α (t)-A1·D α (5) X2=X β (t)-A2·D β (6) X3=X δ (t)-A3·D δ (7) D α =|C1·X α (t)-X(t)| (8) D β =|C2·X β (t)-X(t)| (9) D δ =|C3·X δ (t)-X(t)| (10) Among them, X α (t), X β (t), X δ (t) are the current positions of α, β and δ, A1 to A3 are coefficient matrices, and C1 to C3 are random vectors.
8. The method for generating generalized variable force combination test data for a UAV flight control computer according to claim 7, characterized in that: In the process of judging whether the generated test data covers all the targets, each time a test data is recorded, the covered target value combination is removed from the coverage target set, and then it is judged whether the coverage target set is empty. If it is empty, the test data set is output.
9. A computer storage medium, characterized in that The storage medium stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the method for generating generalized variable force combination test data for a UAV flight control computer as described in any one of claims 1 to 8.
10. A device for generating generalized variable force combination test data for a UAV flight control computer, characterized in that: The device includes a processor and a memory, wherein the memory stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the method for generating generalized variable force combination test data for a UAV flight control computer as described in one of claims 1 to 8.
Citation Information
Patent Citations
Combined test case generation method based on CS-SPSO algorithm
CN110334026A
Intelligent angle measurement training sample generation method using unmanned aerial vehicle platform
CN112098926A