I think Michael Knapik wrote: > > So when does the agenda have all 5 rules in it such that it can be managed > accordingly? >
The agenda is a "to-do list." It is an ordered list of rules that have been "activated" but not yet fired. Properly, it's not a list of rules at all; it's a list of {rule, token} associations (a "token" is the list of facts that match the complete LHS of a rule.) These associations are called "activations." You might define 100 rules, but the agenda could still be empty if there are no facts that match those rules. If you then subsequently assert some facts, then those activations that are created by matching the facts to the rules are placed on the agenda; there will often be fewer activations than rules, and there can be more than one activation per rule. When the engine runs, activations are removed from the agenda one at a time and then "fired." Each time a rule fires, the agenda can change; if Jess is being used in a multithreaded program, the agenda can change at any time. The changes are driven by facts being added, modified, or removed. The (agenda) function lists all the activations on the agenda at the time the function is called. If you call (agenda) on the RHS of a rule, the current activation -- i.e., the association between the rule that called "agenda" and the list of facts that made it fire -- will already have been removed from the agenda, which hopefully helps you to understand your observations. If you want to see all the activations created based on a set of facts and a set of rules, you can execute the (agenda) command from the Jess> prompt before calling (run). --------------------------------------------------------- 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] --------------------------------------------------------------------