JESS: Jess in strategy action

View: New views
2 Messages — Rating Filter:   Alert me  

JESS: Jess in strategy action

by bohlken :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

I have 2 questions about setting a new strategy to the Jess engine.

1) Lets say at a status where the activations have been done, I set a new
strategy to the engine. When I run the engine, are all the activations
then re-ordered according to the new strategy BEFORE any rule is firing?
(It seems to me that this is the case).

2) In my application it is necessary (because of parallel computing) that
I have to change the strategy after the FIRST rule has fired.
What I now think about is to implement a function in my event handler
that changes the strategy when the rule fires (with a seperate variable I
check if this is the first firing):

        public void eventHappened(JessEvent je)
        {
        int type = je.getType();
        switch (type)
        {
            case JessEvent.RESET:
                 break;

            case JessEvent.DEFRULE_FIRED:
                   control.changeStrategy(id);  
            break;
                ...
          }
        }

Is it save to do this? In other words: are all the remaining activations
re-ordered according to the new strategy before the next rule will fire?

Thanks and greetings from Hamburg
Wilfried






--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users you@...'
in the BODY of a message to majordomo@..., NOT to the list
(use your own address!) List problems? Notify owner-jess-users@....
--------------------------------------------------------------------


Re: JESS: Jess in strategy action

by Ernest Friedman-Hill :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On May 14, 2009, at 3:39 AM, bohlken wrote:

> Hi all,
>
> I have 2 questions about setting a new strategy to the Jess engine.
>

The answer to both questions are the same: when set-strategy returns,  
the agenda will be in the ordering appropriate for the new strategy,  
whenever the function is called.


---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences          Phone: (925) 294-2154
Sandia National Labs
PO Box 969, MS 9012                            ejfried@...
Livermore, CA 94550                             http://www.jessrules.com





--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users you@...'
in the BODY of a message to majordomo@..., NOT to the list
(use your own address!) List problems? Notify owner-jess-users@....
--------------------------------------------------------------------