I want to build an expert system in which in a case of emergency at a building with some floors (ground floor + three floors), the elevator should take the people into the ground. Idea is to save people firstly from the highest one (third floor), and after that from second floor, and at the end from first floor. I have problem with salience of rules (I have separate rules for each floor). At the beginning the highest salience is for rule "MoveFloor3" - move elevator to third floor (because I want to save firstly people from the highest floor). When I save all people from third floor I want to change salience in this rule to 0 (or some number smaller than salience for second and first floor), because after that I want to save people from second and first floor. Code for this rule is bellow, how to modify this code in order to change salience after the number of people on this floor becomes 0.
(defrule moveFloor3
(declare (salience 50))
?j<-(lastJob ?t&~moveFloor3)
?e<-(elevator ?peopleInElevator)
?f<-(floor3 ?peopleInFloor)
(capacityElevator ?capacityElevator)
=>
(bind ?newPeopleInElevator (+ ?peopleInElevator (min ?peopleInFloor (- ?capacityElevator ?peopleInElevator))))
(bind ?newPeopleInFloor (- ?peopleInFloor (min ?peopleInFloor (- ?capacityElevator ?peopleInElevator))))
(retract ?e ?f ?s ?j)
(assert (elevator ?newPeopleInElevator))
(assert (floor3 ?newPeopleInFloor))
(assert (lastJob moveFloor3))
(printout t "Elevator moved to third floor" crlf)
)