当前位置:文档之家› 规则引擎

规则引擎


4. Business Rule Exchange - the Next XML Wave 5. /en/jsr/detail?id=094 6. 7. / 8. 9. /jess
程序员大脑当然比专家系统速度快,以下是其计算结果
业务规则引擎架构
Rules authoring environment
Decision Table
Ruleflow
Rule Engine APIs
• JSR 94
APIs for basic rule engine operations, such as rules for parsing, adding facts to the working memory, and firing rules
• Discount : If the total purchase amount of a shopping cart is > 100$ Then Set the discount for the shopping cart to 0.1% RuleML: :
<rule name="Discount"> <conditionPart> <simpleCondition className="ShoppingCart" objectVariable="s"> <binaryExp operator="gt"> <field name="purchaseAmount"/> <constant type="float" value="100"/> </binaryExp> </simpleCondition> </conditionPart> <actionPart> <modify> <variable name="s"/> <assignment> <field name="discount"/> <constant type="float" value="0.1"/> </assignment> </modify> </actionPart> </rule>
• 进行以下快速模式匹配
业务规则嵌在各处代码中…控制与数据 \ 隐含在一起 ? 明确分开 ! 很 难推导出算法 ..? 由……求解 \ 算法 ?? 规则和推理机 ..修改 \ 难 ? 较 易 !! 业务规则….变化!! 扩充 \ 很大改动 ! 逐步增加…..
• 产生以下结果
一般管理系统 专家系统
基于规则引擎的 管理系统

Rule Engine Core
• 优化的RETE 算法 • 正向链 (Forward chaining) • DEMO
Implement business rule engines in a J2EE enterprise
J2EE rule engine architecture

程序员的杰作
Rule Engine-based Programming
Joinwork研发小组整理
2004/11
内容
• • • • 面临的问题 相关概念 解决方案 公司和产品
管理者的要求
• 为提高效率,管理流程必须自动化,即使 现代商业规则异常复杂 • 市场要求业务规则经常变化,IT系统必须依 据业务规则的变化快速、低成本的更新 • 为了快速、低成本的更新,业务人员应能 直接管理IT系统中的规则,不需要程序开发 人员参与
By Margaret Thorpe
Rules: Adding Intelligence to the Enterprise Architecture.
18 July 2002 , Gartner
参考材料
1. Business process automation made easy with Java Part 1 & 2
By Ahmed Abulsorour and Siva Visveswaran September 6, 2002
干完活,程序员去见管理者,得意的说:“… …”
公司(个人)和产品
• Fair, Isaac : Blaze Advisor v4.5
used by WebSphere Commerce
• ILOG, Inc. : JRules v4.5 , Rules
used by Chordiant
• Yasu Technologies : QuickRules v2.6
工作内存( Working memory)
• 被规则所使用的事实的全局数据库 • 包含关于交通灯当前状态的事实如“亮绿 灯”或“亮红灯”,这些事实可能一个或 者两个同时在工作记忆中。
推理机(Inference engine)
• 通过决定哪些规则满足事实或目标,并授 予规则优先级,满足事实或目标的规则被 加入议程。
• Expert Group:
Art Technology Group Inc.(ATG)、 BEA Systems、Fujitsu Limited 、 IBM、ILOG 、 Novell, Inc. 、Oracle 、Unisys
• Status
Proposed Final Draft Public Review Community Draft Ballot Community Review Expert Group Formation JSR Review Ballot 29 Oct, 2003 11 Sep, 2002 19 Feb, 2002 19 Feb, 2002 19 Dec, 2000 27 Nov, 2000
“红灯”规则: IF 亮红灯 THEN 停下来 “绿灯”规则: IF 亮绿灯 THEN 走
• 前件( A n t e c e d e n t )、条件部分(Conditional part)、模式部分 (Pattern part)或左部(Left-hand-side, LHS), • 单独的条件“亮绿灯”称为条件元素(Conditional element)或一个模 式( P a t t e r n )。 • 后件( C o n s e q u e n t )或右部(Right-hand side, RHS):是规则触 发时将要执行的一系列行为( A c t i o n )。
程序员几乎晕倒,还好他遇见了科学家,科学家介绍了自己的研究成果…
科学家的成果
人工智能 (AI) ) 机器人 视觉 语音 专家系统 人工神经系统 自然语言
• • • •
推理方法 领域知识 知识的表示 独立于知识的外壳(shell)
基于规则的专家系统组成
知识库
• 规则:知识的表示,模拟人类问题求解的 产生式规则 • 交通法规知识的规则表示
The Business Rule Engine 2003 Magic Quadrant.
7 April 2003 , Gartner
• “A Gartner survey showed a return on investment of nearly 10 percent in IT costs being saved by using business rule technology. The future savings and benefits of business rule engines are expected to grow significantly over time.”
• Empower business users to change and maintain their own production systems without programming help and without interrupting operations • Build and integrate sophisticated object models incorporating corporate data sources including databases and XML schemas • Use drag and drop visual layout tools to design complex rule-driven process flows with conditional branching, reusable rulesets, functions, and question sets • Personalize business processes and portals with userspecific data displays, interactive dialogs, and product recommendations • Deploy highly scalable rule systems with exceptional performance on all leading platforms
• 正向链 (Forward chaining)和反向链(Backward chaining) • 正向链是从事实到结论的推理 • 反向链则是从假设,即要证明的结论,到事实的推理。
议程( A g e n d a )
• 由推理机创建的一个规则优先级表,这些 规则匹配工作内存中的事实 • 同时会有多个规则和事实匹配,优先级最 高的被触发 • 被触发规则的动作可能会产生新的事实, 新的事实被加入工作内存
• BRML : IBM CommonRules
/
• Business Rule Exchange - the Next XML Wave ?
相关主题