Rule matching method, device and medium based on high-concurrency decision engine
By constructing concurrent queues and rule binary trees, combined with thread pool management to manage concurrent execution, the problem of low rule matching efficiency and deployment failure in high-concurrency decision-making engines is solved, and efficient rule matching and business parameter calculation are achieved.
Patent Information
- Application Number
- CN202410455512.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-16
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2044-04-16
AI Technical Summary
The existing high-concurrency decision-making engine's rule engine based on the RETE algorithm has state limitations, which results in a single instance not being able to access concurrently through threads, high memory overhead, low rule matching efficiency, and prone to failures and lags during deployment.
By building a concurrent queue of business rule sets, we generate rule execution threads, convert business rules into rule binary trees, extract business data for logical classification, calculate rule matching and select target rules, and use thread pools to manage concurrent execution to avoid repeated compilation and resources. exhausted.
It improves the efficiency of rule matching, reduces concurrent queue pressure, avoids system resource exhaustion and deployment failures, and improves the efficiency of business parameter calculation.
Smart Images

Figure CN118363751B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of rule matching technology, and in particular to a rule matching method, device and medium based on a high-concurrency decision engine. Background Art
[0002] Currently, in industries such as finance, e-commerce, advertising, and the Internet of Things, business systems need to handle a large number of concurrent requests. These requests may come from users, devices, or sensors around the world, requiring the system to make decisions and respond in a very short time. Against this background, high-concurrency decision engines have emerged to provide efficient, accurate, and reliable rule matching and execution capabilities.
[0003] However, the existing high-concurrency decision engines are mainly rule engines based on the RETE algorithm. However, the rule engines based on the RETE algorithm are stateful engines, which means that a single engine instance cannot be accessed concurrently by threads. The actual processing capacity of the system is closely related to the number of XUs (Execution Units) on the iLOG RES (Rule Execution Server) server. The memory overhead is large, and when the number of rules is large, it cannot be successfully deployed on a server with limited memory. These rules must be split and the number of rules must be reduced to successfully deploy, resulting in low efficiency in rule matching. At the same time, since the conditional part of the rule is met, the rule engine of the RETE algorithm is prone to failures when uploading the JAR (Java archive) package, compiling, and building the network, resulting in the rule engine being unable to be deployed successfully, and the deployment takes a long time, and the system is stuck. Therefore, how to improve the efficiency of rule matching has become an urgent problem to be solved. Summary of the invention
[0004] The present invention provides a rule matching method, device and medium based on a high-concurrency decision engine, the main purpose of which is to solve the problem of low efficiency when performing rule matching.
[0005] To achieve the above object, the present invention provides a rule matching method based on a high-concurrency decision engine, comprising:
[0006] Acquire a business rule set, build a concurrent queue of the business rule set, and generate a rule execution thread according to the concurrent queue;
[0007] According to the rule execution thread, the business rules in the business rule set are converted into a rule binary tree, and the rule binary tree is traversed to obtain a rule statement of each business rule;
[0008] Acquire business information, extract business data from the business information, and perform business logic classification on the business information according to the business data to obtain a business category;
[0009] Calculating the rule matching degree of each of the business rules according to the business category and the business data using the rule statement;
[0010] A target business rule corresponding to the business information is selected from the business rule set according to the rule matching degree, and a business parameter of the business information is calculated using the target business rule.
[0011] Optionally, the constructing a concurrent queue of the business rule set includes:
[0012] Create a preset number of thread pools on the preset business end;
[0013] Packaging the business rule set to obtain a business classification set;
[0014] The business classification set is written into the thread pool to obtain a concurrent queue in the business rule set.
[0015] Optionally, executing threads according to the concurrent queue generation rule includes:
[0016] Initialize the execution thread pool, consume the concurrent queue, and obtain consumption business rules;
[0017] The consumer business rule is added to the execution thread pool to obtain a rule execution thread.
[0018] Optionally, the performing rule traversal on the rule binary tree to obtain a rule statement of each business rule includes:
[0019] Perform node traversal from the root node of the rule binary tree to obtain node rules;
[0020] Generate a code object of the node rule;
[0021] The code object is serialized to obtain a rule statement of each business rule.
[0022] Optionally, extracting the business data from the business information includes:
[0023] Extracting text data from the business information to obtain a business text;
[0024] Sentence segmentation is performed on the business text to obtain key sentences of the business text;
[0025] Business entities in the key sentences of the text are identified to obtain business data in the business information.
[0026] Optionally, extracting text data from the business information to obtain the business text includes:
[0027] Extracting a business picture from the business information;
[0028] Performing edge detection on the business image to obtain a text edge area;
[0029] The following formula is used to perform edge detection on the business image:
[0030]
[0031]
[0032] Wherein, P represents the text edge area of the business image, F represents the business image, Indicates that a graph opening operation is performed on the business image. represents an expansion operation on the business image, represents a clique operation on the business image, and Θ represents an erosion operation on the business image;
[0033] Perform text recognition on the text edge area to obtain the business text.
[0034] Optionally, the calculating the rule matching degree of each of the business rules according to the business category and the business data by using the rule statement includes:
[0035] Performing business classification on the rule statements to obtain a rule business category for each rule statement;
[0036] Selecting a target rule statement set from the rule statements according to the service category and the rule service category;
[0037] Performing data matching on the business data and each target rule statement in the target rule statement set;
[0038] The rule matching degree of each business rule is calculated according to the result of data matching.
[0039] Optionally, the calculating the business parameter of the business information by using the target business rule includes:
[0040] Obtain a target rule statement of the target business rule;
[0041] Decompiling the target rule statement into a rule object;
[0042] The rule object is executed to calculate the business parameters of the business information according to the business data of the business information.
[0043] In order to solve the above problems, the present invention also provides a rule matching device based on a high-concurrency decision engine, the device comprising:
[0044] A rule execution thread module is used to obtain a business rule set, build a concurrent queue of the business rule set, and generate a rule execution thread according to the concurrent queue;
[0045] A rule statement generation module, used for converting the business rules in the business rule set into a rule binary tree according to the rule execution thread, performing rule traversal on the rule binary tree, and obtaining a rule statement for each of the business rules;
[0046] A business logic classification module is used to obtain business information, extract business data from the business information, and perform business logic classification on the business information according to the business data to obtain a business category;
[0047] A rule matching degree calculation module, used to calculate the rule matching degree of each of the business rules according to the business category and the business data using the rule statement;
[0048] The business parameter calculation module is used to select a target business rule corresponding to the business information from the business rule set according to the rule matching degree, and calculate the business parameter of the business information using the target business rule.
[0049] In order to solve the above problems, the present invention also provides a computer-readable storage medium, in which at least one computer program is stored. The at least one computer program is executed by a processor in an electronic device to implement the above-mentioned rule matching method based on a high-concurrency decision engine.
[0050] The embodiment of the present invention can reduce the pressure of the concurrent queue by constructing a rule execution thread, and at the same time, can limit the number of concurrently executed threads according to the execution thread pool, prevent system resource exhaustion or excessive switching, and improve the efficiency of rule matching; according to the rule execution thread, the business rules are converted into rule statements, so that the rule statements can be persistently stored and rebuilt in different runtime environments, avoiding repeated compilation of business rules; business information is classified by business logic to obtain business categories, and the rule matching degree of each business rule can be calculated according to the business category and business data, and the target business rule corresponding to the business information is selected according to the rule matching degree, and the business parameters of the business information are calculated using the target business rule, so that the business information can be accessed concurrently, effectively improving the efficiency of business parameter calculation. Therefore, the rule matching method, device and medium based on a high-concurrency decision engine proposed in the present invention can solve the problem of poor efficiency during rule matching. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 A flowchart of a rule matching method based on a high-concurrency decision engine provided by an embodiment of the present invention;
[0052] Figure 2 A schematic diagram of a process for converting a business rule in a business rule set into a rule binary tree provided by an embodiment of the present invention;
[0053] Figure 3 A schematic diagram of a process for extracting business data from business information provided by an embodiment of the present invention;
[0054] Figure 4 A functional module diagram of a rule matching device based on a high-concurrency decision engine provided by an embodiment of the present invention;
[0055] The purpose, features and advantages of the present invention will be further described with reference to the accompanying drawings in conjunction with the embodiments. DETAILED DESCRIPTION
[0056] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0057] The embodiment of the present application provides a rule matching method based on a high-concurrency decision engine. The execution subject of the rule matching method based on the high-concurrency decision engine includes but is not limited to at least one of the electronic devices that can be configured to execute the method provided by the embodiment of the present application, such as a server, a terminal, etc. In other words, the rule matching method based on the high-concurrency decision engine can be executed by software or hardware installed on 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 an independent server, or it can be a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), and basic cloud computing services such as big data and artificial intelligence platforms.
[0058] Reference Figure 1 FIG. 1 is a flow chart of a rule matching method based on a high-concurrency decision engine provided by an embodiment of the present invention. In this embodiment, the rule matching method based on a high-concurrency decision engine includes:
[0059] S1. Obtain a business rule set, build a concurrent queue of the business rule set, and generate a rule execution thread according to the concurrent queue.
[0060] In an embodiment of the present invention, a business rule set is a collection of multiple business rules, wherein a business rule is a series of guiding principles and standards formulated by an organization during operation and management. Specifically, business rules are generally in text form. By formulating business rules through text, the content of the business rules can be clarified to ensure the realization of business goals.
[0061] In the embodiment of the present invention, the concurrent queue is a data structure, and the concurrent queue can allow multiple threads or processes to access threads in the queue at the same time while maintaining the order of the queue and the integrity of the data.
[0062] In an embodiment of the present invention, a parallel queue is an abstract data structure that can store a series of threads. In the parallel queue, each thread is processed in a first-in-first-out (FIFO) order. Therefore, the business classification set is written into the thread pool in order to obtain a concurrent queue.
[0063] In the embodiment of the present invention, the concurrent queue of building the business rule set includes:
[0064] Create a preset number of thread pools on the preset business end;
[0065] Packaging the business rule set to obtain a business classification set;
[0066] The business classification set is written into the thread pool to obtain a concurrent queue in the business rule set.
[0067] In an embodiment of the present invention, a preset thread pool including N threads can be created in the service end of the server according to user instructions, each thread includes at least one queue, and the services in the service rule set are classified and packaged. For example, the service rule set includes 1600 rules, and the throughput of the computer system is 2000TPS, which means that the concurrent queue needs to enter and exit 1600*2000*2=6400000 times per second, which exceeds the general queue throughput limit. The 1600 rules can be repackaged to obtain a service classification set, each service classification set includes m rules, which can greatly reduce the pressure of the concurrent queue and transfer the pressure to the subsequent rule execution thread, wherein m is a parameter for adjusting the system processing capacity.
[0068] In the embodiment of the present invention, the rule execution thread is a lightweight process responsible for executing program code, and is the basic unit for multi-tasking in a computer operating system. It allows multiple tasks to be executed at the same time, and is obtained by acquiring and consuming tasks from a concurrent queue.
[0069] In an embodiment of the present invention, the step of executing threads according to the concurrent queue generation rule includes:
[0070] Initialize the execution thread pool, consume the concurrent queue, and obtain consumption business rules;
[0071] The consumer business rule is added to the execution thread pool to obtain a rule execution thread.
[0072] In an embodiment of the present invention, a thread pool of a fixed size is created in the system, and each thread in the thread pool is in an idle state. When in the idle state, business rules can be obtained from the concurrent queue for consumption to obtain a rule execution thread. Specifically, when the execution thread pool is in an idle state, business rules can be obtained from the concurrent queue as tasks for consumption to obtain a rule execution thread for executing the business rules.
[0073] In an embodiment of the present invention, consumption of a concurrent queue refers to the process of safely taking out data from a queue and performing related processing in a multi-threaded or multi-process environment, wherein a concurrent queue allows multiple threads to consume simultaneously. Through the consumption of the concurrent queue, it can be determined whether the business rules are executed, and then the executed business rules can be added to the rule execution thread to facilitate subsequent matching of business rules. Specifically, multiple preset consumption middleware can be used to consume concurrent queues in parallel.
[0074] Among them, thread pool is a concurrent programming design pattern commonly used in computer programming, which is used to manage the creation, destruction and deployment of threads to improve the performance and response speed of the program. The execution thread pool first creates a group of threads and puts them into a pool, waiting to execute tasks. When a task arrives, the execution thread pool will select one from the idle threads to execute the task instead of creating a new thread each time. After the task is executed, the thread will not be destroyed immediately, but will return to the thread pool to continue waiting for the next task. For example, if the execution thread pool includes 70 groups of threads, 70 business rules can be consumed at the same time.
[0075] In an embodiment of the present invention, by constructing a rule execution thread, the pressure on the concurrent queue can be reduced. At the same time, according to the execution thread pool, CPU resources can be used more efficiently, the number of concurrently executed threads can be limited, and the system can be prevented from exhausting resources or excessive switching due to the creation of too many threads, thereby improving the efficiency of rule matching.
[0076] S2. According to the rule execution thread, the business rules in the business rule set are converted into a rule binary tree, and the rule binary tree is traversed to obtain a rule statement of each business rule.
[0077] In an embodiment of the present invention, business rule information usually exists in a structured form, and the business rules can be converted into a general binary tree structure through programming to obtain a rule binary tree for each business rule. The rule binary tree can be used to simulate a hierarchical structure of nodes with zero, one or two child nodes.
[0078] In the embodiment of the present invention, refer to Figure 2 As shown, the converting the business rules in the business rule set into a rule binary tree according to the rule execution thread includes:
[0079] S21, acquiring business rules according to the execution thread of the rule execution thread;
[0080] S22, compiling the business rules into code using a pre-built rule editor to obtain rule codes;
[0081] S23. Construct a binary rule tree of the business rules according to the rule code.
[0082] In an embodiment of the present invention, business rules are obtained by executing each execution thread in the rule execution thread, wherein the execution of each execution thread is managed by a scheduler preset by the operating system, such as time scheduling, etc. The business rules to be executed are obtained by the execution thread, and then each business rule can be compiled into rule information similar to Java code through a pre-built rule editor, wherein the rule editor can be built using front-end technology architectures such as VueJS, and can be published to NPM (Node Package Manager, package installation tool) in the form of VueJS Module, so that other business systems can seamlessly integrate the rule editor at the front end. Furthermore, a common data structure can be designed in JS to facilitate the development of different rule editors and improve the usability of the rule editor.
[0083] In an embodiment of the present invention, by identifying all conditions, actions and logical operation relationships (such as AND, OR, NOT, etc.) in the business rules, a binary tree is constructed from top to bottom and from left to right according to the logical operation relationships between the conditions and actions in the business rules to obtain a rule binary tree, wherein each condition or action can be used as a node of the rule binary tree, and the logical operator serves as a node connecting these conditions or actions.
[0084] In the embodiment of the present invention, the rule traversal of the rule binary tree to obtain the rule statement of each business rule includes:
[0085] Perform node traversal from the root node of the rule binary tree to obtain node rules;
[0086] Generate a code object of the node rule;
[0087] The code object is serialized to obtain a rule statement of each business rule.
[0088] In an embodiment of the present invention, each node of the regular binary tree is traversed from the root node of the regular binary tree, and for the nodes composed of logical operation relationships, the current traversal context can be saved, and the next context can be started to continue the traversal until each node of the regular binary tree is traversed to obtain the node rules.
[0089] Specifically, a code object is a Java object. A new instance (object) of a class can be created through the keyword new. The new keyword will call the class constructor to initialize the object, obtain the code object, and serialize the code object to generate a bytecode sequence to obtain the rule statement of each amateur rule. Among them, object serialization is the process of converting a code object into a byte sequence. After object serialization, the code object can be written to a file, a database, or transmitted to other storage spaces through the network, so that the state of the code object can be persistently stored or rebuilt in different runtime environments, avoiding repeated compilation of business rules and effectively improving the efficiency of rule matching.
[0090] Preferably, the rule statement can be stored in a preset database, so that the rule statement can be directly called from the database to restore the Java object during subsequent calls.
[0091] S3. Acquire business information, extract business data from the business information, and perform business logic classification on the business information according to the business data to obtain a business category.
[0092] In an embodiment of the present invention, business information is specific business information that needs to be matched with business rules, such as the user's vehicle insurance information, the user's insurance policy, etc.; business data is key information in the business information that is related to business rules, such as the insured institution, year, insured amount, insurance type, and other key information; the business information is classified through business data to determine the business needs of the business information and obtain the business category, wherein the data format of the business information includes but is not limited to text, pictures, etc.
[0093] In the embodiment of the present invention, refer to Figure 3 As shown, the extracting the business data in the business information includes:
[0094] S31, extracting text data from the business information to obtain a business text;
[0095] S32, dividing the business text into sentences to obtain key sentences of the business text;
[0096] S33: Identify the business entities in the key sentences of the text and obtain the business data in the business information.
[0097] In an embodiment of the present invention, the business information may be in a non-text form such as a picture format. Text information in the text information may be extracted through optical character recognition (OCR) to obtain business text, and then the business text may be segmented to obtain multiple text segmentations. The multiple text segmentations may be spliced using a pre-built recurrent neural network to obtain multiple text key sentences to improve the accuracy of sentence segmentation, so that business data corresponding to the business entity may be extracted from each text key sentence respectively.
[0098] In the embodiment of the present invention, extracting the text data in the business information to obtain the business text includes:
[0099] Extracting a business picture from the business information;
[0100] Performing edge detection on the business image to obtain a text edge area;
[0101] Perform text recognition on the text edge area to obtain the business text.
[0102] Specifically, the following formula is used to perform edge detection on the business image:
[0103]
[0104]
[0105] Wherein, P represents the text edge area of the business image, F represents the business image, Indicates that a graph opening operation is performed on the business image. represents an expansion operation on the business image, · represents a clique operation on the business image, and Θ represents an erosion operation on the business image.
[0106] In one embodiment, B1 and B2 are preset edge detection operators. By performing opening and dilation operations through the edge detection operators, noise information in the business image can be removed. Dilation and erosion can effectively improve the contour of the text area in the business image. At the same time, the structure of B2 can have different linear directions, thereby being able to extract irregular text contours in the business image, which is conducive to more accurate extraction of business text in the subsequent process.
[0107] In an embodiment of the present invention, a business entity is an entity with a specific meaning corresponding to business data, including names of people, places, institutions, proper nouns, etc. For example, business entities such as insurance institutions, types of insurance, and insured amounts. Specifically, business entities in key sentences of text can be identified through preset business entity keywords to obtain business data.
[0108] In the embodiment of the present invention, the business information is subjected to business logic classification according to the business data to obtain a business category, including:
[0109] Performing text segmentation on the business data to obtain a text segmentation sequence, and calculating an embedding vector of the text segmentation sequence;
[0110] Hidden encoding is performed on the business text to obtain an encoding vector, and the encoding vector is concatenated with the embedding vector to obtain a target vector;
[0111] The business information is subjected to business logic classification according to the target vector to obtain a business category corresponding to the business information.
[0112] In the embodiment of the present invention, the embedding vector of the text word segmentation sequence is calculated using the following formula:
[0113]
[0114] Among them, v i represents the embedding vector of the i-th text segmentation in the text segmentation sequence, g represents the activation function, W represents the preset weight matrix, U represents the preset output weight matrix, and v j represents the vector corresponding to the jth context text segmentation of the ith text segmentation in the text segmentation sequence, and C represents the total number of preset context text segmentations.
[0115] In the embodiment of the present invention, by calculating the embedding vector through the context of each text segmentation, the context information can be integrated to obtain a more accurate embedding vector.
[0116] Specifically, the disentangled attention mechanism and enhanced mask decoder in the pre-built DeBERTa (Decoding-enhanced BERT with Disentangled Attention) neural network can be used to hide the business text. The enhanced mask decoder not only considers the content and relative position of the context words, but also introduces the absolute position information, which helps to calculate the encoding vector more accurately. After the encoding vector is obtained, it is concatenated with the embedded vector after passing through the fully connected layer and activation function to obtain the target vector. The target vector is classified into business logic using the preset fully connected layer and activation function to obtain the business category.
[0117] In the embodiment of the present invention, the business category includes category information of multiple dimensions such as the insured institution, usage nature, and insurance type. The business category can be used to classify business information from multiple aspects such as management dimension and usage nature, thereby improving the efficiency of subsequent rule matching.
[0118] S4. Calculate the rule matching degree of each of the business rules according to the business category and the business data using the rule statement.
[0119] In the embodiment of the present invention, the rule matching degree is the degree of relevance to the business information. The greater the rule matching degree is, the more relevant it is to the business information, and rule matching can be performed based on the rule matching degree.
[0120] In the embodiment of the present invention, the step of calculating the rule matching degree of each of the business rules according to the business category and the business data by using the rule statement includes:
[0121] Performing business classification on the rule statements to obtain a rule business category for each rule statement;
[0122] Selecting a target rule statement set from the rule statements according to the service category and the rule service category;
[0123] Performing data matching on the business data and each target rule statement in the target rule statement set;
[0124] The rule matching degree of each business rule is calculated according to the result of data matching.
[0125] In an embodiment of the present invention, the rule statements can be classified according to the insured institution, insurance category, claim form and other categories of the business rules corresponding to the rule statements, and the rule statement whose rule business category is consistent with the business category is selected as the target rule statement in the target rule statement set.
[0126] In an embodiment of the present invention, data matching is performed based on business data and rules in a target rule statement. For example, target rule statement 1 is A and B and C. If the business data satisfies A and B and C, the rule matching degree of target rule statement 1 is 100%. If the business data satisfies A, the rule matching degree of target rule statement 1 is 1 / 3. The rule matching degree of each business rule can then be calculated using business data.
[0127] S5. Select a target business rule corresponding to the business information from the business rule set according to the rule matching degree, and calculate a business parameter of the business information using the target business rule.
[0128] In an embodiment of the present invention, the target business rule is the business rule corresponding to the rule statement with the largest rule matching degree. The rule execution result of the business information is obtained by executing the target business rule, and the management dimension and decision path corresponding to the business information, that is, the business parameters corresponding to the business information, are obtained to make decisions on the business information.
[0129] In the embodiment of the present invention, the calculating the business parameter of the business information by using the target business rule includes:
[0130] Obtain a target rule statement of the target business rule;
[0131] Decompiling the target rule statement into a rule object;
[0132] The rule object is executed to calculate the business parameters of the business information according to the business data of the business information.
[0133] In the embodiment of the present invention, the target rule statement is a bytecode sequence. The bytecode sequence is restored to a Java object by decompiling, and the business parameters of the business information can be calculated by directly executing the rule object. Since the Java object is stateless and can be accessed concurrently, the efficiency of business parameter calculation is effectively improved.
[0134] like Figure 4 , which is a functional module diagram of a rule matching device based on a high-concurrency decision engine provided by an embodiment of the present invention.
[0135] The rule matching device 400 based on the high-concurrency decision engine of the present invention can be installed in an electronic device. According to the functions implemented, the rule matching device 400 based on the high-concurrency decision engine can include a rule execution thread module 401, a rule statement generation module 402, a business logic classification module 403, a rule matching degree calculation module 404 and a business parameter calculation module 405. The module of the present invention can also be called a unit, which refers to a series of computer program segments that can be executed by an electronic device processor and can complete fixed functions, which are stored in the memory of the electronic device.
[0136] In this embodiment, the functions of each module / unit are as follows:
[0137] The rule execution thread module 401 is used to obtain a business rule set, build a concurrent queue of the business rule set, and generate a rule execution thread according to the concurrent queue;
[0138] The rule statement generating module 402 is used to convert the business rules in the business rule set into a rule binary tree according to the rule execution thread, and perform rule traversal on the rule binary tree to obtain a rule statement for each of the business rules;
[0139] The business logic classification module 403 is used to obtain business information, extract business data from the business information, and perform business logic classification on the business information according to the business data to obtain a business category;
[0140] The rule matching degree calculation module 404 is used to calculate the rule matching degree of each of the business rules according to the business category and the business data using the rule statement;
[0141] The business parameter calculation module 405 is used to select a target business rule corresponding to the business information from the business rule set according to the rule matching degree, and calculate the business parameter of the business information using the target business rule.
[0142] In detail, each module described in the rule matching device 400 based on the high-concurrency decision engine in the embodiment of the present invention is used in the same manner as described above. Figures 1 to 3 The rule matching method based on the high-concurrency decision engine described in the specification is the same as the technical means and can produce the same technical effects, so it will not be repeated here.
[0143] The present invention also provides an electronic device, which may include a processor, a memory, a communication bus and a communication interface, and may also include a computer program stored in the memory and executable on the processor, such as a method program for improving welding stability of heterogeneous titanium alloy laser welding technology.
[0144] In some embodiments, the processor may be composed of an integrated circuit, for example, it may be composed of a single packaged integrated circuit, or it may be composed of multiple packaged integrated circuits with the same or different functions, including one or more central processing units (CPU), microprocessors, digital processing chips, graphics processors and a combination of various control chips.
[0145] The memory includes at least one type of readable storage medium, and the readable storage medium includes a flash memory, a mobile hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a magnetic memory, a disk, an optical disk, etc. In some embodiments, the memory may be an internal storage unit of an electronic device, such as a mobile hard disk of the electronic device.
[0146] The communication bus may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is configured to realize connection and communication between the memory and at least one processor, etc.
[0147] The communication interface is used for communication between the above-mentioned 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, a Bluetooth interface, etc.), which is generally used to establish a communication connection between the electronic device and other electronic devices.
[0148] The figure only shows an electronic device with components. Those skilled in the art will understand that the structure shown in the figure does not constitute a limitation on the electronic device, and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.
[0149] The present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor of an electronic device, the computer program can implement:
[0150] Acquire a business rule set, build a concurrent queue of the business rule set, and generate a rule execution thread according to the concurrent queue;
[0151] According to the rule execution thread, the business rules in the business rule set are converted into a rule binary tree, and the rule binary tree is traversed to obtain a rule statement of each business rule;
[0152] Acquire business information, extract business data from the business information, and perform business logic classification on the business information according to the business data to obtain a business category;
[0153] Calculating the rule matching degree of each of the business rules according to the business category and the business data using the rule statement;
[0154] A target business rule corresponding to the business information is selected from the business rule set according to the rule matching degree, and a business parameter of the business information is calculated using the target business rule.
[0155] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.
[0156] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0157] It is obvious to those skilled in the art that the present invention is not limited to the details of the above exemplary embodiments, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0158] Therefore, no matter from which point of view, the embodiments should be regarded as illustrative and non-restrictive, and the scope of the present invention is limited by the appended claims rather than the above description, so it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any attached figure mark in the claims should not be regarded as limiting the claims involved.
[0159] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0160] In addition, 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 stated in the system claim can also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any particular order.
[0161] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.
Claims
1. A rule matching method based on a high-concurrency decision engine, It is characterized in that The method comprises: Obtain a business rule set, build a concurrent queue of the business rule set, and generate a rule execution thread according to the concurrent queue; According to the rule execution thread, the business rules in the business rule set are converted into a rule binary tree, and the rule binary tree is traversed to obtain a rule statement of each business rule; Acquire business information, extract business data from the business information, perform business logic classification on the business information according to the business data, and obtain business categories; wherein the extracting business data from the business information includes: extracting text data from the business information to obtain business text; performing sentence segmentation on the business text to obtain text key sentences of the business text; identifying business entities in the text key sentences to obtain business data in the business information; wherein the performing business logic classification on the business information according to the business data to obtain business categories includes: performing text segmentation on the business data to obtain a text segmentation sequence, and calculating an embedding vector of the text segmentation sequence; The embedding vector of the text word segmentation sequence is calculated using the following formula: Among them, v i represents the embedding vector of the i-th text segmentation in the text segmentation sequence, g represents the activation function, w represents the preset weight matrix, U represents the preset output weight matrix, and v j represents the vector corresponding to the jth context text segmentation of the i-th text segmentation in the text segmentation sequence, and C represents the total number of preset context text segmentations; Hidden encoding is performed on the business text to obtain an encoding vector, and the encoding vector is concatenated with the embedding vector to obtain a target vector; business logic classification is performed on the business information according to the target vector to obtain a business category corresponding to the business information; Calculating the rule matching degree of each of the business rules according to the business category and the business data using the rule statement; A target business rule corresponding to the business information is selected from the business rule set according to the rule matching degree, and a business parameter of the business information is calculated using the target business rule.
2. The rule matching method based on a high-concurrency decision engine as claimed in claim 1, It is characterized in that The concurrent queue for constructing the business rule set includes: Create a preset number of thread pools on the preset business end; Packaging the business rule set to obtain a business classification set; The business classification set is written into the thread pool to obtain a concurrent queue in the business rule set.
3. The rule matching method based on a high-concurrency decision engine as claimed in claim 1, It is characterized in that The executing thread according to the concurrent queue generation rule includes: Initialize the execution thread pool, consume the concurrent queue, and obtain consumption business rules; The consumer business rule is added to the execution thread pool to obtain a rule execution thread.
4. The rule matching method based on a high-concurrency decision engine as claimed in claim 1, It is characterized in that The rule traversal of the rule binary tree to obtain a rule statement of each business rule includes: Perform node traversal from the root node of the rule binary tree to obtain node rules; Generate a code object of the node rule; The code object is serialized to obtain a rule statement of each business rule.
5. The rule matching method based on a high-concurrency decision engine as claimed in claim 1, It is characterized in that The extracting text data from the business information to obtain the business text includes: Extracting a business picture from the business information; Performing edge detection on the business image to obtain a text edge area; The following formula is used to perform edge detection on the business image: Wherein, P represents the text edge area of the business image, F represents the business image, ° represents performing a graph opening operation on the business image, represents an expansion operation on the business image, represents a clique operation on the business image, and Θ represents an erosion operation on the business image; Perform text recognition on the text edge area to obtain the business text.
6. The rule matching method based on a high-concurrency decision engine as claimed in claim 1, It is characterized in that The using the rule statement to calculate the rule matching degree of each of the business rules according to the business category and the business data includes: Performing business classification on the rule statements to obtain a rule business category for each rule statement; Selecting a target rule statement set from the rule statements according to the service category and the rule service category; Performing data matching between the business data and each target rule statement in the target rule statement set; The rule matching degree of each business rule is calculated according to the result of data matching.
7. The rule matching method based on a high-concurrency decision engine as claimed in claim 1, It is characterized in that The calculating the business parameter of the business information by using the target business rule includes: Obtain a target rule statement of the target business rule; Decompiling the target rule statement into a rule object; The rule object is executed to calculate the business parameters of the business information according to the business data of the business information.
8. A rule matching device based on a high-concurrency decision engine, It is characterized in that The device comprises: A rule execution thread module is used to obtain a business rule set, build a concurrent queue of the business rule set, and generate a rule execution thread according to the concurrent queue; A rule statement generation module, used for converting the business rules in the business rule set into a rule binary tree according to the rule execution thread, performing rule traversal on the rule binary tree, and obtaining a rule statement for each of the business rules; A business logic classification module is used to obtain business information, extract business data from the business information, and perform business logic classification on the business information according to the business data to obtain a business category; wherein the extraction of business data from the business information includes: extracting text data from the business information to obtain business text; performing sentence segmentation on the business text to obtain text key sentences of the business text; identifying business entities in the text key sentences to obtain business data in the business information; wherein the business logic classification of the business information according to the business data to obtain a business category includes: performing text segmentation on the business data to obtain a text segmentation sequence, and calculating an embedding vector of the text segmentation sequence; The embedding vector of the text word segmentation sequence is calculated using the following formula: Among them, v i represents the embedding vector of the i-th text segmentation in the text segmentation sequence, g represents the activation function, w represents the preset weight matrix, U represents the preset output weight matrix, and v j represents the vector corresponding to the jth context text segmentation of the i-th text segmentation in the text segmentation sequence, and C represents the total number of preset context text segmentations; Hidden encoding is performed on the business text to obtain an encoding vector, and the encoding vector is concatenated with the embedding vector to obtain a target vector; business logic classification is performed on the business information according to the target vector to obtain a business category corresponding to the business information; A rule matching degree calculation module, used to calculate the rule matching degree of each of the business rules according to the business category and the business data using the rule statement; The business parameter calculation module is used to select a target business rule corresponding to the business information from the business rule set according to the rule matching degree, and calculate the business parameter of the business information using the target business rule.
9. A computer-readable storage medium storing a computer program, It is characterized in that When the computer program is executed by a processor, the rule matching method based on a high-concurrency decision engine as described in any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Business process / business rule execution system, business process / business rule execution method and program
JP2013033333A
Data analysis-based service distribution method and apparatus, device, and storage medium
WO2023029507A1
