对象修改内容后进入无限循环的剪辑规则

Clips rule for an object going into infinite loop after modifying the content inside it

我正在将剪辑对象内的变量递增 RHS 上的某个数字。

规则有效,但进入无限循环。

我试过 运行 它没有修改对象内部的变量,它进入 RHS 一次,但修改后它进入循环。

(defrule modify
        "modify"
        (step 0)
        ?EA <- (object (is-a ALERT)
                (ID                      ?RID&:(or(eq ?ID "R") (eq ?RID "Q")))
                (TIME                     ?T)
        )
        =>
        (bind ?time (send ?EA get-TIME))
        (bind ?newTime (+ 86399 ?time))
        (send ?EA put-TIME ?newTime)
        (log_info (str-cat "old time is " ?time ", new time is " ?newTime "event time is " (send ?EA get-TIME)))
)

我希望即使在修改对象内的内容后也能打印一次日志。

谢谢。

删除我们在 RHS 上递增的 LHS 上的插槽修复了这个问题。

(defrule modify
        "modify"
        (step 0)
        ?EA <- (object (is-a ALERT)
                (ID                      ?RID&:(or(eq ?ID "R") (eq ?RID "Q")))                
        )
        =>
        (bind ?time (send ?EA get-TIME))
        (bind ?newTime (+ 86399 ?time))
        (send ?EA put-TIME ?newTime)
        (log_info (str-cat "old time is " ?time ", new time is " ?newTime "event time is " (send ?EA get-TIME)))
)

如果我们在 LHS 中保留时间槽 TIME,在 change/increment 规则被重新触发后,它会进入循环。