I think Ned Wolpert wrote:
>
> I notice one small bug, and have a separate question on how
> to use Jess with real-time systems....
>
> The (possible) bug can be seen if the zebra.clp is run in the
> jess/examples/fastword directory. It seems that the startup
> defrule is execute tons of time. (It keeps printing out the
> info on where the people live, etc) Is this the proper
> behavior?
Well, this is just a demo of an undocumented feature, so you can't
really report bugs against it :) But it should print out the problem
and solution 24 times:
----------------------------------------------------------------------
There are five houses, each of a different color, inhabited by men of
different nationalities, with different pets, drinks, and cigarettes.
The Englishman lives in the red house. The Spaniard owns the dog.
The ivory house is immediately to the left of the green house, where
the coffee drinker lives. The milk drinker lives in the middle house.
The man who smokes Old Golds also keeps snails. The Ukrainian drinks
tea. The Norwegian resides in the first house on the left. The
Chesterfields smoker lives next door to the fox owner. The Lucky
Strike smoker drinks orange juice. The Japanese smokes Parliaments.
The horse owner lives next to the Kools smoker, whose house is yellow.
The Norwegian lives next to the blue house.
Now, who drinks water? And who owns the zebra?
HOUSE | Nationality Color Pet Drink Smokes
--------------------------------------------------------------------
1 |norwegian yellow fox water kools
2 |ukrainian blue horse tea chesterfields
3 |englishman red snails milk old-golds
4 |spaniard ivory dog orange-juice lucky-strikes
5 |japanese green zebra coffee parliaments
----------------------------------------------------------------------
Takes 4 seconds on my 266MHz PII (MS jview 4.79.2613) as opposed to 6
seconds for the stock zebra.clp in Jess41b6/examples, or as opposed to
several minutes (!) under Jess 3.2.
>
> Also, my main question is really about using Jess in real-time
> systems. What I would like to do is set the rules, and add
> Java beans into the rule engine. Once I set the rule engine
> running (with '(run)') The objects may change due to rules in the
> rule engine, and may change due to influences outside of the rule
> engine. (Which in turn, will fire propertyChangeEvents, etc)
>
> The question is will I need to re-run the rule engine, or will it
> be 'in constant' motion? If not, how should I implement such a
> situation? (Multiple threads outside of the rule engine are
> affecting the objects in the rule engine) Note that I haven't
> tried it yet with Jess... but wanted to see if it was possible.
As long as we're being generous about the definition of real-time (I
know people speak of using CLIPS in real-time systems too...) have a
look at the pumps example - it contains a 'heartbeat' rule which keeps
the engine running forever:
(deffacts idle-fact (idle))
(defrule sleep-if-bored
(declare (salience -100))
?idle <- (idle)
=>
(retract ?idle)
(call java.lang.Thread sleep 100)
(assert (idle)))
This is the classic solution for this situation.
>
> Thanks.
>
> Ned Wolpert | "It is not man who pursues truth,
> [EMAIL PROTECTED] | but truth man." -Shestov
> [EMAIL PROTECTED] |
---------------------------------------------------------
Ernest Friedman-Hill
Distributed Systems Research Phone: (510) 294-2154
Sandia National Labs FAX: (510) 294-2234
Org. 8920, MS 9214 [EMAIL PROTECTED]
PO Box 969 http://herzberg.ca.sandia.gov
Livermore, CA 94550
---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list. List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------