Hello,
I have a problem using Jess.
I written a simple application in Java that create a Rete object, then
"(batch)" a text file containing rules and facts; then the app do a
"(reset)".
The application do a loop: display all "facts" and the "agenda" content,
then it do "(run 1)", the rule fired is also displayed, then the cycle
restart.
I can report a short (!) log below:

DEBUG: before (run 1)
f-0 (initial-fact)
f-1 (tinyrobot (x 1) (y 1) (initx nil) (inity nil) (name "faBio"))
f-2 (goal (x 11) (y 3))
f-3 (labyrinth (columns 11) (rows 11))
f-4 (start)
f-5 (robot_wnd_vision (distance 1))
f-6 (occupied (x 1) (y 10))
.............
f-52 (occupied (x 11) (y 8))
AGENDA:
[Activation: start_rule  f-4, f-3, f-2, f-1 ; time=14 ; salience=0]
>>>>> start_rule

DEBUG: after (run 1)
f-0 (initial-fact)
f-1 (tinyrobot (x 1) (y 1) (initx 1) (inity 1) (name "faBio"))
f-2 (goal (x 11) (y 3))
f-3 (labyrinth (columns 11) (rows 11))
f-5 (robot_wnd_vision (distance 1))
f-6 (occupied (x 1) (y 10))
........................
f-52 (occupied (x 11) (y 8))
f-53 (passed (x 1) (y 1))
f-54 (moves_counter (c 0))
f-55 (init_colorizing)
AGENDA:
[Activation: init_colorize  f-1, f-55 ; time=116 ; salience=0]
[Activation: init_colorize  f-1, f-55 ; time=59 ; salience=0]
>>>>> init_colorize

DEBUG: after (run 1)
f-0 (initial-fact)
f-1 (tinyrobot (x 1) (y 1) (initx 1) (inity 1) (name "faBio"))
f-2 (goal (x 11) (y 3))
f-3 (labyrinth (columns 11) (rows 11))
f-5 (robot_wnd_vision (distance 1))
f-6 (occupied (x 1) (y 10))
......................
f-52 (occupied (x 11) (y 8))
f-53 (passed (x 1) (y 1))
f-54 (moves_counter (c 0))
f-56 (color_depth (depth 0))
f-57 (start_colorizing_by (x 1) (y 1))
f-58 (colorizing_pos (x 1) (y 1))
f-59 (colorizing)
AGENDA:
[Activation: color_S  f-3, f-59, f-58, f-57,, f-56, f-5,,, ; time=513 ;
salience=0]
[Activation: color_E  f-3, f-59, f-58, f-57,, f-5,, f-56,, ; time=513 ;
salience=0]
[Activation: init_colorize  f-1, f-55 ; time=59 ; salience=0]
[Activation: end_colorizing_stop_colorizing  f-59, f-56, f-5,, ; time=258 ;
salience=-1]
[Activation: end_colorizing_unmobile  f-59, f-56, f-5,, ; time=258 ;
salience=-1]
>>>>> color_S

DEBUG: after (run 1)
f-0 (initial-fact)
f-1 (tinyrobot (x 1) (y 1) (initx 1) (inity 1) (name "faBio"))
f-2 (goal (x 11) (y 3))
f-3 (labyrinth (columns 11) (rows 11))
f-5 (robot_wnd_vision (distance 1))
f-6 (occupied (x 1) (y 10))
.......................
f-52 (occupied (x 11) (y 8))
f-53 (passed (x 1) (y 1))
f-54 (moves_counter (c 0) (is_jess_the_crappiest_ever_thing "yes"))
f-56 (color_depth (depth 0))
f-57 (start_colorizing_by (x 1) (y 1))
f-58 (colorizing_pos (x 1) (y 1))
f-59 (colorizing)
f-60 (colorized_cell (x 1) (y 2) (depth 1) (flagged 0) (fromx 1) (fromy 1)
(direction south) (north 0) (south 0) (east 0) (west 0))
AGENDA:
[Activation: color_E  f-3, f-59, f-58, f-57,, f-5,, f-56,, ; time=513 ;
salience=0]
[Activation: init_colorize  f-1, f-55 ; time=59 ; salience=0]
[Activation: end_colorizing_unmobile  f-59, f-56, f-5,, ; time=258 ;
salience=-1]
[Activation: end_colorizing_stop_colorizing  f-59, f-56, f-5,, ; time=258 ;
salience=-1]
[Activation: end_colorizing_next_level  f-59, f-56, f-5,, f-60 ; time=259 ;
salience=-2]
>>>>> color_E

As you can see above, the problem is that the rule "init_colorize" is
activated two times with the same facts:

[Activation: init_colorize  f-1, f-55 ; time=116 ; salience=0]
[Activation: init_colorize  f-1, f-55 ; time=59 ; salience=0]

Anyway, the facts are the same, but the time is different...
I must notice that this strange behaviour is only due to my application,
since the jess.Main or jess.Console runs correctly, in fact the
init_colorize is activated only once in the agenda.

My Java code is simply:


       public void actionPerformed(ActionEvent p_aE)
        {
            try
            {
                Fact l_fact;
                Rete l_rete=m_rete;


                    l_rete.executeCommand("(run 1)");

                    System.out.println("DEBUG: after (run 1)");
                    l_enum=l_rete.listFacts();

                    while(l_enum.hasNext())
                    {
                        l_fact=(Fact)(l_enum.next());
                        System.out.println("f-"+l_fact.getFactId()+"
"+l_fact.toString());
                    }//while
                }//while
            }//try
            catch(Exception e)
            {
                System.out.println(e);
            }//catch
        }
    }//class



Many thanks if u can help me.

Luca



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