JESS: Time-varying methods inside a and in a test

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

JESS: Time-varying methods inside a and in a test

Skeptic .
Hi,

Is there a good reason why a rule like this :

(defrule r1 
[...]
(test (and (time-varying call1) (time-varying call2))
=> 
[...])

behave differently than one like this :

(defrule r1b
[...]
(test (time-varying call1))
(test (time-varying call2))
=> 
[...])

Thanks !
Reply | Threaded
Open this post in threaded view
|

Re: JESS: Time-varying methods inside a and in a test

Friedman-Hill, Ernest
Although they do compile into different networks, the effect should be  
basically the same. What's the difference you're observing?


On Jul 18, 2011, at 11:00 AM, Skeptic . wrote:

> Hi,
>
> Is there a good reason why a rule like this :
>
> (defrule r1
> [...]
> (test (and (time-varying call1) (time-varying call2))
> =>
> [...])
>
> behave differently than one like this :
>
> (defrule r1b
> [...]
> (test (time-varying call1))
> (test (time-varying call2))
> =>
> [...])
>
> Thanks !

---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences          Phone: (925) 294-2154
Sandia National Labs
PO Box 969, MS 9012                            [hidden email]
Livermore, CA 94550                             http://www.jessrules.com





--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [hidden email]'
in the BODY of a message to [hidden email], NOT to the list
(use your own address!) List problems? Notify [hidden email].
--------------------------------------------------------------------

Reply | Threaded
Open this post in threaded view
|

RE: JESS: Time-varying methods inside a and in a test

Skeptic .


r1 is fired, r1b is not (which is the desired behavior).

> From: [hidden email]
> To: [hidden email]
> Subject: Re: JESS: Time-varying methods inside a and in a test
> Date: Mon, 18 Jul 2011 13:06:56 -0400
>
> Although they do compile into different networks, the effect should be  
> basically the same. What's the difference you're observing?
>
>
> On Jul 18, 2011, at 11:00 AM, Skeptic . wrote:
>
> > Hi,
> >
> > Is there a good reason why a rule like this :
> >
> > (defrule r1
> > [...]
> > (test (and (time-varying call1) (time-varying call2))
> > =>
> > [...])
> >
> > behave differently than one like this :
> >
> > (defrule r1b
> > [...]
> > (test (time-varying call1))
> > (test (time-varying call2))
> > =>
> > [...])
> >
> > Thanks !
>
> ---------------------------------------------------------
> Ernest Friedman-Hill
> Informatics & Decision Sciences          Phone: (925) 294-2154
> Sandia National Labs
> PO Box 969, MS 9012                            [hidden email]
> Livermore, CA 94550                             http://www.jessrules.com
>
>
>
>
>
> --------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users [hidden email]'
> in the BODY of a message to [hidden email], NOT to the list
> (use your own address!) List problems? Notify [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: JESS: Time-varying methods inside a and in a test

Wolfgang Laun-2
In reply to this post by Skeptic .
(and) does a short-circuited evaluation of its operands, but it is still a single CE. Whether it returns false due to the first or second operand does not matter: it'll have to be reevaluated over and over again.

Using two boolean functions in two different CEs may result in less invocations of
these functions since a "true" result of the first CE is not lost.

Wolfgang

On 18 July 2011 17:00, Skeptic . <[hidden email]> wrote:
Hi,

Is there a good reason why a rule like this :

(defrule r1 
[...]
(test (and (time-varying call1) (time-varying call2))
=> 
[...])

behave differently than one like this :

(defrule r1b
[...]
(test (time-varying call1))
(test (time-varying call2))
=> 
[...])

Thanks !

Reply | Threaded
Open this post in threaded view
|

Re: JESS: Time-varying methods inside a and in a test

Wolfgang Laun-2
In reply to this post by Skeptic .
It would be interesting to see these functions.

Basically I'm inclined to believe that this is not possible without some weird side effect achieved by one of the functions.

-W


On 18 July 2011 19:42, Skeptic . <[hidden email]> wrote:


r1 is fired, r1b is not (which is the desired behavior).

> From: [hidden email]
> To: [hidden email]
> Subject: Re: JESS: Time-varying methods inside a and in a test
> Date: Mon, 18 Jul 2011 13:06:56 -0400
>
> Although they do compile into different networks, the effect should be
> basically the same. What's the difference you're observing?
>
>
> On Jul 18, 2011, at 11:00 AM, Skeptic . wrote:
>
> > Hi,
> >
> > Is there a good reason why a rule like this :
> >
> > (defrule r1
> > [...]
> > (test (and (time-varying call1) (time-varying call2))
> > =>
> > [...])
> >
> > behave differently than one like this :
> >
> > (defrule r1b
> > [...]
> > (test (time-varying call1))
> > (test (time-varying call2))
> > =>
> > [...])
> >
> > Thanks !
>
> ---------------------------------------------------------
> Ernest Friedman-Hill
> Informatics & Decision Sciences          Phone: (925) 294-2154
> Sandia National Labs
> PO Box 969, MS 9012                            [hidden email]
> Livermore, CA 94550                             http://www.jessrules.com
>
>
>
>
>
> --------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users [hidden email]'
> in the BODY of a message to [hidden email], NOT to the list
> (use your own address!) List problems? Notify [hidden email]