Hi Srini

The rule EvaluateH30ValueOnPlatform does not necessarily match on a SINGLE
platform at a time. In other words, it could be using the value of x1 of,
say platform A, the value of x2 of, say platform B, the value of etc. etc..

Maybe your intention for  rule EvaluateH30ValueOnPlatform is

(defrule EvaluateH30ValueOnPlatform ""
               ?thisPlatform <= (Platform (x2 ?val1) (x3 ?val2)(x3 ?val2)(x1
?x&: (and (<= ?x ?val1) (>= ?x                    
                            ?val2))))
             =>
              (printout t  ?x crlf)
              (printout t  ?val1 crlf)
              (printout t  ?val2 crlf)
                (modify ?thisPlatform (x4 ?x))
        )

> -----Original Message-----
> From: Cheruku srini [SMTP:[EMAIL PROTECTED]]
> Sent: Tuesday, May 25, 1999 5:26 AM
> To:   [EMAIL PROTECTED]
> Subject:      Re: JESS: data types for slots
> 
> 
> Well, my intention here is to fire the rule if x1 is within the range
> of x2 and x3. Then value of x1 shall be assigned to x4. The total clp
> file is given below.
> 
>  
> ;;;*************
> ;;;* TEMPLATES *
> ;;;*************
> ;;;
> 
> (deftemplate Platform
>    (slot x1 (default 40))
>    (slot x2 (default 400))
>    (slot x3 (default 30))
>    (slot x4 (default 10))
> )
> 
> 
> ;;;*************************
> ;;;* H30 Input
> ;;;*************************
> 
> (defrule EvaluateH30ValueOnPlatform ""
>        (Platform (x2 ?val1))
>        (Platform (x3 ?val2))                                           
>        
>        (Platform (x3 ?val2))
>        (Platform (x1 ?x&: (and (<= ?x ?val1) (>= ?x                    
>                     ?val2))))
>      =>
>       (printout t  ?x crlf)
>       (printout t  ?val1 crlf)
>       (printout t  ?val2 crlf)
>       (assert (Platform (x4 ?x)))
> )
> (defrule initial ""
>    =>
>    (assert  (Platform (x1 50)(x2 300) (x3 30)(x4 0)))
> ;   (assert  (Platform (x1 500)(x2 300) (x3 30)(x4 0)))
> )
> 
> (reset)
> (run)                            
> 
> --- Ernest Friedman-Hill <[EMAIL PROTECTED]> wrote:
> > I think Cheruku srini wrote:
> > > 
> > > 
> > > Hello Hill,
> > 
> > !!! (Culture clash.)
> > 
> > > 
> > > Thank You for the solution. Actually,There are no
> > default values
> > > available for slots. But I have tried giving some
> > arbitrary values as
> > > default values in the deftemplate. The rule gets
> > asserted for all the
> > > combinations of default values as well. 
> > >  Is there any reason for considering the default
> > values also, while
> > > doing assertion.
> > > 
> > > Is there any way one can avoid such assertion
> > wherein default values
> > > are also considered.
> > 
> > 
> > Well,  your rule asserts Platform facts that it also
> > is able to fire
> > on, creating a loop. You simply need to change the
> > rule so that it
> > won't fire on the facts it asserts (if that's what
> > you're trying to
> > accomplish.) It looks like you only want the rule to
> > fire for facts
> > that have the default value in slot x4; so state
> > that explicitly in
> > the rule.
> > 
> > 
> > 
> > > 
> > >   There are so many variables involved in my rules
> > and the execution is
> > > taking a lot of time in going through the
> > combinations of default
> > > values.
> > >  
> > > The template looks like this:
> > > 
> > > (deftemplate Platform
> > >    (slot x1 (default 40))
> > >    (slot x2 (default 400))
> > >    (slot x3 (default 30))
> > >    (slot x4 (default 10))
> > > )                           
> > > 
> > > asserion statement is:
> > > 
> > > (assert  (Platform (x1 50)(x2 300) (x3 30)(x4 0)))
> > > 
> > > and the output is:
> > > 50
> > > 300
> > > 30
> > > 
> > > 40
> > > 300
> > > 30
> > > 
> > > 40
> > > 300
> > > 30
> > > 
> > > 40
> > > 300
> > > 30
> > > 
> > > 40
> > > 300
> > > 30
> > > 
> > > 40
> > > 400
> > > 30 .... goes on for so many combinations.
> > >                                                   
> >             
> > > 
> > > Thanks,
> > > srini
> > > 
> > > --- Ernest Friedman-Hill
> > <[EMAIL PROTECTED]> wrote:
> > > > The error is occurring while the right-hand-side
> > of
> > > > EvaluateH30ValueOnPlatform is executing. The
> > > > "assert" statement there
> > > > does not supply numeric values for all the slots
> > of
> > > > the Platform
> > > > fact. When that fact is asserted, it is
> > immediately
> > > > processed by the
> > > > rule LHSs, including, of course, the LHS of
> > > > EvaluateH30ValueOnPlatform. Since this LHS
> > assumes
> > > > there is a valid
> > > > number in each slot, an exception occurs.
> > > > 
> > > > Solution: in general, use (default) qualifiers
> > for
> > > > deftemplate slots,
> > > > to make sure that appropriate default values are
> > > > always included.
> > > > 
> > > > By the way, Jess 5.0a5 will report a somewhat
> > better
> > > > error message for
> > > > this situation, which will clearly show the
> > (assert)
> > > > statement that is 
> > > > executing. Here is that message, which arguably
> > > > explains the problem:
> > > > 
> > > > Jess reported an error in routine
> > Funcall.execute
> > > > while executing (<=
> > > > ?x ?val1) while executing (and (<= ?x ?val1) (>=
> > ?x
> > > > ?val2)) while
> > > > executing rule LHS (Node 2) while executing rule
> > LHS
> > > > (Node2) while
> > > > executing rule LHS (TECT) while executing
> > (assert
> > > > (Platform (x1 nil)
> > > > (x2 nil) (x3 nil) (x4 ?x))) while executing
> > defrule
> > > > EvaluateH30ValueOnPlatform while executing
> > (run).
> > > >   Message: Error during execution.
> > > >   Program text: ( run )  at line 25.
> > > > 
> > > > 
> > > > I think Cheruku srini wrote:
> > > > > 
> > > > > Hello everybody,
> > > > > 
> > > > > I have written a rule which checks a value
> > with
> > > > two values and if the
> > > > > value is in the range, that value is asserted
> > as
> > > > the fourth value. I do
> > > > > not know the default values for all these and
> > the
> > > > fourth value. 
> > > > > 
> > > > > 
> > > > > clp file is:
> > > > > 
> > > > > ;;;*************
> > > > > ;;;* TEMPLATES *
> > > > > ;;;*************
> > > > > ;;;
> > > > > 
> > > > > (deftemplate Platform
> > > > >    (slot x1 )
> > > > >    (slot x2 )
> > > > >    (slot x3 )
> > > > >    (slot x4)
> > > > > )
> > > > > 
> > > > > (defrule EvaluateH30ValueOnPlatform ""
> > > > >        (Platform (x2 ?val1))
> > > > >        (Platform (x3 ?val2))
> > > > >        (Platform (x1 ?x&: (and (<= ?x ?val1) 
> > > > >                              (>= ?x ?val2))))
> > > > >      =>
> > > > >       (printout t  ?x crlf)
> > > > >       (printout t  ?val1 crlf)
> > > > >       (printout t  ?val2 crlf)
> > > > >       (assert (Platform (x4 ?x)))
> > > > > )
> > > > > (defrule initial ""
> > > > >    =>
> > > > >    (assert  (Platform (x1 50)(x2 300) (x3
> > 30)(x4
> > > > 0)))
> > > > >    (assert  (Platform (x1 500)(x2  300)(x3
> > 30)(x4
> > > > 0)))
> > > > > )
> > > > > 
> > > > > (reset)
> > > > > (run)                                         
> >    
> > > >             
> > > > > 
> > > > > 
> > > > > and the exception is:
> > > > > 
> > > > > 
> > > > > Rete Exception in routine Value::intValue
> > while
> > 
> === message truncated ===
> 
> _____________________________________________________________
> Do You Yahoo!?
> Free instant messaging and more at http://messenger.yahoo.com
> ---------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> in the BODY of a message to [EMAIL PROTECTED], NOT to the
> list. List problems? Notify [EMAIL PROTECTED]
> ---------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list. List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------

Reply via email to