0
我爲一個學校項目編寫了我的第一個CLIPS代碼,但我不熟悉CLIPS(我使用C#和Python作爲主要語言)。第一個CLIPS代碼不起作用
這是我的代碼,我剛開錯誤:
(defrule determine-closing-date
(not (day-to-close ?))
(billing-size ?)
(unpaid-invoices-number ?)
=>
(if
(or
(< billing-size 1000000)
(< unpaid-invoices-number 1000000)
)
then (assert (day-to-close MtTh))
else (assert (day-to-close friday))
)
(defrule determine-billing-size ""
(not (billing-size ?))
(not (day-to-close ?))
=>
(printout t "¿Cuál es el tamaño de la facturacion?")
(assert (billing-size ?size (read))))
(defrule determine-unpaid-invoices-number ""
(not (unpaid-invoices-number ?))
(not (day-to-close ?))
=>
(printout t "¿Cuál es la cantidad de facturas no pagadas")
(assert (unpaid-invoices-number ?size (read))))
(defrule determine-friday-load ""
(day-to-close friday)
(not (friday-load ?))
=>
(printout t "¿Cuál es la carga de cierres para el viernes?")
(assert (friday-load ?load (read))))
(defrule determine-saturday-closing ""
(day-to-close friday)
(not(< friday-load 1000000))
=>
(assert (day-to-close saturday)))
(defrule day-to-close-conclulssion ""
(day-to-close ?)
=>
(if (eq day-to-close MtTh)
then (printout t "Se puede cerrar de Lunes a Jueves")
else (
if (eq day-to-close friday)
then (printout t "Se debe cerrar viernes.")
else (printout t "Se debe cerrar sabado.")
)
))
的errores是:
[ARGACCES5]功能<預期參數#1爲整數類型的或浮動
[PRCCODE3]在defrule的RHS中引用的未定義的變量大小。
[CSTRCPSR1]警告:重新定義defrule:確定-星期六閉+ J + J + J
[CSTRCPSR1]警告:重新定義defrule:一天到近距離conclulssion + J + J
謝謝你們的幫助!你能告訴我我做錯了什麼嗎?我真的想學習這個CLIPS語法 – Yatiac 2015-02-12 16:07:02
1)用於綁定變量的語法不正確。 – 2015-02-12 17:45:46
2)在確定 - 星期六 - 結束規則中,需要檢查小於1000000的負載的存在的週五負載模式,而不是負載小於1000000的事實不存在。 3)當天「關係到結論」的規則需要比其他規則的顯着性要低,以便在所有其他規則應用之後才能執行。如果您刪除突出顯示並運行計費大小和支付3000000的賬單的程序,您會看到原因。 – 2015-02-12 17:51:50