i want to write a project get a precise value for calorie to calculate the precise value of the then part(how much weight increased?).this is my rule:
if calorie is high then increase weight
for this i have this set for calorie:
(highCalorie (20 0)(40 .2) (60 .5) (100 .8) (180 1))
and in the other hand for value of increase weight i have this set:
(increase(50 0) (100 .4) (120 .8) (150 1))
in other word i want to map a value for calorie to increase weight. for do this i write this code :
(deftemplate calories
20 180
(high(20 0)(40 .2) (60 .5) (100 .8) (180 1))
)
(deftemplate fat
50 150
(increase(50 0) (100 .4) (120 .8) (150 1))
)
; We first get a precise value for calorie and fuzzify it.
(defrule getCalorie
(declare (salience 100))
=>
(printout t "Enter calorie: ")
(bind ?t (read))
(assert (calorie ?t))
)
(defrule fuzzifyCalorie
(calorie ?t)
=>
(assert (calories (?t 0) (?t .2) (?t .5)(?t .8)(?t 1))))
; Here we add rules to prescribe amounts of increased weight
(defrule result
(declare (salience -1))
(calories high)
=>
(assert (fat increase)))
(defrule ShowPenicillin
(declare (salience -100))
?f <- (fat ?p)
=>
(printout t "for this colrie" (moment-defuzzify ?f) " grams of fat increased to weight" crlf))
what is my mistake?
thanks alot.
Your deftemplates have missing parentheses. The corrected code is