Hi All

Thanks for the prompt reply.

I knew that I was changing the value before I am printing it out. But even
before entering into the rule, the condition is false. This is for sure as I
know the state of the bean and I am checking it with false condition to
check whether it's working fine.

Coming to second suggestion, the reason for using ( &: ) instead of test CE
is, the variables in the bean are all taken as external address values in
jess. When I am checking the condition using &: it's reporting an error
saying numeric value is required in the corresponding condition.

Any suggestions???

Thanks & Regards 


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of [EMAIL PROTECTED]
Sent: Wednesday, August 11, 2004 7:52 PM
To: [EMAIL PROTECTED]
Subject: Re: JESS: question

I think Subrahmanyam wrote:
>  
> (defrule assign1 
> ?dfact <-   (demand (OBJECT ?demand))
> ?sfact <-   (supply (OBJECT ?supply))
> (test (< (call ?demand getFilledQuantity) (min (call ?demand
> getMinimumTarget) (call ?demand getOrderedQuantity))))
>       =>
>       (call ?demand setFilledQuantity (+ (call ?demand getFilledQuantity)
> 1)) 
> (printout t "test ce : " (< (call ?demand getFilledQuantity) (min (call
> ?demand getMinimumTarget) (call ?demand getOrderedQuantity))) crlf)
>  
>       (retract ?sfact) 
> )
>  


Well, one possibility is that, because the first statement on the
right-hand-side of this rule increments the filledQuantity property,
what the following printout displays is not the same as what the
values were when the rule was actually activated!

While I've got you here, let me point out 1) that using "test" is
always less efficient than writing your conditions as part of a
pattern, 2) "call" is optional, and I generally recommend it be
omitted when possible, and 3) binding variables by matching is cheaper
than using "call" like this. A better (and far clearer) way to write
the LHS of the rule would be:


 (defrule assign1 
   (demand
       (filledQuantity ?f)
       (minimumTarget ?t)
       (orderedQuantity ?o&:(< ?f (min ?t ?o))))   
   ?sfact <- (supply (OBJECT ?supply))
  =>
  ...


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

--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) 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
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to