CN105573737A - Method for increasing operating efficiency of rule engines - Google Patents
Method for increasing operating efficiency of rule engines Download PDFInfo
- Publication number
- CN105573737A CN105573737A CN201410601682.1A CN201410601682A CN105573737A CN 105573737 A CN105573737 A CN 105573737A CN 201410601682 A CN201410601682 A CN 201410601682A CN 105573737 A CN105573737 A CN 105573737A
- Authority
- CN
- China
- Prior art keywords
- rule
- true
- collection
- variable
- regular
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention relates to a method for increasing the operating efficiency of rule engines. The method comprises the following steps: (101) establishing a fact set comprising a plurality of facts; (102) establishing a rule set comprising a plurality of rules, wherein each rule comprises a condition part and an action part; (103) adding a corresponding related fact attribute to each rule in the rule set; (104) matching the fact set with the rule set on the basis of a matching algorithm and establishing a matched rule set; (105) confirming the execution sequence of the rules in the matched rule set according to a rule priority; and (106) executing the action parts of the rules according to the execution sequence of the rules and updating the fact set by using the execution results. The method disclosed by the invention has the advantages that the matching hit rate of the fact set and the rule set in a rule engine inference can be increased; the time loss is reduced; and the operating efficiency of the rule engines is effectively increased.
Description
Technical field
The present invention relates to the rule engine technique in artificial intelligence field, particularly a kind of method improving regulation engine operational efficiency.
Background technology
Regulation engine is developed by inference engine, is a kind of assembly embedded in the application, achieves and separated from application code by operational decision making, and use predefined semantic modules to write operational decision making.Because regulation engine is component software, so only have developer just use by the mode of routine interface and control it, under normal circumstances, the five steps of developer's service regeulations engine is in a program:
1) regulation engine object is created;
2) to loading rule collection in engine or replacing rule set;
3) submit to need be collected by the fact of rule set process to engine;
4) order engine performs;
5) derive engine execution result, from engine, withdraw from the data processed.
Regulation engine is often applied to the system that business rule often changes.The exploitation of the business rule of user and application system can be separated by regulation engine, makes the change of business rule can not have influence on the exploitation of application system, and user can the business rule of rule-based engine flexible customization oneself.
The inference step of regulation engine is as follows:
1) fact collection is inputed to working memory;
2) fact that the rule in rule set and the fact are concentrated is compared;
3) if executing rule exists conflict, namely have activated multiple rule simultaneously, the rule of conflict is put into conflict set;
4) manage conflict, the rule of activation is put in order;
5) executing rule, repeats, until execute all rules.
Any one regulation engine all needs the efficiency of the inference mechanism Sum fanction Condition Matching of solution rule well, when engine performs, can according to the priority performed in queue executing rule execution example one by one, execution part due to rule may change the data object of workspace, thus some rule in queue can be made to perform example because condition changes and lose efficacy, must cancel from queue, also may activate the rule originally do not satisfied condition, generate new rule execution example and enter queue; So the rule just creating one " dynamically " performs chain, the inference mechanism of formation rule.
Engine needs the data object in rapid test job district, from the rule set loaded, find qualified rule, and create-rule performs regulations.The efficiency of rule condition coupling determines the operational efficiency of regulation engine, determines the performance of regulation engine.
Existing a lot of method is for improving the operational efficiency of regulation engine at present.1999, the people such as vanderburg university of U.S. JohnHeusinkveld proposed the method carrying out definition rule with html; 2008, the people such as Information And Communication university of Korea S ChangbaiChoi proposed the execution efficiency being improved regulation engine on the mobile apparatus by the rule set in restriction Rete algorithmic match process and the method for the size of true collection; 2009, the people such as Wuhan University ZhangRuijun proposed and will be converted into and/ortree with the rule set of xml representation of file, then are converted to the method for 0-1matrix, improved the execution efficiency of regulation engine further; 2010, the people such as the emphasis intelligent communication software lab DingXiao of Beijing University of Post & Telecommunication propose by optimize rete algorithm improve regulation engine the method for execution efficiency; 2010, the people such as department of computer science of University Of Tianjin GangZhang proposed and compile rule file in advance, rule file content is described in detail in detail, subfunction bag divides the method that three kinds are improved regulation engine execution efficiencys; 2012, the people such as Toledo university of U.S. SomaShekaraSreenadhReddyDepuru proposed the thought of Data classification: dissimilar user the rule of carrying out mating different, thereby reduce the quantity of rule set, improve operational efficiency.
These research methods above-mentioned are in the operational efficiency that improve regulation engine in varying degrees, but these research methods are applicable to operate in the regulation engine on PC or server mostly, and it is inapplicable for regulation engine on lightweight equipment, main cause is that the computing power of lightweight equipment and storage capacity are limited, and directly application these research methods above-mentioned have certain limitation.In these research methods, the method of rule set and true collection size in the restriction matching process that the people such as ChangbaiChoi propose, although this method can realize on light-weighted mobile device, but there is following problems in the process of implementation in this method: when carrying out rule match at every turn, owing to cannot which rule of Accurate Prediction being triggered, which rule can not be triggered, and selects which rule and mate when also just accurately can not find out each coupling.Therefore, do not talk about accurately if rule is selected, this execution result mated can be caused not accurate, thus affect the operational efficiency of regulation engine.
Summary of the invention
The object of the invention is to overcome the shortcoming that the operational efficiency of the regulation engine existence be applied at present on lightweight equipment is low, on the basis of existing matching algorithm, propose a kind of method for every rule interpolation " association is true " attribute, the method can improve the operational efficiency of regulation engine.
For achieving the above object, the invention provides a kind of method improving regulation engine operational efficiency, described method comprises:
Step 101) set up true collection; Described fact collection is the set of several facts;
Step 102) set up rule set; Described rule set is the set of some rules; Every rule comprises condition part and action part;
Step 103) the every rule in rule set is increased to " association true " attribute of its correspondence;
Step 104) based on matching algorithm, fact collection is mated with rule set, set up matched rule collection;
Step 105) rule concentrated by matched rule determines the execution sequence of rule according to rule prioritization;
Step 106) according to the action part of the execution sequence executing rule of rule, and with the result more new fact collection after performing.
In technique scheme, step 103) comprise further:
The condition part of the every rule in described rule set is made up of several condition element; Described condition element is the quantitative relation of a true variable, is represented by the form of " true variable+relationship description accords with+specifically numerical value or state value "; " association is true " of described condition element is this condition element corresponding " true variable ", and the value corresponding to " association is true " attribute of the every rule in rule set is the set of several condition element association " true variable ".
In technique scheme, described step 104) in matching algorithm be classic Leaps algorithm or Rete algorithm.
In technique scheme, the concrete steps setting up matched rule collection based on classic Leaps algorithm are:
Step 104-1) newly-built stack, store several facts of described fact collection;
Step 104-2) newly-built queue, store several rules of described rule set;
Step 104-3) eject stack top element, obtain a true F;
Step 104-4) from queue, take out a rule R;
Step 104-5) judge whether described true F associates with described regular R, if judged result is affirmative, proceeds to step 104-6); Otherwise, proceed to step 104-8);
Step 104-6) judge whether described true F makes the result of the condition part of described regular R be true, if judged result is affirmative, proceeds to step 104-7); Otherwise, proceed to step 104-8);
Step 104-7) described regular R is put into matched rule collection;
Step 104-8) judge whether queue is empty, if judged result is affirmative, proceeds to step 104-9); Otherwise, proceed to step 104-4);
Step 104-9) judge whether stack is empty, if judged result is affirmative, proceeds to step 105); Otherwise, proceed to step 104-3).
In technique scheme, at described step 104-5) in, judge whether described true F associates with described regular R and comprise further:
The value of " association is true " attribute of described rule is the set of several condition element association " true variable ", the set of " the true variable " of each true variable of described true F and described regular R is compared, if true F exists the set that a true variable belongs to " the true variable " of regular R, then think that this true F associates with this regular R; Otherwise, think that this true F does not associate with this regular R.
The invention has the advantages that:
1, the method for raising regulation engine operational efficiency of the present invention, can improve the match hit rate of true Ji Heguizeji in regulation engine reasoning, reduces time loss, effectively improves the operational efficiency of regulation engine.
2, the method for raising regulation engine operational efficiency of the present invention is applicable to the regulation engine on lightweight equipment, be specially adapted to the regulation engine on the things-internet gateway of lightweight, regulation engine can run on things-internet gateway, user can be facilitated to carry out flexible customization business rule according to the demand of oneself actual scene, solve the problem that current things-internet gateway can only be applicable to application-specific scene.
Accompanying drawing explanation
Fig. 1 is the process flow diagram of the method for raising regulation engine operational efficiency of the present invention;
Fig. 2 is the process flow diagram setting up matched rule collection based on classic Leaps algorithm of the present invention;
Fig. 3 is simulation comparison figure working time of method of the present invention and existing methodical regulation engine.
Embodiment
Compared with existing rule engine technique, method of the present invention is that the every rule in rule set with the addition of " association is true " attribute, when fact collection is mated with rule set, first the every rule in each fact fact concentrated and rule set carries out preliminary matches, carry out associating with " associating the fact " attribute of every rule by each fact and judge, preliminary matches success just can enter the link of ordinary matches, and preliminary matches is unsuccessful, directly thinks that this fact is not mated with this rule.By preliminary matches process, effectively prevent unnecessary ordinary matches process, improve the success ratio of each coupling, thus decrease unnecessary time loss, significantly improve the operational efficiency of whole regulation engine.
Be further described below in conjunction with the method for the drawings and specific embodiments to raising regulation engine operational efficiency of the present invention.
As shown in Figure 1, a kind of method improving regulation engine operational efficiency, comprising:
Step 101) set up true collection;
Described fact collection is the set of several facts;
The described fact comprises several true variablees, and each true variable is the variable states relevant to regulation engine, usually represents by the form of " true variable+logical descriptor (be or equal)+numerical value or state value ".
For true " air themperature equals 20 DEG C ", this true value representing current air temperature is 20 DEG C.
Step 102) set up rule set;
Described rule set is the set of several rules;
Described rule comprises condition part and action part, usually with " if ..., then ... " form represent, condition part is " if ... ", and action part is " then ... ".Condition part comprises several condition element, and action part comprises several action elements.Be connected with " and " or " or " between several condition element, represent the logical relation between these condition element.The result of each condition element is a Boolean type, and condition part is exactly the combination of several Boolean type expression formulas, and its combined result remains a Boolean type.Several action elements that only just can perform an action in part under condition part is genuine situation.
Step 103) corresponding " association is true " attribute is increased to the every rule in described rule set;
Every rule in described rule set is made up of several condition element; Described condition element represents the quantitative relation of a true variable, is represented by the form of " true variable+relationship description accords with (be greater than, be less than, equal)+concrete numerical value or state value "; " association is true " of described condition element is this condition element corresponding " true variable "." association is true " attribute of every rule in corresponding described rule set is the set of " the true variable " of several condition element association of this rule.
" if air themperature is greater than 30 DEG C and air-conditioning is closed condition, then opening air-conditioning " with rule is example, and " the association fact " attribute corresponding to this rule is " air themperature, air-conditioning ".
Step 104) based on matching algorithm, fact collection is mated with rule set, set up matched rule collection;
Step 105) rule concentrated by matched rule determines the execution sequence of rule according to rule prioritization;
Step 106) according to the action part of the execution sequence executing rule of rule, and with the result more new fact collection after performing.
In technique scheme, described matching algorithm is classic Leaps algorithm or Rete algorithm.
As shown in Figure 2, as one preferred embodiment, the concrete steps setting up matched rule collection based on classic Leaps algorithm are:
Step 104-1) newly-built stack, store several facts of described fact collection;
Step 104-2) newly-built queue, store several rules of described rule set;
Step 104-3) eject stack top element, obtain a true F;
Step 104-4) from queue, take out a rule R;
Step 104-5) judge whether described true F associates with described regular R, if judged result is affirmative, proceeds to step 104-6); Otherwise, proceed to step 104-8);
The value of " association is true " attribute of described rule is the set of several condition element association " true variable ", the set of " the true variable " of each true variable of described true F and described regular R is compared, if true F exists the set that a true variable belongs to " the true variable " of regular R, then think that this true F associates with this regular R; Otherwise, think that this true F does not associate with this regular R.
Step 104-6) judge whether described true F makes the result of the condition part of described regular R be true, if judged result is affirmative, proceeds to step 104-7); Otherwise, proceed to step 104-8);
Step 104-7) described regular R is put into matched rule collection;
Step 104-8) judge whether queue is empty, if judged result is affirmative, proceeds to step 104-9); Otherwise, proceed to step 104-4);
Step 104-9) judge whether stack is empty, if judged result is affirmative, proceeds to step 105); Otherwise, proceed to step 104-3).
To not adopting the regulation engine of method of the present invention and adopting the regulation engine of method of the present invention to carry out system realization and experiment test in the actual environment of android4.0.3.The fact collection of test comprises 10 facts; The rule set of test comprises 5,10,20,30,40,50 rules respectively.
Test result is as shown in table 1:
Table 1
Curve map corresponding to above-mentioned data is Fig. 3, as can be seen from Figure 3 in regulation engine, method of the present invention is adopted to be that after every rule interpolation " association the is true " attribute in rule set, there is obvious minimizing the working time of regulation engine, improves the operational efficiency of regulation engine.
Claims (5)
1. improve a method for regulation engine operational efficiency, it is characterized in that, described method comprises:
Step 101) set up true collection, described fact collection is the set of several facts;
Step 102) set up rule set, described rule set is the set of some rules; Every rule comprises condition part and action part;
Step 103) the every rule in rule set is increased to " association true " attribute of its correspondence;
Step 104) based on matching algorithm, fact collection is mated with rule set, set up matched rule collection;
Step 105) rule concentrated by matched rule determines the execution sequence of rule according to rule prioritization;
Step 106) action part of every rule is performed according to the execution sequence of rule, and with the result more new fact collection after performing.
2. the method for raising regulation engine operational efficiency according to claim 1, is characterized in that, described step 103) comprise further:
The condition part of the every rule in described rule set is made up of several condition element; Described condition element is the quantitative relation of a true variable, is represented by the form of " true variable+relationship description accords with+specifically numerical value or state value "; " association is true " of described condition element is this condition element corresponding " true variable ", and the value corresponding to " association is true " attribute of the every rule in rule set is the set of several condition element association " true variable ".
3. the method for raising regulation engine operational efficiency according to claim 1, is characterized in that, described step 104) in matching algorithm be classic Leaps algorithm or Rete algorithm.
4. the method for raising regulation engine operational efficiency according to claim 3, is characterized in that, the concrete steps setting up matched rule collection based on classic Leaps algorithm are:
Step 104-1) newly-built stack, store several facts of described fact collection;
Step 104-2) newly-built queue, store some rules of described rule set;
Step 104-3) eject stack top element, obtain a true F;
Step 104-4) from queue, take out a rule R;
Step 104-5) judge whether described true F associates with described regular R, if judged result is affirmative, proceeds to step 104-6); Otherwise, proceed to step 104-8);
Step 104-6) judge whether described true F makes the result of the condition part of described regular R be true, if judged result is affirmative, proceeds to step 104-7); Otherwise, proceed to step 104-8);
Step 104-7) described regular R is put into matched rule collection;
Step 104-8) judge whether queue is empty, if judged result is affirmative, proceeds to step 104-9); Otherwise, proceed to step 104-4);
Step 104-9) judge whether stack is empty, if judged result is affirmative, proceeds to step 105); Otherwise, proceed to step 104-3).
5. the method for raising regulation engine operational efficiency according to claim 4, is characterized in that, at described step 104-5) in, judge whether described true F associates with described regular R and comprise further:
The value of " association is true " attribute of described rule is the set of several condition element association " true variable ", the set of " the true variable " of each true variable of described true F and described regular R is compared, if true F exists the set that a true variable belongs to " the true variable " of regular R, then think that this true F associates with this regular R; Otherwise, think that this true F does not associate with this regular R.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410601682.1A CN105573737A (en) | 2014-10-30 | 2014-10-30 | Method for increasing operating efficiency of rule engines |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410601682.1A CN105573737A (en) | 2014-10-30 | 2014-10-30 | Method for increasing operating efficiency of rule engines |
Publications (1)
Publication Number | Publication Date |
---|---|
CN105573737A true CN105573737A (en) | 2016-05-11 |
Family
ID=55883913
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410601682.1A Pending CN105573737A (en) | 2014-10-30 | 2014-10-30 | Method for increasing operating efficiency of rule engines |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105573737A (en) |
Cited By (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105635328A (en) * | 2014-10-31 | 2016-06-01 | 中国科学院声学研究所 | Method for improving rule engine response speed |
CN106777029A (en) * | 2016-12-08 | 2017-05-31 | 中国科学技术大学 | A kind of distributed rule automotive engine system and its construction method |
CN107145949A (en) * | 2017-05-04 | 2017-09-08 | 中国科学院软件研究所 | A kind of real-time rule-based reasoning method of multinuclear |
CN108960584A (en) * | 2018-06-13 | 2018-12-07 | 东软集团股份有限公司 | Workflow task classification method, device, readable storage medium storing program for executing and electronic equipment |
CN109857833A (en) * | 2018-12-30 | 2019-06-07 | 贝壳技术有限公司 | A kind of regulation engine implementation method, device and electronic equipment |
CN110601912A (en) * | 2019-11-14 | 2019-12-20 | 紫光云(南京)数字技术有限公司 | Internet of things gateway data simulation design system and method |
CN111932076A (en) * | 2020-07-09 | 2020-11-13 | 车智互联(北京)科技有限公司 | Rule configuration and release method and device and computing equipment |
CN113641708A (en) * | 2021-08-11 | 2021-11-12 | 华院计算技术(上海)股份有限公司 | Rule engine optimization method, data matching method and device, storage medium and terminal |
CN114268540A (en) * | 2021-12-22 | 2022-04-01 | 杭州萤石软件有限公司 | Optimization method, device and equipment of rule engine |
CN114942770A (en) * | 2022-06-10 | 2022-08-26 | 北京宇信科技集团股份有限公司 | Method and device for processing rule running file in decision engine |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101004799A (en) * | 2007-01-16 | 2007-07-25 | 中山大学 | Tense generation formula system |
CN101409885A (en) * | 2008-11-18 | 2009-04-15 | 中国移动通信集团福建有限公司 | Method for analyzing abnormal index based on rule engine |
CN102968309A (en) * | 2012-11-30 | 2013-03-13 | 亚信联创科技(中国)有限公司 | Method and device for realizing rule matching based on rule engine |
-
2014
- 2014-10-30 CN CN201410601682.1A patent/CN105573737A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101004799A (en) * | 2007-01-16 | 2007-07-25 | 中山大学 | Tense generation formula system |
CN101409885A (en) * | 2008-11-18 | 2009-04-15 | 中国移动通信集团福建有限公司 | Method for analyzing abnormal index based on rule engine |
CN102968309A (en) * | 2012-11-30 | 2013-03-13 | 亚信联创科技(中国)有限公司 | Method and device for realizing rule matching based on rule engine |
Cited By (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105635328A (en) * | 2014-10-31 | 2016-06-01 | 中国科学院声学研究所 | Method for improving rule engine response speed |
CN106777029A (en) * | 2016-12-08 | 2017-05-31 | 中国科学技术大学 | A kind of distributed rule automotive engine system and its construction method |
CN107145949B (en) * | 2017-05-04 | 2020-07-21 | 中国科学院软件研究所 | Multi-core real-time rule reasoning method |
CN107145949A (en) * | 2017-05-04 | 2017-09-08 | 中国科学院软件研究所 | A kind of real-time rule-based reasoning method of multinuclear |
CN108960584A (en) * | 2018-06-13 | 2018-12-07 | 东软集团股份有限公司 | Workflow task classification method, device, readable storage medium storing program for executing and electronic equipment |
CN109857833A (en) * | 2018-12-30 | 2019-06-07 | 贝壳技术有限公司 | A kind of regulation engine implementation method, device and electronic equipment |
CN110601912A (en) * | 2019-11-14 | 2019-12-20 | 紫光云(南京)数字技术有限公司 | Internet of things gateway data simulation design system and method |
CN111932076A (en) * | 2020-07-09 | 2020-11-13 | 车智互联(北京)科技有限公司 | Rule configuration and release method and device and computing equipment |
CN111932076B (en) * | 2020-07-09 | 2023-12-12 | 车智互联(北京)科技有限公司 | Rule configuration and release method and device and computing equipment |
CN113641708A (en) * | 2021-08-11 | 2021-11-12 | 华院计算技术(上海)股份有限公司 | Rule engine optimization method, data matching method and device, storage medium and terminal |
CN114268540A (en) * | 2021-12-22 | 2022-04-01 | 杭州萤石软件有限公司 | Optimization method, device and equipment of rule engine |
CN114268540B (en) * | 2021-12-22 | 2024-03-01 | 杭州萤石软件有限公司 | Rule engine optimization method, device and equipment |
CN114942770A (en) * | 2022-06-10 | 2022-08-26 | 北京宇信科技集团股份有限公司 | Method and device for processing rule running file in decision engine |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105573737A (en) | Method for increasing operating efficiency of rule engines | |
Arslan et al. | Use of relaxation methods in sampling-based algorithms for optimal motion planning | |
Naseriparsa et al. | A hybrid feature selection method to improve performance of a group of classification algorithms | |
WO2021254114A1 (en) | Method and apparatus for constructing multitask learning model, electronic device and storage medium | |
CN104915717B (en) | Data processing method, Analysis of Knowledge Bases Reasoning method and relevant apparatus | |
EP3210133A1 (en) | Tagging personal photos with deep networks | |
CN109447276B (en) | Machine learning system, equipment and application method | |
WO2015094269A1 (en) | Hybrid flows containing a continuous flow | |
CN106227043A (en) | adaptive optimal control method | |
CN108255602A (en) | Task combined method and terminal device | |
CN105635328A (en) | Method for improving rule engine response speed | |
WO2016019278A1 (en) | Predicting and optimizing energy storage lifetime performance with adaptive automation control software | |
CN106775944A (en) | The method integrated based on cultural multi-ant colony algorithm virtual machine under cloud platform | |
CN111061763B (en) | Method and device for generating rule execution plan of rule engine | |
Yang et al. | Resource-aware pareto-optimal automated machine learning platform | |
Liang et al. | An improved genetic algorithm for service selection under temporal constraints in cloud computing | |
CN103577899A (en) | Service composition method based on reliability prediction combined with QoS | |
CN117787444B (en) | Intelligent algorithm rapid integration method and device for cluster countermeasure scene | |
Lin et al. | Towards zero touch networks: From the perspective of hierarchical language systems | |
US20230229528A1 (en) | Parameter Configuration Method and Related System | |
EP4343644A1 (en) | Method for training a machine learning model in a server-client machine learning scenario | |
CN110493825A (en) | The load-balancing method of multitask under a kind of edge calculations framework | |
Simiński | Extraction of rules dependencies for optimization of backward inference algorithm | |
CN113268599B (en) | Training method and device for file classification model, computer equipment and storage medium | |
Taqi et al. | OBKA-FS: AN OPPOSITIONAL-BASED BINARY KIDNEYINSPIRED SEARCH ALGORITHM FOR FEATURE SELECTION. |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20160511 |
|
RJ01 | Rejection of invention patent application after publication |