您将如何在 Rete 网络中构造 Alpha 节点,该网络的规则包含在其他规则中发现的两个条件?
How would you structure Alpha Nodes in a Rete Network that has a rule with two conditions found in other rules?
假设我有三个规则:
- 当Object的foo属性为1时,输出"foo"
- 当Object的bar 属性为1时,输出"bar"
- 当Object的foo属性为1,bar属性为1时,输出"both foo and bar"
对于这种情况,alpha 节点的结构是什么样的?我见过这样的例子,给定规则 1 和 2,它可能看起来像:
foo == 1 - "foo"
root<
bar == 1 - "bar"
并且,给定 3:
root - foo == 1 - bar == 1 - "both foo and bar"
并且,给定 3 和 1:
"foo"
root - foo == 1 <
bar == 1 - "both foo and bar"
给定 3、2 和 1,它看起来像吗:
foo == 1 - "foo"
root <
"bar"
bar == 1 <
foo == 1 - "both foo and bar"
或
foo == 1 - "foo"
/
root-- bar == 1 - "bar"
\
foo == 1 - bar == 1 - "both foo and bar"
或者其他方式?
如果您要共享节点并保留测试属性的顺序,它将如下所示:
bar == 1 - "bar"
root <
"foo"
foo == 1 <
bar == 1 - "both foo and bar"
假设我有三个规则:
- 当Object的foo属性为1时,输出"foo"
- 当Object的bar 属性为1时,输出"bar"
- 当Object的foo属性为1,bar属性为1时,输出"both foo and bar"
对于这种情况,alpha 节点的结构是什么样的?我见过这样的例子,给定规则 1 和 2,它可能看起来像:
foo == 1 - "foo"
root<
bar == 1 - "bar"
并且,给定 3:
root - foo == 1 - bar == 1 - "both foo and bar"
并且,给定 3 和 1:
"foo"
root - foo == 1 <
bar == 1 - "both foo and bar"
给定 3、2 和 1,它看起来像吗:
foo == 1 - "foo"
root <
"bar"
bar == 1 <
foo == 1 - "both foo and bar"
或
foo == 1 - "foo"
/
root-- bar == 1 - "bar"
\
foo == 1 - bar == 1 - "both foo and bar"
或者其他方式?
如果您要共享节点并保留测试属性的顺序,它将如下所示:
bar == 1 - "bar"
root <
"foo"
foo == 1 <
bar == 1 - "both foo and bar"