Rule engine processing method and system

By setting recommendation rule sets and parallel processing technology, the traditional rule engine's lack of response speed and flexibility is solved, and the efficient processing of real-time data and the generation of recommendation results is achieved, which meets the efficient decision-making support needs of modern complex business applications. .

CN119149811APending Publication Date: 2024-12-17湖北省信产通信服务有限公司

Patent Information

Application Number
CN202411176419.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-26
Publication Date
2024-12-17

AI Technical Summary

Technical Problem

Traditional rules engines are slow to respond when processing large-scale data, making them difficult to apply flexibly in different application scenarios, and the rule definition and management process are cumbersome, which cannot meet the high requirements for real-time decision support by modern complex business applications.

Method used

By setting up a recommendation rule set, dividing data fragmentation and processing in parallel, using parallel computing architecture and efficient data storage and retrieval structures, the rapid matching and processing of real-time data is achieved and recommended results are generated.

Benefits of technology

It significantly improves the processing efficiency and performance of the rule engine, improves flexibility and scalability, meets the high requirements for real-time decision support by modern complex business applications, and reduces computing and resource consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119149811A_ABST
    Figure CN119149811A_ABST
Patent Text Reader

Abstract

The invention provides a rule engine processing method and system, and relates to the technical field of rule decision. The method comprises the following steps: storing a plurality of recommendation rules and recommendation results of a constructed recommendation rule set into a rule table; the behavior data of the user is imported from the e-commerce platform, data fragments are divided from the behavior data according to preset behavior characteristics, and rule subsets matched with the behavior characteristics are screened out from the recommendation rule set; performing parallel processing on the data fragments and the rule subsets to obtain decision rules triggered by the behavior data; and merging the behavior data of the decision rule into a computing node, searching a recommendation result of the behavior data of the user in a rule table according to the decision rule in the computing node, and generating a recommended commodity for the user according to the recommendation result of the user. Through an efficient rule storage and retrieval structure, decision support can be efficiently carried out in a complex real-time environment, the calculation amount is reduced, and the processing efficiency and performance of a rule engine are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention mainly relates to the technical field of rule decision making, and in particular to a rule engine processing method and system. Background Art

[0002] A rule engine is a component used to process complex business logic, which can infer and make decisions on input data according to a predefined set of rules. In modern information systems, data is generated and transmitted faster and faster, and the demand for real-time data processing is increasing. Whether it is financial transactions, industrial control, or network security, many application scenarios need to respond within milliseconds or even microseconds. This places higher demands on the performance and efficiency of rule engines in processing data. Traditional rule engines often have slow response speeds when processing large-scale data, performance bottlenecks that cannot respond in real time, or poor scalability that makes it difficult to flexibly apply in different application scenarios, or cumbersome rule definition and management processes that are not conducive to rapid response to business changes. In order to solve the problems of traditional rule engines, an efficient rule engine is needed to quickly and accurately support decision-making on data streams. Summary of the invention

[0003] The technical problem to be solved by the present invention is to provide a rule engine processing method and system in view of the deficiencies in the prior art.

[0004] The technical solution of the present invention to solve the above technical problems is as follows:

[0005] A rule engine processing method comprises the following steps:

[0006] Setting a plurality of recommendation rules to construct a recommendation rule set, and storing the plurality of recommendation rules in the recommendation rule set and the corresponding recommendation results in a pre-constructed rule table;

[0007] Importing multiple behavior data of multiple users from an e-commerce platform, dividing the multiple behavior data into multiple data slices according to multiple preset behavior features, wherein the data slices include multiple behavior data, and filtering recommendation rules matching the multiple behavior features from the recommendation rule set to obtain rule subsets corresponding to the multiple data slices;

[0008] Processing each of the data slices and the corresponding rule subsets in parallel to obtain a plurality of decision rules triggered by any behavior data of each of the data slices in the corresponding rule subsets;

[0009] Merging multiple behavior data of multiple decision rules in corresponding data slices into different computing nodes respectively to obtain multiple computing nodes;

[0010] Decision calculation is performed on each computing node respectively, and the decision calculation is to search the rule table for recommendation results corresponding to multiple behavior data of each user according to the corresponding decision rules, and generate recommended products for each user according to the multiple recommendation results corresponding to each user.

[0011] Another technical solution of the present invention to solve the above technical problems is as follows:

[0012] A rule engine processing system, comprising:

[0013] A rule storage module, used to set a plurality of recommendation rules to construct a recommendation rule set, and store the plurality of recommendation rules in the recommendation rule set and the corresponding recommendation results in a pre-constructed rule table;

[0014] A data partitioning module, used to import multiple behavioral data of multiple users from the e-commerce platform, divide the multiple behavioral data into multiple data slices according to multiple preset behavioral features, the data slices include multiple behavioral data, filter out recommendation rules matching the multiple behavioral features from the recommendation rule set, and obtain rule subsets corresponding to the multiple data slices;

[0015] A rule filtering module, used for processing each of the data slices and the corresponding rule subsets in parallel, to obtain a plurality of decision rules triggered by any behavior data of each of the data slices in the corresponding rule subsets;

[0016] A data merging module, used to merge multiple behavior data of multiple decision rules in corresponding data slices into different computing nodes to obtain multiple computing nodes;

[0017] The data decision module is used to perform decision calculations on each of the computing nodes respectively. The decision calculations are to search the rule table for recommendation results corresponding to multiple behavioral data of each user according to the corresponding decision rules, and generate recommended products for each user according to the multiple recommendation results corresponding to each user.

[0018] The beneficial effects of the present invention are: using the rules defined in the rule base to match and process the received real-time data, generating recommendation results and outputting the recommended targets to the user. Combined with an efficient rule storage and retrieval structure, it is possible to efficiently perform decision support in a complex real-time environment, significantly improving the processing efficiency and performance of the rule engine, not only reducing the amount of calculation, but also improving the flexibility and scalability of the rule engine. The ability of the rule engine in real-time data processing, rule execution efficiency, rule management flexibility, and decision processing scalability is significantly improved, thereby meeting the high requirements of modern complex business application scenarios for real-time decision support. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 A flowchart of a rule engine processing method provided by an embodiment of the present invention;

[0020] Figure 2 A module block diagram of a rule engine processing system provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0021] The principles and features of the present invention are described below in conjunction with the accompanying drawings. The examples given are only used to explain the present invention and are not used to limit the scope of the present invention.

[0022] In order to solve the problems of traditional rule engines, a rule engine processing technology is needed that can quickly and accurately support decision-making on data streams. This rule engine processing technology not only needs to have high-performance data processing capabilities, but also needs to have a flexible rule definition and management mechanism to adapt to changing business needs.

[0023] By designing an efficient rule engine and implementing data processing by the rule engine, the decision support system that uses the rule engine can significantly improve its capabilities in real-time data processing, rule execution efficiency, rule management flexibility, and system scalability, thereby meeting the high requirements of modern complex business environments for real-time decision support.

[0024] Example 1: Figure 1 As shown, a rule engine processing method provided by an embodiment of the present invention includes the following steps:

[0025] Setting a plurality of recommendation rules to construct a recommendation rule set, and storing the plurality of recommendation rules in the recommendation rule set and the corresponding recommendation results in a pre-constructed rule table;

[0026] Importing multiple behavior data of multiple users from an e-commerce platform, dividing the multiple behavior data into multiple data slices according to multiple preset behavior features, wherein the data slices include multiple behavior data, and filtering recommendation rules matching the multiple behavior features from the recommendation rule set to obtain rule subsets corresponding to the multiple data slices;

[0027] Processing each of the data slices and the corresponding rule subsets in parallel to obtain a plurality of decision rules triggered by any behavior data of each of the data slices in the corresponding rule subsets;

[0028] Merging multiple behavior data of multiple decision rules in corresponding data slices into different computing nodes respectively to obtain multiple computing nodes;

[0029] Decision calculation is performed on each computing node respectively, and the decision calculation is to search the rule table for recommendation results corresponding to multiple behavior data of each user according to the corresponding decision rules, and generate recommended products for each user according to the multiple recommendation results corresponding to each user.

[0030] It should be understood that the present rule engine processing solution processes rules in parallel based on a MapReduce model constructed based on a parallel computing architecture (such as a Spark architecture or a Flink architecture). The MapReduce model includes a Map phase, a Shuffle phase, and a Reduce phase. The Map phase processes each of the data shards and the corresponding rule subsets in parallel. The Shuffle phase merges multiple behavioral data of the decision rules in the corresponding data shards into different computing nodes. The Reduce phase performs decision calculations on each of the computing nodes. The present rule engine processing solution can be applied to decision support systems.

[0031] Among them, the user's behavior data is obtained from the commodity shopping platform at a preset frequency, and the user's behavior data and the commodity information that has been visited on the commodity shopping platform are stored in a database. After obtaining the recommendation results of multiple behavior data of the user, the commodity information is obtained from the database according to the recommendation results to recommend the commodity to the user (for example, based on multiple recommendation results, it is determined that electronic commodities need to be recommended, and electronic commodities such as mobile phones, computers and tablets are obtained from the database, and there is no need to search for electronic commodities that have appeared in the behavior data).

[0032] In the embodiment of the present invention, the rules are pre-processed and stored in the rule table, and high performance is maintained when processing a large number of complex rules, which significantly reduces the rule execution time and resource consumption, and improves the efficiency and accuracy of rule execution. Through parallel computing and distributed processing technology (i.e., MapReduce model), the processing power and response speed of the rule engine are significantly improved to meet the needs of real-time decision support. The scalable multi-layer rule engine architecture can be efficiently expanded and stably operated in a distributed environment, flexibly respond to changing business needs, and support the application of large-scale business scenarios.

[0033] Preferably, the setting of multiple recommendation rules to construct a recommendation rule set is specifically:

[0034] Based on the behavior characteristics, multiple recommendation rules are set, the recommendation rules corresponding to the behavior characteristics of the set key characteristics are combined, and the same parts of the combined recommendation rules are simplified by Boolean algebra to obtain multiple combination rules;

[0035] The uncombined multiple recommended rules are regarded as a single rule, and a recommended rule set is constructed by the multiple single rules and the multiple combined rules.

[0036] Preferably, the multiple recommendation rules are set based on the behavior characteristics, and the recommendation rules corresponding to the behavior characteristics of the set key characteristics are combined, specifically:

[0037] The behavior characteristics setting multiple recommendation rules includes setting multiple browsing recommendation rules based on browsing characteristics, setting multiple purchase recommendation rules based on purchase characteristics, and setting multiple query recommendation rules based on query characteristics;

[0038] It is determined whether the plurality of recommendation rules are combinable rules respectively. If so, the plurality of browsing recommendation rules and / or the plurality of purchase recommendation rules and / or the plurality of query recommendation rules belonging to the set key features are combined respectively.

[0039] Specifically, the rules are set as follows: Rule 1: If the user browses the electronic product page, then recommend electronic products; Rule 2: If the user purchases a certain type of book, then recommend that type of book. That is, Rule 1: IF user views sitemin category'electronics' THEN recommend items in category'electronics'; Rule 2: IF user purchases itemin category'books' THEN recommend items incategory'books'. Rules 1 and 2 are formally expressed as: R1: IF (action = view∧category = 'electronics') THEN recommend (category = 'electronics'); R2: IF (action = purchases∧category = 'books') THEN recommend (category = 'books'). Combining Rules 1 and 2, the formal expression of the conditional combination rule is: R new :IF(action='view'∧category=C)∨(action='purchase'∧category=C)THEN recommend(category=C). The same part of the combined recommendation rules (ie, the part of THEN recommend(category=”)) is simplified through Boolean algebra.

[0040] That is, Rule 1: IF (A ∧ B) THEN X; Rule 2: IF (A ∧ C) THEN Y. It can be combined into: R new:IF A THEN (IF B THEN X; IF C THEN Y).

[0041] It should be understood that the behavior characteristics are behaviors in the behavior data, including browsing, purchasing, and querying. The key characteristics of browsing behavior are the number of browsing times, browsing time, and types of browsed goods. The key characteristics of purchasing behavior are the number of purchases, purchase date, and types of purchased goods. The key characteristics of query behavior are the number of queries, query date, and types of queried goods. Combining the recommendation rules of the behavior characteristics that belong to the set key characteristics can be combining the recommendation rules with the browsed goods type characteristics and the purchased goods type characteristics, and combining the recommendation rules with the number of browsing characteristics and the number of purchase characteristics.

[0042] In the embodiment of the present invention, combining some conditions reduces the repeated calculation of a certain condition. Formal representation can clarify the logical structure of the rules, making the rules easier to understand and verify. Through formal representation, optimization algorithms can be used to accelerate the processing of rules and reduce the amount of calculation. Formal representation provides a unified processing method for the rule engine to ensure the consistency of rules in different environments and data sets. By optimizing the rule processing algorithm, the computing efficiency of the rule engine is improved, enabling it to quickly execute complex business logic and decision rules, thereby improving the overall performance of the system.

[0043] Preferably, the storing of the plurality of recommendation rules in the recommendation rule set and the corresponding recommendation results in a pre-built rule table is specifically as follows:

[0044] Establishing corresponding rule indexes for a plurality of recommended rules in the recommended rule set, and storing the corresponding recommended rules in a rule storage location in a pre-constructed rule table according to the plurality of rule indexes respectively;

[0045] The recommendation results of the plurality of recommendation rules include known recommendation results and unknown recommendation results, and the known recommendation results are stored in a result storage location in the rule table corresponding to a recommendation rule storage location.

[0046] Specifically, each rule calculates its index value when it is inserted and stores it in the corresponding position in the rule table. A hash table is used to store the results of the conditions to avoid repeated calculations. The establishment of condition indexes is divided into single conditions (i.e., single rules) and combined conditions (i.e., combined rules), and the rules and recommended results are stored in the form of key-value pairs through a hash table. When caching a single condition, an index is established for each single condition, and the recommended results are stored through a hash table. The key is the unique identifier of the condition (such as the condition name or expression), and the value is the calculation result of the condition (such as True or False). When caching combined conditions, the results of the single condition cache can be used to quickly calculate the combined value. The key of the combined condition is the unique identifier of the combined condition (such as the combined condition name or expression), and the value is the calculation result of the combined condition. Establish an index and cache for the rule, such as: Condition_Cache[A] = evaluate(A).

[0047] It should be understood that the known recommendation results are preset according to rules, such as true or false.

[0048] In an embodiment of the present invention, a conditional index and cache mechanism are established for the rules in the rule base to avoid repeated calculations and speed up the efficiency of rule judgment. When the recommended results of the corresponding rules are needed during parallel processing of rules, the known cached results are directly found from the rule table for use, which saves the efficiency of the rules for data decision-making and improves the accuracy of the results. A high-performance memory database is used to store and retrieve real-time data to reduce the delay in data reading and writing. An efficient indexing mechanism is introduced to speed up the data retrieval process and ensure that the required data can be quickly located in a large-scale data environment. A flexible rule definition and management mechanism is provided, allowing users to easily add, modify and delete rules to adapt to changing business needs and reduce the maintenance cost of the system.

[0049] Preferably, the parallel processing of each of the data slices and the corresponding rule subsets is specifically as follows:

[0050] The multiple behavior data and the corresponding rule subsets of each data slice are divided into one processing unit to obtain multiple processing units, and the multiple processing units are processed in parallel through a mapping function.

[0051] Specifically, each Map task (i.e., processing unit) processes the data shard for which it is responsible and generates intermediate results. That is, each data shard D is processed in parallel. j , execute the corresponding rule subset R i , generate each data shard D j Behavioral data in In the corresponding rule subset R i Multiple rules triggered in Mapping functions such as: Map(R i, D j )={Action i |Condition i (D j )=True}.

[0052] In the embodiment of the present invention, the behavior data is mapped to the rule subset through the Map stage, which is responsible for filtering the untriggered rules.

[0053] Preferably, the plurality of behavior data of the plurality of decision rules in the corresponding data slices are merged into different computing nodes to obtain a plurality of computing nodes, specifically:

[0054] The plurality of decision rules are sorted to obtain a sorted sequence, and the plurality of behavior data of each decision rule in the corresponding data shard is merged into the corresponding position of the sorted sequence through a local aggregation operation, and the plurality of decision rules and the corresponding plurality of behavior data in the sorted sequence are divided into different computing nodes according to preset merging parameters, and each decision rule and the corresponding plurality of behavior data are grouped in the divided computing nodes to obtain a plurality of data groups, and a computing node is formed by the plurality of data groups to obtain a plurality of computing nodes.

[0055] Specifically, the intermediate results (i.e., the rules triggered by the behavior data) are sorted based on the rules (or key values) to ensure that the behavior data of the same rules (or key values) can be grouped together. In other words, the triggered conditions are judged by a unique identifier (such as the rule name or expression) to determine whether they are the same rule. In sorting or subsequent merging and grouping operations, the use of a unique identifier can ensure that the behavior data of the same rule can be correctly grouped together for processing. The triggered decision rules are sorted according to the preset sorting conditions. The sorting (Sort) is as follows: Sort({Map(R i , D j )})=Sorted({Map(R i , D j )}, Condition i ).

[0056] Combine the behavior data corresponding to each decision rule according to the sorting sequence of the decision rule to ensure that the behavior data of the same rule can be grouped together to reduce the amount of data to be calculated. The merging can be achieved through local aggregation operations. Group the merged data according to the rule conditions. The grouping operation makes the behavior data meet specific rule conditions so that the behavior data of the same rule can be merged into the same computing node.

[0057] It should be understood that merging is to transfer multiple behavior data that trigger the same decision rule to the same computing node, which can have multiple behavior data of multiple triggered decision rules (for example, multiple behavior data corresponding to three decision rules are merged into one node); while grouping is to further subdivide and organize the behavior data according to the decision rules within the node (for example, group the corresponding behavior data according to three different decision rules, and divide them into three data groups). Although these two steps are based on rule conditions, they have different functions. Merging is the data transmission across nodes, and grouping is the data organization within the node.

[0058] In the embodiment of the present invention, the behavior data is redistributed and transmitted so that the behavior data with the same rule conditions are merged into the same computing node.

[0059] Preferably, after the step of obtaining a plurality of computing nodes, the method further comprises:

[0060] The loads of the plurality of computing nodes are calculated respectively through a monitoring tool to obtain a plurality of load values, and the plurality of load values ​​are compared with preset thresholds respectively. When the load values ​​are greater than the preset thresholds, the plurality of data groups are divided into a plurality of data fragments respectively, and the plurality of data fragments are respectively distributed to computing nodes with low loads through a load balancing algorithm.

[0061] Specifically, the key indicators usually involved in load monitoring include: CPU usage: CPU usage of each node. Memory usage: memory usage of each node. I / O usage: disk and network I / O usage. Task queue length: the number of tasks to be processed on each node. Task completion time: the time it takes for each node to process a task. These indicators can be obtained through the built-in monitoring tools of distributed computing frameworks (such as Apache Spark and Apache Flink).

[0062] Dynamically adjusting the load of computing nodes includes:

[0063] Threshold setting: Set thresholds for each monitoring indicator; for example, CPU usage exceeds 80% or the task queue length exceeds a certain number. Real-time monitoring: Use monitoring tools to continuously collect load data for each node (i.e., computing node) and compare it with the threshold. Trigger adjustment: When a certain indicator is detected to exceed the threshold, an adjustment operation is triggered; adjustment operations may include task reallocation and data resharding, etc. Load redistribution algorithm (i.e., load balancing algorithm): Redistribute tasks or data among nodes. Task migration: Migrate some tasks from nodes with high load to nodes with low load. Data resharding: Redivide the data into more small fragments and distribute them to different nodes.

[0064] Dynamically adjusting the computing nodes also includes: recording the task redistribution path, such as the node number to which the task is moved. Monitoring the key load indicators of the new node. Recording system performance indicators (such as task completion time, system response time, etc.) and adjusted system performance data.

[0065] It should be understood that the monitoring tool may be a Metrics System, which is used to measure various indicators of the computing nodes.

[0066] In the embodiment of the present invention, the load of each computing node is monitored, and the rules and data sharding are dynamically adjusted to ensure efficient use of computing resources.

[0067] Preferably, searching the rule table for recommendation results corresponding to the plurality of behavior data of each user according to the corresponding decision rule includes:

[0068] According to the rule index of the corresponding decision rule, the recommendation result of the result storage location corresponding to the rule storage location is searched in the rule table. When the recommendation result is a known recommendation result, it is directly obtained. When the recommendation result is an unknown recommendation result, the decision rule is executed to make a decision on the corresponding behavior data to obtain the recommendation result.

[0069] Specifically, the Reduce stage processes each computing node to obtain the recommendation result, summarizes the recommendation result, and outputs the final processing result. When the decision rule in each computing node makes a decision on the behavior data, it first searches the rule table for the corresponding recommendation result according to the rule index. If the recommendation result exists, it is directly obtained; if the recommendation result is not saved, the behavior data is decided by the rule to generate the recommendation result.

[0070] In the embodiment of the present invention, the corresponding recommendation result is searched according to the rule index, which saves the time of decision-making calculation and can quickly respond and generate processing results when processing large batches of data.

[0071] Preferably, after the step of obtaining the rule subsets corresponding to the plurality of data shards, the method further comprises:

[0072] Establish a corresponding data index for each of the data slices, store the corresponding data slices in a behavior feature storage location in a pre-built data table according to the multiple data indexes, and store the rule subset in a matching rule storage location of the corresponding data slice in the data table;

[0073] When new behavior data is imported, the data shard to which the new behavior data belongs is matched according to the behavior characteristics of the new behavior data. When a data shard is matched, the rule subset of the matching rule storage location corresponding to the behavior characteristic storage location is searched in the data table according to the data index of the data shard;

[0074] When no data shards are matched, the new behavior data are divided into new data shards according to the behavior characteristics of the new behavior data, and a new rule subset is screened out from the recommended rule set according to the behavior characteristics of the new behavior data.

[0075] Specifically, use tree-based index structures (such as B+ trees, Trie) or hash tables to speed up data retrieval. In parallel processing, indexes can significantly speed up data matching and retrieval. The specific steps are as follows:

[0076] Partitioning large-scale data and combining it with partition indexes can further improve retrieval efficiency. Data partitioning refers to dividing a large-scale data set D into several smaller subsets {D j Each subset is called a partition. Partitioning can more effectively manage and process large-scale data, improve system performance and retrieval efficiency. Divide data D into multiple partitions {D j} is: Partition(D)={D j}.

[0077] Create an index: Create an index I for the data set D, for example, using a B+ tree or hash table. The index value of each piece of data is calculated when it is inserted and stored in the corresponding location. j The index of} is: I[D j ]=Index(D j ).

[0078] When querying data, only the relevant partitions need to be accessed, rather than traversing the entire data set, thus reducing query time. Data from different partitions can be assigned to different computing nodes for parallel processing, making full use of computing resources. When inputting data, the index is first used for fast matching. If the match is successful, the corresponding rule set is directly obtained. i}, the query is:

[0079] Query(I j ,Condition i )→Matching_Records in D j .

[0080] In the embodiment of the present invention, the behavior data is stored, and when searching, the corresponding partition is found according to the data category, thereby improving the search efficiency, reducing the query time, and making full use of computing resources for parallel processing.

[0081] Preferably, performing decision calculations on each of the computing nodes separately further includes:

[0082] Corresponding slave nodes are respectively built for the plurality of computing nodes. When any computing node fails, the plurality of behavior data corresponding to the plurality of decision rules in the computing node are copied to the corresponding slave nodes, and decision calculations are performed on the slave nodes.

[0083] In the embodiment of the present invention, when some nodes fail, other nodes can take over the tasks through the fault-tolerant mechanism. A master-slave architecture is adopted. When the master node fails, the slave node automatically switches to the master node, ensuring that the system can still run stably under high load and fault conditions, and ensuring the security and integrity of the data.

[0084] Preferably, after generating the recommendation result, the method further includes:

[0085] Logs are used to record operating status and fault information to facilitate fault location and recovery. System data is backed up regularly to prevent data loss. A data recovery mechanism is provided to ensure that data can be quickly restored when it is damaged or lost. A distributed file system is used for real-time data synchronization and backup.

[0086] Preferably, the process for executing complex rules is as follows:

[0087] Assume the following complex rule set:

[0088] Rule1:IF(X>5∧Y<3)THEN Z=10;

[0089] Rule2:IF(X≤5∨Y≥3)THEN Z=0;

[0090] Rule3:IF(X>8)THEN W=5.

[0091] Process the imported behavior dataset D, including:

[0092] Create rule index and cache, including:

[0093] Condition_Cache[X>5];

[0094] Condition_Cache[Y<3].

[0095] Execute rules through parallel computing, including:

[0096] The Map stage determines which rules in the rule subset are triggered by data sharding, as follows:

[0097] Map(R1, D j ) = {Z = 10 | (X > 5 ∧ Y < 3)};

[0098] Map(R2, D j ) = {Z = 0 | (X < 5 ∨ Y ≥ 3)};

[0099] Map(R3,D j )={W=5|(X>8)}.

[0100] The intermediate results output by the map phase are merged through the Shuffle phase, as follows:

[0101] Intermediate_Results = U j (Map(R1,D j )∪Map(R2,D j ∪Map(R3,D j )).

[0102] The Reduce phase uses rules to make decisions on data sharding and summarizes the final results as follows:

[0103] FinaL_Results = U i Intermediate_Results[i].

[0104] Embodiment 2:

[0105] Import user behavior data on the e-commerce platform (such as browsing, clicking, purchasing, etc.). Assume that the user behavior data contains the following fields:

[0106] D = {user number, product number, operation, timestamp};

[0107] The operations include view, click, purchase, etc.

[0108] Processing is done according to a predefined set of recommended rules, assuming the following rules:

[0109] Rule 1: If the user browses the electronic product page, recommend electronic products;

[0110] Rule 2: If the user has purchased a certain type of book, then recommend books of that type.

[0111] That is, Rule1:IF user views item in category'electronics'THEN recommenditems in category'electronics';

[0112] Rule2:IF user purchases item in category'books'THEN recommend items incategory'books'.

[0113] Rules 1 and 2 are formally expressed as:

[0114] R1:IF(action=view∧category='electronics')THEN

[0115] recommend(category='electronics');

[0116] R2:IF(action=purchases∧category='books')THEN

[0117] recommend(category='books').

[0118] Combining Rule 1 and Rule 2, the formal expression of the conditional combination rule is:

[0119] R new :IF(action='view'∧category=C)∨(action='purchase'∧

[0120] category=C)THEN recommend(category=C).

[0121] Use conditional indexing and caching mechanisms to speed up rule processing. Assume that the cache contains the following information:

[0122] Condition_Cache={(action=view)→True, (category='electronics')→True};

[0123] The condition index and cache mechanism can speed up rule processing by pre-calculating and storing the results of certain conditions. Through data structures such as hash tables, it is possible to avoid repeated calculations of the same conditions, thereby improving efficiency.

[0124] Use the MapReduce model to process the ruleset in parallel:

[0125] Map phase: Each processing unit evaluates a subset of rules R i ,include:

[0126] Map(R1, D j )={recommend(category='electronics')|(action=view∧

[0127] category = 'electronics')};

[0128] Map(R2, D j )={recommend(category='books')|(action=purchase∧

[0129] category='books')}.

[0130] Shuffle phase:

[0131] Intermediate_Results = U j Map(R i , D j ).

[0132] Reduce phase: Summarizes the results of all processing units, including:

[0133] Reduce(Intermediate_Results)=U i Intermediate_Results[i].

[0134] Generate a recommendation result recommend(category='electronics'), that is, recommend similar electronic products.

[0135] Among them, user behavior data and product information are stored in an efficient memory database and indexed to speed up retrieval:

[0136] Index(user_id, item_id, category);

[0137] When you need to retrieve user behavior data, you can directly access it through the index to improve query efficiency:

[0138] Query(Index,Condition i )→Matching_Records.

[0139] When the new behavior data received is that the number of purchases of a certain type of goods is 6 and the number of purchase days is 10, that is, {purchase_count: 6, last_purchase_days: 10};

[0140] The corresponding rule subset is found through the index corresponding to the data type. If the rule subset found in the rule hash table is:

[0141] {purchase_count>5;last_purchase_within_30_days};

[0142] The structure of the rule subset in the hash table is:

[0143] {"purchase_count>5":True; "last_purchase_days<30":True};

[0144] The recommendation result is searched according to the rule index corresponding to the rule in the rule subset. If it exists, the calculation result in the rule hash table is used directly; if it does not exist, the rule needs to be calculated to obtain the recommendation result and update the rule hash table. If the recommendation result is True, it is considered that the received data meets the same conditions, and the corresponding type of products are recommended to the user. The final recommended product list is a combination of the processing results of parallel computing and the index query results. The rule engine determines which rules are triggered through parallel computing, and then uses the index mechanism to quickly retrieve relevant data, generate recommendation results, and display them to the user.

[0145] Finally, relevant electronic products are recommended to users to achieve real-time decision support. This embodiment demonstrates the specific application of an efficient rule engine in a real-time recommendation system for an e-commerce platform. By using technologies such as rule optimization, conditional indexing and caching, parallel computing, and efficient data storage and retrieval, it ensures that fast and accurate recommendation services can be provided in a high-concurrency and large-scale data environment.

[0146] This solution can also be applied in application scenarios such as financial transactions, industrial control and network security.

[0147] like Figure 2 As shown, an embodiment of the present invention provides a rule engine processing system, including:

[0148] A rule storage module, used to set a plurality of recommendation rules to construct a recommendation rule set, and store the plurality of recommendation rules in the recommendation rule set and the corresponding recommendation results in a pre-constructed rule table;

[0149] A data partitioning module, used to import multiple behavioral data of multiple users from the e-commerce platform, divide the multiple behavioral data into multiple data slices according to multiple preset behavioral features, the data slices include multiple behavioral data, filter out recommendation rules matching the multiple behavioral features from the recommendation rule set, and obtain rule subsets corresponding to the multiple data slices;

[0150] A rule filtering module, used for processing each of the data slices and the corresponding rule subsets in parallel, to obtain a plurality of decision rules triggered by any behavior data of each of the data slices in the corresponding rule subsets;

[0151] A data merging module, used to merge multiple behavior data of multiple decision rules in corresponding data slices into different computing nodes to obtain multiple computing nodes;

[0152] The data decision module is used to perform decision calculations on each of the computing nodes respectively. The decision calculations are to search the rule table for recommendation results corresponding to multiple behavioral data of each user according to the corresponding decision rules, and generate recommended products for each user according to the multiple recommendation results corresponding to each user.

[0153] This solution has achieved significant beneficial effects by introducing technical means such as parallel computing, distributed processing, optimized rule processing, efficient data storage and retrieval, fault tolerance mechanism and data backup and recovery, including:

[0154] Significantly improve the efficiency of rule processing: Use parallel computing technology to accelerate the rule execution process through multi-threading or distributed computing. Use optimization technologies such as rule preprocessing and rule merging to reduce repeated and invalid calculations, significantly reduce rule execution time and resource consumption, and meet real-time requirements.

[0155] Fast data storage and retrieval: Use high-performance in-memory databases to store and retrieve real-time data, reducing latency in data reading and writing. Introduce efficient indexing mechanisms to speed up the data retrieval process and ensure that required data can be quickly located in large-scale data environments.

[0156] Fault handling and recovery mechanism: Introduce fault tolerance mechanism to ensure normal operation when some nodes fail. Provide data backup and recovery mechanism to ensure data security and integrity.

[0157] Enhanced scalability: Server nodes can be added through horizontal expansion, or the performance of a single node can be enhanced through vertical expansion to enhance scalability and maintainability; support distributed deployment, expand processing capabilities through clustering, and support deployment in large-scale and complex application scenarios.

[0158] Reduce operating costs: Through efficient rule processing and intelligent management, the hardware resources and labor input required for operation are reduced, the operating costs are reduced, and the overall economic benefits are improved.

[0159] Improved stability and reliability: The distributed architecture and perfect management mechanism enhance stability and reliability, enabling stable operation in high-concurrency and complex business environments, reducing failures and downtime.

[0160] Simplify the integration and deployment process: Provide easy-to-integrate and deploy solutions so that the rule engine can be easily integrated into existing decision support systems, reducing deployment time and costs and accelerating system launch.

[0161] The above-mentioned rule engine processing system can refer to the implementation content and beneficial effects of the rule engine processing method specifically described above, which will not be repeated here.

[0162] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.

[0163] 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 principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A rule engine processing method, characterized in that: The steps include: Setting a plurality of recommendation rules to construct a recommendation rule set, and storing the plurality of recommendation rules in the recommendation rule set and the corresponding recommendation results in a pre-constructed rule table; Importing multiple behavior data of multiple users from an e-commerce platform, dividing the multiple behavior data into multiple data slices according to multiple preset behavior features, wherein the data slices include multiple behavior data, and filtering recommendation rules matching the multiple behavior features from the recommendation rule set to obtain rule subsets corresponding to the multiple data slices; Processing each of the data slices and the corresponding rule subsets in parallel to obtain a plurality of decision rules triggered by any behavior data of each of the data slices in the corresponding rule subsets; Merging multiple behavior data of multiple decision rules in corresponding data slices into different computing nodes respectively to obtain multiple computing nodes; Decision calculation is performed on each computing node respectively, and the decision calculation is to search the rule table for recommendation results corresponding to multiple behavior data of each user according to the corresponding decision rules, and generate recommended products for each user according to the multiple recommendation results corresponding to each user.

2. The rule engine processing method according to claim 1, characterized in that: The setting of multiple recommendation rules to construct a recommendation rule set is specifically: Based on the behavior characteristics, multiple recommendation rules are set, the recommendation rules corresponding to the behavior characteristics of the set key characteristics are combined, and the same parts of the combined recommendation rules are simplified by Boolean algebra to obtain multiple combination rules; The uncombined multiple recommended rules are regarded as a single rule, and a recommended rule set is constructed by the multiple single rules and the multiple combined rules.

3. The rule engine processing method according to claim 2, characterized in that: The multiple recommendation rules are set based on the behavior characteristics, and the recommendation rules corresponding to the behavior characteristics of the set key characteristics are combined, specifically: The behavior characteristics setting multiple recommendation rules includes setting multiple browsing recommendation rules based on browsing characteristics, setting multiple purchase recommendation rules based on purchase characteristics, and setting multiple query recommendation rules based on query characteristics; It is determined whether the plurality of recommendation rules are combinable rules respectively. If so, the plurality of browsing recommendation rules and / or the plurality of purchase recommendation rules and / or the plurality of query recommendation rules belonging to the set key features are combined respectively.

4. The rule engine processing method according to claim 1, characterized in that: The storing of the plurality of recommendation rules in the recommendation rule set and the corresponding recommendation results into the pre-built rule table is specifically as follows: Establishing corresponding rule indexes for a plurality of recommended rules in the recommended rule set, and storing the corresponding recommended rules in a rule storage location in a pre-constructed rule table according to the plurality of rule indexes respectively; The recommendation results of the plurality of recommendation rules include known recommendation results and unknown recommendation results, and the known recommendation results are stored in a result storage location in the rule table corresponding to a recommendation rule storage location.

5. The rule engine processing method according to claim 4, characterized in that: The searching the rule table for recommendation results corresponding to the plurality of behavior data of each user according to the corresponding decision rule includes: According to the rule index of the corresponding decision rule, the recommendation result of the result storage location corresponding to the rule storage location is searched in the rule table. When the recommendation result is a known recommendation result, it is directly obtained. When the recommendation result is an unknown recommendation result, the decision rule is executed to make a decision on the corresponding behavior data to obtain the recommendation result.

6. The rule engine processing method according to claim 1, characterized in that: The parallel processing of each of the data slices and the corresponding rule subsets is specifically as follows: The multiple behavior data and the corresponding rule subsets of each data slice are divided into one processing unit to obtain multiple processing units, and the multiple processing units are processed in parallel through a mapping function.

7. The rule engine processing method according to claim 1, characterized in that: The step of respectively merging the multiple behavior data of the multiple decision rules in the corresponding data slices into different computing nodes to obtain multiple computing nodes is specifically as follows: The plurality of decision rules are sorted to obtain a sorted sequence, and the plurality of behavior data of each decision rule in the corresponding data shard is merged into the corresponding position of the sorted sequence through a local aggregation operation, and the plurality of decision rules and the corresponding plurality of behavior data in the sorted sequence are divided into different computing nodes according to preset merging parameters, and each decision rule and the corresponding plurality of behavior data are grouped in the divided computing nodes to obtain a plurality of data groups, and a computing node is formed by the plurality of data groups to obtain a plurality of computing nodes.

8. The rule engine processing method according to claim 7, characterized in that: After the step of obtaining a plurality of computing nodes, the method further includes: The loads of the plurality of computing nodes are calculated respectively through a monitoring tool to obtain a plurality of load values, and the plurality of load values ​​are compared with preset thresholds respectively. When the load values ​​are greater than the preset thresholds, the plurality of data groups are divided into a plurality of data fragments respectively, and the plurality of data fragments are respectively distributed to computing nodes with low loads through a load balancing algorithm.

9. The rule engine processing method according to claim 1, characterized in that: After the step of obtaining the rule subsets corresponding to the plurality of data fragments, the method further includes: Establish a corresponding data index for each of the data slices, store the corresponding data slices in a behavior feature storage location in a pre-built data table according to the multiple data indexes, and store the rule subset in a matching rule storage location of the corresponding data slice in the data table; When new behavior data is imported, the data shard to which the new behavior data belongs is matched according to the behavior characteristics of the new behavior data. When a data shard is matched, the rule subset of the matching rule storage location corresponding to the behavior characteristic storage location is searched in the data table according to the data index of the data shard; When no data shards are matched, the new behavior data are divided into new data shards according to the behavior characteristics of the new behavior data, and a new rule subset is screened out from the recommended rule set according to the behavior characteristics of the new behavior data.

10. A rule engine processing system, characterized in that: include: A rule storage module, used to set a plurality of recommendation rules to construct a recommendation rule set, and store the plurality of recommendation rules in the recommendation rule set and the corresponding recommendation results in a pre-constructed rule table; A data partitioning module, used to import multiple behavioral data of multiple users from the e-commerce platform, divide the multiple behavioral data into multiple data slices according to multiple preset behavioral features, the data slices include multiple behavioral data, filter out recommendation rules matching the multiple behavioral features from the recommendation rule set, and obtain rule subsets corresponding to the multiple data slices; A rule filtering module, used for processing each of the data slices and the corresponding rule subsets in parallel, to obtain a plurality of decision rules triggered by any behavior data of each of the data slices in the corresponding rule subsets; A data merging module, used to merge multiple behavior data of multiple decision rules in corresponding data slices into different computing nodes to obtain multiple computing nodes; The data decision module is used to perform decision calculations on each of the computing nodes respectively. The decision calculations are to search the rule table for recommendation results corresponding to multiple behavioral data of each user according to the corresponding decision rules, and generate recommended products for each user according to the multiple recommendation results corresponding to each user.

Citation Information

Patent Citations

  • Rule-driven guidance and feedback system

    CA2327191A1

  • Distributed rule engine system and construction method thereof

    CN106777029A

  • Product recommendation system

    CN113869982A

  • Intention recognition method, interaction system and equipment

    CN114625878A

  • Rule-based real-time decision making and data processing method in streaming database

    CN117743398A

Cited By

  • Efficient man-machine interaction method and system combining rule engine and real-time stream processing technology

    CN120335620A