Re: JESS: Reversing logic
Normally I don't get into long-winded discussions on the Jess group because it is, and should be, devoted to answering questions about Jess. After all, it is the Jess User's Group, not the Long-Winded-Rambling-What-About-That Group. However, Mitch wanted to open up the following to discussion by the Jess group so I'm posting my private answer in the public forum. Then I'm going back to work. :-) I've been doing rulebased systems (RBS) since 1989. I even worked for Neuron Data way back when the only real tool that they had was Nexpert, a full opportunistic backward chaining system. Anyway, I've picked up a few tricks along the way. Jess (along with OPSJ, drools, Mandarex, JEOPS and others) are tools for programmers, not for business analysts; much like C++ and Java. There are other, must more expensive systems, that have extensive debugging tools, GUI screens for business analysts and special language processors for the business analysts. Some are scalable; some are not. Also, the thought process jump from OO to declarative languages is akin to the thought process jump from procedural to OO. It's still bits and bytes on the computer, the change is the approach and the view of the logic. The Jess In Action book is good and does an excellent job of teaching Jess, but it only goes so far. There are many other books that might help, but not many programmers have the time to read and understand these books. See http://www.kbsc.com/aibooks.html for a suggested list. Many of these go more into the technical, statistical, theory, etc. than most programmers or users have a need. I suppose that the main thing to consider is that the rules are declarative and each rule must be incrementally independent; it must contain the logic that it needs and not depend on another rule to fire first before it fires. We get around that by using either goal-driven rules or priorities, but priorities are something that should be used with great discretion - no more than three levels if possible. Setup priority rules, logic priority rules and clean-up priority rules. Take care and remember, it's a long, long road with lots of study on your own. The time problem is something that management rarely understands so you have to sell that concept to the management. Working with rules is 70% thought and design and only 30% implementation. I just go off the phone with the Maricopa County Attorney's office who have implemented a rulebased system over a three year period, but they spend a lot of time up front considering all of the requirements, constraints, etc. BEFORE writing the first line of code. And they follow that same process for any new project that comes along that needs rules. Something well worth thinking about. SDG jco Mitch Christensen wrote: Thanks All. DeMorgan's laws is what I was trying to remember last night (and couldn't). I knew there was a way to transpose/normalize logic, but couldn't recall the specifics. However, ;) I did do a truth table, and I did change the logic to fix my rule before posting my question. My problem is that now I am having a hard time explaining *why* it works. In other words, it works now, but looking at the rule, I would insist that it shouldn't. Here is my truth table. StmtA : (not (and A B)) which is equivalent to (or (not A)(not B)) StmtB : (and (not A)(not B)) +---+---+---+---+ | A | B | StmtA | StmtB | +---+---+---+---+ | 0 | 0 | 1 | 1 | +---+---+---+---+ | 1 | 0 | 1 | 0 | +---+---+---+---+ | 0 | 1 | 1 | 0 | +---+---+---+---+ | 1 | 1 | 0 | 0 | +---+---+---+---+ Now, whenever my CE is true (i.e. StmtX is 1), my rule should fire. Since I was incorrectly using StmtA instead of StmtB, I would expect my rule to fire occasionally when it shouldn't (i.e. false positives). The symptom I was getting was that my rule wasn't firing when it otherwise should as all the previous patterns were matched. I simply converted to the StmtB form and the rule fired. How can that be? To address Ernest's warning, this CE is the last statement prior to the =, so ?rowAmt is declared outside of the CE. I apologize if I'm just noising up the list. It's great that it works, but it worries me that I can't explain why. -Mitch P.S. Here is the complete rule in case that helps: (defrule find-ncp-row-partic-name Find all NCP records (column (type amount)(x ?xc)(y ?yc)(width ?wc)(height ?hc)) ?amt - (word (text ?tAmt:(not (regex-match ?tAmt ^\\p{Punct}+$))) (x ?xAmt:(and (= ?xAmt ?xc)( ?xAmt (+ ?xc ?wc (y ?rowAmt:(and (= ?rowAmt ?yc)( ?rowAmt (+ ?yc ?hc (width ?wAmt:(and ( ?wAmt 5)(= ?wAmt ?wc ?name1 - (word (text ?tName1:(regex-match (upcase ?tName1) ^[A-Z][A-Z\\-]+,?$)) (x ?xName1) (y ?rowName1:(same-row ?rowName1 ?rowAmt))) ?name2 - (word
Re: JESS: Reversing logic
Best answer is always the easiest. But one other heuristic that I like to follow is to always express things in a positive manner rather than a negated manner. If it works in the positive manner, reversing can lead to incredibly long and complicated errors in logic. The other answer about a truth table is always good as well. Also, building a spread sheet wherever possible also helps to expose poor logical conclusions and hypotheses. Dusan Sormaz wrote: First morning shot on it: De Morgan's laws: (not ( and a b)) == (or (not a) (not b)) Dusan Sormaz At 08:17 PM 3/8/2005, you wrote: Ok, I know that I should know this, but Im having trouble reasoning through it. Why do the following two CEs versions produce significantly different results? The only difference is that Im reversing the and/not order, but this results significantly different activation results. (not (and (allocation-amount (page ?p)(row ?rowAa:(same-row ?rowAa ?rowAmt))(x ?xAmt)) (word (x ?xOther:( ?xOther ?xName1))(y ?yOther:(same-row ?yOther ?rowAmt) (and (not (allocation-amount (page ?p)(row ?rowAa:(same-row ?rowAa ?rowAmt))(x ?xAmt))) (not (word (x ?xOther:( ?xOther ?xName1))(y ?yOther:(same-row ?yOther ?rowAmt) Thanks. -Mitch * * Duan ormaz, PhD, Associate Professor * Ohio University * Industrial and Manufacturing Systems Engineering Department * 277 Stocker Center, Athens, OH 45701-2979 * phone: (740) 593-1545 * fax: (740) 593-0778 * e-mail: [EMAIL PROTECTED] * url: http://www.ent.ohiou.edu/~sormaz http://www.ent.ohiou.edu/%7Esormaz * -- 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 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: performance experiment
Has anyone ever thought about using the Sting.intern() method? It's been used with other rulebased systems to ensure string location. I have an example somewhere that I'll try and look up when I get back from supper. If I don't do it tonight, someone remind me. Terrible memory problems at my youngish years. SDG jco [EMAIL PROTECTED] wrote: I think Timothy Redmond wrote: But it isn't obvious to me why the rule was so bad. I constructed a small experiment. It appears that Jess is not as efficient if it has a rule where a java object is getting matched with another java object. OK, I remember now what's going on here. The problem is that the hashCode() of some Java objects (Collections are one famous offender) can change, meaning that the method isn't really available for use in indexing. To be safe, later versions of Jess 6 simply don't do indexing on Java object fields -- better slow and correct than fast and wrong! Jess 7 will (eventually) have a scheme whereby you can tell Jess which of your classes have mutable hashCodes. Jess will know about many common cases, and you can provide additional information. This will let you have both correctness and speed. - 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
Re: JESS: performance experiment
thanks --- I do know that it does ensure the proper String object when used in a rulebase. Do you have any idea about what kind of performance hit you get compared to a Hashtable lookup? [EMAIL PROTECTED] wrote: I think James Owen jco wrote: Has anyone ever thought about using the Sting.intern() method? It's been used with other rulebased systems to ensure string location. I have an example somewhere that I'll try and look up when I get back from supper. If I don't do it tonight, someone remind me. Terrible memory problems at my youngish years. Early versions of Jess did actually use String.intern(). It was a performance boost back in the day. But it was a real problem if you had an app that generated lots of unique Strings, like, for example, XML processing -- you would use an enormous amount of memory needlessly. I eventually took it out. But nowadays, it's a performance loss, anyway: a simple string comparison is faster than the hashtable lookup inside intern(). - 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
Re: JESS: looking for JessWin
http://herzberg.ca.sandia.gov/jess/user.shtml sivan k wrote: Hello I would like to know where I can get JessWin. Thanks Jenny __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- 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 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
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 )