« Return to Thread: JESS: infinite loop again

JESS: infinite loop again

by Rose S :: Rate this Message:

Reply to Author | View in Thread

Hello,
I've declared no-loop in my rule to avoid infinite loop,
but I have two rules that when I use them separately (I
mean when I define one of them) there's no loop but when I
define both of them in my project and run them an infinite
loop would happen.
what's the problem with that?
is there some thing wrong with my rules?


Thanks in advance
Rose


Get your new Email address!
Grab the Email name you've always wanted before someone else does!
(defrule Stucco-Keratosis
 
 (declare (no-loop TRUE))
         (object (is-a TumorPatient)
                 (OBJECT ?tp)
                 (pName ?pn)
                 (Cyst-CF ?ccf)
                 (Itching-CF ?icf)
  (Heel-Lesion-CF ?hcf)
                 (Scale-CF ?scf)
                 (Papule-CF ?pcf)
                 (Nodule-CF ?ncf)
    (Plaqua-CF ?pqcf))
         (object (is-a Tumor)
                 (OBJECT ?t)
                 (disName "Stucco-Keratosis")
                 (Cyst-Weight ?cw)
                 (Heel-Lesion-Weight ?hw)
                 (Itching-Weight ?iw)
                 (Nodule-Weight ?nw)
                 (Papule-Weight ?pw)
  (Plaqua-Weight ?pqw)
                 (Scale-Weight ?sw))

=>
(bind ?r1 (* ?hcf ?hw))
(bind ?r2 (* ?scf ?sw))
(bind ?r3 (+ ?r1 ?r2))
(bind ?r4 (* ?r3 100))
(bind ?r5 (integer ?r4))
(printout t "Patient " ?pn " with " ?r5 " percent has Stucco-Keratosis." crlf)
(slot-set ?tp Stucco-Keratosis ?r5)
)

********************************************************

(defrule Dermatofibroma
 
 (declare (no-loop TRUE))
         (object (is-a TumorPatient)
                 (OBJECT ?tp)
                 (pName ?pn)
                 (Cyst-CF ?ccf)
                 (Itching-CF ?icf)
  (Heel-Lesion-CF ?hcf)
                 (Scale-CF ?scf)
                 (Papule-CF ?pcf)
                 (Nodule-CF ?ncf)
    (Plaqua-CF ?pqcf))
         (object (is-a Tumor)
                 (OBJECT ?t)
                 (disName "Dermatofibroma")
                 (Cyst-Weight ?cw)
                 (Heel-Lesion-Weight ?hw)
                 (Itching-Weight ?iw)
                 (Nodule-Weight ?nw)
                 (Papule-Weight ?pw)
  (Plaqua-Weight ?pqw)
                 (Scale-Weight ?sw))

=>
(bind ?r1 (* ?scf ?sw))
(bind ?r2 (* ?pcf ?pw))
(bind ?r3 (* ?ncf ?nw))
(bind ?r4 (+ ?r1 ?r2))
(bind ?r5 (+ ?r4 ?r3))
(bind ?r6 (* ?r5 100))
(bind ?r7 (integer ?r6))
(printout t "Patient " ?pn " with " ?r7 " percent has Dermatofibroma." crlf)
(slot-set ?tp Dermatofibroma ?r7)
)

 « Return to Thread: JESS: infinite loop again