Commercial rule engine rule migration method

By classifying the rules of the business rule engine and building node trees, combining deep neural network models and genetic algorithms, the problems of inaccurate test results and difficult to resolve rule conflicts in the existing technology are solved, and efficient and accurate rule migration and operation feasibility is improved.

CN119556919AInactive Publication Date: 2025-03-04SHENZHEN AIRONG TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510122891.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-26
Publication Date
2025-03-04
Estimated Expiration
Not applicable · inactive patent

Smart Images

  • Figure CN119556919A_ABST
    Figure CN119556919A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of big data processing, and discloses a business rule engine rule migration method, which comprises the following steps of: S01, classifying target rules in a source target engine; s02, based on the constructed node tree, performing simulation migration on the target rule, and setting a conflict resolution matching principle for the migrated new rule; s03, performing data verification on the rule after simulation migration, and obtaining a rule loss degree; step S04, obtaining the predicted rule operation feasibility after migration; s05, obtaining an optimal migration scheme as a migration method of the rule migration; s06, migrating and correspondingly optimizing and adjusting the rule by adopting the optimal migration scheme; by setting the step S02 and the step S03, rules can be migrated by constructing a node tree and adopting a binary tree form, the flexibility and adaptability of data migration are improved, the binary tree ensures that data are not intersected, and data conflicts are avoided according to a conflict resolution matching principle.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of big data processing technology, and more specifically to a business rule engine rule migration method. Background Art

[0002] A rule engine migration test method, device, electronic device and storage medium are disclosed in a public document with publication number CN116340187B; the method includes: obtaining a test interface request message; obtaining a first operation record and a first decision conclusion of a first rule engine according to the test interface request message; wherein the first rule engine is the rule engine before migration; obtaining a second operation record and a second decision conclusion of a second rule engine according to the test interface request message; wherein the second rule engine is the rule engine after migration; determining the test result according to the first operation record, the second operation record, the first decision conclusion and the second decision conclusion. Thus, the test result can be obtained according to the first operation record and the second operation record, avoiding the problem of obtaining a test result that passes the test when the decision conclusion is consistent but the operation process is inconsistent, thereby improving the accuracy of the test.

[0003] However, in the existing data environment, the amount of data generated every day is very large. Each operation behavior will trigger a rule engine and the execution of rules, and one execution may trigger several or even dozens of business rules, and each business rule includes the collection of multiple data sources, data calculation and reconstruction, and finally decision generation; therefore, the operation record contains multiple different operation data, some operation process data are consistent, but some operation process data are inconsistent; and one data may not only meet one rule, but also meet multiple rules at the same time. At this time, it is necessary to classify the rules and set matching principles to resolve rule conflicts. Summary of the invention

[0004] In order to overcome the above-mentioned defects of the prior art, the present invention provides a business rule engine rule migration method to solve the problems existing in the above-mentioned background technology.

[0005] The present invention provides the following technical solution: a business rule engine rule migration method, comprising the following steps: Step S01: classify the target rules in the source target engine, obtain k different categories of target rule classifications, decompose each rule in each category into a conditional judgment form, construct k node trees with the same number as the rules in the category, each node tree consists of n binary trees, and set a digital label for each binary tree; Step S02: construct a simulation engine environment based on the new target engine, simulate the migration of the target rules based on the constructed node tree, and set conflict resolution and matching principles for the migrated new rules; Step S03: perform data verification on the rules after simulated migration, mark the binary trees and nodes that fail the verification, and if the data verification fails, record the rule as an infeasible rule and obtain the rule loss degree; Step S04: input the rule loss degree, the current migration plan and the new target engine performance into the constructed rule operation prediction model to obtain the predicted feasibility of the rule operation after migration; Step S05: combining the feasibility of rule operation after migration predicted by the rule operation prediction model, using an optimization algorithm to obtain the best migration solution as the migration method for this rule migration; Step S06: adopt the best migration solution to migrate the rules and make corresponding optimization adjustments.

[0006] Preferably, each node tree corresponds to a type of rule, and each binary tree corresponds to a rule of the type of rule; each rule is in the form of a rule set or a rule chain; The performance of the new target engine includes the response time, throughput, resource utilization, compatibility and technical architecture of the new target engine; the migration plan is specifically any one of gradual migration, one-time migration, repeated migration, existing migration plan and a plan formed by collecting historical execution rule migration methods and modifying them in combination with professional field rule migration knowledge.

[0007] Preferably, the source target engine is the source business rule engine, the rules to be migrated are migrated from the source business engine to the new business engine, and the target rules are the business rules to be migrated; the acquisition of k different categories of target rule classification adopts spectral clustering or K-means clustering; If the target rule is a fixed category rule, the K-means clustering algorithm is used to perform cluster analysis on the target rule to obtain all the rules belonging to each rule category; if the target rule is a random rule, the spectral clustering algorithm is used to perform cluster analysis on the target rule to obtain k rule categories and all the rules belonging to each rule category.

[0008] Preferably, the specific method of constructing k node trees having the same number as the number of rules in the category is: When there are n rules in the kth target rule category, a node tree is constructed. The root node stores basic information, that is, the category of the kth target rule and other storable information. The other storable information is the target rule data type. The root node of the node tree has n child nodes, recorded as source child nodes, and each source child node corresponds to a rule. Each rule corresponds to a binary tree structure. Each source child node is the root node of the corresponding binary tree, and the corresponding digital label of the corresponding rule is stored at the same time. The condition judgment of each rule is a child node of the binary tree, recorded as a molecule node. Each molecule node represents a condition. The left subtree represents the processing logic when the condition is true, and the right subtree represents the processing logic when the condition is false. Each binary tree has multiple layers of molecule nodes.

[0009] Preferably, the specific setting method of the conflict resolution matching principle is: If there is a rule with multiple conditions, they are T>b1, T>b2, T>b3, ..., T>b m , T is the data for rule condition judgment, b m is the mth condition judgment value; at this time, the data required for rule execution is t, and t satisfies the rule condition t>b c ,…,t>b d , where c=1, 2, 3, ..., m, d=1, 2, 3, ..., m, and c≠d; at this time, the rule condition whose condition judgment value is closest to the t value is executed, and the judgment method is: Take the absolute value of the difference between t and each conditional judgment value, calculate the ratio of each absolute value to the total absolute value, take the conditional judgment value corresponding to the minimum ratio, and execute the rule corresponding to the conditional judgment value; the formula is expressed as: , where BL te is the ratio of the absolute value of the difference between the e-th condition judgment value and t to the total absolute value, b e is the e-th conditional judgment value, e∈[c, d], if there exists an e-th conditional judgment value that makes BL te The value of is the smallest, then the rule corresponding to the e-th conditional judgment value is executed.

[0010] Preferably, the specific method of performing data verification on the rules after simulated migration is: Input the data of the rules to be executed into the migrated node tree. If there is a node that does not have an adaptation for a certain data and data verification cannot be performed, the binary tree verification fails and the binary tree that fails verification is marked. At this time, the decision conclusion cannot be output; if the decision conclusion output by a certain data is inconsistent with the rule result in the new target engine, there is a node error, that is, the node verification fails, and the node that fails verification is marked. At this time, the output decision conclusion is wrong; If data verification fails, the migrated node tree needs to be pruned or adjusted to adapt to the rules of the new target engine.

[0011] Preferably, the method for obtaining the rule loss degree is: Perform A data verifications on the migrated rules, obtain the nodes or binary trees marked in each data verification, set digital labels respectively, and obtain the rule loss degree through the rule loss degree calculation formula; The formula for calculating the rule loss is: ; Among them, δ is the rule loss degree, μ f is the number of infeasible rules that failed binary tree verification during the fth data verification, μ f+1 is the number of infeasible rules that fail binary tree verification during the f+1th data verification, β f is the number of infeasible rules that failed node verification during the f-th data verification, β f+1 is the number of infeasible rules that failed node verification during the f+1th data verification, λ1 and λ2 are the binary tree weight factor and node weight factor, respectively, f=1, 2, 3, …, A; The calculation formulas for the binary tree weight factor and the node weight factor are: ; ; where ε 1f is the number of binary trees marked during the f-th data verification, ε 2f is the number of nodes marked during the f-th data verification, and N is the number of all child nodes in all node trees except the root node.

[0012] Preferably, the rule operation prediction model is a deep neural network model; it includes an input layer, a hidden layer and an output layer; each hidden layer includes a plurality of neurons, each neuron is connected to the neurons in the next layer, the connection includes a weight, and an activation function is applied to each neuron between the hidden layer and the output layer; The rule loss degree, migration scheme and corresponding new target engine performance are taken as a group of research data, g groups of research data are collected in advance, the research data and the corresponding new target engine performance after migration are converted into a corresponding set of feature vectors, each set of feature vectors is used as input data of the input layer, the predicted new target engine performance after migration corresponding to each group of research data is used as output, the actual new target engine performance after migration corresponding to each group of research data is used as the prediction target, and the rule operation prediction model is trained by minimizing the sum of prediction errors of all analysis data as the training target; The current migration plan, rule loss degree and the performance of the new target engine are used as the input of the rule operation prediction model, the corresponding new target engine's performance after migration is used as the output of the output layer, and the new target engine's performance after migration is used as the feasibility of the rule operation after migration.

[0013] Preferably, the optimization algorithm adopts a genetic algorithm, and the specific method is: Step S11: Encode the migration plan, obtain chromosomes, and construct the initial population; Encode the migration plan as P, where P is the chromosome, and randomly generate U chromosomes to form the initial population. ; Step S12: determining a fitness function; The fitness function is expressed as: , where h r is the fitness corresponding to the rth chromosome, YX r is the feasibility of the post-migration rule operation corresponding to the rth chromosome; r=1, 2, 3, …, U; Step S13: performing natural selection on chromosomes in the population; Step S14: performing crossover recombination on chromosomes in the population; Step S15: mutating the chromosomes in the population; Step S16: Obtain a new population, preset the population generation to be L, the fitness threshold to be Q, L is an integer greater than 0, and Q is a real number greater than 0; loop steps S13 to S15 until the generation corresponding to the new population is L or the fitness corresponding to the chromosome in the new population is greater than or equal to the fitness threshold Q, the loop ends, and the migration plan corresponding to the chromosome with the maximum fitness in the new population is obtained, which is the optimal migration plan.

[0014] Technical effects and advantages of the present invention: (1) The present invention is provided with step S02 and step S03, which is conducive to migrating rules by constructing a node tree in the form of a binary tree, thereby improving the flexibility and adaptability of data migration. At the same time, a conflict resolution matching principle is set to operate and set multiple rules that are satisfied at the same time. The binary tree ensures that there is no intersection of data, and the conflict resolution matching principle avoids data conflicts. At the same time, the data after the simulated migration is verified to obtain the rule loss degree, thereby laying a foundation for the subsequent analysis of the rule operation performance of the new target engine after the migration, that is, the feasibility of the rule operation.

[0015] (2) The present invention is provided with step S05 and step S06, which is conducive to obtaining the relationship between the migration plan and the rule loss degree and the rule operation feasibility by constructing a neural network model, and integrating the trained neural network model, that is, the rule operation prediction model, into the fitness calculation of the genetic algorithm, which can give full play to the nonlinear and multimodal data modeling capabilities of the neural network and effectively capture complex data relationships; based on the parallel computing processing mechanism, the computing efficiency is improved, and the effect of the migration plan is evaluated through deep learning technology, and complex data relationships are captured through deep learning technology. It can fully and accurately understand the impact of different migration plans on rule migration, and select the best migration plan for different new target engines and business rules, thereby effectively improving the flexibility and adaptability in the process of business rule migration. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 This is a flow chart of the business rule engine rule migration method of the present invention.

[0017] Figure 2 This is a node tree structure diagram of business rules. DETAILED DESCRIPTION

[0018] The technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the present invention. In addition, the forms of the various structures recorded in the following embodiments are only examples. The business rule engine rule migration method involved in the present invention is not limited to the various structures recorded in the following embodiments. All other implementations obtained by ordinary technicians in this field without making creative work belong to the scope of protection of the present invention.

[0019] like Figure 1 As shown, the present invention provides a business rule engine rule migration method, comprising the following steps: Step S01: classify the target rules in the source target engine, obtain target rule classifications of k different categories, decompose each rule in each category into conditional judgment forms, construct k node trees with the same number of rules in the category, each node tree is composed of n binary trees, and a digital label is set for each binary tree; each node tree corresponds to a category of rules, and each binary tree corresponds to a rule of the category; each rule can be in the form of a rule set or a rule chain; Step S02: construct a simulation engine environment based on the new target engine, simulate the migration of the target rules based on the constructed node tree, and set conflict resolution and matching principles for the migrated new rules; Step S03: perform data verification on the rules after simulated migration, and mark the binary trees and nodes that fail verification. If data verification fails, the decision conclusion cannot be output or the decision conclusion is wrong, then the rule is recorded as an infeasible rule, and the rule loss degree is obtained; Step S04: input the rule loss degree, the current migration plan and the performance of the new target engine into the constructed rule operation prediction model to obtain the predicted feasibility of the rule operation after migration; the performance of the new target engine includes but is not limited to the response time, throughput, resource utilization, compatibility and technical architecture of the new target engine; the migration plan can be an existing migration plan such as gradual migration, one-time migration, repeated migration, etc., and can also be obtained by collecting historically executed rule migration methods and modifying them in combination with professional field rule migration knowledge; Step S05: combining the feasibility of rule operation after migration predicted by the rule operation prediction model, using an optimization algorithm to obtain the best migration solution as the migration method for this rule migration; Step S06: adopting the best migration solution to migrate the rules and make corresponding optimization adjustments, such as pruning the migrated node tree.

[0020] In this embodiment, it should be specifically explained that the source target engine is the source business rule engine, the rules to be migrated are migrated from the source business engine to the new business engine, and the target rules are the business rules to be migrated; the acquisition of k different categories of target rule classification can adopt spectral clustering or K-means clustering. If the source target engine has previously classified the business rules, that is, each rule is placed in a corresponding category, the target rules can be directly divided into different categories; If the target rule is a rule of a fixed few categories, the K-means clustering algorithm can be used to perform cluster analysis on the target rule to obtain all rules belonging to each rule category; if the target rule is a random rule, the spectral clustering algorithm can be used to perform cluster analysis on the target rule to obtain k rule categories and all rules belonging to each rule category; the K-means clustering algorithm and the spectral clustering algorithm are both existing technologies, and this embodiment will not go into details. When the rule is decomposed into the form of conditional judgment, the corresponding processing logic is executed when the condition is true, and the corresponding processing logic is executed when the condition is false. For each conditional judgment, the processing logic when the condition is true is necessarily different from the processing logic when the condition is false. For example, if a rule is that a 10% discount can be obtained when the purchase amount is greater than or equal to 500, after conversion to the conditional judgment form: when the purchase amount is greater than or equal to 500, the condition is true, and the processing logic is to execute the 10% discount, and the decision conclusion obtained is to pay 450 yuan; when the purchase amount is 450 yuan and less than 500 yuan, the condition is false, and the processing logic is not to execute the 10% discount, that is, to pay at the original price, and the decision conclusion obtained is to pay 450 yuan; The obtained decision conclusions are the same, but the operation process of the rule data is completely different. Therefore, the subsequent construction of a binary tree to migrate the data ensures that when the decision conclusions are the same, the differences in the operation process of each condition judgment node can be obtained, thereby further improving the accuracy of rule migration.

[0021] In this embodiment, it should be specifically explained that the specific method of constructing k node trees having the same number as the rules in the category is: When there are n rules in the kth target rule category, a node tree is constructed. The root node stores basic information, that is, the category of the kth target rule and other storable information. Other storable information can be selected by technicians in this field according to actual conditions, such as the target rule data type. The root node of the node tree has n child nodes, which are recorded as source child nodes. Each source child node corresponds to a rule. Each rule corresponds to a binary tree structure. Each source child node is the root node of the corresponding binary tree, and stores the corresponding digital label of the corresponding rule. The condition judgment of each rule is a child node of the binary tree, which is recorded as a molecular node. Each molecular node represents a condition. The left subtree represents the processing logic when the condition is true, and the right subtree represents the processing logic when the condition is false. Each binary tree can have multiple layers of molecular nodes. For example, Figure 2 As shown, if there is an a-th rule that a store member and a 10% discount on purchases greater than 500 yuan can enjoy a discount, the corresponding source child node is the a-th one. The condition of the first-level child node, i.e., the source child node, is whether the store member is a store member, and the condition of the first-level molecular node of the binary tree, i.e., the second-level child node of the node tree, is whether the purchase amount is greater than 500 yuan; store membership is the first condition, and the purchase amount greater than 500 yuan is the second condition; a=1, 2, 3, …, n.

[0022] In this embodiment, it should be specifically explained that, the step S02 is based on the constructed node tree, and each node tree is traversed layer by layer, starting from the root node of the binary tree, and traversing the molecular nodes layer by layer, and performing data conversion on the rules; for each molecular node, it is migrated from the source target engine to the new target engine according to its rule logic; during the migration process, the hierarchical structure of the node tree and the binary tree is used to achieve rapid positioning and accurate migration of rule data; The specific setting method of the conflict resolution matching principle is as follows: If there is a rule with multiple conditions, they are T>b1, T>b2, T>b3, ..., T>b m , T is the data for rule condition judgment, b m is the mth condition judgment value; at this time, the data required for rule execution is t, and t satisfies the rule condition t>b c ,…,t>b d , where c=1, 2, 3, ..., m, d=1, 2, 3, ..., m, and c≠d; at this time, the rule condition whose condition judgment value is closest to t is executed. The judgment method is: take the absolute value of the difference between t and each condition judgment value, calculate the ratio of each absolute value to the total absolute value, the smaller the ratio is, the closer the condition judgment value is to t, take the condition judgment value corresponding to the minimum ratio, and execute the rule corresponding to the condition judgment value; the formula is expressed as: , where BL te is the ratio of the absolute value of the difference between the e-th condition judgment value and t to the total absolute value, b e is the e-th conditional judgment value, e∈[c, d], if there exists an e-th conditional judgment value that makes BL te The value of is the smallest, then the rule corresponding to the e-th conditional judgment value is executed; its purpose is that data that meets multiple rule conditions at the same time will cause data conflicts, and there may be multiple decision conclusions in the end. Therefore, a conflict resolution matching principle is set to analyze the rule data and the conditional judgment value, and obtain the rule condition closest to the t value as the execution rule, so as to ensure that the data of the molecular nodes at the same level have no intersection, only execute one rule, generate one decision conclusion result, and avoid data conflicts; this conflict resolution matching principle is applicable to all business rules for numerical condition judgments, and technical personnel in this field can reasonably set this principle according to the specific rule type of the business rule and the actual situation.

[0023] For example, if a rule states that a 10% discount is available when the purchase amount is greater than or equal to 500, and an 20% discount is available when the purchase amount is greater than or equal to 1000, then there are two conditions, namely T≥500 and T≥1000, 500 is the judgment value of the first condition, and 1000 is the judgment value of the second condition; if a certain data is a purchase amount of 1500 yuan, then the data meets both conditions of T≥500 and T≥1000. At this time, the ratio of the absolute value of the difference between the two condition values ​​and the amount of 1500 of the rule to be executed to the total absolute value is calculated, which are 0.67 and 0.33 respectively. The ratio value corresponding to the second condition judgment value is the smallest, so the rule corresponding to the second condition judgment value is executed, and the decision conclusion is to get a 20% discount, so 1200 yuan is paid.

[0024] In this embodiment, it should be specifically explained that the specific method of performing data verification on the rules after simulated migration in step S03 is: Input the data of the rules to be executed into the migrated node tree. If there is a node that does not have an adaptation for a certain data and data verification cannot be performed, the binary tree verification fails and the binary tree that fails verification is marked. At this time, the decision conclusion cannot be output; if the decision conclusion output by a certain data is inconsistent with the rule result in the new target engine, there is a node error, that is, the node verification fails, and the node that fails verification is marked. At this time, the output decision conclusion is wrong; If data verification fails, the migrated node tree needs to be pruned or adjusted to adapt to the rules of the new target engine.

[0025] In this embodiment, it should be specifically explained that the method for obtaining the rule loss degree is: Perform A data verifications on the migrated rules, obtain the nodes or binary trees marked in each data verification, set digital labels respectively, and obtain the rule loss degree through the rule loss degree calculation formula; The formula for calculating the rule loss is: ; Among them, δ is the rule loss degree, μ f is the number of infeasible rules that failed binary tree verification during the fth data verification, μ f+1 is the number of infeasible rules that failed binary tree verification during the f+1th data verification, μ f is the number of infeasible rules that fail binary tree verification during the f-th data verification, β f is the number of infeasible rules that failed node verification during the f-th data verification, λ1 and λ2 are the binary tree weight factor and node weight factor, respectively, f=1, 2, 3, …, A; The calculation formulas for the binary tree weight factor and the node weight factor are: ; ; Among them, ε 1f is the number of binary trees marked during the f-th data verification, ε 2f is the number of nodes marked during the f-th data verification, and N is the number of all child nodes in all node trees except the root node.

[0026] In this embodiment, it should be specifically explained that the rule operation prediction model is a deep neural network model; it includes an input layer, a hidden layer and an output layer; each hidden layer includes multiple neurons, each neuron is connected to the neurons in the next layer, and the connection contains weights to determine the importance and influence of data transmission in the neural network; each neuron between the hidden layer and the output layer is applied with an activation function, and the activation function is mapped into nonlinearity, allowing the network to learn more complex patterns and features; The rule loss degree, migration scheme and corresponding new target engine performance are taken as a group of research data, g groups of research data are collected in advance, the research data and the corresponding new target engine performance after migration are converted into a corresponding set of feature vectors, each set of feature vectors is used as input data of the input layer, the predicted new target engine performance after migration corresponding to each group of research data is used as output, the actual new target engine performance after migration corresponding to each group of research data is used as the prediction target, and the rule operation prediction model is trained by minimizing the sum of prediction errors of all analysis data as the training target; The current migration scheme, rule loss degree and performance of the new target engine are used as inputs of the rule operation prediction model, the corresponding new target engine operation performance after migration is used as the output of the output layer, and the new target engine operation performance after migration is used as the feasibility of the rule operation after migration; The specific architecture of the rule operation prediction model is the existing technology of the deep neural network model, which will not be elaborated in this embodiment; the g group of research data can be obtained by repeatedly adopting the model migration operation to obtain the corresponding rule loss degree when different migration schemes are adopted for a variety of different new target engine performances, thereby obtaining the research data.

[0027] In this embodiment, it should be specifically explained that the optimization algorithm can adopt one or more of a variety of optimization algorithms such as a genetic algorithm and a fireworks algorithm. This embodiment takes the genetic algorithm as an example, and the specific method is as follows: Step S11: Encode the migration plan, obtain chromosomes, and construct the initial population; Step S12: determining a fitness function; Step S13: performing natural selection on chromosomes in the population; Step S14: performing crossover recombination on chromosomes in the population; Step S15: mutating the chromosomes in the population; Step S16: Obtain a new population, preset the population generation number to be L, the fitness threshold to be Q, L is an integer greater than 0, and Q is a real number greater than 0; loop through steps S13 to S15 until the generation number corresponding to the new population is L or the fitness corresponding to a chromosome in the new population is greater than or equal to the fitness threshold Q, the loop ends, and the migration scheme corresponding to the chromosome with the maximum fitness in the new population is obtained, which is the best migration scheme; Encode the migration plan as P, where P is the chromosome, and randomly generate U chromosomes to form the initial population. ; The fitness function is expressed as: , where h r is the fitness corresponding to the rth chromosome, YX r is the feasibility of the post-migration rule operation corresponding to the rth chromosome; r=1, 2, 3, …, U; Integrating the trained neural network model, i.e. the rule operation prediction model, into the fitness calculation of the genetic algorithm can give full play to the nonlinear and multimodal data modeling capabilities of the neural network and effectively capture complex data relationships. Based on the parallel computing processing mechanism, the computing efficiency is improved, and the effect of the migration plan is evaluated through deep learning technology. The deep learning technology is used to capture complex data relationships, and the impact of different migration plans on rule migration can be fully and accurately understood. The best migration plan is selected for different new target engines and business rules, thereby effectively improving the flexibility and adaptability in the process of business rule migration. The natural selection is carried out by combining the elite method and the rotation method; the elite method produces F1 offspring chromosomes, and for a population with a capacity of U, the fitness corresponding to the U chromosomes is arranged from large to small, and each of the F1 chromosomes at the front produces a offspring chromosome; the rotation method produces F2 offspring chromosomes, that is, U chromosomes produce F2 offspring chromosomes according to the corresponding rotation probability; F1+F2=U, so as to keep the offspring population capacity U unchanged and the population generation number increases; The expression of the rotation probability is: , where ζ r is the rotation probability corresponding to the rth chromosome; In the step S14, E chromosomes are randomly selected from the population for crossover recombination to obtain E new chromosomes; the crossover recombination adopts the PMX method, which is a prior art method and is not described in detail in this embodiment; after the chromosome crossover recombination, the fitness of the E new chromosomes is calculated, and the fitness of the E new chromosomes and the fitness of the E chromosomes are sorted from large to small to generate a sorting table, and the E new chromosomes in the sorting table replace the E chromosomes for crossover recombination in the population in positive order; in this embodiment, E=0.7U is preferred, and if the calculated E is not an integer, E is rounded up to ensure that the calculated E is an integer; In step S15, the mutation probability is preset to V, and U chromosomes in the population are mutated according to the mutation probability. The mutation method is to randomly select the positions of two genes in the chromosome and exchange the values ​​of the two genes. In this embodiment, V=0.02 is preferred. The mutation probability is preset by a person skilled in the art according to the algorithm efficiency and algorithm accuracy.

[0028] In this embodiment, it should be specifically explained that the difference between this embodiment and the prior art lies in that this embodiment has step S02 and step S03, which is conducive to migrating rules in the form of a binary tree by constructing a node tree, thereby improving the flexibility and adaptability of data migration. At the same time, a conflict resolution matching principle is set to operate and set multiple rules that are satisfied at the same time. The binary tree ensures that the data has no intersection, and the conflict resolution matching principle avoids data conflicts. At the same time, the data after the simulated migration is verified to obtain the rule loss degree, thereby laying a foundation for the subsequent analysis of the rule running performance of the new target engine after the migration, that is, the feasibility of the rule running; the embodiment has step S05 and step S06, which is conducive to constructing a neural network model. The model is used to obtain the relationship between the migration plan and the rule loss degree and the rule operation feasibility, and the trained neural network model, namely the rule operation prediction model, is integrated into the fitness calculation of the genetic algorithm, which can give full play to the nonlinear and multimodal data modeling capabilities of the neural network and effectively capture complex data relationships. Based on the parallel computing processing mechanism, the computing efficiency is improved, and the effect of the migration plan is evaluated through deep learning technology. The complex data relationships are captured through deep learning technology, which can fully and accurately understand the impact of different migration plans on rule migration, and select the best migration plan for different new target engines and business rules, thereby effectively improving the flexibility and adaptability in the process of business rule migration.

[0029] Finally: The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

[0030] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A business rule engine rule migration method, characterized by: The following steps are involved: Step S01: classify the target rules in the source target engine, obtain k different categories of target rule classifications, decompose each rule in each category into a conditional judgment form, construct k node trees with the same number as the rules in the category, each node tree consists of n binary trees, and set a digital label for each binary tree; Step S02: construct a simulation engine environment based on the new target engine, simulate the migration of the target rules based on the constructed node tree, and set conflict resolution and matching principles for the migrated new rules; Step S03: perform data verification on the rules after simulated migration, mark the binary trees and nodes that fail the verification, and if the data verification fails, record the rule as an infeasible rule and obtain the rule loss degree; Step S04: input the rule loss degree, the current migration plan and the new target engine performance into the constructed rule operation prediction model to obtain the predicted feasibility of the rule operation after migration; Step S05: combining the feasibility of rule operation after migration predicted by the rule operation prediction model, using an optimization algorithm to obtain the best migration solution as the migration method for this rule migration; Step S06: adopt the best migration solution to migrate the rules and make corresponding optimization adjustments.

2. A business rule engine rule migration method according to claim 1, characterized in that: Each node tree corresponds to a type of rule, and each binary tree corresponds to a rule of the type of rule; each rule is in the form of a rule set or a rule chain; The performance of the new target engine includes response time, throughput, resource utilization, compatibility and technical architecture of the new target engine; The migration scheme is any one of gradual migration, one-time migration, repeated migration, existing migration schemes, and schemes formed by collecting historically executed rule migration methods and modifying them in combination with professional field rule migration knowledge.

3. A business rule engine rule migration method according to claim 1, characterized in that: The source target engine is the source business rule engine, the rules that need to be migrated are migrated from the source business engine to the new business engine, and the target rules are the business rules that need to be migrated; the acquisition of k different categories of target rule classification adopts spectral clustering or K-means clustering; If the target rule is a fixed category rule, the K-means clustering algorithm is used to perform cluster analysis on the target rule to obtain all the rules belonging to each rule category; if the target rule is a random rule, the spectral clustering algorithm is used to perform cluster analysis on the target rule to obtain k rule categories and all the rules belonging to each rule category.

4. A business rule engine rule migration method according to claim 1, characterized in that: The specific method of constructing k node trees with the same number of rules as the category is: When there are n rules in the kth target rule category, a node tree is constructed, and the root node stores basic information, that is, the category of the kth target rule and other storable information. The other storable information is the target rule data type; The root node of the node tree has n child nodes, denoted as source child nodes, and each source child node corresponds to a rule; each rule corresponds to a binary tree structure, and each source child node is the root node of the corresponding binary tree, and stores the corresponding digital label of the corresponding rule. The condition judgment of each rule is a child node of the binary tree, denoted as a numerator node. Each numerator node represents a condition, the left subtree represents the processing logic when the condition is true, and the right subtree represents the processing logic when the condition is false; each binary tree has multiple layers of numerator nodes.

5. A business rule engine rule migration method according to claim 4, characterized in that: The specific setting method of the conflict resolution matching principle is as follows: If there is a rule with multiple conditions, they are T>b1, T>b2, T>b3, ..., T>b m , T is the data for rule condition judgment, b m is the mth condition judgment value; At this time, the data that needs to be executed is t, and t satisfies the rule condition t>b c ,…,t>b d , where c=1, 2, 3, ..., m, d=1, 2, 3, ..., m, and c≠d; at this time, the rule condition whose condition judgment value is closest to the t value is executed, and the judgment method is: Take the absolute value of the difference between t and each conditional judgment value, calculate the ratio of each absolute value to the total absolute value, take the conditional judgment value corresponding to the minimum ratio, and execute the rule corresponding to the conditional judgment value; the formula is expressed as: , where BL te is the ratio of the absolute value of the difference between the e-th condition judgment value and t to the total absolute value, b e is the e-th conditional judgment value, e∈[c, d], if there exists an e-th conditional judgment value that makes BL te The value of is the smallest, then the rule corresponding to the e-th conditional judgment value is executed.

6. A business rule engine rule migration method according to claim 5, characterized in that: The specific method of performing data verification on the rules after simulated migration is as follows: Input the data of the rules to be executed into the migrated node tree. If there is a node that does not have an adaptation for a certain data and data verification cannot be performed, the binary tree verification fails and the binary tree that fails verification is marked. At this time, the decision conclusion cannot be output; if the decision conclusion output by a certain data is inconsistent with the rule result in the new target engine, there is a node error, that is, the node verification fails, and the node that fails verification is marked. At this time, the output decision conclusion is wrong; If data verification fails, the migrated node tree needs to be pruned or adjusted to adapt to the rules of the new target engine.

7. A business rule engine rule migration method according to claim 6, characterized in that: The method for obtaining the rule loss degree is: Perform A data verifications on the migrated rules, obtain the nodes or binary trees marked in each data verification, set digital labels respectively, and obtain the rule loss degree through the rule loss degree calculation formula; The formula for calculating the rule loss is: ; Among them, δ is the rule loss degree, μ f is the number of infeasible rules that failed binary tree verification during the fth data verification, μ f+1 is the number of infeasible rules that fail binary tree verification during the f+1th data verification, β f is the number of infeasible rules that failed node verification during the f-th data verification, β f+1 is the number of infeasible rules that failed node verification during the f+1th data verification, λ1 and λ2 are the binary tree weight factor and node weight factor, respectively, f=1, 2, 3, …, A; The calculation formulas for the binary tree weight factor and the node weight factor are: ; ; Among them, ε 1f is the number of binary trees marked during the f-th data verification, ε 2f is the number of nodes marked during the f-th data verification, and N is the number of all child nodes in all node trees except the root node.

8. A business rule engine rule migration method according to claim 7, characterized in that: The rule-based prediction model is a deep neural network model, which includes an input layer, a hidden layer, and an output layer. Each hidden layer includes multiple neurons, each neuron is connected to the neurons in the next layer, and the connection contains weights. An activation function is applied to each neuron between the hidden layer and the output layer. The rule loss degree, migration scheme and corresponding new target engine performance are taken as a group of research data, g groups of research data are collected in advance, the research data and the corresponding new target engine performance after migration are converted into a corresponding set of feature vectors, each set of feature vectors is used as input data of the input layer, the predicted new target engine performance after migration corresponding to each group of research data is used as output, the actual new target engine performance after migration corresponding to each group of research data is used as the prediction target, and the rule operation prediction model is trained by minimizing the sum of prediction errors of all analysis data as the training target; The current migration plan, rule loss degree and the performance of the new target engine are used as the input of the rule operation prediction model, the corresponding new target engine's performance after migration is used as the output of the output layer, and the new target engine's performance after migration is used as the feasibility of the rule operation after migration.

9. A business rule engine rule migration method according to claim 8, characterized in that: The optimization algorithm adopts a genetic algorithm, and the specific method is as follows: Step S11: Encode the migration plan, obtain chromosomes, and construct the initial population; Encode the migration plan as P, where P is the chromosome, and randomly generate U chromosomes to form the initial population. ; Step S12: determining a fitness function; The fitness function is expressed as: , where h r is the fitness corresponding to the rth chromosome, YX r is the feasibility of the post-migration rule operation corresponding to the rth chromosome; r=1, 2, 3, …, U; Step S13: performing natural selection on chromosomes in the population; Step S14: performing crossover recombination on chromosomes in the population; Step S15: mutating the chromosomes in the population; Step S16: Obtain a new population, preset the population generation to be L, the fitness threshold to be Q, L is an integer greater than 0, and Q is a real number greater than 0; loop steps S13 to S15 until the generation corresponding to the new population is L or the fitness corresponding to the chromosome in the new population is greater than or equal to the fitness threshold Q, the loop ends, and the migration plan corresponding to the chromosome with the maximum fitness in the new population is obtained, which is the optimal migration plan.

Citation Information

Patent Citations

  • Rule engine migration testing methods, devices, electronic equipment and storage media

    CN116340187B