1
일치 트리거하지 않습니다클립 : 수정 - 인스턴스 패턴 파일 test.clp 갖는
(defclass TestClass (is-a USER)
(role concrete)
(pattern-match reactive)
(slot value)
(slot threshold))
(definstances TestObjects
(Test of TestClass
(value 0)
(threshold 3)))
(defrule above-threshold
?test <- (object (is-a TestClass))
(test (> (send ?test get-value) (send ?test get-threshold)))
=>
(printout t "*** Above threshold!! ***" crlf)
(refresh below-threshold))
(defrule below-threshold
?test <- (object (is-a TestClass))
(test (> (send ?test get-value) (send ?test get-threshold)))
=>
(printout t "*** Back to normal ***" crlf)
(refresh above-threshold))
나는 파일을로드 :
이CLIPS> (reset)
CLIPS> (agenda)
0 below-threshold: [Test]
For a total of 1 activation.
CLIPS> (run)
*** Back to normal ***
CLIPS> (modify-instance [Test] (value 8))
TRUE
CLIPS> (agenda)
CLIPS>
의제는 활성 규칙을 표시하지 않습니다. 나는 8에 대한 값의 변경 (인스턴스 수정)이 패턴 일치를 트리거하고 "임계 값 초과"규칙이 실행 및 의제에 선택 될 것으로 기대합니다. 내가 뭘 놓치고 있니? 기본 프로그래밍 가이드의 섹션 5.4.1.7, 개체 패턴과 패턴 매칭,에서