更新されたコード: チェックを追加する場所?f<-(practice-is-on-off OFF)
(defrule no-practice "Rules for when practice cannot be held"
(or ?f <- (practice (number-of-paddlers ?p&:(< ?p 6)))
?f <- (practice (number-of-coaches ?c&:(< ?c 1))))
=>
(modify ?f (practice-is-on-off OFF)))
;end
CLIPS でテンプレートを定義しており、論理演算子 OR を使用しています。ただし、テンプレートをロードすると、エラーがスローされます
[TMPLTDEF1] Invalid slot or not defined in corresponding deftemplate practice.
ERROR:
(defrule MAIN::no-practice "Rules for when practice cannot be held"
?f <- (practice (or
ここに私が持っているものがあります:洞察を事前にありがとう。ありがとう
(deftemplate practice "structure of a practice"
(slot number-of-paddlers (type NUMBER))
(slot number-of-coaches (type NUMBER))
(slot practice-is-on-off (type SYMBOL) (default ON))
(slot practice-id (type NUMBER))
)
(defrule no-practice "Rules for when practice cannot be held"
?f <- (practice
(or
(number-of-paddlers
?v_number-of-paddlers&:(
< ?v_number-of-paddlers 6))
(number-of-coaches
?v_number-of-coaches&:(
< ?v_number-of-coaches 1))
)
)
=>
(modify ?f (practice-is-on-off OFF)
)
)