关于模糊逻辑

时间:2019-03-22 16:56:30

标签: fuzzy-logic

当我在模糊剪辑中运行这些规则时,它什么也没显示。我希望输出询问用户是或否,然后询问用户被诊断的人是年轻,老人还是成年人。那么模糊逻辑图应该属于年龄类别。

(deftemplate age
    0 100 
    ((children (2 1) (10 0))
    (young (15 0) (20 1) (21 1) (30 0))
    (adult (31 0) ( 40 1) (55 1))
    (old (S 60 90))
    (young_and_adult young and adult)
    (adult_and_old adult and old)))


(defrule r1
    (declare (salience (100))
    (demyelination_yes)
=>
    (printout t "Extensive demyelination (yes/no)?" crlf)
    (assert ( diagnosis Extensive_demyenation (read))))



(defrule r2
    (declare (salience (100))
    ( diagnosis Extensive_demyenation no)
=>
    (printout t "Perivascular demyelinatioin (yes/no)?" crlf)
    (assert (diagnosis Perivascular_demyelinatioin (read))))



(defrule r3
    (declare (salience (100))
    (diagnosis Perivascular_demyelinatioin yes)
=>
    (printout t "perivascfibrin (yes/no)?" crlf)
    (assert (diagnosis perivascfibrin (read))))



(defrule r4
    (declare (salience 100))
    (diagnosis perivascfibrin no)
=>
    (printout t "Acute disseminated encephalomyelitis Disease." crlf)
    (printout t "children, young, adult, old, young_and_adult, adult_and_old ? ")
    (bind ?m (read))
    (assert-string (format nil "(age %s)" ?m)))



(defrule ShowResults
(declare (salience (-100))
   ?f <- (age ?l)
   =>
    (plot-fuzzy-value t * nil nil ?f1))

0 个答案:

没有答案