计算已触发的规则而不修改现有规则

时间:2016-05-30 19:41:10

标签: clips

如何计算在CLIPS中执行程序期间触发了多少规则?但我不想修改现有的规则,比如在每个规则中添加一个计数器。

1 个答案:

答案 0 :(得分:0)

使用(watch statistics)命令:

CLIPS> (clear)
CLIPS> (defrule rule-1 (data ?) =>)
CLIPS> (assert (data 1) (data 2) (data 3))
<Fact-3>
CLIPS> (watch statistics)
CLIPS> (run)
3 rules fired        Run time is 1.60000054165721e-05 seconds.
187499.936524567 rules per second.
4 mean number of facts (4 maximum).
1 mean number of instances (1 maximum).
2 mean number of activations (3 maximum).
CLIPS>