The rules make sense if I assume that there is one Tumor object for each
distinct value of disName, with the diagnostic weight factors. So, one (new)
TumorPatient object will match each of the Tumor objects and determine the
percentage of that disease.

The loop results from each rule modifying, in turn, some TumorPatient
object; so, as soon as the second one fires, the TumorPatient is put back on
the agenda with the first Tumor fact, and so on.

Drop the no-loop, which only guards against the *same* rule firing with a
particular fact combination. Instead, when inserting a new TumorPatient, set
slots Dermatofibroma and Stucco-Keratosis to nil (or some specifc value <0
or >100) and add a test for that value to each rule, e.g.,

(defrule Dermatofibroma
         (object (is-a TumorPatient)
                 (OBJECT ?tp)
                 (pName ?pn)
                 (Dermatofibroma nil)
...
))

-W






On 5/28/09, Rose S <[email protected]> wrote:
>
>
> Hi Jason,
> first of all thanks for your reply.
> for the answer of your question I'm developing this in protege.
> It is what I'm trying to do :
> I'm trying to specify weight percent of any kinds of tumors for each
> patient.
> for example patient number 1 has 37 percent of "dermatofibroma" and 56
> percent of "Stucco-Keratosis".
> and the other patient with number 2 has diffrent weight percents.
> and that slot-set function in RHS of the rule fills each disease slot with
> it's percent.
> because of this I didn't define any common slot between objects.
>
> Best Regards
> Rose
>
> --- On *Thu, 28/5/09, Jason Morris <[email protected]>* wrote:
>
>
> From: Jason Morris <[email protected]>
> Subject: Re: JESS: infinite loop again
> To: [email protected]
> Date: Thursday, 28 May, 2009, 5:30 PM
>
> Hi Rose,
>
> Aside from some Jess usage issues, I think you have a big logic flaw in
> your rules.
>
> Look at what you have written in the first rule:
>
> You are essentially trying to match any (object) that is-a-tumor-patient
> with any (object) that is-a-tumor. However, I don't see any slot binding
> that is common to either of those patterns that logically joins them so that
> you can draw the conclusion that a particular patient has a certain type of
> tumor leading to a certain disease. You are pulling the conclusions out of
> thin air. The fact that the individual rules fire or not is immaterial in
> the face of this.
>
> If I'm right, then if you were to just take your first rule, assert two
> patient objects and three tumor objects, and run Jess, you should get the
> Cartesian product of 6 firings of your rule. Using both rules should cause
> the infinite loop because they will alternately change the facts,
> perpetually activating each other.
>
> A more rigorous diagnosis rule might look like this:
>
> IF
> We have a patient, p AND
> This patient has a tumor, t AND
> This tumor has an attribute, a(1) AND
> ...
> This tumor has an attribute, a(n)
> The patient exhibits symptom s(1) AND
> ...
> The patient exhibits symptom s(m)
> THEN
> Conclude that patient p has disease d caused by tumor-type t with the score
> z.
>
> Also, what is that (slot-set..) function on the RHS of your rules? Are you
> developing this in Protege?
>
> Cheers,
> Jason
>
> On Mon, May 25, 2009 at 1:51 PM, Rose S 
> <[email protected]<http://mc/[email protected]>
> > wrote:
>
>>   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!
>> <http://sg.rd.yahoo.com/aa/mail/domainchoice/mail/signature/*http://mail.promotions.yahoo.com/newdomains/aa/>
>> Grab the Email name you've always wanted before someone else does!
>
>
>
>
> --
> -----------------------------------------------------------
> Morris Technical Solutions LLC
> [email protected]<http://mc/[email protected]>
> (517) 304-5883
>
>
> ------------------------------
> New Email names for you!
> <http://sg.rd.yahoo.com/aa/mail/domainchoice/mail/signature/*http://mail.promotions.yahoo.com/newdomains/aa/>
> Get the Email name you've always wanted on the new @ymail and @rocketmail.
> Hurry before someone else does!

Reply via email to