I think Mitch Christensen wrote: > Hey, > > I'm reading "Expert Systems Principles and Programming" by Giarratano and I > decided to try using Jess to solve the cryptarithmic problem at the bottom > of page 39. I've got a rule that produces no valid solutions :(. I've > spent several hours looking over the code can't see my fault. I was > wondering if someone else might be interested in having a look. >
Well, first of all, note that Jess comes with a solution to this exact problem, although that solution takes a different approach than the one you've taken here. This isn't wrong, though, and I'd think it'd be possible to make it work. A (The?) "right" answer is G = 1 E = 9 R = 7 A = 4 L = 8 D = 5 O = 2 N = 6 B = 3 T = 0 So what I did was load up your facts and your rule, and use the "view" command to visualize the network, and then double-clicked on the green join nodes to see what was happening in each one. If you look at the ones near the bottom, you'll see that the left memories don't contain any facts for B=3; they allow other values of B, but not 3. So something's wrong with the rule. If you open up each node one at a time, you can see that it's the tests for G that eliminate the correct values of B. That makes sense, as if you look lower down, G is getting assigned the value 3. So it looks as though one of your assumptions about G is wrong. Looking at the rule, we see in the "G" pattern that ?Rn being used before it's bound to a value. Jess' static analyzer is fairly weak, and this kind of error is generally reported at runtime; in this case it looks like Jess may be trying to do the right thing anyway, but failing. These tests have to be moved down to the "R" pattern; this may or may not be the only problem, but it's one problem, anyway. I'll have to look at why you weren't getting an error message. --------------------------------------------------------- Ernest Friedman-Hill Science and Engineering PSEs Phone: (925) 294-2154 Sandia National Labs FAX: (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] --------------------------------------------------------------------