2016-10-28 4 views
0

私の熟練したシステムでは、このパラメータに適したノートブックが表示されたら、開発者と価格を確認する必要があります。クリップのエキスパートシステムが動作しません

(スクリーンショットで)このパラメータを持つ例えば

私は結果を持っている必要があります:モデル:私は何も表示されません。しかし

Screenshot

Noteebok1。問題やバグはどこにありますか?

CLPファイルコード:

(defglobal ?*s* = 0) 
(deftemplate Notebook 
(slot pModel) 
(slot pDeveloper) 
(slot pPrice)) 
;*******************************************************************  
(deffunction QuestionOf(?TextQuestion $?variations) 
(printout t ?TextQuestion) 
(bind ?Answer (read)) 
(if (lexemep ?Answer) 
then (bind ?Answer (lowcase ?Answer))) 
(while (not (member ?Answer ?variations)) do 
(printout t ?TextQuestion) 
(bind ?Answer (read)) 
(if (lexemep ?Answer) 
then (bind ?Answer (lowcase ?Answer)))) 
?Answer) 
;********************************************************************' 
(defrule banner 
(declare (salience 10)) 
=>(load-facts D:\fact.txt) 
(printout t crlf crlf) 
(printout t "Expert system. Nout search") 
(printout t crlf crlf)) 
;******************************************************************' 
(defrule QuestionDeveloper 
(not (Developer ?)) 
=>(bind ?asssert(QuestionOf "Check Developer (a-HP,b-Samsung,c-Apple,d-IDontKnow)" a b c d)) 
(if (eq ?asssert a)then (assert (Developer HP))) 
(if (eq ?asssert b)then (assert (Developer Samsung))) 
(if (eq ?asssert c)then (assert (Developer Apple))) 
(if (eq ?asssert d)then (assert (Developer IDontKnow)))) 
;******************************************************************' 
(defrule QuestionPrice 
(not (Price ?)) 
=>(bind ?asssert(QuestionOf "Price?(a-300,b-400,c-500,d-IDontKnow)" a b c d)) 
(if (eq ?asssert a)then (assert (Price 300))) 
(if (eq ?asssert b)then (assert (Price 400))) 
(if (eq ?asssert c)then (assert (Price 500))) 
(if (eq ?asssert d)then (assert (Price IDontKnow)))) 
;******************************************************************' 
(defrule Vyvod 
(or (Developer ?xDeveloper)(Developer IDontKnow)) 
(or (Price ?xPrice)(Price IDontKnow)) 
(Notebook(pModel ?Model)(pDeveloper ?xDeveloper)(pPrice ?xPrice)) 
=>(bind ?*s*(+ ?*s* 1)) 
(printout t crlf " " ?*s* ". Model : " ?Model crlf)) 
;******************************************************************' 

Fact.txt:ファイルfact.txtから

(Notebook(pModel Notebook1)(pDeveloper HP)(pPrice 500)) 
(Notebook(pModel Notebook2)(pDeveloper Samsung)(pPrice 400)) 
(Notebook(pModel Notebook3)(pDeveloper Apple)(pPrice 500)) 

答えて

0

事実がロードされていません。ファイルが指定されたパスにあり、読み取りアクセス権があることを確認します。

+0

ありがとうございました。 –

関連する問題