Я хочу, чтобы клипы следовали моему порядку с соблюдением правил.
Я использовал шаблон «состояние», чтобы убедиться, что правила будут выполняться по моему приказу (разрешение конфликтов), путем изменения «статуса» слота после срабатывания каждого правила. но клипы изменяют «статус» после первого выполнения правила, а не после сбора всех принятых данных с помощью правила. Итак, я использовал шаблон «изменить» и правило «callChange», чтобы изменить «статус» для меня. но все та же проблема. Я пробовал «заметность», но он всегда выполняет первое запущенное правило и не переходит к другому активированному правилу с более низкой «заметностью».
любая помощь, пожалуйста, есть мир моего кода:
(deftemplate laptop(slot name)(slot price)(slot usagefor )(slot description))
(deftemplate find_laptops (slot price)(slot usagefor ))
(deftemplate range(slot min)(slot max))
(deftemplate state(slot status))
(deftemplate change(slot newStatus))
(deffacts laptops
(laptop(name k53e)(price 200)(usagefor homeandoffice)(description 2.1i3_6gb_500gb_intel_2.2kg))
(laptop(name x205ta)(price 200)(usagefor homeandoffice)(description 1.3atom_2gb_320ssd_intel_1.5kg))
(laptop(name n550gk)(price 800)(usagefor gamingandprogramming)(description 2.4i7_8gb_1t_nvidia850_2.2kg))
(state(status 1))
(change(newStatus notFinish)))
(defrule callChange (declare (salience 10))
?c<-(change(newStatus ?newStatus))
?s<-(state(status ?status))=>
(modify ?c (newStatus notFinish))
(modify ?s (status(+ ?status 1))
))
(defrule get_info_laptop (declare (salience 50))
?s<-(state(status 1))
?c<-(change(newStatus ?newStatus)) =>
(printout t "enter usagefor" crlf) (bind ?usagefor (read))
(printout t "enter price " crlf) (bind ?price (read))
(assert(find_laptops(price ?price)(usagefor ?usagefor)))
(modify ?c (newStatus Finish))
)
(defrule find_laptop_res (declare (salience 100))
?s<-(state(status 2))
?c<-(change(newStatus ?newStatus))
(find_laptops(price ?price)(usagefor ?usagefor ))
(laptop(name ?name)(price ?price)(usagefor ?usagefor )(description ?description)) =>
(printout t " the name is " ?name " and the description " ?description" the best laptop is " ?name crlf)
(modify ?c (newStatus Finish)))