drools - Select a single rule (based on attribute weights) from multiple rules matched in Drools
问题描述
I want to be able to select 1 off the multiple rules which match the input. Logic to pickup the best match should be based on weights provided for each attribute.
eg:
Attrib1_Weight = 1
Attrib2_Weight = 4
Attrib3_Weight = 1
Rule1 = Attrib1, Attrib3
Rule2 = Attrib2
So if a condition meets both Rule1 and Rule2 -- Rule2 will be selected as Attrib2 is having weight = 4. For Rule1 total weight is 2.
I am using decision table excel.
解决方案
您可以为表示权重的每个规则添加一个新约束。然后,您需要将重量作为事实插入到引擎中。
推荐阅读
- opencv - 如何使用 Cmake 用 python 3 而不是 python 2 构建 opencv
- python - 如何设置pyplot网格的属性
- android - 取消单击按钮或视图时如何添加功能?
- c# - 有没有更优雅的方法来使用 system.text.json 从 JSON 对象获取特定值
- wpf - Prism CustomRegionAdapter,允许多个
- python - python中两个列表的排列而不使用python中的itertools组合或合并列表可能吗?
- crystal-reports - 水晶报表返回一个空白,当预期返回应该是一个日期
- python - 关于在可编辑的 PDF 文件中填写表格的问题
- linux - 当 Windows PATH 的文件夹名称带有空格时,WSL(Windows 子系统 linux)会中断 $PATH
- javascript - 无法在 React Native 中使用 Font Awesome 图标