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
> > executing rule LHS:
> > > [Node2 ntest
> > > s=1 [Test1: test=EQ;sub_idx=-1;slot_value=(and (<=
> > ?2,2,-1 ?0,3,-1) (>=
> > > ?2,2,-1
> > > ?1,4,-1))] ;usecount = 1;unique = false] while
> > executing defrule
> > > initial.
> > >   Message: Not a number: nil type = 1 at line 43: 
> > ( run ) .
> > >         at jess.Value.typeError(Value.java:299)
> > >         at jess.Value.numericValue(Value.java:181)
> > >         at jess.LtOrEq.call(Funcall.java:1337)
> > >         at
> > jess.Funcall.simpleExecute(Funcall.java:341)
> > >         at jess.Funcall.execute(Funcall.java:301)
> > >         at jess.Funcall.execute(Funcall.java:201)
> > >         at jess.And.call(Funcall.java:1106)
> > >         at
> > jess.Funcall.simpleExecute(Funcall.java:341)
> > >         at jess.Funcall.execute(Funcall.java:301)
> > >         at jess.Funcall.execute(Funcall.java:205)
> > >         at jess.Test1.doTest(Test1.java:106)
> > >         at jess.Node2.runTests(Node2.java:366)
> > >         at
> > jess.Node2.runTestsVaryLeft(Node2.java:331)
> > >         at
> > jess.Node2.runTestsVaryLeft(Node2.java:321) 
> > > 
> > > 
> > > This has got something to do with the data types.
> > But I have given all
> > > the values in my assert statement.
> > > 
> > > Can somebody help me out in solving this problem.
> > > 
> > > Thanks,
> > > 
> > > srinu              
> > > 
> > > ===
> > > 
> > >
> > _____________________________________________________________
> > > 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]
> > >
> > ---------------------------------------------------------------------
> > > 
> > > 
> > 
> > 
> > ---------------------------------------------------------
> > Ernest Friedman-Hill  
> > Distributed Systems Research        Phone: (925)
> > 294-2154
> > Sandia National Labs                FAX:   (925)
> > 294-2234
> > Org. 8920, MS 9214                 
> > [EMAIL PROTECTED]
> > PO Box 969                 
> > http://herzberg.ca.sandia.gov
> > Livermore, CA 94550
> > 
> > ---------------------------------------------------------------------
> > 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]
> > ---------------------------------------------------------------------
> > 
> > 
> 
> _____________________________________________________________
> 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]
> ---------------------------------------------------------------------
> 
> 


---------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems Research        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
Org. 8920, MS 9214                  [EMAIL PROTECTED]
PO Box 969                  http://herzberg.ca.sandia.gov
Livermore, CA 94550

---------------------------------------------------------------------
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