Reasoning: Goal Trees and Rule-Based Expert system

Simon's Ant

“An ant, viewed as a behaving system, is quite simple. The apparent complexity of its behavior over time is largely a reflection of the complexity of the environment in which it finds itself.” — Herbert Simon (Simon’s Law)

Forward-chaining Rule-Based Expert System

fact -> conclusion

Backward-chaining Rule-Based Expert System

heuristic:

  1. specific cases
  2. different
  3. experiments

Generic Forward chaining Algorithm

1. For all rules and assertions, find all matches, i.e. Rule + Assertion combinations
2. Check if any of the matches are defunct
    A defunct match is one where the consequents from the match are already in the DB.
3. Fire the first non-defunct match.
4. Repeat until no more matches fire. 

Generic Backchaining Algorithms

function rule_match_goal_tree(hypothesis, rules, DB):
    1. check hypothesis against DB exit if satisfied.
    2. find all matching rules:  any rule with a consequent that matches hypothesis
    3. for each rule in matching rules:
        i) binding <- unify rule.consequent and hypothesis
        ii) subtree <- antecedents_goal tree(rule, rules, binding, DB)
        iii) Optimization: If subtree evaluation returns true, 
            we can short-circuit because we are ORing subtrees. 
    return OR(rule subtrees)

function antecedent_goal_tree(rule, rules, binding, DB):
    for each antecedent:
        1. new-hypothesis <- antecedent + binding
        2. check new-hypothesis against DB, if matched, update binding
        3. subtree <- rule_match_goal_tree(hypothesis, rules, DB)
        4. Optimization: Short circuit if the antecedent logics calls for it
             i.e. if in an AND then the first failure fails the whole branch.
             if in an OR, the first success implies the whole branch succeeds
    return {antecedent logic}(antecedent subtrees) 

猜你喜欢

转载自blog.csdn.net/Da_tianye/article/details/82025231