Rule matching method, device and equipment based on improved Beta network and medium
By improving the rule matching method of the Beta network, through condition parsing, alpha classification, and memory optimization, the problem of low matching efficiency when the number of rules is large is solved, and efficient and real-time rule matching is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-05
- Publication Date
- 2026-03-10
AI Technical Summary
In existing technologies, rule matching efficiency and real-time performance are low, especially when the number of rules reaches thousands or even tens of thousands, making it difficult to meet real-time and concurrency requirements.
By improving the rule matching method of the Beta network, including condition parsing, alpha classification, shared quantity calculation, alpha classification ranking, Beta network construction and memory usage optimization, the rule storage and matching process are optimized.
It improves the efficiency and real-time performance of rule matching, reduces computational overhead, and enhances system stability and resource utilization efficiency.
Smart Images

Figure CN121638481A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of artificial intelligence and deep learning, and particularly relates to a rule matching method and device based on an improved Beta network, equipment and a medium. BACKGROUND
[0002] In the fields of artificial intelligence, expert systems, industrial control, and knowledge graph reasoning, rule matching is the core mechanism of knowledge reasoning and event response. Rule matching is usually based on "condition-action (IF-THEN)" rules, which involves obtaining fact data from external inputs or running environments, comparing them with the established rule base, filtering out rules that meet the conditions, and then driving subsequent action execution. This process is the premise of building a knowledge automated reasoning link and an important basic ability to realize intelligent decision-making and complex scenario response of the system.
[0003] From a functional perspective, the main functions of rule matching include: (1) Knowledge reasoning and decision support: In complex business systems, automatic matching reasoning of fact data can provide decision suggestions or directly trigger business processes; (2) Real-time response and event-driven: In industrial production, network monitoring, and other environments, the system can trigger corresponding strategies in real time according to dynamic inputs to improve operational efficiency and safety; (3) Explainability and rule maintainability: Compared with black-box models such as deep learning, rule-based decision-making processes are traceable, auditable, and easy to maintain and extend.
[0004] In existing technologies, static indexing is the first proposed optimization scheme for production systems. The idea is to create an index for rules to ensure that when the system asserts facts again, it can quickly find the corresponding rules in a short time. In 1979, Forgy proposed the Rete algorithm, which can perform incremental matching, cache matching states during reasoning, and share network nodes to improve matching efficiency.
[0005] However, as the business scale and the number of rules continue to grow, the traditional "one-by-one traversal" matching method has a sharp increase in computational overhead, especially when the number of rules reaches thousands or even tens of thousands, the matching efficiency decreases significantly, making it difficult to meet real-time and concurrency requirements, resulting in low efficiency and real-time performance of rule matching. SUMMARY
[0006] The present application provides a rule matching method, device, equipment and medium based on an improved Beta network, which can improve the efficiency and real-time performance of rule matching based on an improved Beta network.
[0007] To achieve the above object, the application provides a rule matching method based on an improved Beta network, which comprises the following steps of: acquiring existing rule data, and performing conditional analysis on the existing rule data to obtain a conditional analysis set; performing Alpha classification on the conditional analysis set by using a preset Alpha network to obtain an Alpha classification set, and calculating the sharing amount of an Alpha classification node in the Alpha classification set; calculating the sharing amount of the Alpha classification in the Alpha classification set according to the sharing amount of the Alpha classification node, and sorting the Alpha classification in the Alpha classification set according to the sharing amount of the Alpha classification to obtain an Alpha classification sorting result; constructing a Beta network according to the Alpha classification sorting result, and calculating the memory usage of each node in the Beta network; optimizing the Beta node in the Beta network according to the memory usage, obtaining an improved Beta network after optimization, and performing business rule matching based on the improved Beta network.
[0008] To solve the above problems, the application further provides a rule matching device based on an improved Beta network, which comprises the following modules: a conditional analysis module, which is used for acquiring existing rule data, and performing conditional analysis on the existing rule data to obtain a conditional analysis set; a Beta network construction module, which is used for performing Alpha classification on the conditional analysis set by using a preset Alpha network to obtain an Alpha classification set, and calculating the sharing amount of an Alpha classification node in the Alpha classification set; calculating the sharing amount of the Alpha classification in the Alpha classification set according to the sharing amount of the Alpha classification node, and sorting the Alpha classification in the Alpha classification set according to the sharing amount of the Alpha classification to obtain an Alpha classification sorting result; constructing a Beta network according to the Alpha classification sorting result, and calculating the memory usage of each node in the Beta network; a business rule matching module, which is used for optimizing the Beta node in the Beta network according to the memory usage, obtaining an improved Beta network after optimization, and performing business rule matching based on the improved Beta network.
[0009] To solve the above problems, the application further provides an electronic device, which comprises the following components: at least one processor; and a memory in communication connection with the at least one processor; wherein The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the rule matching method based on the improved Beta network.
[0010] To solve the above problems, the application further provides a computer readable storage medium, which stores at least one computer program, and the at least one computer program is executed by a processor in an electronic device to implement the rule matching method based on the improved Beta network.
[0011] The present application performs conditional analysis on existing rule data to obtain a conditional analysis set. Complex rules can be decomposed into executable conditional analyses by conditional analysis, and the conditional analyses are combined to form a conditional analysis set, so as to realize the structured expression of rules. In addition, the conditional analysis set is classified by a preset Alpha network to obtain an Alpha classification set, and the sharing amount of the Alpha classification nodes in the Alpha classification set is calculated. The classification of conditions and the calculation of the sharing amount by the Alpha network can optimize rule storage and reduce repeated matching. In addition, the sharing amount of the Alpha classification nodes in the Alpha classification set is calculated based on the sharing amount of the Alpha classification, and the Alpha classification in the Alpha classification set is sorted based on the sharing amount of the Alpha classification, so as to obtain an Alpha classification sorting result. This can reduce the calculation overhead, maximize node sharing and resource allocation, and further improve the real-time performance and concurrency of rule matching. Finally, a Beta network is constructed based on the Alpha classification sorting result, and the memory usage of each node in the Beta network is calculated. The Beta nodes in the Beta network are optimized based on the memory usage, and an improved Beta network is obtained after optimization. Business rule matching is performed based on the improved Beta network, which can construct an efficient Beta network structure, and the resources can be controlled through memory usage monitoring, and the system overhead can be reduced through memory optimization, so as to improve the matching speed and system stability, and further improve the efficiency and real-time performance of rule matching. BRIEF DESCRIPTION OF DRAWINGS
[0012] Figure 1 A flowchart of the rule matching method based on the improved Beta network provided by an embodiment of the present application is shown. Figure 2 A process flowchart of the Beta node memory space of the rule matching method based on the improved Beta network provided by an embodiment of the present application is shown. Figure 3 A functional module diagram of the rule matching device based on the improved Beta network provided by an embodiment of the present application is shown. Figure 4A structural schematic diagram of an electronic device for implementing the rule matching method based on the improved Beta network according to an embodiment of the present application is shown in Fig. 1.
[0013] The implementation, functional features and advantages of the present application will be further described with reference to the embodiments and the accompanying drawings. DETAILED DESCRIPTION
[0014] It should be understood that the specific embodiments described herein are merely intended to explain the present application and are not intended to limit the present application.
[0015] An embodiment of the present application provides a rule matching method based on an improved Beta network. The execution subject of the rule matching method based on the improved Beta network includes but is not limited to at least one of electronic devices such as a server and a terminal, which can be configured to execute the method provided by the embodiment of the present application. In other words, the rule matching method based on the improved Beta network can be executed by software or hardware installed in a terminal device or a server device, and the software can be a blockchain platform. The server includes but is not limited to a single server, a server cluster, a cloud server or a cloud server cluster, etc. The server can be a stand-alone server, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content distribution networks (CDN), and basic cloud computing services such as big data and artificial intelligence platforms, etc.
[0016] Reference Figure 1 Fig. 1 shows a flowchart of the rule matching method based on the improved Beta network according to an embodiment of the present application. In this embodiment, the rule matching method based on the improved Beta network includes: S1, obtaining existing rule data and performing conditional analysis on the existing rule data to obtain a conditional analysis set.
[0017] It should be understood that the existing rule data refers to the business rules or logical descriptions defined in the database, and the existing rule data can be production scheduling rules or business approval rules in the manufacturing field, etc.
[0018] It should be understood that the conditional analysis refers to the process of disassembling, identifying and converting the logical conditions in the existing rule data into executable basic constraint units.
[0019] S2, performing Alpha classification on the conditional analysis set using a preset Alpha network to obtain an Alpha classification set, and calculating the sharing amount of the Alpha classification nodes in the Alpha classification set.
[0020] Understandably, the pre-built Alpha network refers to the pre-constructed set of Alpha nodes and their connection structure in rule matching, which is used to conditionally filter the input facts, essentially a fixed conditional filtering framework.
[0021] Understandably, Alpha classification is a node that performs preliminary conditional filtering on the input existing rule data.
[0022] Understandably, the amount of sharing refers to the degree of overlap between existing rule data in different alpha categories. For example, if there is a large overlap between the existing rule data of two alpha categories, the amount of sharing is high.
[0023] Specifically, the condition parsing set is subjected to Alpha classification using a pre-defined Alpha network to obtain an Alpha classification set, including: Using the pre-defined Alpha classification rules in the Alpha network, each condition in the condition parsing set is identified. Conditions that satisfy the Alpha classification rules are taken as Alpha classification nodes, and the Alpha classification nodes are merged into their respective Alpha network nodes. Delete conditions that do not meet the Alpha classification rules.
[0024] Further, the shared amount of Alpha classification nodes in the Alpha classification set is calculated, including: The shared amount of Alpha class nodes in the Alpha class set is calculated using the following formula: in, For the first The number of nodes shared by each Alpha classification node. For business rules Does it contain Alpha classification nodes? , This represents the total number of business rules. For the first Alpha classification nodes, For the first Each business rule .
[0025] S3. Calculate the sharing amount of Alpha categories in the Alpha category set based on the sharing amount of Alpha category nodes, and sort the Alpha categories in the Alpha category set based on the sharing amount of Alpha categories to obtain the Alpha category sorting result.
[0026] Specifically, the sharing of Alpha categories in the Alpha category set is calculated based on the sharing of Alpha category nodes, including: The following formula is used to calculate the share of Alpha categories in the Alpha category set. : in, The total number of categories for Alpha. This represents the shared amount of Alpha category nodes contained within the Alpha category.
[0027] Furthermore, the Alpha categories in the Alpha category set are sorted based on the amount of sharing among the Alpha categories, resulting in the Alpha category ranking results, including: Step 1: Traverse the Alpha network and calculate the shared data of all Alpha classification nodes in the Alpha network; Step 2: Based on the shared amount of Alpha category nodes, calculate the shared amount of each Alpha category, and sort the Alpha categories in descending order of shared amount. Step 3: Sort the Alpha categories with equal sharing based on the number of nodes from least to most to obtain the Alpha category ranking results.
[0028] S4. Construct a Beta network based on the Alpha classification and ranking results, and calculate the memory usage of each node in the Beta network.
[0029] Understandably, a Beta network is a network structure that combines and matches different conditional filtering results from Alpha nodes. In a Beta network, a Beta node is connected by its left input (the result of the previous Beta node) and its right input (the result of a certain Alpha node).
[0030] Understandably, memory utilization refers to the ratio of the actual amount of memory occupied by a Beta node during operation to the total amount of memory that the Beta node can be allocated. It is used to measure the resource consumption and optimization potential of a Beta node.
[0031] Specifically, a Beta network is constructed based on the Alpha classification ranking results, including: Step 1: Process the Alpha network based on the shared data of the Alpha classification; Step 2: Select a business rule R from the existing set of business rules in the rule data; Step 3: Take a condition parsing p from the business rule R, and put the condition parsing p as the Beta(p) node into the Beta network. The Alpha(p) node is connected to the Beta(p) node as the right input. Step 301: If the Beta node is the first one, then the left input is a virtual input and is empty; otherwise, connect the previous Beta node to the Beta(p) node. Step 4: Repeat step 3 until all conditions in business rule R have been processed; Step 5: Repeat steps 2-4 until all business rules in the business rule set have been processed. After processing, the completed Beta network is obtained.
[0032] S5. Optimize the Beta nodes in the Beta network based on memory usage. After optimization, an improved Beta network is obtained, and business rule matching is performed based on the improved Beta network.
[0033] Understandably, optimizing Beta nodes in the Beta network based on memory usage can be implemented using the following steps: Deleting business rules within a node according to their weights, in ascending order of weight, and using a least recently used strategy for nodes with the same weight. The limit of 1 for the most recently used rule is changed to n. This strategy requires maintaining two queues: an access history queue and a data queue. The access history queue stores records of all business rules accessed. If a business rule has been accessed n times, it is moved to the data queue. When a business rule needs to be deleted, the one with the nth access time furthest from the current time is cleared.
[0034] Specifically, optimizations are made to Beta nodes in the Beta network based on memory usage, including: Calculate memory usage by comparing the used memory size of the Beta node with the total memory size. Beta nodes in the Beta network whose memory usage exceeds a preset memory usage threshold are deleted, resulting in an improved Beta network.
[0035] Furthermore, Beta nodes in the Beta network whose memory usage exceeds a preset memory usage threshold are deleted, including: Step 1: When the business rule of a Beta node in the Beta network is accessed for the first time, the business rule of the current Beta node is stored in the access history queue. Step 2: If the number of accesses for the current Beta node's business rules in the access history queue has not reached the preset number, then delete the current Beta node's business rules according to the first-in-first-out control strategy. Step 3: When the data in the access history queue has been accessed a preset number of times, the business rules of the current Beta node are passed to the data queue, and the business rule queue is reordered. Step 4: When a business rule in the business rule queue is accessed, the business rule queue is reordered; Step 5: When you need to delete a business rule from the queue, simply delete the business rule at the end of the queue.
[0036] Understandably, the preset memory usage threshold refers to a pre-set upper limit for the proportion of memory usage, for example, it can be set to 70%.
[0037] For example, after obtaining the improved Beta network through optimization, the process also includes: After successfully deleting a business rule from a Beta node whose usage exceeds the threshold, it's also necessary to delete the corresponding content from the Alpha node and other Beta nodes that store the business rule. For other Beta nodes, simply delete the corresponding content within the Beta node. If the Alpha node doesn't share any other business rules that don't need to be deleted, it needs to be completely removed from the Alpha network; if it does share other business rules that don't need to be deleted, only the storage information corresponding to the deleted rule needs to be deleted.
[0038] This invention performs condition parsing on existing rule data to obtain a set of condition parsings. This parsing breaks down complex rules into executable basic condition units, achieving a structured expression of the rules. Furthermore, the condition parsing set is used to perform Alpha classification using a pre-defined Alpha network to obtain an Alpha classification set, and the sharing of Alpha classification nodes in the Alpha classification set is calculated. By classifying conditions and calculating sharing through the Alpha network, rule storage can be optimized and duplicate matching reduced. Moreover, the sharing of Alpha classifications in the Alpha classification set is calculated based on the sharing of Alpha classification nodes, and the Alpha classifications in the Alpha classification set are then analyzed based on the sharing of Alpha classification nodes. The classes are sorted to obtain the Alpha classification ranking result, which can reduce computational overhead, maximize node sharing and resource allocation, and thus improve the real-time performance and concurrency of rule matching. Finally, a Beta network is constructed based on the Alpha classification ranking result, and the memory usage of each node in the Beta network is calculated. The Beta nodes in the Beta network are optimized based on the memory usage, resulting in an improved Beta network. Business rule matching is then performed based on the improved Beta network, which can build an efficient Beta network structure. Resource control is achieved through memory usage monitoring, and system overhead is reduced through memory optimization, improving matching speed and system stability, thereby improving the efficiency and real-time performance of rule matching.
[0039] Reference Figure 2 The diagram shown is a flowchart of the Beta node memory space processing method based on the improved Beta network according to an embodiment of the present invention.
[0040] like Figure 3 The diagram shown is a functional block diagram of a rule matching device based on an improved Beta network provided in an embodiment of the present invention.
[0041] The rule matching device 100 based on an improved Beta network described in this invention can be installed in an electronic device. Depending on the functions implemented, the rule matching device 100 based on an improved Beta network may include a condition parsing module 101, a Beta network construction module 102, and a business rule matching module 103.
[0042] The module described in this invention can also be called a unit, which refers to a series of computer program segments that can be executed by the processor of an electronic device and can perform a fixed function, and are stored in the memory of the electronic device.
[0043] In this embodiment, the functions of each module / unit are as follows: The condition parsing module 101 is used to obtain existing rule data and perform condition parsing on the existing rule data to obtain a condition parsing set.
[0044] The Beta network construction module 102 is used to perform Alpha classification on the condition parsing set using a preset Alpha network to obtain an Alpha classification set, and calculate the sharing amount of Alpha classification nodes in the Alpha classification set; calculate the sharing amount of Alpha classification in the Alpha classification set based on the sharing amount of Alpha classification nodes, and sort the Alpha classification in the Alpha classification set based on the sharing amount of Alpha classification to obtain the Alpha classification ranking result; construct the Beta network based on the Alpha classification ranking result, and calculate the memory usage rate of each node in the Beta network.
[0045] The business rule matching module 103 is used to optimize the Beta nodes in the Beta network according to the memory usage rate, and after the optimization is completed, an improved Beta network is obtained, and business rule matching is performed based on the improved Beta network.
[0046] like Figure 4 The diagram shown is a schematic representation of an electronic device that implements a rule matching method based on an improved Beta network, according to an embodiment of the present invention.
[0047] The electronic device may include a processor 10, a memory 11, a communication bus 12, and a communication interface 13. It may also include a computer program stored in the memory 11 and executable on the processor 10, such as a rule matching method program based on an improved Beta network.
[0048] In some embodiments, the processor 10 may be composed of integrated circuits, such as a single packaged integrated circuit or multiple integrated circuits with the same or different functions, including combinations of one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips. The processor 10 is the control unit of the electronic device, connecting various components of the entire electronic device through various interfaces and lines. It executes programs or modules stored in the memory 11 (e.g., executing a rule matching method program based on an improved Beta network) and calls data stored in the memory 11 to perform various functions of the electronic device and process data.
[0049] The memory 11 includes at least one type of readable storage medium, including flash memory, portable hard drive, multimedia card, card-type memory (e.g., SD or DX memory), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 11 can be an internal storage unit of an electronic device, such as a portable hard drive. In other embodiments, the memory 11 can be an external storage device of the electronic device, such as a plug-in portable hard drive, Smart Media Card (SMC), Secure Digital (SD) card, Flash Card, etc. Furthermore, the memory 11 can include both internal and external storage units of the electronic device. The memory 11 can be used not only to store application software and various types of data installed on the electronic device, such as code for a rule matching method program based on an improved Beta network, but also to temporarily store data that has been output or will be output.
[0050] The communication bus 12 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This bus can be divided into an address bus, a data bus, a control bus, etc. The bus is configured to enable communication between the memory 11 and at least one processor 10, etc.
[0051] The communication interface 13 is used for communication between the aforementioned electronic device and other devices, including a network interface and a user interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a Wi-Fi interface, Bluetooth interface, etc.), typically used to establish communication connections between the electronic device and other electronic devices. The user interface may be a display, an input unit (such as a keyboard), or optionally, a standard wired or wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen, etc. The display may also be appropriately referred to as a screen or display unit, used to display information processed in the electronic device and to display a visual user interface.
[0052] Figure 4 Only electronic devices with components are shown; those skilled in the art will understand that... Figure 4The structure shown does not constitute a limitation on the electronic device and may include fewer or more components than shown, or combine certain components, or have different component arrangements.
[0053] For example, although not shown, the electronic device may also include a power supply (such as a battery) to power the various components. Preferably, the power supply can be logically connected to the at least one processor 10 through a power management device, thereby enabling functions such as charging management, discharging management, and power consumption management. The power supply may also include one or more DC or AC power supplies, recharging devices, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components. The electronic device may also include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be described in detail here.
[0054] It should be understood that the embodiments described are for illustrative purposes only and are not limited to this structure in the scope of the patent application.
[0055] The memory 11 in the electronic device stores a rule matching method program based on an improved Beta network, which is a combination of multiple instructions that, when run in the processor 10, can achieve the following: Obtain existing rule data and perform condition parsing on the existing rule data to obtain a set of condition parsings; The condition parsing set is subjected to Alpha classification using a pre-defined Alpha network to obtain an Alpha classification set, and the shared amount of Alpha classification nodes in the Alpha classification set is calculated. The shared amount of Alpha categories in the Alpha category set is calculated based on the shared amount of Alpha category nodes, and the Alpha categories in the Alpha category set are sorted based on the shared amount of Alpha categories to obtain the Alpha category sorting result. Construct a Beta network based on the Alpha classification ranking results, and calculate the memory usage of each node in the Beta network; The Beta nodes in the Beta network are optimized based on memory usage. After optimization, an improved Beta network is obtained, and business rules are matched based on the improved Beta network.
[0056] Specifically, the specific implementation method of the processor 10 for the above instructions can be referred to the description of the relevant steps in the corresponding embodiment of the accompanying drawings, and will not be repeated here.
[0057] Furthermore, if the modules / units integrated in the electronic device 1 are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. The computer-readable storage medium can be volatile or non-volatile. For example, the computer-readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, or a read-only memory (ROM).
[0058] The present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor of an electronic device, can perform the following: Obtain existing rule data and perform condition parsing on the existing rule data to obtain a set of condition parsings; The condition parsing set is subjected to Alpha classification using a pre-defined Alpha network to obtain an Alpha classification set, and the shared amount of Alpha classification nodes in the Alpha classification set is calculated. The shared amount of Alpha categories in the Alpha category set is calculated based on the shared amount of Alpha category nodes, and the Alpha categories in the Alpha category set are sorted based on the shared amount of Alpha categories to obtain the Alpha category sorting result. Construct a Beta network based on the Alpha classification ranking results, and calculate the memory usage of each node in the Beta network; The Beta nodes in the Beta network are optimized based on memory usage. After optimization, an improved Beta network is obtained, and business rules are matched based on the improved Beta network.
[0059] In the several embodiments provided by this invention, it should be understood that the disclosed devices, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and other division methods may be used in actual implementation.
[0060] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0061] Furthermore, the functional modules in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional modules.
[0062] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0063] Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be embraced within the invention. No appended diagram markings in the claims should be construed as limiting the scope of the claims.
[0064] The blockchain referred to in this invention is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Essentially, a blockchain is a decentralized database, a chain of data blocks linked together using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block. A blockchain can include an underlying blockchain platform, a platform product service layer, and an application service layer.
[0065] The embodiments of this application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.
[0066] Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices recited in a system claim may also be implemented by a single unit or device through software or hardware. The terms "first," "second," etc., are used to indicate names and do not indicate any specific order.
[0067] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.
Claims
1. A rule matching method based on an improved Beta network, characterized in that, The method comprises: acquiring existing rule data, and performing conditional analysis on the existing rule data to obtain a conditional analysis set; performing Alpha classification on the conditional analysis set using a preset Alpha network to obtain an Alpha classification set, and calculating a sharing amount of an Alpha classification node in the Alpha classification set; calculating a sharing amount of an Alpha classification in the Alpha classification set according to the sharing amount of the Alpha classification node, and sorting the Alpha classifications in the Alpha classification set according to the sharing amount of the Alpha classification to obtain an Alpha classification sorting result; constructing a Beta network according to the Alpha classification sorting result, and calculating a memory usage rate of each node in the Beta network; optimizing a Beta node in the Beta network according to the memory usage rate, obtaining an improved Beta network after optimization, and performing business rule matching based on the improved Beta network.
2. The method of claim 1, wherein the improved Beta network is based on a Beta network with a modified rule matching method, wherein the modified rule matching method comprises: determining a rule match based on a rule match score; and determining the rule match score based on a rule match score function. The Alpha classification set is obtained by performing Alpha classification on the conditional analysis set using the preset Alpha network, which comprises: performing conditional identification on each condition in the conditional analysis set using an Alpha classification rule in the preset Alpha network, taking a condition satisfying the Alpha classification rule as an Alpha classification node, and incorporating the Alpha classification node into a node in the Alpha network; deleting a condition not satisfying the Alpha classification rule.
3. The rule matching method based on the improved Beta network as described in claim 1, characterized in that, The sharing amount of the Alpha classification node in the Alpha classification set is calculated, which comprises: The sharing amount of the Alpha classification node in the Alpha classification set is calculated using the following formula: ; wherein, node share of the th Alpha classification node, number of business rules whether the Alpha classification node is included , total number of business rules, the th Alpha classification node, the th business rule, .
4. The method of claim 3, wherein the improved Beta network is based on a Beta network with a modified rule matching method, wherein the modified rule matching method comprises: determining a rule match based on a rule match score; and determining the rule match score based on a rule match score function. The Alpha classification sorting result is obtained by sorting the Alpha classifications in the Alpha classification set according to the sharing amount of the Alpha classification, which comprises: Step 1: traversing the Alpha network, and calculating the sharing amount of all Alpha classification nodes in the Alpha network; Step 2: sorting the Alpha classifications according to the sharing amount of the Alpha classification nodes included in the Alpha classification, and calculating the sharing amount of each Alpha classification, and sorting the Alpha classifications according to the order from large to small of the sharing amount; Step 3: sorting the Alpha classifications with equal sharing amounts according to the order from few to many of the node quantity to obtain the Alpha classification sorting result.
5. The method of claim 1, wherein the improved Beta network is based on a Beta network with a modified rule matching method, wherein the modified rule matching method comprises: determining a rule match based on a rule match score; and determining the rule match score based on a rule match score function. The Beta network is constructed according to the Alpha classification sorting result, which comprises: Step 1: processing the Alpha network according to the sharing amount of the Alpha classification; Step 2: selecting a business rule R from a business rule set of the existing rule data; Step 3: taking a conditional analysis p from the business rule R, and placing the conditional analysis p as a Beta (p) node into the Beta network, and connecting an Alpha (p) node as a right input to the Beta (p) node; If the Beta node is located at the first, the left input is a virtual input, which is empty; otherwise, connecting the previous Beta node to the Beta (p) node; Step 4: repeating step 3 until the conditions in the business rule R are processed. Step 5: Steps 2-4 are repeated until all business rules in the business rule set are processed, and a completed Beta network is obtained after the processing.
6. The method of claim 1, wherein the improved Beta network is based on a Beta network with a modified rule matching method, wherein the modified rule matching method comprises: determining a rule match based on a rule match score; and determining the rule match score based on a rule match score function. The Beta nodes in the Beta network are optimized according to the memory usage, including: The memory usage is calculated by the used memory size and the total memory size of the Beta node; The Beta nodes in the Beta network whose memory usage exceeds the preset memory usage threshold are deleted, and an improved Beta network is obtained after the deletion.
7. The method of claim 6, wherein the improved Beta network is based on a Beta network with a modified rule matching method, wherein the modified rule matching method comprises: determining a rule match based on a rule match score; and determining the rule match score based on a rule match score function. The Beta nodes in the Beta network whose memory usage exceeds the preset memory usage threshold are deleted, including: Step 1: When the business rules of the Beta node in the Beta network are accessed for the first time, the business rules of the current Beta node are stored in the access history queue; Step 2: When the business rules of the current Beta node in the access history queue do not reach the preset access times, the business rules of the current Beta node are deleted according to the first-in-first-out control strategy; Step 3: When the data in the access history queue is accessed for the preset access times, the business rules of the current Beta node are transmitted to the data queue, and the business rule queue is reordered; Step 4: When a business rule in the business rule queue is accessed, the business rule queue is reordered; Step 5: When the business rule queue needs to be deleted, the business rule at the end of the business rule queue is directly deleted.
8. A rule matching apparatus based on an improved Beta network, characterized by, The device is used to implement the rule matching method based on the improved Beta network as claimed in any one of claims 1-7, and the device includes: A condition analysis module is configured to obtain existing rule data and perform condition analysis on the existing rule data to obtain a condition analysis set; A Beta network construction module is configured to perform Alpha classification on the condition analysis set using a preset Alpha network to obtain an Alpha classification set, calculate the sharing amount of the Alpha classification nodes in the Alpha classification set, calculate the sharing amount of the Alpha classifications in the Alpha classification set according to the sharing amount of the Alpha classification nodes, sort the Alpha classifications in the Alpha classification set based on the sharing amount of the Alpha classifications to obtain an Alpha classification sorting result, construct a Beta network according to the Alpha classification sorting result, and calculate the memory usage of each node in the Beta network; A business rule matching module is configured to optimize the Beta nodes in the Beta network according to the memory usage, obtain an improved Beta network after the optimization, and perform business rule matching based on the improved Beta network.
9. An electronic device, comprising: The electronic device includes: At least one processor; and A memory connected in communication with the at least one processor; wherein The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the rule matching method based on the improved Beta network as claimed in any one of claims 1-7.
10. A computer readable storage medium storing a computer program, characterized in that, The computer program, when executed by a processor, implements the rule matching method based on the improved Beta network according to any one of claims 1 to 7.