> But notice what happens if we modify defrule main like this: > > (defrule main > (possible-goal ?a) > (the-goal ?a) > => > (printout t "You won!" crlf) > ) > > and add the following deffacts: > > (deffacts possible-goal > (possible-goal bird) > (possible-goal cat) > (possible-goal dog)) > > Now the-goal is eventually satisfied, and all the possible goals are > explored to some extent. The reason this works and the previous setup > did not is that the old main would generate (need-X nil) facts, while > the "ground rules" would only match (need-X bird), etc. In the present > case, all the facts contain specific animal names, so the ground rules > match them. The problem with this, for what I'm trying to do, is that I don't know what the deffacts are. The possible values come from a UserFunction that gets invoked through the backchaining process. And the UserFunction is itself just a wrapper for an API, so that the real function can be plugged in by someone else. (A related problem is that there are an infinite number of possible values that may be returned as satisfying the goal, so even if I knew them, I couldn't assert them all as possible goals.) Anyway, I've been mulling over some ideas as to how to make backtracking "happen." One thing we have going for us is that, being the forward- chaining creature that it is, Jess is only too happy to generate many matches. So it's "just" a question of controlling the rate at which they are generated. So I'm thinking in terms of using CEs similar in purpose to the 'not' CEs, but containing more specific information about the bindings that have already been tried and failed. I could be more specific but I'll wait til I've actually tried to do it. -S. Sidney Bailin Knowledge Evolution, Inc. --------------------------------------------------------------------- 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] ---------------------------------------------------------------------
