0
我卡在這裏這個剪輯項目。我真的不知道如何解決我的問題。任何幫助? this is the project新增到剪輯和不知道如何處理這個基本項目
這裏是我的代碼:
CLIPS> (assert (saving 30000))
<Fact-1>
CLIPS> (assert (income 50000))
<Fact-2>
CLIPS> (assert (job steady))
<Fact-3>
CLIPS> (assert (expenses 10000))
<Fact-4>
CLIPS> (defglobal ?*s* = 30000)
CLIPS> (defglobal ?*i* = 50000)
CLIPS> (defglobal ?*e* = 10000)
CLIPS> (defglobal ?*x* = 0.5)
CLIPS> (defrule rule1
(test (> ?*s* (* ?*x* ?*i*)))
=>
(assert (savingst good)))
CLIPS> (defrule rule2
(job steady)
(test(> ?*i* ?*e*))
=> (assert (incomest good))
)
CLIPS> (defrule rule3
(and (savingst good)(incomest good))
=>
(printout t "Advise is invest money in stocks" crlf)
(assert (investment ok))
)
CLIPS> (run)
Advise is invest money in stocks
CLIPS> (bsave "C:/Users/Home/Desktop/pro")
TRUE
CLIPS> (save file.clp)
首先我不知道我應該怎麼導出* .clp文件。但我做到了,如上所示。當我加載這個文件然後運行它時,它只運行rule1。 有沒有人可以幫助我?
太謝謝你了:)這是完美的。 – shaaidaa
我用這個代碼加我的事實: 'CLIPS>(defrule insertFacts =>(斷言(工作穩步)) (斷言(收入50000)) (斷言(節省30000)) (斷言(費用10000) ))' 但你的邏輯更合理。 – shaaidaa