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 pieces
of good advice:

First, it seems to me that having the Demand objects themselves
definstanced, as well as the DemandPool objects, would make everything
vastly easier; if instead of writing the above long function, you
could 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 something
in one rule which sounds to me like a whole group of rules: first do
this, then do this, then do this. You need to take a step back and
look at the problem, trying to break it down into smaller pieces, and
write each piece as a separate rule.

This last one isn't advice so much as a guess at a good way to
approach 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 have
a loop which asserted a priority value and then ran the system to
process all the demands with that priority; then retracted the
priority fact and asserted a new one. The loop could itself take the
form of a low-salience rule: low-salience so that it would do the
retraction until all the processing had been done for that priority
level. Make sense? This, together with definstancing the demand
objects, could vastly simplify your whole approach to the problem.



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

Reply via email to