Re: JESS: Jess Manners Benchmark with Java Implementation

2004-09-03 Thread James Owen jco




Attached... I ran these quite some time ago for most rulebased Java
engines.

Kochhar, Gaurav wrote:

  Hi,
I am trying to create a Benchmark for finalizing a Rule Engine in
our Company. We need rule engine for a J2EE based application. I already
ran the pumps application in Jess examples. As a standard Benchmark with
couple of other rule engines we chose Miss Manners.

Could you point me to a JAVA implementation of Miss Manners in Jess?

I did find a Miss Manners implementation using C but I need it for Java.

Thanks
Gaurav








-Original Message-
From: friedman_hill ernest j [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, September 02, 2004 3:46 PM
To: Kochhar, Gaurav
Subject: Re: Welcome to jess-users


To post to the list, send mail to [EMAIL PROTECTED].


I think Kochhar, Gaurav wrote:
  
  
I just subscribed to the jess-mailing list.

How do I post a question on this mailing list??





-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, September 02, 2004 2:54 PM
To: Kochhar, Gaurav
Subject: Welcome to jess-users

--

Welcome to the jess-users mailing list!

Please save this message for future reference.  Thank you.

If you ever want to remove yourself from this mailing list,
you can send mail to [EMAIL PROTECTED] with the following
command in the body of your email message:

unsubscribe jess-users

or from another account, besides [EMAIL PROTECTED]:

unsubscribe jess-users [EMAIL PROTECTED]

If you ever need to get in contact with the owner of the list,
(if you have trouble unsubscribing, or have questions about the
list itself) send email to [EMAIL PROTECTED] .
This is the general rule for most mailing lists when you need
to contact a human.

 Here's the general information for the list you've subscribed to,
 in case you don't already have it:

[Last updated on: Fri Nov  9  9:00:29 2001]
The jess-users list is for discussion of Jess, the rule engine for the
Java platform, from Sandia National Laboratories.




  
  


-
Ernest Friedman-Hill  
Advanced Software Research  Phone: (925) 294-2154
Sandia National LabsFAX:   (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].


  


-- 

SDG 
jco

"Do No Evil.  
Do Only Good Things.
See the good in every one.
Always keep learning.
Teach those who want to be taught.
Avoid fools at all costs.
Harm No One,
Except to Defend Yourself,
Or to Defend Another.
Kill No One,
Except to Keep From Being Killed,
Or to Keep Another From Being Killed."

CafeBabe
1210151411101114



CLASSPATH=/home/ejfried/Jess61p5 java -server -XX:NewSize=16m -Xms32m -Xmx32m 
jess.Main manners.clp

( guest (name 1 )  (sex m )  (hobby 2) )
( guest (name 1 )  (sex m )  (hobby 1) )
( guest (name 1 )  (sex m )  (hobby 4) )
( guest (name 1 )  (sex m )  (hobby 5) )
( guest (name 2 )  (sex f )  (hobby 3) )
( guest (name 2 )  (sex f )  (hobby 2) )
( guest (name 2 )  (sex f )  (hobby 1) )
( guest (name 2 )  (sex f )  (hobby 4) )
( guest (name 2 )  (sex f )  (hobby 5) )
( guest (name 3 )  (sex f )  (hobby 5) )
( guest (name 3 )  (sex f )  (hobby 4) )
( guest (name 3 )  (sex f )  (hobby 2) )
( guest (name 4 )  (sex m )  (hobby 3) )
( guest (name 4 )  (sex m )  (hobby 2) )
( guest (name 4 )  (sex m )  (hobby 1) )
( guest (name 4 )  (sex m )  (hobby 4) )
( guest (name 5 )  (sex m )  (hobby 2) )
( guest (name 5 )  (sex m )  (hobby 5) )
( guest (name 5 )  (sex m )  (hobby 3) )
( guest (name 6 )  (sex f )  (hobby 1) )
( guest (name 6 )  (sex f )  (hobby 4) )
( guest (name 6 )  (sex f )  (hobby 2) )
( guest (name 6 )  (sex f )  (hobby 5) )
( guest (name 6 )  (sex f )  (hobby 3) )
( guest (name 7 )  (sex f )  (hobby 1) )
( guest (name 7 )  (sex f )  (hobby 2) )
( guest (name 7 )  (sex f )  (hobby 3) )
( guest (name 7 )  (sex f )  (hobby 5) )
( guest (name 8 )  (sex m )  (hobby 3) )
( guest (name 8 )  (sex m )  (hobby 5) )
( guest (name 9 )  (sex m )  (hobby 3) )
( guest (name 9 )  (sex m )  (hobby 5) )
( guest (name 9 )  (sex m )  (hobby 2) )
( guest (name 9 )  (sex m )  (hobby 4) )
( guest (name 10 )  (sex m )  (hobby 2) )
( guest (name 10 )  (sex m )  (hobby 3) )
( guest (name 10 )  (sex m )  (hobby 4) )
( guest (name 10 )  (sex m )  (hobby 5) )
( guest (name 10 )  (sex m )  (hobby 1) )
( guest (name 11 )  (sex m )  (hobby 2) )
( guest (name 11 )  (sex m )  (hobby 4) )
( guest (name 11 )  (sex m )  (hobby 5) )
( guest (name 11 )  (sex m )  (hobby 1) )
( guest (name 12 )  (sex f )  

JESS: Jess Manners Benchmark with Java Implementation

2004-09-02 Thread Kochhar, Gaurav
Hi,
I am trying to create a Benchmark for finalizing a Rule Engine in
our Company. We need rule engine for a J2EE based application. I already
ran the pumps application in Jess examples. As a standard Benchmark with
couple of other rule engines we chose Miss Manners.

Could you point me to a JAVA implementation of Miss Manners in Jess?

I did find a Miss Manners implementation using C but I need it for Java.

Thanks
Gaurav








-Original Message-
From: friedman_hill ernest j [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 02, 2004 3:46 PM
To: Kochhar, Gaurav
Subject: Re: Welcome to jess-users


To post to the list, send mail to [EMAIL PROTECTED]


I think Kochhar, Gaurav wrote:
 
 I just subscribed to the jess-mailing list.
 
 How do I post a question on this mailing list??
 
 
 
 
 
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, September 02, 2004 2:54 PM
 To: Kochhar, Gaurav
 Subject: Welcome to jess-users
 
 --
 
 Welcome to the jess-users mailing list!
 
 Please save this message for future reference.  Thank you.
 
 If you ever want to remove yourself from this mailing list,
 you can send mail to [EMAIL PROTECTED] with the following
 command in the body of your email message:
 
 unsubscribe jess-users
 
 or from another account, besides [EMAIL PROTECTED]:
 
 unsubscribe jess-users [EMAIL PROTECTED]
 
 If you ever need to get in contact with the owner of the list,
 (if you have trouble unsubscribing, or have questions about the
 list itself) send email to [EMAIL PROTECTED] .
 This is the general rule for most mailing lists when you need
 to contact a human.
 
  Here's the general information for the list you've subscribed to,
  in case you don't already have it:
 
 [Last updated on: Fri Nov  9  9:00:29 2001]
 The jess-users list is for discussion of Jess, the rule engine for the
 Java platform, from Sandia National Laboratories.
 
 
 



-
Ernest Friedman-Hill  
Advanced Software Research  Phone: (925) 294-2154
Sandia National LabsFAX:   (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]




Re: JESS: Jess Manners Benchmark with Java Implementation

2004-09-02 Thread ejfried
   I think Kochhar, Gaurav wrote:
 Hi,
 I am trying to create a Benchmark for finalizing a Rule Engine in
 our Company. We need rule engine for a J2EE based application. I already
 ran the pumps application in Jess examples. As a standard Benchmark with
 couple of other rule engines we chose Miss Manners.
 
 Could you point me to a JAVA implementation of Miss Manners in Jess?
 
 I did find a Miss Manners implementation using C but I need it for Java.

The manners benchmark itself is never implemented in C nor in Java,
but in the rule language of a particular rule engine. I've attached
the files manners.clp and mann128.dat, which together comprise the
benchmark for Jess with problem size 128.

What *is* commonly implemented in C is a little program called
manner_data, which generates different versions of the data file
mannXXX.dat  for different problem sizes. It has to be customized for
each rule engine, as the data file contains facts in the rule engine's
own format.

I don't have a Java implementation, but it's a trivial little
program, and it would be fairly easy to whip one up. If anybody wants
to do it, I'll find it a home on the web.

-
Ernest Friedman-Hill  
Advanced Software Research  Phone: (925) 294-2154
Sandia National LabsFAX:   (925) 294-2234
PO Box 969, MS 9012 [EMAIL PROTECTED]
Livermore, CA 94550 http://herzberg.ca.sandia.gov
;; Deftemplates

(deftemplate guest (slot name) (slot sex) (slot hobby))

(deftemplate last_seat (slot seat))

(deftemplate seating
  (slot id) (slot pid) (slot seat1) (slot name1) (slot name2) (slot seat2) (slot 
path_done))

(deftemplate path (slot id) (slot name) (slot seat))

(deftemplate chosen (slot id) (slot name) (slot hobby))

(deftemplate count (slot c))

(deftemplate context (slot state))

(defrule assign_first_seat
  ?ctxt - (context (state start))
  (guest (name ?n))
  ?count - (count (c ?c))
  =
  (assert (seating (seat1 1) (name1 ?n) (name2 ?n) (seat2 1) (id ?c) (pid 0) 
(path_done yes)))
  (assert (path (id ?c) (name ?n) (seat 1)))
  (modify ?count (c (+ ?c 1)))
  (printout t seat   1   ?n   ?n   1   ?c   0   1 crlf)
  (modify ?ctxt (state assign_seats)))

(defrule find_seating
  ?ctxt - (context (state assign_seats))
  (seating (seat1 ?seat1) (seat2 ?seat2) (name2 ?n2) (id ?id) (pid ?pid) (path_done 
yes))
  ;; **
  ;; *** Uncomment this line for the cheat version
  ;; (not (seating (path_done yes) (seat2 ?s2:( ?s2 ?seat2
  ;; **
  (guest (name ?n2) (sex ?s1) (hobby ?h1))
  (guest (name ?g2) (sex ~?s1) (hobby ?h1))
  ?count - (count (c ?c))
  (not (path (id ?id) (name ?g2)))
  (not (chosen (id ?id) (name ?g2) (hobby ?h1)))
  =
  (assert (seating (seat1 ?seat2) (name1 ?n2) (name2 ?g2) (seat2 (+ ?seat2 1)) (id ?c)
   (pid ?id) (path_done no)))
  (assert (path (id ?c) (name ?g2) (seat ( + ?seat2 1
  (assert (chosen (id ?id) (name ?g2) (hobby ?h1)))
  (modify ?count (c (+ ?c 1)))
  (printout t seat   ?seat2   ?n2   ?g2 crlf)
  (modify ?ctxt (state make_path)))

(defrule path_done
  ?ctxt - (context (state make_path))
  ?seat - (seating (path_done no))
  =
  (modify ?seat (path_done yes))
  (modify ?ctxt (state check_done)))


(defrule make_path
  (context (state make_path))
  (seating (id ?id) (pid ?pid) (path_done no))
  (path (id ?pid)(name ?n1) (seat ?s))
  (not (path (id ?id) (name ?n1)))
  =
  (assert (path (id ?id) (name ?n1) (seat ?s

(defrule continue
  ?ctxt - (context (state check_done))
  =
  (modify ?ctxt (state assign_seats)))

(defrule are_we_done
  ?ctxt - (context (state check_done))
  (last_seat (seat ?l_seat))
  (seating (seat2 ?l_seat))
  =
  (printout t crlf Yes, we are done!! crlf)
  (modify ?ctxt (state print_results))
)

(defrule print_results
  (context (state print_results))
  (seating (id ?id) (seat2 ?s2))
  (last_seat (seat ?s2))
  ?path - (path (id ?id) (name ?n) (seat ?s))
  =
  (retract ?path)
  (printout t ?n   ?s crlf))

(defrule all_done
  (context (state print_results))
  =
  (halt))

(set-reset-globals t)
(defglobal ?*t* = (time))
;; (readline)
(reset)
(batch mann128.dat)
(printout t (run) crlf)
(printout t Elapsed time:  (- (time) ?*t*) crlf)
(exit)






(assert (guest (name 1) (sex f) (hobby 3)))
(assert (guest (name 1) (sex f) (hobby 1)))
(assert (guest (name 1) (sex f) (hobby 5)))
(assert (guest (name 1) (sex f) (hobby 2)))
(assert (guest (name 2) (sex m) (hobby 5)))
(assert (guest (name 3) (sex f) (hobby 1)))
(assert (guest (name 3) (sex f) (hobby 2)))
(assert (guest (name 3) (sex f) (hobby 5)))
(assert (guest (name 3) (sex f) (hobby 3)))
(assert (guest (name 3) (sex f) (hobby 4)))
(assert (guest (name 4) (sex f) (hobby 1)))
(assert (guest (name 4) (sex f) (hobby 2)))
(assert (guest (name 4) (sex f) (hobby 5)))
(assert (guest (name 4) (sex f)