Efficient man-machine interaction method and system combining rule engine and real-time stream processing technology
By building a hybrid index structure and utilizing SIMD parallel computing technology, the memory access and parallel processing of the rule engine are optimized, and the efficiency and response time problems of the traditional rule engine under large-scale rule sets are solved, achieving efficient real-time human-computer interaction.
Patent Information
- Application Number
- CN202510830647.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-20
- Publication Date
- 2025-07-18
- Estimated Expiration
- 2045-06-20
AI Technical Summary
When dealing with large-scale rule sets, traditional rules engines have problems such as inefficient search efficiency, long response time, and unoptimized memory access. Especially in real-time human-computer interaction scenarios, they cannot meet the users' demanding requirements for system response speed, and lack context awareness and parallel computing capabilities.
Build a hybrid index structure, combine hash index and tree index, filter rules based on rule access frequency and context feature, and use SIMD parallel computing technology to optimize memory access mode and realize parallel evaluation of rule conditions.
It significantly reduces the time delay of the rule engine, improves the search efficiency by more than 60%, and controls the response time within 100ms, meeting the performance requirements of real-time human-computer interaction.
Smart Images

Figure CN120335620A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical fields of computer science and artificial intelligence, and particularly relates to an efficient human - computer interaction method and system combining a rule engine and real - time stream processing technology. Background Art
[0002] As a core decision - making component, the rule engine is playing an increasingly important role in intelligent systems. Traditional rule engines face problems such as low search efficiency, long response time, and unoptimized memory access when dealing with large - scale rule sets. Especially in real - time human - computer interaction scenarios, users have extremely high requirements for the system response speed.
[0003] In the prior art, rule engines mainly use linear search or simple index structures for rule matching. This method will cause significant performance bottlenecks when the number of rules is large. At the same time, traditional methods lack in - depth analysis of rule access patterns and fail to fully utilize the correlation and access frequency characteristics between rules for optimization. In addition, existing systems generally lack context - awareness capabilities and cannot dynamically filter relevant rules according to the current interaction scenario, resulting in a large amount of ineffective calculations.
[0004] In terms of parallel processing, traditional rule engines fail to effectively utilize the SIMD (Single Instruction Multiple Data) capabilities of modern processors and cannot achieve batch parallel evaluation of rule conditions. These technical limitations severely restrict the application effect of rule engines in high - concurrency and low - latency scenarios.
[0005] Therefore, there is an urgent need for an efficient rule - engine solution that can combine intelligent indexing, context - awareness, memory optimization, and parallel computing technologies to meet the dual requirements of real - time and accuracy for modern human - computer interaction systems. Summary of the Invention
[0006] The purpose of the present invention is to solve the technical problems existing in the prior rule - engine technology, such as low search efficiency, long response time, and unoptimized memory access, and to provide an efficient human - computer interaction method and system combining a rule engine and real - time stream processing technology. This method constructs a hybrid index structure, introduces a context - awareness mechanism, optimizes the memory access pattern, and utilizes SIMD parallel computing technology to significantly reduce the time delay of the rule engine, improve the response speed of the human - computer interaction system and the user experience. The specific technical solutions are as follows: In the first aspect, the present invention provides an efficient human - computer interaction method combining a rule engine and real - time stream processing technology for reducing the time delay of the rule engine, characterized in that the method includes: Step S1, construct a rule hybrid index structure to locate each rule according to the access frequency of each rule in the rule engine, use a hash index to search for high - frequency rules, and use a tree - shaped index to search for low - frequency rules; Step S2: Based on the context-driven method, combined with the context features of the current human-computer interaction, screen each rule in the rule engine, and obtain the candidate rule set according to the constructed rule hybrid index structure; Step S3: Rearrange the candidate rule set in the memory area according to the access relevance, and process the rearranged candidate rule set simultaneously according to the SIMD instruction to reduce the time delay of the rule engine.
[0007] Furthermore, the construction method of the hybrid index structure in Step S1 is as follows: Statistical rule set Each rule in Access frequency , calculate the frequency threshold , where Is the average access frequency, Is the standard deviation of the access frequency, Is the standard deviation coefficient; Rules that meet Are classified as high-frequency rule sets , using hash index For Quick positioning of time complexity; Rules that meet Are classified as low-frequency rule sets , using Tree index For Ordered search of time complexity; Build a hybrid index , realizing the average search time , where Is the proportion of high-frequency rules.
[0008] Furthermore, the construction method of the hash index Is as follows: Extract the key feature vectors of each rule in the high-frequency rule set , where Is the rule type, Is the priority, Is the number of conditions; Calculate the hash value using the locality-sensitive hashing function , where Is the hash parameter, Is the size of the hash table, set the size of the hash table , to keep the load factor at 0.5 and minimize the impact of hash collisions on the search time.
[0009] Furthermore, the Tree index The construction method is as follows: The low-frequency rule set is sorted according to the composite key , where the priority is the primary key, the rule type is the secondary key, and the rule ID is the unique identifier; Construct a tree structure, set the node size to 4KB, and the degree of the tree is: ; Store the complete rule information in the leaf nodes and only store the index key values in the internal nodes.
[0010] Furthermore, it is characterized in that the context-driven method is specifically: For each rule , a predefined applicable context set is defined, and the matching degree between the rule and the current context is calculated: ; According to the constructed rule hybrid index structure, find the rules with a matching degree greater than 0.5 to form a candidate rule set .
[0011] Furthermore, the candidate rule set is rearranged in the memory area according to the access relevance, and the access relevance between the rules in the candidate rule set is calculated, and the simultaneous access probability of the rule pair is calculated: , where is the number of times that the rules and are simultaneously accessed, is the total number of accesses; Cluster the rules based on the relevance, and assign the rules that meet to the same memory block.
[0012] Furthermore, the rules in each memory block are evaluated in parallel, and the SIMD instructions are used to simultaneously process the conditional judgments of multiple rules to achieve parallel acceleration of single instruction multiple data.
[0013] Furthermore, the specific method for simultaneously processing the rearranged candidate rule set according to the SIMD instructions is: Convert the rule conditions in the same memory block into vectorized representations. For a memory block containing rules, construct a condition matrix , where is the maximum number of conditions.
[0014] Adopt the AVX-512 instruction set to process 16 32-bit conditional values at a time and batch-evaluate the rule conditions: , where represents the vectorized logical bitwise AND operation; is the th conditional column, that is, taking all rows and the (k - 1)th column of matrix C; identifying the rule indexes that meet the conditions through bitmask operations to reduce the time delay of the rule engine.
[0015] Furthermore, the method further includes a rule engine dynamic optimization step: Step S4, establish a time window statistical model for rule access frequency, and use a sliding window to collect rule access data within a time period, and calculate the dynamic frequency of the rule within the time window : ; where is the smoothing factor, is the number of accesses of rule within the time window, and
[0016] is the number of accesses of all rules within the time window. Step S5, detect the rule heat migration according to the dynamic frequency change, and trigger the index structure reconstruction when is satisfied, where the change threshold
[0017] is not greater than 0.3. When the dynamic frequency of rule in two adjacent windows is greater than , update the rule hybrid index structure, and maintain the real-time requirement of the average response time
[0018] through incremental hash table expansion and B+ tree node splitting operations.
[0019] In a second aspect, the present invention provides an efficient human-computer interaction system combining a rule engine and real-time stream processing technology for executing the method in the first aspect. The system includes: a hybrid index module, a context awareness module, a memory optimization module, and a SIMD execution engine.
[0020] The hybrid index module is used to construct a rule hybrid index structure to locate each rule according to the access frequency of each rule in the rule engine, and uses a hash index to find high-frequency rules and a tree index to find low-frequency rules.
[0021] The context awareness module screens each rule in the rule engine based on a context-driven method, combined with the context characteristics of the current human-computer interaction, and obtains a candidate rule set according to the constructed rule hybrid index structure.
[0022] The SIMD execution engine supports the AVX-512 instruction set, and processes the rearranged candidate rule set according to SIMD instructions simultaneously, so as to reduce the time delay of the rule engine.
[0023] Compared with the prior art, the beneficial effects of the present invention are as follows: By constructing a hybrid index structure, the present invention adopts a hash index with a time complexity for high-frequency rules and a B+ tree index for low-frequency rules, achieving a significant optimization of the average search time. Compared with the traditional linear search method, the search efficiency is increased by more than 60%, the average response time of the system is controlled within 100 ms, and the delay is reduced by more than 50% compared with the traditional method, meeting the strict requirements of real-time human-computer interaction. Description of the Drawings
[0024] Figure 1 It is a flowchart of an efficient human-computer interaction method combining a rule engine and real-time stream processing technology according to the present invention.
[0025] Figure 2 It is a schematic diagram of the composition of an efficient human-computer interaction system combining a rule engine and real-time stream processing technology according to the present invention. Detailed Embodiments
[0026] To make the objectives, technical solutions and advantages of the present invention clearer, the technical solutions in the present invention will be described clearly and completely below. Apparently, the described embodiments are some but not all of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art without creative efforts based on the embodiments in the present invention belong to the scope of protection of the present invention.
[0027] Embodiment 1 As Figure 1 shown, it is a flowchart of an efficient human-computer interaction method combining a rule engine and real-time stream processing technology according to the present invention, used to reduce the time delay of the rule engine. The method includes: Step S1, according to the access frequencies of the rules in the rule engine, construct a rule hybrid index structure to locate each rule, and use a hash index to search for high-frequency rules and a tree index to search for low-frequency rules.
[0028] The rule engine usually contains 1,000 to 100,000 rules, and each rule contains attributes such as a rule ID, a rule type (such as a verification rule, a business rule, a security rule), a priority (level 1-10), and the number of conditions (1-20 conditions). The access frequency statistics adopt a sliding time window mechanism, the window size is set to 1 hour to 24 hours, and the statistical data is updated every 15 minutes.
[0029] For example, in an e-commerce recommendation system with 5,000 rules, statistical analysis shows that the access frequencies of the user login verification rules, product recommendation rules, and price calculation rules are 45%, 35%, and 20% respectively, which belong to high-frequency rules; while the access frequencies of the refund processing rules, exception handling rules, etc. are only 2 - 5%, belonging to low-frequency rules. Through this classification, 80% of the search requests can be completed within O(1) time through a hash index; it should be noted that O(1) represents a constant time complexity, meaning that regardless of the data scale, the time required for the algorithm to execute remains constant and does not increase with the increase in the input data volume; 1 does not refer to 1 second or 1 millisecond, but to a constant, which may be 1 operation, or 5 or 10 operations, but the key is that this number is fixed; when the data increases from 100 to 1 million, the execution time of the O(1) algorithm is basically the same.
[0030] The construction method of the hybrid index structure described in step S1 is as follows: Statistical rule set For each rule in calculate the access frequency , and calculate the frequency threshold , where is the average access frequency, is the standard deviation of the access frequency, is the coefficient of the standard deviation. Adopting a dynamic adjustment strategy, when the scale of the rule set is less than 1,000, set the coefficient to 0.5; when the scale is between 1,000 - 10,000, the coefficient is 0.8; when the scale exceeds 10,000, the coefficient is
[0031] 1.2 to ensure that the proportion of the high-frequency rule set remains between 20 - 30%. Classify the rules that meet as the high-frequency rule set and use a hash index for fast positioning with O(1) time complexity; Classify the rules that meet as the low-frequency rule set and use a tree index for ordered search with O(log n) time complexity; The tree is specifically designed for disk storage and large data volume search. Compared with an ordinary binary tree, it has the following advantages: lower tree height (reducing the number of search layers), supporting range queries, cache-friendly, and good concurrency performance; for the low-frequency rule set, the The time complexity means that even with 1 million low-frequency rules, it takes at most about 20 comparisons to find the target rule.
[0032] The specific meaning of complexity is as follows: Assume the degree of the tree is 170 (each node has at most 170 key values), then: For 10,000 rules: it takes at most ≈ 2 levels and 2 node accesses. For 100,000 rules: it takes at most ≈ 3 levels and 3 node accesses. For 1 million rules: it takes at most ≈ 3 levels and 3 node accesses.
[0033] The node size of the tree is set to 4KB to ensure that each node access can fully utilize the CPU cache. The storage format of the composite key is: priority (4 bytes) + rule type (4 bytes) + rule ID (8 bytes), totaling 16 bytes, plus an 8-byte pointer, so each key-value pair occupies 24 bytes; each node can store approximately 170 key-value pairs, corresponding to the degree of the tree .
[0034] Construct a hybrid index , to achieve an average search time , where is the proportion of high-frequency rules.
[0035] The method for constructing the hash index is as follows: Extract the key feature vectors of each rule in the high-frequency rule set , where is the rule type, is the priority, is the number of conditions; Calculate the hash value using a locality-sensitive hashing function , where is the hash parameter, is the size of the hash table. Set the size of the hash table to keep the load factor at 0.5 and minimize the impact of hash collisions on the search time. When
[0036] the ratio is 3:2:1, the hash distribution is the most uniform. Specifically, for the rule type value range of 1 - 10, the priority value range of 1 - 10, and the condition number value range of 1 - 20, we can set (select a prime number to reduce collisions).
[0037] Hash parameters need to be adjusted according to different business scenarios. For example, in a financial risk control system, where there are significant differences in priorities, the weight of can be increased; in a content recommendation system, where the distribution of rule types is relatively uniform, the weights of the three parameters can be balanced. The setting of the hash table size M also needs to consider memory limitations. When the available memory is limited, the load factor can be appropriately reduced to 0.3 - 0.4 to trade time for space.
[0038] The tree index is constructed as follows: Sort the low-frequency rule set according to the composite key , where the priority is the primary key, the rule type is the secondary key, and the rule ID is the unique identifier; Construct a tree structure with the node size set to 4KB and the degree of the tree : ; Store the complete rule information in the leaf nodes and only store the index key values in the internal nodes.
[0039] Step S2: Based on the context-driven method, combine the context features of the current human-computer interaction to filter each rule in the rule engine, and obtain the candidate rule set according to the constructed rule hybrid index structure.
[0040] The definition of context features includes multiple dimensions such as user features (age, gender, region, preferences), session features (access time, access path, stay duration), device features (device type, network environment, screen resolution), business features (transaction type, product category, price range), etc. Each dimension is represented by a bit vector. For example, user age is represented by 8 bits for different age groups, and product category is represented by 16 bits for different categories.
[0041] The context-driven method is specifically as follows: Pre-define the applicable context set for each rule , calculate the matching degree between the rule and the current context : ; According to the constructed rule hybrid index structure, find the rules with a matching degree greater than 0.5 to form the candidate rule set .
[0042] The matching degree is calculated using similarity, whose value range is [0, 1], and the threshold is 0.5. In an e-commerce scenario, when the user is "a 25-year-old female, browsing clothing products, using a mobile device", the matching degree of rules related to clothing recommendations is between 0.7 - 0.9, while the matching degree of rules related to electronic products is less than 0.3.
[0043] Step S3, rearrange the candidate rule set in the memory area according to access correlation, and simultaneously process the rearranged candidate rule set according to the SIMD instruction to reduce the time delay of the rule engine.
[0044] Rearrange the candidate rule set in the memory area according to access correlation, and calculate the access correlation between the rules in the candidate rule set and calculate the simultaneous access probability of the rule pair : where , where is the number of times that rules and are simultaneously accessed, and is the total number of accesses; The window size is set to 1000 - 10000 access records, and the probability threshold is 0.3. When the threshold is too low (e.g., 0.1), it will cause the memory block to be too large and the cache efficiency to decrease; when the threshold is too high (e.g., 0.7), it will cause related rules to be scattered into different memory blocks and lose the clustering effect.
[0045] Cluster the rules based on correlation, and assign the rules that satisfy to the same memory block; the memory block size is set to 64KB, which is half of the processor L1 cache size, ensuring that the entire memory block can be fully loaded into the cache; each memory block can accommodate about 200 - 500 rules. To avoid memory fragmentation, the memory pool technology is used to pre-allocate memory blocks of a fixed size.
[0046] Evaluate the rules in each memory block in parallel, and use the SIMD instruction to simultaneously process the conditional judgments of multiple rules to achieve parallel acceleration of single instruction multiple data.
[0047] The specific method of simultaneously processing the rearranged candidate rule set according to the SIMD instruction is as follows: Convert the rule conditions in the same memory block into a vectorized representation. For a memory block containing rules, construct a conditional matrix , where is the maximum number of conditions; Adopt the AVX - 512 instruction set to process 16 32 - bit conditional values at a time and batch - evaluate the rule conditions: , where represents the vectorized logical bit - wise AND operation; is the th conditional column, that is, take all rows of the matrix C, the (k - 1)th column.
[0048] The AVX-512 instruction set requires the CPU to support 512-bit vector registers, which are currently mainly supported in Intel Xeon Scalable processors and some high-end desktop processors. For systems that do not support AVX-512, they can degrade to use the AVX2 (256-bit) or SSE4 (128-bit) instruction sets, and accordingly the number of conditional quantities processed at one time is reduced to 8 or 4.
[0049] Identify the rule indexes that meet the conditions through bitmask operations to reduce the time delay of the rule engine.
[0050] The construction of the conditional matrix requires standardizing the rule conditions. For example, the numerical condition "age>25" is converted into a 32-bit integer comparison operation, and the string condition "category == 'electronics'" is converted into a hash value comparison; for complex logical expressions, they are converted into a vectorized operation sequence using reverse Polish notation.
[0051] The execution time of SIMD instructions is about 1 / 16 to 1 / 8 of that of traditional scalar instructions. The specific speedup ratio depends on the condition complexity and data dependencies. To maximize SIMD efficiency, data alignment techniques are used to ensure the vectorization of memory access, and prefetch instructions are used to reduce memory latency.
[0052] Bitmask operations use specialized bit operation instructions, such as _mm512_test_epi32_mask, which can quickly identify the positions of rules that meet the conditions. The result processing uses parallel bit scan instructions, and the time complexity is , where is the number of candidate rules.
[0053] This method also includes the dynamic optimization step of the rule engine: Step S4, establish a time window statistical model for rule access frequencies, and use a sliding window to collect rule access data within a time period, and calculate the dynamic frequency of the rule within the time window : ; where, is the smoothing factor, is the number of accesses of rule within the time window, is the number of accesses of all rules within the time window.
[0054] The time interval of the sliding window is dynamically adjusted according to the system load. It is set to 5 minutes during high load periods (QPS>1000) and 30 minutes during low load periods; the smoothing factor The selection is based on the stability of the access pattern: for business systems with a relatively stable access pattern, it is set to 0.8 - 0.9; for systems with a faster-changing access pattern, it is set to 0.3 - 0.5.
[0055] The dynamic frequency is calculated using the Exponential Weighted Moving Average (EWMA) algorithm, which assigns higher weights to recent data. To avoid the influence of noisy data, a minimum sample number limit is also introduced. The dynamic frequency is updated only when the total number of accesses within a certain time window exceeds 100 times.
[0056] Step S5, detect heat migration according to the dynamic frequency change rule, and trigger the index structure reconstruction when is satisfied, where the change threshold is not greater than 0.3.
[0057] Step S6, when the rule has a dynamic frequency greater than in two adjacent windows, update the rule hybrid index structure, and maintain the real-time requirement of the average response time through incremental hash table expansion and B+ tree node splitting operations.
[0058] Incremental hash table expansion uses consistent hashing technology, and the system can still provide normal services during the expansion process; the expansion process is divided into three stages: 1) Create a new hash table; 2) Gradually migrate data; 3) Switch to the new table and release the old table; the entire process is completed within 10 ms.
[0059] The tree node splitting operation adopts a batch processing method, combines multiple nodes that need to be split for processing, reduces the lock overhead, and uses the Copy-on-Write technology during the splitting process.
[0060] The monitoring of the response time uses quantile statistics, focusing on the P95 and P99 response times. When the P99 response time exceeds 200 ms, an emergency optimization process is triggered, including measures such as temporarily increasing the hash table size and adjusting the SIMD batch processing size.
[0061] Embodiment 2 As Figure 2 shown, it is a schematic diagram of the composition of an efficient human-computer interaction system combining a rule engine and real-time stream processing technology of the present invention. The system includes: a hybrid index module, a context awareness module, a memory optimization module, and a SIMD execution engine.
[0062] The hybrid index module is used to construct a rule hybrid index structure to locate each rule according to the access frequency of each rule in the rule engine. It uses a hash index to find high-frequency rules and a tree index to find low-frequency rules.
[0063] The hybrid index module adopts a modular design and includes an index manager, a hash index sub-module, a B+ tree index sub-module, and a statistical analysis sub-module. The index manager is responsible for coordinating the work of each sub-module and maintaining the global mapping relationship from rules to indexes. The memory occupancy of the module is dynamically allocated according to the rule scale. For a system with 10,000 rules, the hash index usually occupies 2 - 4MB of memory, and the B+ tree index occupies 8 - 16MB of memory.
[0064] The module supports multi-threaded concurrent access and uses a read-write lock mechanism to ensure data consistency. Read operations can be executed concurrently, and write operations require exclusive access.
[0065] The persistent storage of the index adopts the method of periodic snapshots plus incremental logs. Snapshots are generated once an hour, and incremental logs record index changes in real time. When the system restarts, it first loads the latest snapshot and then replays the incremental logs to restore to the latest state. The entire recovery process is completed within 1 - 2 minutes.
[0066] The context-aware module, based on a context-driven approach, combines the context features of the current human-computer interaction to screen each rule in the rule engine and obtains a candidate rule set according to the constructed rule hybrid index structure.
[0067] The context-aware module supports multiple context acquisition methods, including HTTP request header parsing, user profile API calls, real-time behavior analysis, etc.
[0068] To reduce latency, the module implements a multi-level caching mechanism: the L1 cache stores the context information of the most recent 1000 users, the L2 cache stores hot context patterns, and the L3 cache connects to an external user profile system.
[0069] The calculation of context matching is optimized using bit operations. The context features are encoded as bit vectors, and intersections and unions are quickly calculated through operations such as bitwise AND and bitwise OR.
[0070] For complex context queries, context conditions in the form of boolean expressions are supported, such as: "(age >= 25 AND gender = 'F') OR (category = 'luxury')".
[0071] The memory optimization module rearranges the candidate rule set in the memory area according to access relevance; monitors the memory usage, triggers garbage collection when the memory usage rate exceeds 80%, and clears the unused rule cache; the memory compression function can compress and store the rule data with low-frequency access and decompress it dynamically during access, trading time for space. The SIMD execution engine supports the AVX-512 instruction set and processes the rearranged candidate rule set according to the SIMD instructions simultaneously, reducing the time delay of the rule engine.
[0072] The engine internally maintains the code paths of different instruction set versions, including AVX-512, AVX2, SSE4, and scalar versions.
[0073] The engine implements conditional compilation and dynamic distribution mechanisms, and selects the most suitable vectorization strategy according to the characteristics of the rule conditions. For simple numerical comparisons, integer vector instructions are used; for string matching, byte comparison instructions are used; for complex logic, a hybrid vectorization scheme is used.
[0074] To maximize the SIMD efficiency, the engine implements data rearrangement and alignment optimization; the input data is automatically rearranged into a SIMD-friendly format, and the memory allocation ensures vector width alignment. The engine also supports pipelined processing, preloading the next batch of data while processing the current batch of data to hide the memory access latency.
[0075] The four modules communicate with each other through message queues and shared memory. The message queue is used to control the instruction transfer, and the shared memory is used for large data volume transmission; the system adopts an event-driven architecture, and each module registers the events it is interested in and communicates decoupled through the event bus.
[0076] The system implements a complete monitoring and warning mechanism. The monitoring metrics include query response time, index hit rate, memory usage rate, SIMD execution efficiency, etc. When the key metrics are abnormal, the system automatically triggers an alarm and executes the predefined emergency handling process.
[0077] The specific implementation manners described above further elaborate the purpose, technical solutions, and beneficial effects of the present invention. It should be understood that the above are only the specific implementation manners of the present invention and are not used to limit the protection scope of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. An efficient human-computer interaction method combining rule engine and real-time stream processing technology for reducing the time delay of the rule engine, characterized in that, The method includes: Step S1: Based on the access frequencies of the rules in the rule engine, construct a rule hybrid index structure to locate each rule. Use a hash index to find high-frequency rules and a tree index to find low-frequency rules; Step S2: Based on a context-driven method, combine the context features of the current human-computer interaction to filter the rules in the rule engine, and obtain a candidate rule set according to the constructed rule hybrid index structure; Step S3: Rearrange the candidate rule set in the memory area according to access relevance, and simultaneously process the rearranged candidate rule set according to SIMD instructions to reduce the time delay of the rule engine.
2. The method according to claim 1, wherein The construction method of the hybrid index structure described in Step S1 is: Statistical rule set For each rule The access frequency , calculate the frequency threshold , where Is the average access frequency, Is the standard deviation of the access frequency, Is the coefficient of standard deviation; Classify the rules that satisfy as a high-frequency rule set and use a hash index to perform fast positioning with time complexity; Classify the rules that satisfy as a low-frequency rule set , and use a tree index to perform an ordered search with time complexity; Construct a hybrid index to achieve the average search time , where is the proportion of high-frequency rules.
3. The method according to claim 2, characterized in that, The hash index is constructed as follows: extract the key feature vectors of each rule in the high-frequency rule set , where is the rule type, is the priority, is the number of conditions; Adopt a locality-sensitive hashing function Calculate the hash value, where is the hash parameter, is the size of the hash table, and set the size of the hash table to keep the load factor at 0.5 and minimize the impact of hash collisions on the search time.
4. The method according to claim 3, characterized in that The tree index is constructed as follows: sort the low-frequency rule set in accordance with the composite key where the priority is the primary key, the rule type is the secondary key, and the rule ID is the unique identifier; Construct a tree structure, set the node size to 4KB, and the degree of the tree : ; Store the complete rule information at the leaf nodes and only store the index key values at the internal nodes.
5. The method according to claim 4, characterized in that, The context-driven method specifically is: For each rule predefine a set of applicable contexts , calculate the matching degree of the rule and the current context : ; Search for rules with a matching degree greater than 0.5 according to the constructed rule hybrid index structure to form a candidate rule set .
6. The method according to claim 5, characterized in that, Rearrange the candidate rule sets in the memory area according to access relevance and calculate the access relevance among the rules in the candidate rule sets Calculate the access relevance between the rules in the candidate rule sets and calculate the simultaneous access probability of the rule pairs : where is the number of times that rules and are simultaneously accessed, and is the total number of accesses; Cluster the rules based on relevance and assign the rules that satisfy to the same memory block.
7. The method according to claim 6, characterized in that, Parallelly evaluate the rules within each memory block, and use SIMD instructions to simultaneously process the conditional judgments of multiple rules to achieve parallel acceleration of single instruction multiple data.
8. The method according to claim 7, wherein The specific method for simultaneously processing the rearranged candidate rule set according to SIMD instructions is: Convert the rule conditions within the same memory block into a vectorized representation. For a memory block containing rules, construct a condition matrix , where is the maximum number of conditions; Adopt the AVX-512 instruction set to process 16 32-bit conditional values at a time and batch-evaluate the rule conditions: , where represents a vectorized logical bitwise AND operation; is the th conditional column, that is, taking all rows and the (k - 1)th column of matrix C; Identify the rule indexes that meet the conditions through bitmask operations to reduce the time delay of the rule engine.
9. The method according to claim 8, characterized in that The method further includes a dynamic optimization step for the rule engine: Step S4, establish a time window statistical model for the rule access frequency, and use a sliding window Collect the rule access data within the time period, and calculate the rule Dynamic frequency within the time window : ; Among them, is the smoothing factor, is the rule Access times within the time window, is the access times of all rules within the time window; Step S5, detect heat transfer according to the dynamic frequency change rule, and trigger the reconstruction of the index structure when the following condition is met is satisfied, where the change threshold is not greater than 0.3; Step S6, when the rule in two adjacent windows has a dynamic frequency greater than , update the rule mixing index structure, and through the operations of incremental hash table expansion and B+ tree node splitting, maintain the real-time requirement of the average response time.
10. An efficient human-computer interaction system combining a rule engine and real-time stream processing technology for performing the method according to any one of claims 1-9, characterized in that, The system includes: a hybrid index module, a context awareness module, a memory optimization module, and a SIMD execution engine; The hybrid index module is used to construct a rule hybrid index structure to locate each rule based on the access frequencies of the rules in the rule engine, use a hash index to find high-frequency rules, and use a tree index to find low-frequency rules; The context awareness module, based on a context-driven method, combines the context features of the current human-computer interaction to filter the rules in the rule engine, and obtains a candidate rule set according to the constructed rule hybrid index structure; The memory optimization module rearranges the candidate rule set in the memory area according to access relevance; The SIMD execution engine supports the AVX-512 instruction set and simultaneously processes the rearranged candidate rule set according to SIMD instructions to reduce the time delay of the rule engine.
Citation Information
Patent Citations
Rule engine system optimization method and device, computer equipment and storage medium
CN111814458A
Policy adaptive control method based on cloud environment
CN116436786A
Rule engine processing method and system
CN119149811A
A rule engine positioning method combined with AI intelligence
CN119782370A
Intelligent document retrieval and generation system based on metadata driving
CN120104624A
Cited By
Goods source intelligent recall method and system based on multi-dimensional condition matrix
CN121190168A