JESS: rete reset exception

2004-10-25 Thread bhaskar yallala
I am getting this exception while calling rete.reset() after executing the rules!



Jess reported an error in routine DefinstanceList.updateShadowFact. Message: Object not a definstance: ...

I over rode the hashCode method. Is this the problem?




Thanks
Bhaskar

Thanks and regards,Bhaskar
[EMAIL PROTECTED][EMAIL PROTECTED]
		Do you Yahoo!?vote.yahoo.com - Register online to vote today!

Re: JESS: few questions

2004-08-17 Thread bhaskar yallala
Thanks Ernest Friedman!
I removed m_name, it worked fine!
[EMAIL PROTECTED] wrote:
I think [EMAIL PROTECTED] wrote:  Is there a way to call one rule from another., instead of recreating non-similar conditions in another rule too? If you're worried about duplication on the right-hand-side of rules,you can write a deffunction, and call it on the right-hand-side ofboth rules. If you're worried about duplicate patterns: Jess noticesthis, and the duplication is removed while the Rete network is built;as long as the common patterns are the first patterns in the rule,duplicates will be shared between all rules automatically.Is it required for dynamic bean to have m_name as property and a constructor?No, of course they don't have to have a "name" property. Because Jessdoesn't construct your Beans itself, they don't even have to have adefault
 constructor.-Ernest Friedman-Hill Advanced Software Research Phone: (925) 294-2154Sandia National Labs FAX: (925) 294-2234PO Box 969, MS 9012 [EMAIL PROTECTED]Livermore, CA 94550 http://herzberg.ca.sandia.govTo 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]Thanks and regards,Bhaskar
[EMAIL PROTECTED][EMAIL PROTECTED]
		Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.

Re: JESS: writing priorities

2004-07-18 Thread bhaskar yallala
Thanks for the reply. 
Firstly, I tried the first advice, but with no success. I guess I didnt understand you properly. I have DemandPool object with demands[] as property with get and set. I am doing defInstance of demand pool in java program, which already has demands.
These lines
(demandPool (demands $? ?demand $?))(OBJECT ?demandPool)
(demand (cusPriority 1|2) )(OBJECT ?demand)
are in rule. 
But some how rules doesnt get fired although I have demands with cusPriority 1 and 2.

Secondly, I liked your suggestion. I am definitely going to implement it. But now, I am just kind of prototyping the problem and want to see whether I can do this simple way in JESS.
I guess you are suggesting to put the demands in loop for one priority and process. But the thing is I can have more than three properties which needs to be prioritized like customerPriority, customerRating, costFactor so on. I want to match demand with best of all these priorities. If I write loops for all three its going to be complicated. And there is no fixed costFactor, it can be any value 0. Basically I want to get demand with maximum of costFactor. This looks to me like more like procedural programming. I can write loops in java better.

Does rule engine solve these kind of problems in simpe way?

Thanks
Bhaskar


[EMAIL PROTECTED] wrote:
I think bhaskar yallala wrote: But I want to write a rule such that for the given demands only cusPriority highest should be matched first and cusFactor highest should be matched. If cusPriority highest is not matched , then it should go for next priority level. Similarly, for cusFactor.  I was thinking of writing with and , or but it can't prioritize. (or (eq (call ?demand getCustomerPriority) 1) (eq (call ?demand getCustomerPriority) 2)) ) This one just selects customer priority 1 or 2. I want to first go through all demands and see whether there is customerPriority 1 is present at all in the list. I can't write the rule for you exactly, but I can give you two piecesof good advice:First, it seems to me that having the Demand objects themselvesdefinstanced, as well as the DemandPool objects, would ma!
ke
 everythingvastly easier; if instead of writing the above long function, youcould simply match(DemandPool (demands $? ?demand $?))(Demand (customerPriority 1 | 2) (OBJECT ?demand))you can see how much simpler everything would be.Second, remember that rules are cheap. You're trying to do somethingin one rule which sounds to me like a whole group of rules: first dothis, then do this, then do this. You need to take a step back andlook at the problem, trying to break it down into smaller pieces, andwrite each piece as a separate rule.This last one isn't advice so much as a guess at a good way toapproach your problem. Imagine if you had a fact like(priority 1)And a rule which matched the priority fact with a pattern like(priority ?x)and did something with demands with that priority. Then you could havea loop which asserted a priority value and then ran the system toprocess all !
the
 demands with that priority; then retracted thepriority fact and asserted a new one. The loop could itself take theform of a low-salience rule: low-salience so that it would do theretraction until all the processing had been done for that prioritylevel. Make sense? This, together with definstancing the demandobjects, could vastly simplify your whole approach to the problem.-Ernest Friedman-Hill Science and Engineering PSEs Phone: (925) 294-2154Sandia National Labs FAX: (925) 294-2234PO Box 969, MS 9012 [EMAIL PROTECTED]Livermore, CA 94550 http://herzberg.ca.sandia.govTo 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]Thanks and regards,Bhaskar
[EMAIL PROTECTED][EMAIL PROTECTED]
		Do you Yahoo!?
Vote for the stars of Yahoo!'s next ad campaign!

JESS: writing priorities

2004-07-16 Thread bhaskar yallala
Hi All,

I have demand pool bean which has demands as an array.
Demand has customerPriority, cusFactor, wantedDate, quantity etc.

I have been able to write to match supply with a demand in the demand pool.

But I want to write a rule such that for the given demands only cusPriority highest should be matched first and cusFactor highest should be matched. If cusPriority highest is not matched , then it should go for next priority level. Similarly, for cusFactor.

I was thinking of writing with and , or but it can't prioritize.
(or(eq (call ?demand getCustomerPriority) 1) (eq (call ?demand getCustomerPriority) 2)) )
This one just selects customer priority1 or 2. I want to first go through all demands and see whether there is customerPriority 1 is present at all in the list.

Does any body has done similar stuff?

Any ideas?


Thanks
Bhaskar

		Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.

Re: JESS: writing priorities

2004-07-16 Thread bhaskar yallala
Why this doesnt fire?
I am passing demandPool with three demand objects and customerPriority set 1 for each of them?

(demandPool (OBJECT ?demandPool))
(demandPool (demands $?demands:(member$ (eq customerPriority 1) $?demands ) ) )
I am calling rete.run(); 

Thanks
Bhaskar
bhaskar yallala [EMAIL PROTECTED] wrote:

Hi All,

I have demand pool bean which has demands as an array.
Demand has customerPriority, cusFactor, wantedDate, quantity etc.

I have been able to write to match supply with a demand in the demand pool.

But I want to write a rule such that for the given demands only cusPriority highest should be matched first and cusFactor highest should be matched. If cusPriority highest is not matched , then it should go for next priority level. Similarly, for cusFactor.

I was thinking of writing with and , or but it can't prioritize.
(or(eq (call ?demand getCustomerPriority) 1) (eq (call ?demand getCustomerPriority) 2)) )
This one just selects customer priority1 or 2. I want to first go through all demands and see whether there is customerPriority 1 is present at all in the list.

Does any body has done similar stuff?

Any ideas?


Thanks
Bhaskar



Do you Yahoo!?Yahoo! Mail Address AutoComplete - You start. We finish.Thanks and regards,Bhaskar
[EMAIL PROTECTED][EMAIL PROTECTED]
		Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!

Re: JESS: writing priorities

2004-07-16 Thread bhaskar yallala
Thanks Ernest Friedman for the reply.

I haveone main problem here in the first mail. Can you please respond to it? Because thats kind of important design decision we have to make!


In the second mail I sent I was trying to check whether any demand has customerPriority value 1.

Thanks
Bhaskar[EMAIL PROTECTED] wrote:
I think bhaskar yallala wrote: Why this doesnt fire? I am passing demandPool with three demand objects and customerPriority set 1 for each of them?  (demandPool (OBJECT ?demandPool)) (demandPool (demands $?demands:(member$ (eq customerPriority 1) $?demands ) ) )I don't really know what you're trying to do, of course -- you're notreally giving us much information to go on -- but in this function call(member$ (eq customerPriority 1) $?demands )you're asking if the result of calling (eq customerPriority 1) is amember the list in $?demands; (eq customerPriority 1) evaluates toFALSE, of course (the symbol customerPriority and the number 1 are notthe same!) so the member$ is TRUE if and only if "FALSE" appears in$?demands; and I suspect that's not what you intend.
  I am calling rete.run();   Thanks Bhaskar  bhaskar yallala <[EMAIL PROTECTED]>wrote: Hi All,  I have demand pool bean which has demands as an array. Demand has customerPriority, cusFactor, wantedDate, quantity etc.  I have been able to write to match supply with a demand in the demand pool.  But I want to write a rule such that for the given demands only cusPriority highest should be matched first and cusFactor highest should be matched. If cusPriority highest is not matched , then it should go for next priority level. Similarly, for cusFactor.  I was thinking of writing with and , or but it can't prioritize. (or (eq (call ?demand getCustomerPriority) 1) (eq (call ?demand getCustomerPriority) 2)) ) This one just selects customer priority 1 or 2. I want to first go through all demands and see whether there is customerPriority 1 is!
 present
 at all in the list.  Does any body has done similar stuff?  Any ideas?   Thanks Bhaskar- Do you Yahoo!? Yahoo! Mail Address AutoComplete - You start. We finish.   Thanks and regards, Bhaskar  [EMAIL PROTECTED] [EMAIL PROTECTED]   - Do you Yahoo!? New and Improved Yahoo! Mail - 100MB free storage!-Ernest Friedman-Hill Science and Engineering PSEs Phone: (925) 294-2154Sandia National Labs FAX: (925) 294-2234PO Box 969, MS 9012 [EMAIL PROTECTED]Livermore, CA 94550 http://herzberg.ca.sandia.govTo unsubscribe, send the words 'uns!
ubscribe
 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]
		Do you Yahoo!?
Vote for the stars of Yahoo!'s next ad campaign!

Re: JESS: multi slot example

2004-07-12 Thread bhaskar yallala
Thanks Ernest Friedman again for the reply!
If you use a pattern like (demandPool (demands $?first ?demand:(eq (get-member ?demand type) "x") $?rest))then the particular demand that had type "x" is already bound to thevariable ?demand and is available on the rule's RHS.

In above rule, if I want to get all the matching demands as list on RHS,how can I get them?
Right now, I only get first demand that's matched.

Thanks
Bhaskar
[EMAIL PROTECTED] wrote:
I think bhaskar yallala wrote:  Secondly, In (demandPool (demands $?first ?demand:(eq (get-member ?demand) "x") $?rest)) what does it mean by $?first and $?rest? Does it mean it will iterate starting from first to the end?$?first and $?rest are just multifields (i.e., variables that match 0or more items in a list.) Something like(shopping-cart $?a milk $?b)matches whenever the shopping-care contains milk; $?a optionallymatches any items in the cart before the milk, and $?b matches any atthe end. I like to use $?first and $?rest but you can use any namesyou like.  Thirdy, in  (demandPool (types ?t1 ?t2 $?more)) what does it mean by patterns types ?t1 ?t2 does it mean it will match those patterns of types 1 2 or 2 1 or 1 3 etc? What does it mean by $?more!
? Does it
 mean 1 2 3 etc patterns??t1, ?t2, and $?more are, again, just variables. A multifield matcheszero or more items, and a plain variable matches exactly two, so thispattern matches when there are two or more items in the list. Is there any documentation about $?more , $?first $?rest, $?length etc any where? This kind of matching is covered (briefly) on pages 103-104 of "Jessin Action."   Fourthly,if I want to bind the matching demand/s how can I do that? Is it like  (demandPool (demands $?first (bind ?matchedDemand (?demand:(eq (get-member ?demand) "x") )$?rest)) If you use a pattern like (demandPool (demands $?first ?demand:(eq (get-member ?demand type) "x") $?rest))then the particular demand that had type "x" is already bound to thevariable ?demand and is available on the rule's RHS. Thanks Bhaskar 
 [EMAIL PROTECTED] wrote: I think bhaskar yallala wrote:class DeandPool{int[] types;Demand[] demands;}   First of all, defclasses turn JavaBean properties -- not member variables -- into template slots. You'll need "int[] getTypes()" and "Demand[] getDemands()" (and perhaps the equivalent setter methods, too) before these will show up as slots.(defrule checkPool(demandPool (types $?types)(demands $?demands)(OBJECT ?demandPool))  I want to write rule where on LHS, fire rule only if type is  2..  "?type" (or ?types, you've written both) is a list, and so can't be compared to a number. If you want to compare the length of this list then you could write  (demandPoo!
l (types
 $?types:( (length$ ?types) 2)))  Although the best way to do it is to write a pattern that matches only when there are two or more types, like  (demandPool (types ?t1 ?t2 $?more)) And also I want to write a rule where demand.type="x", then only fire.  When this is true for at least one Demand object in the demands slot? You could write something like  (demandPool (demands $?first ?demand:(eq (get-member ?demand) "x") $?rest))   - Ernest Friedman-Hill  Science and Engineering PSEs 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] - Do you Yahoo!? New and Improved Yahoo! Mail - Send 10MB messages!-Ernest Friedman-Hill Science and Engineering PSEs Phone: (925) 294-2154Sandia National Labs FAX: (925) 294-2234PO Box 969, MS 9012 [EMAIL PROTECTED]Livermore, CA 94550 http://herzberg.ca.sandia.govTo 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 add!
ress!)
 List problems? Notify [EMAIL PROTECTED]Thanks and regards,Bhaskar
[EMAIL PROTECTED][EMAIL PROTECTED]
		Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.

JESS: breaking complex rules

2004-07-12 Thread bhaskar yallala


Hi folks,
Is there a way to break a complex rule in to simpel rules JESS?
How can I make it to fire a rule LHS of defrule? Is it by assert? I was trying this but it says bad slot value!

Any ideas?
Thanks
BhaskarThanks and regards,Bhaskar
[EMAIL PROTECTED][EMAIL PROTECTED]
		Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!

Re: JESS: multi slot example

2004-07-11 Thread bhaskar yallala
Thanks for the reply.
Firstly, I have the getter and setter for bean properties.

Secondly, In (demandPool (demands $?first ?demand:(eq (get-member ?demand) "x") $?rest))
what does it mean by $?first and $?rest? Does it mean it will iterate starting from first to the end?

Thirdy, in 
(demandPool (types ?t1 ?t2 $?more))
what does it mean by patterns types ?t1 ?t2 does it mean it will match those patterns of types 1 2 or 2 1 or 1 3 etc? What does it mean by $?more? Does it mean 1 2 3 etc patterns?
Is there any documentation about $?more , $?first $?rest, $?lengthetc any where? 

Fourthly,if I want to bind the matching demand/s how can I do that?
Is it like
(demandPool (demands $?first (bind ?matchedDemand (?demand:(eq (get-member ?demand) "x") )$?rest))

Thanks
Bhaskar
[EMAIL PROTECTED] wrote:
I think bhaskar yallala wrote:  class DeandPool{  int[] types;  Demand[] demands;  }First of all, defclasses turn JavaBean properties -- not membervariables -- into template slots. You'll need "int[] getTypes()" and"Demand[] getDemands()" (and perhaps the equivalent setter methods,too) before these will show up as slots.  (defrule checkPool  (demandPool (types $?types)(demands $?demands)(OBJECT ?demandPool))   I want to write rule where on LHS, fire rule only if type is  2.."?type" (or ?types, you've written both) is a list, and so can't becompared to a number. If you want to compare the length of this listthen you could write(demandPool (types $?types:( (length$ ?types) 2)))Although the be!
st way to
 do it is to write a pattern that matches onlywhen there are two or more types, like(demandPool (types ?t1 ?t2 $?more))  And also I want to write a rule where demand.type="x", then only fire.When this is true for at least one Demand object in the demands slot?You could write something like(demandPool (demands $?first ?demand:(eq (get-member ?demand) "x") $?rest))-Ernest Friedman-Hill Science and Engineering PSEs Phone: (925) 294-2154Sandia National Labs FAX: (925) 294-2234PO Box 969, MS 9012 [EMAIL PROTECTED]Livermore, CA 94550 http://herzberg.ca.sandia.govTo 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]
		Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!

JESS: multi slot example

2004-07-10 Thread bhaskar yallala
Hello All
Does any body have complete example of multislot example?
I have JIA.I am just learning things.I didnt find any complete example anywhere.
Ihave 
class DeandPool{
int[] types;
Demand[] demands;
}
class Demand{
String type;
}
Ihave rule file like this:
(watch all)
(defclass demandPool DemandPool)

(defrule checkPool
(demandPool (types $?types)(demands $?demands)(OBJECT ?demandPool))
;(test ( $?type 2) )
;test for demand type equals X
=
(printout t "Got Pool!" ?types (call ?demandPool getTypes)crlf)
(printout t "first type is!" (nth$ 2 ?types) crlf)
==
I want to write rule where on LHS, fire rule only if type is  2..
It doesnt work.
And also I want to write a rule where demand.type="x", then only fire.
Can any body please fill in the blanks? or tell me how does Jess accesses multislots ?

Thanks
Bhaskar

		Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!