Re: JESS: Handling Time
I think Judson, Ross wrote: It's a little frustrating working with time in Jess. You can store a time as a java.util.Date, but then you can't compare it with , , etc...if you work with it as a long, then you can't call + and other math functions; they change the number into INTEGER. If you work with time as ms/1000, then you lose a lot of accuracy. Any suggestions on how best to handle time? I have a few specific ones: 1. Extend , , etc. to work with Comparable objects. I like this idea very much. 2. Instead of printing ExternalAddress and so forth when printing out fact lists, use an extra slot descriptor to indicate that toString() should be called on the object in the fact slot, and that used as the text to represent the object. 3. Extend + and other math functions to work with LONG values. Yes, LONG should be a first-class type. This has been promised for several releases now! - Ernest Friedman-Hill Distributed Systems ResearchPhone: (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: Handling Time
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Instead of using java.util.Date, you might try java.util.Calendar. Calendar allows after(), before() or equals(), all of which return a boolean. Calendar also has returns Date getTime() and setTime(Date) if those are already in your code somewhere. Just a thought. :-) SDG jco - -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Judson, Ross Sent: Thursday, August 14, 2003 12:13 PM To: [EMAIL PROTECTED] Subject: JESS: Handling Time It's a little frustrating working with time in Jess. You can store a time as a java.util.Date, but then you can't compare it with , , etc...if you work with it as a long, then you can't call + and other math functions; they change the number into INTEGER. If you work with time as ms/1000, then you lose a lot of accuracy. Any suggestions on how best to handle time? I have a few specific ones: 1. Extend , , etc. to work with Comparable objects. 2. Instead of printing ExternalAddress and so forth when printing out fact lists, use an extra slot descriptor to indicate that toString() should be called on the object in the fact slot, and that used as the text to represent the object. 3. Extend + and other math functions to work with LONG values. RJ - 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] - -BEGIN PGP SIGNATURE- Version: PGPfreeware 6.5.8 for non-commercial use http://www.pgp.com iQA/AwUBPz0Gd9xsw6qfZxRLEQLZ4wCfTI/sPGW9tcqKE7F7TsWYYF+d3CIAmwcV 3xDdHIvsC4+LSJeZpFlNpHDx =0ULf -END PGP SIGNATURE- 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]
JESS: JESS in Action -- problem
Following book instruction, downloaded : JessCode.zip and JessSE.zip (Jess61p4) Set it up to run under Tomcat but got this exception below Unimplemented function multislot. Any ideas? Thanks Hue javax.servlet.ServletException: Unimplemented function at BaseServlet.checkInitialized(BaseServlet.java:26) at Catalog.doGet(Catalog.java:13) at BaseServlet.doPost(BaseServlet.java:10) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) root cause Jess reported an error in routine Funcall.execute while executing (multislot address) while executing (batch tekmart.clp). Message: Unimplemented function multislot. Program text: ( batch tekmart.clp ) at line 1. at jess.Funcall.execute(Unknown Source) at jess.Jesp.a(Unknown Source) at jess.Jesp.for(Unknown Source) at jess.Jesp.parse(Unknown Source) at jess.Jesp.parse(Unknown Source) at jess.Batch.batch(Unknown Source) at jess.Batch.call(Unknown Source) at jess.ep.a(Unknown Source) at jess.Funcall.execute(Unknown Source) at jess.Jesp.a(Unknown Source) at jess.Jesp.for(Unknown Source) at jess.Jesp.parse(Unknown Source) at jess.Rete.executeCommand(Unknown Source) at jess.Rete.executeCommand(Unknown Source) at BaseServlet.checkInitialized(BaseServlet.java:20) at Catalog.doGet(Catalog.java:13) at BaseServlet.doPost(BaseServlet.java:10) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica tionFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt erChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv e.java:260) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 80) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv e.java:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:643) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authenticator Base.java:550) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:641) at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.ja va:246) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 80) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:241 5) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java :180) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:643) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherVa lve.java:170) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:641) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java :172) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 80) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve. java:174) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 80) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:43 2) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processC onnection(Http11Protocol.java:386) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:53 4) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool .java:530) at java.lang.Thread.run(Thread.java:536)
Re: JESS: JESS in Action -- problem
AI think Hue Le wrote: Following book instruction, downloaded : JessCode.zip and JessSE.zip (Jess61p4) Set it up to run under Tomcat but got this exception below Unimplemented function multislot. Any ideas? Thanks Hue Aah! There's an extra parenthesis which must have gotten in there during some reformatting. Line 13 in tekmart.clp looks like (multislot name)) but that last close paren is bogus; it should just be (multislot name) The template is correct as given on page 294 in the book. Thanks for the tip; I've sent Manning a patch. - Ernest Friedman-Hill Distributed Systems ResearchPhone: (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]
JESS: Manners benchmarks, redux
Hi Folks, If you've been on this list for a while, you'll probably recall various discussions of the Manners benchmark. Once a user posted a table of various rule engine performance results on this benchmark. Jess was more or less average in that table. One of the measurements, marked JRULES-OPT, was strikingly faster than all the others, and I questioned that result. Apparently this result comes from the JRules people's own tweaked version of the benchmark code. Someone who understands the tweak has shared the ideas with me, and it turns out that the optimization works as well, or better, for Jess. On my machine, Jess does this optimized Manners benchmark at N=128 in 2-3 seconds, as compared to 38 seconds for the classic version; Jess can actually run the optimized program with N=256 (a previously unheard-of problem size!) in 22 seconds. The optimization consists of adding a single not pattern to a single rule. The outputs are identical, and in fact, if you use watch rules to watch everything that happens, you can see that the exact same sequence of rules fires, activated by the same facts, in the same order. So how does the optimization work? Well, what Manners really tests is worst-case agenda handling. One of the rules (find_seating) is activated and then immediately deactivated a large number of times every cycle (there are N cycles, one for each guest.) The number of activations actually grows on each cycle; by 50 cycles or so it's nearly 2000 activations being created and immediately destroyed, and it grows to many tens of thousands per cycle by N=128. The optimization adds a pattern to find_seating so that many of these activations are eliminated. Thus, the very thing that the problem is supposed to test is being skipped! This is therefore not an optimization at all -- it changes the problem into a different, far easier problem. This vindicates my original assertion that the JRULES-0PT measurement shouldn't count. It also should serve as a lesson to anybody who hasn't already figured this out: don't trust benchmarks! - Ernest Friedman-Hill Distributed Systems ResearchPhone: (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]