Target scene generation method, device, server and storage medium

Through the method of automatically generating test scenarios, the initial vector set is constructed using the initial scene code and configuration information, and the variation, mean and cross-processing is performed, which solves the problem of time-consuming and labor-consuming design of test scenarios and improves the testing efficiency and scene availability.

CN113887129BActive Publication Date: 2025-07-08SHENZHEN TCL NEW-TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111106204.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-22
Publication Date
2025-07-08
Estimated Expiration
2041-09-22

AI Technical Summary

Technical Problem

In the intelligent manufacturing industry, the existing technology relies on manual design of test scenarios, which consumes a lot of manpower and time and is inefficient.

Method used

By obtaining the initial scene code and configuration information, the initial vector collection is constructed, variation processing, mean operation, cross-processing and selection processing are performed, and the target scenarios are automatically generated to reduce human intervention.

Benefits of technology

It realizes automated generation of test scenarios, saves manpower and time, ensures that the generated variation vectors are moderate, and improves the availability and efficiency of the target scenario.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113887129B_ABST
    Figure CN113887129B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a target scenario generation method, apparatus, server, and storage medium; obtaining an initial scenario code and scenario configuration information; constructing an initial vector set according to the initial scenario code and scenario configuration information; obtaining a mutation vector corresponding to the initial feature vector to obtain a mutation vector set; performing a mean operation on the mutation vectors in the mutation vector set to obtain an intermediate vector set; performing a crossover operation on the intermediate vectors in the intermediate vector set and the initial feature vector to generate a difference vector set; determining a target scenario according to the difference vector set and the initial vector set, where the target scenario includes one or more of the difference vectors or the initial feature vectors. By performing mutation processing, mean processing, crossover processing, and selection processing on the initial vector set, the target scenario is automatically derived and replicated based on the original scenario, thereby minimizing manual intervention and saving a large amount of manpower and time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of testing, and specifically to a method, apparatus, server, and storage medium for generating a target scenario. Background Art

[0002] Currently, in intelligent manufacturing, in order to win a larger market share, in addition to optimizing the functions of products, controlling the quality of products is also a crucial link. When conducting quality control on products, it is usually necessary to construct a large number of test scenarios and conduct tests on multiple aspects of the products to ensure that the quality of the products passes.

[0003] However, test scenarios usually rely on manual design and deployment, and when a large number of test scenarios are required, it is extremely easy to consume a large amount of manpower and time. Summary of the Invention

[0004] Embodiments of the present application provide a method, apparatus, server, and storage medium for generating a target scenario, which can reduce the manual intervention in the generation of test scenarios and automatically generate a target scenario.

[0005] An embodiment of the present application provides a method for generating a target scenario, including: obtaining an initial scenario code and scenario configuration information; constructing an initial vector set according to the initial scenario code and scenario configuration information, where the initial vector set includes a plurality of initial feature vectors, and the initial feature vectors represent scenario code link features; obtaining mutation vectors corresponding to the initial feature vectors to obtain a mutation vector set; performing a mean operation on the mutation vectors in the mutation vector set to obtain an intermediate vector set, where the intermediate vector set includes a plurality of intermediate vectors; performing a crossover operation on the intermediate vectors in the intermediate vector set and the initial feature vectors to generate a difference vector set, where the difference vector set includes a plurality of difference vectors; and determining a target scenario according to the difference vector set and the initial vector set, where the target scenario includes one or more of the difference vectors or the initial feature vectors.

[0006] An embodiment of the present application also provides a target scenario generation device, including: an acquisition module, configured to acquire an initial scenario code and scenario configuration information; a construction module, configured to construct an initial vector set according to the initial scenario code and scenario configuration information, the initial vector set includes a plurality of initial feature vectors, and the initial feature vectors represent scenario code link features; a mutation module, configured to acquire mutation vectors corresponding to the initial feature vectors to obtain a mutation vector set; a mean processing module, configured to perform a mean operation on the mutation vectors in the mutation vector set to obtain an intermediate vector set, the intermediate vector set includes a plurality of intermediate vectors; a crossover module, configured to perform a crossover operation on the intermediate vectors in the intermediate vector set and the initial feature vectors to generate a difference vector set, the difference vector set includes a plurality of difference vectors; a selection module, configured to determine a target scenario according to the difference vector set and the vector set, and the target scenario includes one or more of the difference vectors or feature vectors.

[0007] An embodiment of the present application also provides a server, including a memory storing multiple instructions; the processor loads the instructions from the memory to execute the steps in any one of the target scenario generation methods provided by the embodiments of the present application.

[0008] An embodiment of the present application also provides a computer-readable storage medium, the computer-readable storage medium stores multiple instructions, and the instructions are suitable for being loaded by a processor to execute the steps in any one of the target scenario generation methods provided by the embodiments of the present application.

[0009] Embodiments of the present application can acquire an initial scenario code and scenario configuration information, construct an initial vector set based on the scenario configuration information and the initial scenario code, and then realize the automatic derivation and replication of a target scenario based on the original scenario by performing mutation processing, mean processing, crossover processing, and selection processing on the initial vector set, thereby minimizing manual intervention and saving a large amount of manpower and time. Moreover, the mean processing can ensure that the generated mutation vectors do not differ too much from each other, ensuring the effectiveness of the crossover processing and further improving the usability of automatically generating the target scenario. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] To more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the accompanying drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative efforts.

[0011] Figure 1 It is a scenario architecture diagram of the target scenario generation method provided by the embodiments of the present application;

[0012] Figure 2It is another scenario architecture diagram of the target scenario generation method provided by the embodiments of this application;

[0013] Figure 3 It is a schematic flowchart of the target scenario generation method provided by an embodiment of this application;

[0014] Figure 4 It is a schematic flowchart of the target scenario generation method provided by another embodiment of this application;

[0015] Figure 5 It is a simplified implementation flowchart of a server provided by the embodiments of this application;

[0016] Figure 6 It is a detailed deployment diagram of a server provided by the embodiments of this application;

[0017] Figure 7 It is a schematic flowchart of generating an initial vector set provided by the embodiments of this application;

[0018] Figure 8 It is a schematic flowchart of the mutation operation provided by the embodiments of this application;

[0019] Figure 9 It is a schematic flowchart of the mean operation provided by the embodiments of this application;

[0020] Figure 10 It is a schematic diagram of the crossover operation provided by the embodiments of this application;

[0021] Figure 11 It is a schematic flowchart of the target scenario generation method provided by another embodiment of this application;

[0022] Figure 12 It is a simplified implementation flowchart of multiple servers provided by this application;

[0023] Figure 13 It is a detailed deployment diagram of multiple servers provided by the embodiments of this application;

[0024] Figure 14 It is a schematic structural diagram of the target scenario generation device provided by the embodiments of this application;

[0025] Figure 15 It is a schematic structural diagram of the server provided by the embodiments of this application. Detailed implementation manners

[0026] The following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative efforts belong to the scope of protection of the present application.

[0027] The embodiments of the present application provide a target scenario generation method, device, server, and storage medium.

[0028] Among them, the target scenario generation device can be specifically integrated in the server. The server can be a single server or a server cluster composed of multiple servers.

[0029] The following will be described in detail respectively. It should be noted that the serial numbers of the following embodiments are not used to limit the preferred order of the embodiments.

[0030] Please refer to Figure 1 , which shows a scenario architecture diagram provided by the embodiments of the present application. Figure 1 In the case of only one server, a trigger device is provided at the front end. The trigger device can be an electronic device, which can refer to devices such as mobile phones, tablet computers, smart Bluetooth devices, laptops, or personal computers (PCs). Users can start and operate the front-end interface of the trigger to perform operations such as starting, initializing scenario deployment, querying, and scenario exporting. In the embodiments of the present application, it is used to trigger the start of the server to run the algorithm and upload the initialization scenario code script file and configuration file to the server. An algorithm script for implementing the target scenario generation method is deployed on the main server, and some data generated by the main server can be saved in the MySQL database.

[0031] Please refer to Figure 2 , which shows another scenario architecture diagram provided by the embodiments of the present application. Figure 2 In the case of multiple servers, the operations at the front end are the same as those in Figure 1 . When there are multiple servers, k8s can intervene in the main server and allocate some operations to the slave servers for execution. Some data generated by each slave server can be saved in the MySQL database.

[0032] In this embodiment, a target scenario generation method is provided. As shown in Figure 3 , the specific process of the target scenario method can include the following steps: S110 to S160.

[0033] S110. Obtain the initial scenario code and scenario configuration information.

[0034] The initial scenario code and scenario configuration information refer to the code and configuration information of the initial scenario, where the scenario configuration information is preset. In some embodiments, when obtaining the initial scenario code and scenario configuration information, the user may use an electronic device to send a trigger command to the server, and the server can be started according to the trigger command. The electronic device uploads the initial scenario code, scenario configuration information, etc. to the started server to instruct the server to perform subsequent steps according to the initial scenario code, scenario configuration information, etc.

[0035] S120. Construct an initial vector set according to the initial scenario code and scenario configuration information. The initial vector set includes multiple initial feature vectors, and the initial feature vectors represent scenario code link features.

[0036] After receiving the initial scenario code and scenario configuration information, the server can process the initial scenario code based on the scenario configuration information. Among them, the scenario configuration information may include a key range. When processing the initial scenario code based on the scenario configuration information, it may be to obtain the code within the key range in the initial scenario code, and the code within the key range may be referred to as the key code. Specifically, the key range refers to the basic information constituting the initial scenario, such as the code function body path, environment dependency library path, strong and weak dependencies between function methods, main function path, code block of the initial scenario, code entry, etc.

[0037] After determining the key code, the key code can be parameterized to obtain the initial feature vectors in the initial vector set, so as to convert the code scenario into a structured scenario represented by parameters, which is convenient for subsequent processing.

[0038] When parameterizing the key code, it may be parameterized based on the scenario configuration information. The scenario configuration information may include a configuration table file, which is essentially stored in the form of key-value pairs for code and feature values, that is, the scenario configuration information includes the correspondence between the code and the feature values. First, the key code can be classified according to the type to obtain the key parameters of the initial feature vectors; then, the key parameters are filled with values based on the scenario configuration information to obtain the feature values corresponding to the key parameters.

[0039] Among them, when classifying the key code according to the type, it may be classified according to the functions that the key code can achieve, and then the key parameters are filled with values to obtain the feature values corresponding to the key parameters, and these feature values constitute the initial feature vectors. Suppose the initial vector set is represented by x n Then the initial feature vectors include x i (1), x i (2), x i (3), …, x i(n) n initial eigenvectors, where each initial eigenvector includes eigenvalue of m dimensions, namely x1(1), x2(1), …, x m (1), and each initial eigenvector represents the code link feature of the initial scenario. For example, it can be the builder link representing function A, or the function generator link of function B, etc.

[0040] In some embodiments, in order to ensure the correctness of the constructed initial eigenvector and avoid problems such as missing or misaligned construction, the to-be-verified eigenvector obtained after value filling can be verified, and the to-be-verified initial eigenvector passing the verification is used as the initial eigenvector. Specifically, when filling values for the key parameters to obtain the eigenvalues corresponding to the key parameters, the eigenvector composed of these eigenvalues can be used as the to-be-verified eigenvector; the to-be-verified eigenvector is verified, the to-be-verified eigenvector passing the verification is used as the initial eigenvector, and the to-be-verified eigenvector failing the verification is reconstructed.

[0041] Specifically, when verifying the to-be-verified eigenvector, the bidirectional maximum matching algorithm can be used to verify the to-be-verified vector. Specifically, the pre-set forward list and reverse list can be obtained; the to-be-verified eigenvector is respectively matched forward with the forward list and the reverse list to obtain the first forward matching result corresponding to the forward list and the second forward matching result corresponding to the reverse list; if the first forward matching result and the second forward matching result are the same, the to-be-verified eigenvector is used as the initial eigenvector; if the first forward matching result and the second forward matching result are different, the forward list and the reverse list are respectively sorted in ascending order; the to-be-verified eigenvector is respectively matched backward with the forward list and the reverse list after ascending order sorting to obtain the first reverse matching result corresponding to the forward list and the second reverse matching result corresponding to the reverse list; if the first reverse matching result and the second reverse matching result are the same, the to-be-verified eigenvector is used as the initial eigenvector; if the first reverse matching result and the second reverse matching result are different, return to execute classifying the key code features by type to obtain the key parameters of the initial eigenvector and subsequent steps.

[0042] That is to say, it is necessary to verify the constructed to-be-verified eigenvector. The to-be-verified vector passing the verification represents the eigenvector that can be used, that is, the initial eigenvector, and the to-be-verified vector failing the verification needs to be reconstructed. The to-be-verified eigenvector passing the verification, that is, the initial eigenvector, can be stored in a fixed position to obtain the initial vector set.

[0043] S130. Obtain the mutation vector corresponding to the initial eigenvector to obtain a mutation vector set.

[0044] After obtaining the initial vector set, multiple initial feature vectors in the initial vector set can be obtained, and corresponding mutation vector sets can be obtained by mutating the initial feature vectors. When obtaining the mutation vectors corresponding to the initial feature vectors to obtain the mutation vector set, a specified mutation strategy and the number of mutations can be obtained; determine the vectors to be mutated and the difference vectors from the initial vector set, where the two initial feature vectors that make up the difference vector are both different from the vector to be mutated; according to the mutation strategy and the scaling factor, perform weighted summation of the difference vector and the vector to be mutated to obtain the mutation vector corresponding to the vector to be mutated; re-determine the difference vector from the initial vector set, and execute the step of performing weighted summation of the difference vector and the vector to be mutated according to the mutation strategy and the scaling factor until the number of mutation vectors corresponding to the vector to be mutated is the number of mutations; return to execute the steps of determining the vector to be mutated and the difference vector from the initial vector set and subsequent steps until each initial feature vector in the initial vector set obtains its corresponding number of mutation vectors equal to the number of mutations.

[0045] Among them, the difference vector refers to the vector obtained by subtracting two different initial feature vectors. The above mutation process can be understood as that each initial feature vector in the initial vector set serves as the vector to be mutated. Then, for a vector to be mutated, first, two initial feature vectors different from the vector to be mutated are selected from the initial vector set, and the difference between these two initial feature vectors is obtained to get the difference vector. For example, if the vector to be mutated is A, and the two selected initial feature vectors are B and C, the difference vector is B - C.

[0046] After obtaining the difference vectors, according to the mutation strategy and the obtained scaling factor, perform weighted summation of the difference vector and the vector to be mutated to obtain 1 mutation vector of the vector to be mutated, and repeat the above operation to obtain the number of mutation vectors equal to the number of mutations of the vector to be mutated. If the number of mutations is 10, then a vector to be mutated can obtain 10 corresponding mutation vectors. Repeat the above process to obtain 10 mutation vectors corresponding to each initial feature vector in the initial vector set. If there are n initial feature vectors in the initial vector set, then there are n × the number of mutations mutation vectors in the mutation vector set. Among them, the larger the value of the number of mutations, the greater the degree of adaptive change. The specific value of the number of mutations can be set according to actual needs and will not be specifically limited here.

[0047] The mutation strategy refers to the mutation direction of the initial feature vectors. The mutation strategy adopted in this application can be a randomly specified mutation strategy.

[0048] After mutating each initial feature vector in the initial vector set, a corresponding mutation vector set can be obtained, where the mutation vector set includes multiple mutation vectors. After obtaining the mutation vector set, the mutation vectors can be further processed.

[0049] S140. Perform a mean operation on the mutant vectors in the mutant vector set to obtain an intermediate vector set, where the intermediate vector set includes multiple intermediate vectors.

[0050] In the obtained mutant vector set, an initial feature vector corresponds to the number of mutation times of mutant vectors. If the differences between mutant vectors are too large, it will reduce the value of subsequent crossover operations. To avoid this situation, a mean operation can be performed on the obtained mutant vectors. When performing a mean operation on the mutant vectors in the mutant vector set to obtain an intermediate vector set, for the number of mutant vectors corresponding to each initial feature vector, the mutant vectors can be first optimized for extreme values to obtain the optimized number of mutant vectors; according to the number of mutation times and the softness, a mean operation is performed on the optimized number of mutant vectors to obtain the intermediate vector corresponding to each initial feature vector. Among them, the role of the softness is to set the upper and lower limits of the mean operation.

[0051] When optimizing the extreme values of mutant vectors, the τ-EO algorithm can be used to optimize the extreme values to obtain the optimized mutant vectors. After optimizing the extreme values of each mutant vector, a mean operation can be performed on the number of mutant vectors corresponding to an initial feature vector to obtain the intermediate vector corresponding to the initial feature vector. Among them, first optimizing the extreme values of mutant vectors and then performing a mean operation on the optimized mutant vectors can avoid the situation where it is impossible to optimize the differential balance in the subsequent mean operation due to extreme value errors.

[0052] When performing extreme value optimization, for each mutant vector, the eigenvalues corresponding to the mutant vector can be sorted in a preset order to obtain an eigenvalue set; a target eigenvalue is selected from the eigenvalue set based on a preset probability function; when the target eigenvalue is an extreme value, the target eigenvalue is replaced with a random number, and the random number is generated according to a preset probability distribution; when the target eigenvalue is not an extreme value, the step of selecting a target eigenvalue from the eigenvalue set based on the preset probability function and subsequent steps are returned until all extreme values in the eigenvalue set are replaced to obtain the optimized mutant vector.

[0053] In some embodiments, the mutation vector may carry identification information, and the identification information represents the initial feature vector corresponding to the mutation vector to determine which initial feature vector the mutation vector is mutated from. For example, the identification information of mutation vector A1 may be A, the identification information of mutation vector B2 may be B, and the identification information of mutation vector A2 may be A. Then, mutation vectors A1 and A2 are mutated from the initial feature vector A, and mutation vector B2 is mutated from the initial feature vector B. Thus, the number of mutation vectors corresponding to the initial feature vector can be obtained, and then the mean operation is performed on these mutation vectors to obtain the intermediate vector corresponding to the initial feature vector, so as to obtain the intermediate vector set, and then the next step is performed based on the intermediate vector set.

[0054] S150. Perform a cross operation on the intermediate vectors in the intermediate vector set and the initial feature vector to generate a set of difference vectors, where the set of difference vectors includes multiple difference vectors.

[0055] After obtaining the intermediate vector set, the intermediate vectors in the intermediate vector set and the initial feature vector can be subjected to a cross operation to generate a set of difference vectors. Specifically, the number of intermediate vectors in the intermediate vector set is the same as the number of initial feature vectors in the initial feature vector set, and one initial feature vector corresponds to one intermediate vector. Performing a cross operation on the initial feature vector and its corresponding intermediate vector can obtain the corresponding difference vector.

[0056] It can be understood that a difference vector and an initial feature vector have eigenvalue features of m dimensions. For each intermediate vector, an estimated value and a cross operator are obtained, where the cross operator is a random floating point number between 0 and 1; when the estimated value is less than or equal to the cross operator, the intermediate eigenvalue is taken as the target value; when the estimated value is greater than the cross operator, the eigenvalue of the initial feature vector is taken as the target value; the vector composed of the target values is determined as the difference vector. For example, when the eigenvalue of the j-th dimension of the intermediate vector, the estimated value is less than the cross operator, then the eigenvalue of the j-th dimension of the difference vector is the eigenvalue of the j-th dimension of the intermediate vector. When the eigenvalue of the (j + 1)-th dimension of the intermediate vector, the estimated value is greater than the cross operator, then the eigenvalue of the (j + 1)-th dimension of the difference vector is the eigenvalue of the (j + 1)-th dimension of the initial feature vector.

[0057] S160. Determine the target scenario according to the set of difference vectors and the set of initial vectors, where the target scenario includes one or more of the difference vectors or feature vectors.

[0058] After obtaining the difference vectors, better target individuals can be selected from the set of difference vectors and the set of initial vectors through a greedy selection strategy to form the target scenario.

[0059] Specifically, when determining the target scenario based on the difference vector set and the initial vector set, for each difference vector, the fitness value of the difference vector can be obtained; the fitness value of the initial feature vector can be obtained; if the fitness value of the difference vector is less than the fitness value of the initial feature vector, the difference vector is used as the target vector; if the fitness value of the difference vector is greater than or equal to the fitness value of the initial feature vector, the initial feature vector is used as the target vector; the target vector set composed of the target vectors is used as the target scenario.

[0060] That is to say, after obtaining the difference vector set, a selection is made between the difference vector and the initial feature vector. Specifically, the fitness values of the difference vector and the initial feature vector can be calculated, and by determining the magnitude relationship between the fitness value of the difference vector and the fitness value of the initial feature vector, the selected target vector is determined to obtain the final target scenario.

[0061] The target scenario is obtained by self - change of the initial scenario code and scenario configuration information of the initial scenario. To ensure that the obtained target scenario can be used, after obtaining the target scenario, the target scenario can be run for a trial to determine whether the target scenario is abnormal. Specifically, running the target scenario for a trial can be to schedule the virtual container service to run the target scenario for a trial to obtain the running result, where the running result is used to reflect whether the target scenario is abnormal; if the running result indicates that the target scenario is abnormal, the abnormal target scenario is reported to the cloud.

[0062] In some embodiments, when there are multiple servers, where one server is the master server and the other servers are all slave servers, multiple servers can be used to accelerate the verification of the target scenario. Specifically, when verifying the target scenario, the other slave servers can be started in the form of containers, and the verification of the target scenario can be scheduled to the slave servers. The slave servers verify the target scenario and receive the running results returned by the other slave servers.

[0063] In some embodiments, when there are multiple servers, that is, one server is the master server and the other servers are all slave servers, a server cluster composed of multiple servers can also be used to accelerate the foregoing crossover and selection processes, that is, to accelerate S150 and S160 to improve the overall rate of the algorithm. Specifically, the intermediate vector set is used as the initial particle swarm; the optimal solution in the initial particle swarm is solved according to the standard PSO algorithm to generate a difference vector set. After obtaining the difference vector set, the difference vector set can be used as the initial particle swarm; the optimal solution in the initial particle swarm is solved according to the standard PSO algorithm to generate the target scenario.

[0064] The above process of accelerating S150 and S160 can be executed by the master server. The master server speeds up the algorithm through the PSO algorithm. When the running resources are too large during the execution of the PSO algorithm, it can be distributed and accelerated to other slave servers through load balancing scheduling. In actual use, it can be that the user selects the acceleration function at the front end to trigger the acceleration through the PSO algorithm.

[0065] Specifically, when scheduling the verification of the target scenario to the slave server for distributed acceleration and scheduling the solution of the optimal solution in the initial particle population of the PSO algorithm to the slave server for distributed acceleration, the first slave server can be selected according to the performance parameters of the slave server; copy the target source code to the first slave server to process the target data through the first slave server, where the target data includes the difference vector set, the target scenario, and the intermediate vector set; when the performance parameters of the first slave server meet the preset conditions, select the second slave server; homomorphically copy the target source code to the second slave server and start the second slave server; receive the retrieval tag returned by the second slave server, where the retrieval tag corresponds to the target data; when it is determined that the same retrieval tag exists in the memory of the first slave server, close the query of the target data corresponding to the retrieval tag by the second slave server and obtain the next retrieval tag; when it is determined that the same retrieval tag does not exist in the memory of the first slave server, run the processing of the target data corresponding to the retrieval tag through the second slave server.

[0066] The target scenario generation method provided by the embodiments of the present application obtains the initial scenario code and scenario configuration information, constructs the initial vector set based on the scenario configuration information and the initial scenario code, and then generates a new target scenario by performing mutation processing, mean processing, crossover processing, and selection processing on the initial vector set. Among them, the mean processing can ensure that the generated mutation vectors do not differ too much from each other, ensure the effectiveness of the crossover processing, and further improve the usability of the generated target scenario.

[0067] Please refer to Figure 4 which shows the target scenario generation method provided by another embodiment of the present application. The execution subject of this method can be the master service mentioned in the foregoing embodiments and is applicable to Figure 1 the architecture shown in Figure 5 and Figure 6 . Figure 5 shows a simplified flowchart of the implementation process with only one server, Figure 6 shows a detailed deployment diagram with only one server.

[0068] S210. Obtain the initial scenario code and scenario configuration information.

[0069] S220. Obtain the code within the key range in the initial scenario code, where the code within the key range is the key code.

[0070] After obtaining the initial scenario code and scenario configuration information, the scenario configuration information may include a key range. The key range refers to the range of the initial scenario code that needs to be extracted. The code within the key range in the initial scenario code is extracted as the key code. For example, the code block, data information block, dependency logic, dependency library, scenario configuration, and code entry of the scenario can be extracted as the key code.

[0071] In some embodiments, the scenario configuration information may further include the number of reads, and the server reads the initial scenario code in a loop according to the number of reads.

[0072] S230. Parameterize the key code to obtain the initial feature vector in the initial vector set.

[0073] After obtaining the key code, the key code can be parameterized to construct the initial feature vector. Parameterization means converting the coded scenario into a structured scenario represented by parameters for subsequent processing. Specifically, refer to Figure 7 , and constructing the initial feature vector may include steps S231 to S234.

[0074] S231. Classify the key code according to the type to obtain the key parameter of the initial feature vector, where the classification according to the type is to classify according to the type of function implemented by the key code.

[0075] When parameterizing the key code, the key code can be classified according to the type first to obtain the key parameter of the initial feature vector. The key parameter can refer to the code or the type of classification. Among them, the classification according to the type is to classify according to the type of function implemented by the key code, that is, each initial feature vector represents the code link feature of a scenario. In some embodiments, the validator can monitor the hook in the manner of a background server, report to the cloud when an exception occurs, and return an error message to prompt the user to check the code and scenario configuration information.

[0076] S232. Determine the eigenvalue corresponding to the key parameter according to the correspondence between the code and the eigenvalue to obtain the feature vector to be verified.

[0077] After obtaining the key parameters, the eigenvalue corresponding to the key parameter can be determined according to the correspondence between the code and the eigenvalue, where the correspondence between the code and the eigenvalue can be obtained through the scenario configuration file. It can be understood that the key parameter is obtained through the code, that is, there is a correspondence between the code and the key parameter. Then, according to the correspondence between the key parameter and the code, the corresponding code can be determined. According to the correspondence between the code and the eigenvalue, the eigenvalue corresponding to the key parameter can be determined, so that the feature vector to be verified can be obtained.

[0078] S233. Verify the feature vector to be verified through the bidirectional maximum matching algorithm.

[0079] S234. Use the verified vector to be verified as the initial feature vector, and reconstruct the vector to be verified that fails the verification.

[0080] In some embodiments, the feature vector to be verified can be directly used as the initial feature vector.

[0081] In some embodiments, in order to avoid missing or misaligning the constructed initial feature vector, the verified vector to be verified is used as the initial feature vector, and the vector to be verified that fails the verification is reconstructed.

[0082] Specifically, it can be to verify the feature vector to be verified through the bidirectional maximum matching algorithm. Obtain the pre-set forward list and reverse list; perform forward matching on the feature vector to be verified with the forward list and the reverse list respectively to obtain the first forward matching result corresponding to the forward list and the second forward matching result corresponding to the reverse list; if the first forward matching result is the same as the second forward matching result, it can be considered that the feature vector to be verified passes the verification; if the first forward matching result is different from the second forward matching result, sort the forward list and the reverse list in ascending order respectively; perform reverse matching on the feature vector to be verified with the forward list and the reverse list after ascending order respectively to obtain the first reverse matching result corresponding to the forward list and the second reverse matching result corresponding to the reverse list; if the first reverse matching result is the same as the second reverse matching result, it can be considered that the feature vector to be verified passes the verification; if the first reverse matching result is different from the second reverse matching result, it can be considered that the feature vector to be verified fails the verification.

[0083] S240. Obtain the mutation vector corresponding to the initial feature vector to obtain a set of mutation vectors.

[0084] After obtaining the initial vector set, the initial vector set and the scenario configuration information can be read through the vector searcher, so that the mutation vector corresponding to the initial feature vector can be obtained to obtain a set of mutation vectors. Specifically, please refer to Figure 8, obtaining the mutation vector may include the following steps S241 to S246.

[0085] S241. Obtain the specified mutation strategy and the number of mutations.

[0086] After obtaining the initial vector set, the mutation vector can be obtained based on the initial feature vectors. Before performing the mutation operation on the initial feature vectors, the specified mutation strategy and the number of mutations can be obtained through the scenario configuration information. The mutation strategy refers to the mutation direction of the initial feature vectors, and any one mutation strategy can be arbitrarily specified.

[0087] S242. Determine the vector to be mutated and the difference vector from the initial vector set, and the two initial feature vectors constituting the difference vector are both different from the vector to be mutated.

[0088] When obtaining the mutation vector based on the initial feature vectors, the vector to be mutated and the difference vector can be determined from the initial vector set, where the difference vector is obtained by subtracting two initial feature vectors that are different from each other and both different from the vector to be mutated. For example, the initial vector set is X n (X i (1), X i (2)……X i (n)), the feature vector to be mutated can be X i (1), and the other two initial feature vectors can be any two different initial feature vectors other than X i (1), such as X i (3) and X i (5), and the difference vector is X i (3)-X i (5).

[0089] S243. According to the mutation strategy and the scaling factor, perform weighted summation on the difference vector and the vector to be mutated to obtain the mutation vector corresponding to the vector to be mutated.

[0090] After obtaining the difference vector and the initial feature vectors, the difference vector and the vector to be mutated can be weighted and summed according to the mutation strategy and the scaling factor to obtain the mutation vector corresponding to the vector to be mutated. Specifically, the mutation vector can be calculated according to the following formula:

[0091] H i (g) = X p1 (g)+F·(X p2 (g)-X p3 (g));

[0092] Among them, H i (g) represents the mutation vector, X p1(g) represents the vector to be mutated, F is the scaling factor, and its value range is [0.2, 1.8]. (X p2 (g) - X p3 (g)) is the difference vector. The result of the difference vector can be stored in the difference vector bucket, and the numerical value of the vector summation can be obtained from the difference vector bucket and operated on to obtain the mutated vector.

[0093] S244. Determine whether the number of mutated vectors corresponding to the vector to be mutated is equal to the number of mutation times. If so, execute S245; if not, execute S246.

[0094] After obtaining the mutated vectors corresponding to the vector to be mutated, it can be determined whether the number of mutated vectors corresponding to the vector to be mutated is equal to the number of mutation times. If the number of mutated vectors equal to the number of mutation times has been obtained, it indicates that the current vector to be mutated has been mutated for the number of mutation times, and S245 can be continued to execute.

[0095] If the number of mutated vectors corresponding to the vector to be mutated is less than the number of mutation times, it indicates that the current vector to be mutated has not been mutated completely, and S246 can be continued to execute.

[0096] S245. Determine whether each initial feature vector in the initial vector set has obtained the corresponding number of mutated vectors equal to the number of mutation times. If so, obtain the mutated vector set; if not, execute S242.

[0097] After determining that the vector to be mutated has obtained the corresponding number of mutated vectors equal to the number of mutation times, it can be continued to judge whether each initial feature vector in the initial vector set has obtained the corresponding number of mutated vectors equal to the number of mutation times.

[0098] If each initial feature vector in the initial vector set has obtained the corresponding number of mutated vectors equal to the number of mutation times, it indicates that each initial feature vector has been used as the vector to be mutated and mutated for the number of mutation times. The set composed of all the obtained mutated vectors is used as the mutated vector set.

[0099] If there exists any initial feature vector in the initial vector set that has not obtained the corresponding number of mutated vectors equal to the number of mutation times, it indicates that the mutation is not completed, and it can be returned to continue to execute S242 and the subsequent steps until each initial feature vector in the initial vector set has obtained the corresponding number of mutated vectors equal to the number of mutation times.

[0100] S246. Re - determine the difference vector from the initial vector set.

[0101] If the number of mutated vectors corresponding to the vector to be mutated is less than the number of mutation times, it indicates that the vector to be mutated has not reached the set number of mutation times. Therefore, the differential vector can be determined again from the initial vector set. After determining the differential vector, return to execute S243 until the number of mutated vectors corresponding to the vector to be mutated is equal to the number of mutation times.

[0102] S250. Perform a mean operation on the mutated vectors in the mutated vector set to obtain an intermediate vector set. The intermediate vector set includes multiple intermediate vectors.

[0103] After obtaining the mutated vector set, the mutated vector set includes the mutated vectors obtained by mutating each initial feature vector in the initial vector set. It can be understood that each initial feature vector is mutated the number of mutation times to obtain the corresponding number of mutated vectors. To ensure that the mutated vectors do not differ too much from each other, a mean operation can be performed on the mutated vectors corresponding to the same initial feature vector. It should be noted that if the mutated vectors differ too much, the value of the subsequent crossover operation will be reduced, and the output crossover operation result will be recognized as abnormal and reported during the boundary check. Specifically, refer to Figure 9 , and the mean operation on the mutated vectors can include the following steps: S251 to S252.

[0104] S251. For the number of mutated vectors corresponding to each initial feature vector, perform extreme value optimization on the mutated vectors to obtain the optimized number of mutated vectors.

[0105] For each initial feature vector, there are the number of mutated vectors corresponding to it. For each mutated vector, extreme value optimization can be performed on the mutated vector first to obtain the optimized number of mutated vectors corresponding to the initial feature vector.

[0106] When performing extreme value optimization on the mutated vectors, the τ-EO algorithm can be used. Specifically, the eigenvalues corresponding to the mutated vectors can be obtained, and these eigenvalues can be sorted in a preset order to obtain an eigenvalue set. The eigenvalue can refer to the value that the mutated vector itself has. After obtaining the eigenvalue set, the target eigenvalue is selected from the eigenvalue set based on a preset probability function. Among them, the preset probability function can refer to the formula: P k ∝k -τ , 1≤k≤n and τ∈(0, +∞) and the default setting is 2 100 .

[0107] It should be noted that in this embodiment, the preset order is sorted from small to large, that is, the smallest eigenvalue is ranked first, and the largest eigenvalue is ranked nth. According to the preset probability function, the smaller τ is, the smaller the difference in selection probability is, and the smaller the variable is, the easier it is to be selected. When τ tends to 0, the selection opportunities for each value are equal, and it becomes a completely random algorithm. When it tends to infinity, the τ-EO algorithm becomes the basic EO algorithm.

[0108] Select a target eigenvalue from the eigenvalue set according to the preset probability function. If the target eigenvalue is an extreme value, replace the target eigenvalue with a random number, where the random number is generated according to the preset probability distribution; if the target eigenvalue is not an extreme value, return to execute the step of selecting the target eigenvalue from the eigenvalue set based on the preset probability function and subsequent steps until all the extreme values in the eigenvalue set are replaced, and it is considered that the optimization of the mutation vector is completed, and the optimized mutation vector is obtained.

[0109] S252. Perform a mean operation on the optimized number of mutation vectors according to the number of mutation times and the softness to obtain an intermediate vector corresponding to each of the initial feature vectors.

[0110] Optimize the number of mutation vectors corresponding to the initial feature vector to obtain the optimized number of mutation vectors. Obtain the preset number of mutation times and softness, and perform a mean operation on the optimized number of mutation vectors to obtain an intermediate vector corresponding to the initial feature vector.

[0111] Specifically, the mean operation on the optimized number of mutation vectors can be implemented with reference to the following formula: V(i) = 1 / g * ∑(i - n)F * H i (g), where V(i) represents the intermediate vector, g represents the number of mutation times, n represents the softness, and its value ranges from 0.1 to 0.9, F is the scaling factor, and H i (g) is the mutation vector, where i is a fixed value of 1.

[0112] It can be understood that the above process is for the number of mutation vectors corresponding to one initial feature vector. Since each initial feature vector corresponds to the number of mutation vectors, therefore, S251 to S252 can be executed for the number of mutation vectors corresponding to each initial feature vector to obtain the intermediate vector corresponding to each initial feature vector, so that the set composed of the intermediate vectors can be used as the intermediate vector set.

[0113] S260. Perform a crossover operation on the intermediate vectors in the intermediate vector set and the initial feature vectors to generate a difference vector set, and the difference vector set includes multiple difference vectors.

[0114] After obtaining the intermediate vector set, the intermediate vector can be cross-operated with the initial feature vector to generate a difference vector, and further, the set composed of the difference vectors is used as the difference vector set. Specifically, the cross-operation can be performed according to the following formula.

[0115]

[0116] Among them, CR is a cross operator, which can be randomly generated by a CR generator. The generation logic is a random floating point number between [0, 1], and no secondary processing is required according to the fitness function; rand is an estimated value, which can be generated by an estimated value generator; V i,j represents the eigenvalue of the j-th dimension of the i-th difference vector; h i,j represents the eigenvalue of the j-th dimension of the i-th intermediate vector; x i,j represents the eigenvalue of the j-th dimension of the i-th initial feature vector. It should be noted that the CR generation logic is an adaptive adjustment logic process. At the same time, non-empty and out-of-bounds checks can be performed on the rand boundary and the CR boundary to ensure that the cross-operation direction is correct and a difference vector set is generated. See also Figure 10 for a schematic diagram showing the cross-operation.

[0117] S270. Determine the target scenario according to the difference vector set and the initial vector set. The target scenario includes one or more of the difference vectors or the initial feature vectors.

[0118] After obtaining the difference vector set, the generated difference vectors can be received through a scalable queue container, and the better difference vectors can be obtained through a greedy selection strategy. That is to say, the target scenario can be determined according to the difference vector set and the initial vector set, where the target scenario includes one or more of the difference vectors or the initial feature vectors. That is to say, after the cross-operation, each initial feature vector in the initial vector set corresponds to a difference vector, and one can be selected from the difference vector and the initial feature vector as a target vector in the target scenario. Specifically, the selection formula can be used to make a selection between the difference vector and the initial feature vector.

[0119]

[0120] Among them, f(V i (g)) represents the fitness value of the difference vector, f(Xi(g)) represents the fitness value of the initial feature vector, X i(g + 1) represents the target vector in the target scenario, and f() is the fitness function. Usually, the fitness function is related to the objective function. This formula means that if the optimal value of the fitness function is lower than the difference vector, the intermediate vector is taken as the target vector; otherwise, the current vector is retained, that is, the initial feature vector is taken as the target vector. The set of target vectors formed by the target vectors is used as the target scenario. For each target vector, the obtained solution is better than or equal to the initial feature vector, and all optimizations are achieved through mutation, crossover, and selection.

[0121] After obtaining the target scenario, the virtual container server can be scheduled to conduct a trial run on the target scenario to obtain the running result, which can reflect whether the target scenario is abnormal; if the running result indicates that the target scenario is abnormal, the abnormal target scenario can be reported to the cloud; if the running result indicates that the target scenario is normal, no processing is required.

[0122] The target scenario generation method provided by the embodiments of the present application performs a mutation operation on the initial feature vector. After obtaining the mutated vector, the mutated vector is first subjected to extreme value optimization and then mean operation. Extreme value optimization can avoid the inability to optimize differential balance in subsequent means, and mean operation can reduce the differences between mutated vectors and improve the effect of subsequent crossover operations, further improving the usability of the generated target scenario.

[0123] Please refer to Figure 11 , which shows the target scenario generation method provided by another embodiment of the present application. This method focuses on describing the acceleration process using a server cluster on the basis of the foregoing embodiment and is applicable to Figure 2 the architecture diagram shown in Figure 12 and Figure 13 , Figure 12 which shows a simplified implementation process diagram of multiple servers, Figure 13 and

[0124] S310. Obtain the initial scenario code and scenario configuration information.

[0125] S320. Construct an initial vector set according to the initial scenario code and scenario configuration information. The initial vector set includes multiple initial feature vectors, and the initial feature vectors represent the scenario code link features.

[0126] S330. Obtain the mutated vectors corresponding to the initial feature vectors to obtain a mutated vector set.

[0127] S340. Perform a mean operation on the mutated vectors in the mutated vector set to obtain an intermediate vector set, and the intermediate vector set includes multiple intermediate vectors.

[0128] S350. Cross - operate the intermediate vectors in the intermediate vector set with the initial feature vector to generate a difference vector set, where the difference vector set includes multiple difference vectors.

[0129] S360. Determine a target scenario based on the difference vector set and the initial vector set, where the target scenario includes one or more of the difference vectors or the initial feature vectors.

[0130] S370. Verify the target scenario.

[0131] After obtaining the target scenario, a virtual container server can be scheduled to conduct a trial run on the target scenario to obtain a running result, which can reflect whether the target scenario is abnormal; if the running result indicates that the target scenario is abnormal, the abnormal target scenario can be reported to the cloud; if the running result indicates that the target scenario is normal, no processing is required.

[0132] The above S310 to S360 can refer to the corresponding parts in the foregoing embodiments. To avoid repetition, they will not be elaborated here. Among them, S330 can be called a mutation operation, S340 can be called a mean operation, S350 can be called a cross - operation, S360 is a selection operation, and S370 is a verification operation.

[0133] S380. Accelerate the cross - operation and the selection operation according to the standard PSO algorithm.

[0134] When there are multiple servers, one of them is the master server and the rest are slave servers. When using the acceleration function, the cross - operation and the selection operation can be accelerated according to the standard PSO algorithm.

[0135] Specifically, when performing the cross - operation, the intermediate vector set can be used as the initial particle population, and the standard PSO algorithm can be directly used. Define the number of particle populations N = Vi(g)*rand(), and calculate the particle velocity Vi using the PSO algorithm, where pbest and gbest are the position values of Vi(g), and the initial values are randomly generated values. Specifically, the following formula can be used to solve vi.

[0136] v i = v i + c1×rand()×(pbest i - x i ) + c2×rand()×(gbest i - x i )

[0137] Among them, pbest i refers to the optimal solution found by the particle itself, and gbest iIt refers to the optimal solution currently found in the entire particle population. c1 and c2 are learning factors, rand() is a random number between (0, 1), and x i refers to the current position of the particle. By continuously updating the position information of the particle and making appropriate evaluations to find the optimal solution, i.e., the difference vector.

[0138] Similarly, when accelerating the selection operation, the set of difference vectors can be used as the initial particle population, and the target scenario can be solved in the above manner.

[0139] Generally, when accelerating the crossover operation and the selection operation according to the PSO algorithm, it is still executed by the main server. However, in some embodiments, when the acceleration occupies too much resources, the main server can schedule the acceleration process to other slave servers for distributed acceleration.

[0140] In some embodiments, the verification operation can also be scheduled to a slave server to improve the operation rate of verification.

[0141] Specifically, the scheduling process can be to select a first slave server according to the performance parameters of the slave server, copy the target source code to the first slave server, so as to process the target data through the first slave server. The target data includes a set of difference vectors, a target scenario, and a set of intermediate vectors. That is to say, the target source code includes the source code for PSO acceleration and the source code for verifying the target scenario.

[0142] When the performance parameters of the first slave server meet the preset conditions, a second slave server is selected. When the performance parameters of the first slave server meet the preset conditions, it indicates that too much resources are occupied, and a second slave server can be selected for load balancing. After selecting the second slave server, the target source code can be copied to the second slave server and the second slave server can be started. After the second slave server is started, the second slave server accesses the target data, so that the main server can receive the retrieval mark returned by the second slave server. The retrieval mark corresponds to the target data. After the main server receives the retrieval mark, it can determine whether there is the same retrieval mark in the memory of the first slave server. If there is the same retrieval mark, it indicates that the first slave server has processed the target data corresponding to this retrieval mark. Therefore, the query of the target data corresponding to the retrieval mark by the second slave server can be closed, and the next retrieval mark can be obtained. After obtaining the next retrieval mark, it is continued to determine whether there is the same next retrieval mark in the memory of the first slave server.

[0143] If it is determined that there is no same retrieval mark in the memory of the first slave server, it indicates that the first slave server has not processed the target data corresponding to this retrieval mark. Therefore, the processing of the target data corresponding to this retrieval mark can be run through the second slave server. To achieve the load balancing of multiple servers.

[0144] Specifically, a k8s dynamic load balancing docker container can be adopted. Among them, k8s runs on the main server, and docker virtualized containers are distributed on slave servers. The slave servers perform PSO acceleration operations and verification of the target scenario, and the main server performs task allocation, resource scheduling, etc.

[0145] In actual use, the performance monitoring can default to using the hardware resource occupancy of k8s as the data source. Monitor the GC log through a hook program, that is, view all processes started by the virtual machine using jps (JVM process Status), the full name of the main class executed, and the JVM startup parameters, and monitor the virtual machine information using jstat (JVM Statistics Monitoring Tool), and set the CPU threshold range [50, 100]; the memory threshold [30, 70].

[0146] If the CPU of the first slave server is 100% and the memory is greater than 70%, the second slave server can be started using k8s. If the CPU of the first slave server is lower than 50%, the resources of the first slave server can be shut down and recycled using k8s. Specifically, canary rolling deployment can be used to start the deployment of the second slave server and converge the resources of the first slave server.

[0147] After starting the second server, the source code for scenario verification and PSO acceleration can be copied to the docker of the second server. The main server can run the database connect. The second slave server can build a connection request to obtain the target data. The following takes the target data as an example of the target scenario for illustration.

[0148] The second slave server runs the scenario verification code, polls the target scenario database and returns the retrieval mark to the main server; if the main server determines that the same retrieval mark exists in the memory of the first slave server, it closes the current data query of the second slave server and loops to the next data query. If it determines that the same retrieval mark does not exist in the memory of the first slave server, it verifies the target data corresponding to the retrieval mark through the second slave server.

[0149] Similarly, if the CPU of the second slave server is 100% and the memory is greater than 70%, the third slave server can be started using k8s. If the CPU of the second slave server is lower than 50%, the resources of the second slave server can be shut down and recycled using k8s. In this way, when the running resource occupancy is too large, it can be evenly scheduled to other slave servers for distributed acceleration to speed up the generation of the target scenario and the verification rate of the target scenario.

[0150] To better implement the above method, an embodiment of the present application further provides a target scenario generation device, which can be specifically integrated in a server. The server can be a single server or a server cluster composed of multiple servers.

[0151] For example, in this embodiment, taking the target scenario generation device being specifically integrated in a server as an example, the method of the embodiment of the present application will be described in detail.

[0152] For instance, as Figure 14 shown, the target scenario generation device may include an acquisition module 410, a construction module 420, a mutation module 430, a mean processing module 440, a crossover module 450, and a selection module 460.

[0153] The acquisition module 410 is configured to acquire an initial scenario code and scenario configuration information; the construction module 420 is configured to construct an initial vector set according to the initial scenario code and scenario configuration information, where the initial vector set includes a plurality of initial feature vectors, and the initial feature vectors represent scenario code link features; the mutation module 430 is configured to acquire mutation vectors corresponding to the initial feature vectors to obtain a mutation vector set; the mean processing module 440 is configured to perform a mean operation on the mutation vectors in the mutation vector set to obtain an intermediate vector set, where the intermediate vector set includes a plurality of intermediate vectors; the crossover module 450 is configured to perform a crossover operation on the intermediate vectors in the intermediate vector set and the initial feature vectors to generate a difference vector set, where the difference vector set includes a plurality of difference vectors; the selection module 460 is configured to determine a target scenario according to the difference vector set and the vector set, and the target scenario includes one or more of the difference vectors or feature vectors.

[0154] In some embodiments, the scenario configuration information includes a key range, and the construction module 420 is further configured to acquire the code in the key range in the initial scenario code, where the code in the key range is the key code; parameterize the key code to obtain the initial feature vectors in the initial vector set.

[0155] In some embodiments, the scenario configuration information further includes the correspondence between codes and eigenvalue, and the building module 420 is further configured to classify the key codes according to types to obtain the key parameters of the initial feature vector, where the classification according to types is performed according to the types of functions implemented by the key codes; determine the eigenvalues corresponding to the key parameters according to the correspondence between the codes and the eigenvalue to obtain the feature vector to be verified; obtain a preset forward list and a reverse list; perform forward matching on the feature vector to be verified with the forward list and the reverse list respectively to obtain a first forward matching result corresponding to the forward list and a second forward matching result corresponding to the reverse list; if the first forward matching result is the same as the second forward matching result, use the feature vector to be verified as the initial feature vector; if the first forward matching result is different from the second forward matching result, perform a forward sorting on the forward list and the reverse list respectively; perform reverse matching on the feature vector to be verified with the forward list and the reverse list after the forward sorting respectively to obtain a first reverse matching result corresponding to the forward list and a second reverse matching result corresponding to the reverse list; if the first reverse matching result is the same as the second reverse matching result, use the feature vector to be verified as the initial feature vector; if the first reverse matching result is different from the second reverse matching result, return to execute the classification of the key code features according to types to obtain the key parameters of the initial feature vector and subsequent steps.

[0156] In some embodiments, the mutation module 430 is further configured to obtain a specified mutation strategy and the number of mutations;

[0157] Determine a vector to be mutated and a difference vector from the initial vector set, and the two initial feature vectors constituting the difference vector are both different from the vector to be mutated; perform weighted summation on the difference vector and the vector to be mutated according to the mutation strategy and the scaling factor to obtain the mutated vector corresponding to the vector to be mutated; re-determine the difference vector from the initial vector set, and execute the step of performing weighted summation on the difference vector and the vector to be mutated according to the mutation strategy and the scaling factor until the number of mutated vectors corresponding to the vector to be mutated reaches the number of mutations; return to execute the step of determining the vector to be mutated and the difference vector from the initial vector set and subsequent steps until each initial feature vector in the initial vector set obtains its respective corresponding number of mutated vectors equal to the number of mutations.

[0158] In some embodiments, the mean processing module 440 further includes an extreme value optimization unit and a mean unit. The extreme value optimization unit is configured to perform extreme value optimization on the mutation vectors corresponding to the number of mutation times for each initial feature vector to obtain the optimized mutation vectors corresponding to the number of mutation times. The mean unit is configured to perform a mean operation on the optimized mutation vectors corresponding to the number of mutation times according to the number of mutation times and the softness to obtain an intermediate vector corresponding to each initial feature vector.

[0159] In some embodiments, the extreme value optimization unit is further configured to, for each mutation vector, sort the eigenvalues corresponding to the mutation vector in a preset order to obtain an eigenvalue set; select a target eigenvalue from the eigenvalue set based on a preset probability function; when the target eigenvalue is an extreme value, replace the target eigenvalue with a random number, where the random number is generated according to a preset probability distribution; when the target eigenvalue is not an extreme value, return to execute the step of selecting a target eigenvalue from the eigenvalue set based on the preset probability function and subsequent steps until all extreme values in the eigenvalue set are replaced to obtain the optimized mutation vector.

[0160] In some embodiments, the crossover module 450 is further configured to, for each intermediate vector, obtain an estimated value and a crossover operator, where the crossover operator is a random floating point number between 0 and 1; when the estimated value is less than or equal to the crossover operator, obtain the eigenvalue of the intermediate vector as the target value; when the estimated value is greater than the crossover operator, obtain the eigenvalue of the initial feature vector as the target value; and determine the vector composed of the target values as the difference vector.

[0161] In some embodiments, the selection module 460 is further configured to, for each difference vector, obtain the fitness value of the difference vector; obtain the fitness value of the initial feature vector; if the fitness value of the difference vector is less than the fitness value of the initial feature vector, use the difference vector as the target vector; if the fitness value of the difference vector is greater than or equal to the fitness value of the initial feature vector, use the initial feature vector as the target vector; and use the set of target vectors composed of the target vectors as the target scenario.

[0162] In some embodiments, the target scenario generation device 400 further includes a verification module. After determining the target scenario according to the difference vector set and the vector set, the verification module is configured to schedule the virtual container service to perform a trial run on the target scenario to obtain a running result, where the running result is used to reflect whether the target scenario is abnormal; if the running result indicates that the target scenario is abnormal, report the abnormal target scenario to the cloud.

[0163] In some embodiments, the target scene generation device 400 further includes a PSO acceleration module. When performing a cross operation on the intermediate vectors in the intermediate vector set and the initial feature vector to generate a difference vector set, the PSO acceleration module is configured to use the intermediate vector set as an initial particle swarm; solve the optimal solution in the initial particle swarm according to the standard PSO algorithm to generate a difference vector set; when determining the target scene according to the difference vector set and the initial vector set, the PSO acceleration module is configured to use the difference vector set as an initial particle swarm; solve the optimal solution in the initial particle swarm according to the standard PSO algorithm to generate a target scene.

[0164] In some embodiments, the target scene generation device 400 further includes a load balancing module. The load balancing module is configured to select a first slave server according to the performance parameters of the slave servers; copy the target source code to the first slave server to process the target data through the first slave server, where the target data includes a difference vector set, a target scene, and an intermediate vector set; when the performance parameters of the first slave server meet a preset condition, select a second slave server; copy the target source code to the second slave server and start the second slave server; receive a retrieval tag returned by the second slave server, where the retrieval tag corresponds to the target data; when it is determined that the same retrieval tag exists in the memory of the first slave server, close the query of the target data corresponding to the retrieval tag by the second slave server and obtain the next retrieval tag; when it is determined that the same retrieval tag does not exist in the memory of the first slave server, run the processing of the target data corresponding to the retrieval tag through the second slave server.

[0165] In specific implementation, each of the above modules or units can be implemented as an independent entity, or can be combined arbitrarily to be implemented as the same or several entities. For the specific implementation of each of the above units, reference can be made to the foregoing method embodiments, which will not be elaborated herein.

[0166] As can be seen from the above, the target scene generation device in this embodiment can obtain an initial scene code and configuration information, construct an initial vector set based on the configuration information and the initial scene code, and then generate a new target scene by performing mutation processing, mean processing, cross processing, and selection processing on the initial vector set. Among them, the mean processing can ensure that the generated mutation vectors do not differ too much from each other, ensure the effectiveness of the cross processing, further improve the usability of automatically generating the target scene, and save a large amount of labor costs.

[0167] Correspondingly, an embodiment of the present application further provides a server, as Figure 15 shown Figure 15The following is a schematic structural diagram of the server provided by the embodiment of the present application. The server 500 includes a processor 501 having one or more processing cores, a memory 502 having one or more computer-readable storage media, and a computer program stored on the memory 502 and executable on the processor. Among them, the processor 501 is electrically connected to the memory 502. Those skilled in the art can understand that the server structure shown in the figure does not constitute a limitation on the server, and it may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.

[0168] The processor 501 is the control center of the server 500, connecting various parts of the entire server 500 through various interfaces and lines. By running or loading software programs and / or modules stored in the memory 502, and calling data stored in the memory 502, it executes various functions of the server 500 and processes data, thereby monitoring the server 500 as a whole.

[0169] In the embodiment of the present application, the processor 501 in the server 500 will load the instructions corresponding to the processes of one or more application programs into the memory 502 according to the following steps, and the processor 501 will run the application programs stored in the memory 502 to implement various functions:

[0170] Obtain the initial scenario code and scenario configuration information;

[0171] Construct an initial vector set according to the initial scenario code and scenario configuration information. The initial vector set includes multiple initial feature vectors, and the initial feature vectors represent scenario code link features;

[0172] Obtain the mutation vectors corresponding to the initial feature vectors to obtain a mutation vector set;

[0173] Perform a mean operation on the mutation vectors in the mutation vector set to obtain an intermediate vector set. The intermediate vector set includes multiple intermediate vectors;

[0174] Perform a cross operation on the intermediate vectors in the intermediate vector set and the initial feature vectors to generate a difference vector set. The difference vector set includes multiple difference vectors;

[0175] Determine the target scenario according to the difference vector set and the initial vector set. The target scenario includes one or more of the difference vectors or the initial feature vectors.

[0176] For the specific implementation of each of the above operations, reference can be made to the previous embodiments, and details will not be elaborated here.

[0177] Optionally, as Figure 15As shown, the server 500 further includes: a touch display screen 503, a radio frequency circuit 504, an audio circuit 505, an input unit 506, and a power supply 507. Among them, the processor 501 is electrically connected to the touch display screen 503, the radio frequency circuit 504, the audio circuit 505, the input unit 506, and the power supply 507 respectively. Those skilled in the art can understand that Figure 4 the server structure shown in does not constitute a limitation on the server, and it may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.

[0178] The touch display screen 503 can be used to display a graphical user interface and receive operation instructions generated by the user acting on the graphical user interface. The touch display screen 503 may include a display panel and a touch panel. Among them, the display panel can be used to display information input by the user or provided to the user, as well as various graphical user interfaces of the server. These graphical user interfaces can be composed of graphics, text, icons, videos, and any combination thereof. Optionally, the display panel can be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc. The touch panel can be used to collect touch operations of the user on or near it (such as the user using a finger, a stylus, or any suitable object or accessory to operate on the touch panel or near the touch panel), and generate corresponding operation instructions, and the operation instructions execute the corresponding program. Optionally, the touch panel can include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the touch orientation of the user, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into touch point coordinates, and then sends it to the processor 501, and can receive commands sent by the processor 501 and execute them. The touch panel can cover the display panel. After the touch panel detects a touch operation on or near it, it transmits it to the processor 501 to determine the type of touch event. Subsequently, the processor 501 provides corresponding visual output on the display panel according to the type of touch event. In the embodiment of the present application, the touch panel and the display panel can be integrated into the touch display screen 503 to achieve input and output functions. However, in some embodiments, the touch panel and the touch panel can be implemented as two independent components to achieve input and output functions. That is, the touch display screen 503 can also be used as a part of the input unit 506 to achieve the input function.

[0179] The radio frequency circuit 504 can be used to transmit and receive radio frequency signals to establish wireless communication with a network device or other servers through wireless communication, and transmit and receive signals with the network device or other servers.

[0180] The audio circuit 505 can be used to provide an audio interface between the user and the server through a speaker and a microphone. The audio circuit 505 can convert the received audio data into an electrical signal and transmit it to the speaker, which converts it into a sound signal for output. On the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 505, converted into audio data, and then the audio data is output to the processor 501 for processing. After that, it is sent to another server, for example, through the radio frequency circuit 504, or the audio data is output to the memory 502 for further processing. The audio circuit 505 may also include an earphone jack to provide communication between the peripheral earphone and the server.

[0181] The input unit 506 can be used to receive input digital, character information or user feature information (such as fingerprint, iris, facial information, etc.), and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function controls.

[0182] The power supply 507 is used to supply power to each component of the server 500. Optionally, the power supply 507 can be logically connected to the processor 501 through a power management system, so as to realize functions such as management of charging, discharging, and power consumption management through the power management system. The power supply 507 may also include any components such as one or more DC or AC power supplies, a recharge system, a power failure detection circuit, a power converter or inverter, and a power status indicator.

[0183] Although Figure 15 not shown in the figure, the server 500 may also include a camera, a sensor, a Wi-Fi module, a Bluetooth module, etc., which will not be elaborated here.

[0184] In the above embodiments, the descriptions of the various embodiments have their own emphases. For the parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0185] As can be seen from the above, the server provided in this embodiment can obtain the initial scene code and the scene configuration information, construct the initial vector set based on the scene configuration information and the initial scene code, and then realize the automatic derivation and replication of the target scene based on the original scene by performing mutation processing, mean processing, crossover processing, and selection processing on the initial vector set, thereby minimizing manual intervention and saving a large amount of manpower and time. And the mean processing can ensure that the generated mutant vectors are not too different from each other, ensure the effectiveness of the crossover processing, and further improve the usability of the automatically generated target scene.

[0186] Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructions or by controlling relevant hardware through instructions. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.

[0187] To this end, an embodiment of the present application provides a computer-readable storage medium, which stores multiple computer programs that can be loaded by a processor to execute the steps in any one of the target scenario generation methods provided by the embodiments of the present application. For example, the computer program can execute the following steps:

[0188] Obtain an initial scenario code and scenario configuration information;

[0189] Construct an initial vector set according to the initial scenario code and scenario configuration information, where the initial vector set includes multiple initial feature vectors, and the initial feature vectors represent scenario code link features;

[0190] Obtain the mutation vectors corresponding to the initial feature vectors to obtain a mutation vector set;

[0191] Perform a mean operation on the mutation vectors in the mutation vector set to obtain an intermediate vector set, where the intermediate vector set includes multiple intermediate vectors;

[0192] Perform a cross operation on the intermediate vectors in the intermediate vector set and the initial feature vectors to generate a difference vector set, where the difference vector set includes multiple difference vectors;

[0193] Determine a target scenario according to the difference vector set and the initial vector set, where the target scenario includes one or more of the difference vectors or the initial feature vectors.

[0194] For the specific implementation of each of the above operations, reference may be made to the previous embodiments, which will not be elaborated herein.

[0195] Among them, the storage medium may include: read-only memory (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk, etc.

[0196] Since the computer programs stored in the storage medium can execute the steps in any one of the target scenario generation methods provided by the embodiments of the present application, the beneficial effects that can be achieved by any one of the target scenario generation methods provided by the embodiments of the present application can be realized. For details, refer to the previous embodiments, which will not be elaborated herein.

[0197] The above has introduced in detail a target scenario generation method, apparatus, server, and storage medium provided by the embodiments of the present application. Specific examples are used herein to elaborate on the principles and implementation manners of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application; at the same time, for those skilled in the art, according to the idea of the present application, there will be changes in the specific implementation manners and application scopes. In summary, the content of this specification should not be construed as a limitation to the present application.

Claims

1. A method for generating a target scenario, characterized in that Including: Obtain an initial scenario code and scenario configuration information; Construct an initial vector set according to the initial scenario code and scenario configuration information, where the initial vector set includes a plurality of initial feature vectors, and the initial feature vectors represent scenario code link features; Obtain mutation vectors corresponding to the initial feature vectors to obtain a mutation vector set; Perform a mean operation on the mutation vectors in the mutation vector set to obtain an intermediate vector set, where the intermediate vector set includes a plurality of intermediate vectors; Perform a cross operation on the intermediate vectors in the intermediate vector set and the initial feature vectors to generate a difference vector set, where the difference vector set includes a plurality of difference vectors; Determine a target scenario according to the difference vector set and the initial vector set, where the target scenario includes one or more of the difference vectors or the initial feature vectors; The scenario configuration information includes a key range, and constructing the initial vector set according to the initial scenario code and scenario configuration information includes: Obtain the code in the key range in the initial scenario code, where the code in the key range is the key code; Parameterize the key code to obtain the initial feature vectors in the initial vector set; In the process of performing a cross operation on the intermediate vectors in the intermediate vector set and the initial feature vectors to generate a difference vector set, it further includes: Use the intermediate vector set as an initial particle swarm; Solve the optimal solution in the initial particle swarm according to the standard PSO algorithm to generate a difference vector set; In the process of determining the target scenario according to the difference vector set and the initial vector set, it includes: Use the difference vector set as an initial particle swarm; Solve the optimal solution in the initial particle swarm according to the standard PSO algorithm to generate the target scenario.

2. The method according to claim 1, wherein The scenario configuration information further includes the correspondence between the code and the eigenvalue, and parameterizing the key code feature to obtain the initial feature vectors in the initial vector set includes: Classify the key code according to the type to obtain the key parameters of the initial feature vectors, where the classification according to the type is to classify according to the type of function implemented by the key code; Determine the eigenvalues corresponding to the key parameters according to the correspondence between the code and the eigenvalue to obtain the feature vectors to be verified; Obtain a pre-set positive list and a negative list; Perform forward matching on the feature vectors to be verified with the positive list and the negative list respectively to obtain a first forward matching result corresponding to the positive list and a second forward matching result corresponding to the negative list; If the first forward matching result is the same as the second forward matching result, use the feature vectors to be verified as the initial feature vectors; If the first forward matching result is different from the second forward matching result, sort the positive list and the negative list in ascending order respectively; Perform reverse matching on the feature vectors to be verified with the positively sorted positive list and negative list respectively to obtain a first reverse matching result corresponding to the positive list and a second reverse matching result corresponding to the negative list; If the first reverse matching result is the same as the second reverse matching result, use the feature vector to be verified as the initial feature vector; If the first reverse matching result is different from the second reverse matching result, return to perform the classification of the key code features by type to obtain the key parameters of the initial feature vector and subsequent steps.

3. The method according to claim 1, wherein The obtaining of the mutation vectors corresponding to the initial feature vector to obtain a set of mutation vectors includes: Obtain the specified mutation strategy and the number of mutations; Determine the vector to be mutated and the difference vector from the initial vector set, and the two initial feature vectors constituting the difference vector are both different from the vector to be mutated; According to the mutation strategy and the scaling factor, perform weighted summation of the difference vector and the vector to be mutated to obtain the mutation vector corresponding to the vector to be mutated; Redetermine the difference vector from the initial vector set, and perform the step of performing weighted summation of the difference vector and the vector to be mutated according to the mutation strategy and the scaling factor until the number of mutation vectors corresponding to the vector to be mutated reaches the number of mutations; Return to perform the step of determining the vector to be mutated and the difference vector from the initial vector set and subsequent steps until each initial feature vector in the initial vector set obtains the corresponding number of mutations of mutation vectors.

4. The method according to claim 3, characterized in that, The performing of mean operation on the mutation vectors in the set of mutation vectors to obtain an intermediate vector set, the intermediate vector set includes a plurality of intermediate vectors, including: For the number of mutation vectors corresponding to each initial feature vector, Perform extreme value optimization on the mutation vectors to obtain the optimized number of mutation vectors; According to the number of mutations and the softness, perform mean operation on the optimized number of mutation vectors to obtain the intermediate vector corresponding to each initial feature vector.

5. The method according to claim 4, characterized in that, The performing of extreme value optimization on the mutation vectors to obtain the optimized number of mutation vectors includes: For each mutation vector, Sort the eigenvalues corresponding to the mutation vector in a preset order to obtain an eigenvalue set; Select a target eigenvalue from the eigenvalue set based on a preset probability function; When the target eigenvalue is an extreme value, replace the target eigenvalue with a random number, and the random number is generated according to a preset probability distribution; When the target eigenvalue is not an extreme value, return to perform the step of selecting a target eigenvalue from the eigenvalue set based on the preset probability function and subsequent steps until all the extreme values in the eigenvalue set are replaced to obtain the optimized mutation vector.

6. The method according to claim 1, wherein The performing of crossover operation on the intermediate vectors in the intermediate vector set and the initial feature vector to generate a set of difference vectors includes: For each intermediate vector, obtain an estimated value and a crossover operator, and the crossover operator is a random floating point number between 0 and 1; When the estimated value is less than or equal to the crossover operator, obtain the eigenvalue of the intermediate vector as the target value; When the estimated value is greater than the crossover operator, obtain the eigenvalue of the initial feature vector as the target value; Determine the vector composed of the target values as the difference vector.

7. The method according to claim 1, wherein Determining a target scenario based on the set of difference vectors and the set of vectors includes: For each difference vector, obtaining the fitness value of the difference vector; Obtaining the fitness value of the initial feature vector; If the fitness value of the difference vector is less than the fitness value of the initial feature vector, using the difference vector as the target vector; If the fitness value of the difference vector is greater than or equal to the fitness value of the initial feature vector, using the initial feature vector as the target vector; Using the set of target vectors formed by the target vectors as the target scenario.

8. The method according to claim 1, characterized in that After determining the target scenario based on the set of difference vectors and the set of vectors, it further includes: Scheduling a virtual container service to perform a trial run on the target scenario to obtain a running result, where the running result is used to reflect whether the target scenario is abnormal; If the running result indicates that the target scenario is abnormal, reporting the abnormal target scenario to the cloud.

9. The method according to claim 8 or 1, characterized in that, It further includes: Selecting a first slave server according to the performance parameters of the slave server; Copying the target source code to the first slave server to process the target data through the first slave server, where the target data includes the set of difference vectors, the target scenario, and the set of intermediate vectors; When the performance parameters of the first slave server meet the preset conditions, selecting a second slave server; Copying the target source code to the second slave server and starting the second slave server; Receiving a retrieval tag returned by the second slave server, where the retrieval tag corresponds to the target data; When it is determined that the same retrieval tag exists in the memory of the first slave server, closing the query of the target data corresponding to the retrieval tag by the second slave server and obtaining the next retrieval tag; When it is determined that the same retrieval tag does not exist in the memory of the first slave server, running the processing of the target data corresponding to the retrieval tag through the second slave server.

10. An apparatus for generating a target scenario, characterized in that, The device includes: An acquisition module for acquiring an initial scenario code and scenario configuration information; A construction module for constructing an initial vector set according to the initial scenario code and scenario configuration information, where the initial vector set includes a plurality of initial feature vectors, and the initial feature vectors represent scenario code link features; A mutation module for obtaining mutation vectors corresponding to the initial feature vectors to obtain a set of mutation vectors; An average processing module for performing an average operation on the mutation vectors in the set of mutation vectors to obtain a set of intermediate vectors, where the set of intermediate vectors includes a plurality of intermediate vectors; A crossover module for performing a crossover operation on the intermediate vectors in the set of intermediate vectors and the initial feature vectors to generate a set of difference vectors, where the set of difference vectors includes a plurality of difference vectors; A selection module for determining a target scenario according to the set of difference vectors and the set of vectors, where the target scenario includes one or more of the difference vectors or feature vectors; The scenario configuration information includes a key range, and constructing the initial vector set according to the initial scenario code and scenario configuration information includes: Obtaining the code in the key range in the initial scenario code, where the code in the key range is the key code; Parameterize the key code to obtain the initial feature vectors in the initial vector set; In the process of performing cross - operation on the intermediate vectors in the intermediate vector set and the initial feature vectors to generate a set of difference vectors, it further includes: Use the intermediate vector set as the initial particle swarm; Solve the optimal solution in the initial particle swarm according to the standard PSO algorithm to generate a set of difference vectors; In the process of determining the target scenario according to the set of difference vectors and the initial vector set, it includes: Use the set of difference vectors as the initial particle swarm; Solve the optimal solution in the initial particle swarm according to the standard PSO algorithm to generate the target scenario.

11. A server, characterized in that, It includes a processor and a memory, and the memory stores multiple instructions; the processor loads the instructions from the memory to execute the steps in the target scenario generation method according to any one of claims 1 - 9.

12. A computer-readable storage medium, characterized in that, The computer - readable storage medium stores multiple instructions, and the instructions are suitable for being loaded by a processor to execute the steps in the target scenario generation method according to any one of claims 1 - 9.

Citation Information

Patent Citations

  • Optimized test vector generation method based on genetic algorithm and variation analysis

    CN107590313A

  • Automatic driving limit performance test method, device and equipment and storage medium

    CN112181698A