我对CLIPS专家系统很陌生。
如何告诉剪辑在执行特定指令后停止执行规则?!!
就像这样:
(defrule firstRule
(some assumption)
=>
(if (X happened) then (and (print "yikes 1")(terminate the program))
(defrule secondRule
(some assumption)
=>
(if (Y happened) then (and (print "yikes 2")(terminate the program))
(defrule thirdRule
(some assumption)
=>
(if (Z happened) then (and (print "yikes 3")(terminate the program))如果Y和Z发生了,而X没有发生,我希望这样的东西被打印出来:
yikes 2发布于 2013-12-22 17:31:06
用这个:
(if [condition]
then
(printout t "yikes 3" crlf)
(halt))其中的条件应该类似于变量、B或表达式(> 34)。在printout语句中,t是指示输出方向的逻辑名称(在本例中t表示标准输出),crlf输出一个回车/行提要(输出的新行)。(halt)语句在当前规则完成执行后停止规则的执行。然后,可以通过在命令提示符下输入(run)来重新启动执行。或者,(exit)命令将立即终止规则和CLIPS的执行。
https://stackoverflow.com/questions/20720457
复制相似问题