clips - how to fuzzify in fuzzyclips? -
i want write project precise value calorie calculate precise value of part(how weight increased?).this rule:
if calorie high increase weight
for have set calorie:
(highcalorie (20 0)(40 .2) (60 .5) (100 .8) (180 1))
and in other hand value of increase weight have set:
(increase(50 0) (100 .4) (120 .8) (150 1))
in other word want map value calorie increase weight. write 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)) ) ; first precise value calorie , 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 add rules 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 colrie" (moment-defuzzify ?f) " grams of fat increased weight" crlf))
what mistake?
thanks alot.
your deftemplates have missing parentheses. corrected code is
(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))))
Comments
Post a Comment