如何在剪辑中创建条件规则以查找输出
例如
(deftemplate holiday
(slot hotel (allowed-symbols nice good poor))
(slot weather (allowed-symbols sunny raining))
)
(deftemplate output
(slot option (allowed-symbols go plan stay))
)有了这个,我们如何创建这样的规则
if hotel = poor then stay
if hotel = poor and weather = raining then stay
if (hotel = poor and weather = sunny) or (hotel = good and weather = raining) then plan谢谢
发布于 2016-11-22 18:03:06
(defrule hotel-rule1
(holiday (hotel ?hotel&:(eq ?hotel poor)))
=>
(assert (output (option stay)))
)
(defrule hotel-rule2
(holiday (hotel ?hotel&:(eq ?hotel poor)) (weather ?weather&:(eq ?weather raining)))
=>
(assert (output (option stay)))
)我会将最后一条规则的“或”条件分成两条不同的规则,类似于我所写的例子。
再见Nic
https://stackoverflow.com/questions/40738583
复制相似问题