О нечеткой логике - PullRequest
0 голосов
/ 22 марта 2019

Когда я запускаю эти правила в нечетких клипах, они ничего не показывают. Я хочу, чтобы вывод спрашивал пользователя «да» или «нет», а затем спрашивал пользователя, относится ли диагностируемый человек к категории молодых, пожилых или, возможно, взрослых. Тогда нечеткая логика должна графу принадлежать к возрастной категории.

(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))
...