【发布时间】:2021-05-17 10:34:27
【问题描述】:
我想知道我每天都做哪些活动,所以我构建了以下代码:
(deftemplate schedule
(slot activity)
(slot starthour)
(slot endhour)
)
(defrule r1
(schedule (activity ?a) (starthour ?start) (endhour ?end))
(not (busy ?start ?a))
=>
(assert (busy ?start ?a))
)
(defrule r2
(busy ?d ?a)
(schedule (activity ?a) (starthour ?start) (endhour ?end))
(test (< ?d ?end))
=>
(assert (busy ( + ?d 1) ?a))
)
CLIPS> (assert (schedule (activity reading) (starthour 3) (endhour 5)))
<Fact-1>
CLIPS> (assert (schedule (activity music) (starthour 4) (endhour 7)))
<Fact-2>
对于我插入的事实,我得到了一个不按日期排序的结果。 CLIPS如何解释事实的顺序? 有没有办法让我在一天内进行 1 次以上的活动?
非常感谢!
【问题讨论】:
标签: clips