Submitted by: Submitted by HadeeqaNadeem
Views: 725
Words: 357
Pages: 2
Category: Science and Technology
Date Submitted: 04/11/2011 08:44 AM
Forward chaining example
• RULES
1. IF a flammable liquid was spilled
THEN call the fire brigade
2. IF the pH of the spill < 6
THEN the spill is an acid
3. IF the spill is an acid
AND the spill smells like vinegar
THEN the spill is acetic acid
[pic]
As rule 2's condition matched a fact, its conclusion can be added to the list of known facts in working memory.
Example of Backward chaining
This is a lazy kind of inference. It does no work until absolutely necessary, in distinction to forward chaining, where the system eagerly awaits new facts and tries applying conditions as soon as they arrive.
So, if we had this knowledge base again
1 If someone is a third year, then they need a job.
2 If someone is a third year, then they live in.
3 If someone needs a job, they will apply to be an accountant.
and we were to add
John is a third year
the system would do nothing at all.
But if we were then to ask the question
Is there anyone who is going to become an accountant?
the system would try to answer. It would begin by searching either for a fact that gives the answer directly, or for a rule by which the answer could be inferred. To find such a rule, it searches the entire knowledge base for rules whose conclusions, if made true, will answer the question.
In this example, there are no facts giving the answer; there's one rule whose conclusion, if true, would supply an answer, and that's rule 3.
The system next checks the rule's conditions. Is there anyone who needs a job? As with the original question, we look either for a fact that answers directly, or for a rule. There are no facts, but rule 1 is relevant.
So we now check its conditions. Is there a third year? This time, there is a fact that answers this: John is a third year. So we've proved rule 1, and that's proved rule 3, and that's answered the question.