TWO common inference mechanisms used in Expert Systems for reasoning:
Forward Chaining:
Backward Chaining:
Forward chaining assumes we
know all the facts, and works from that premise.
Backward chaining assumes
no data, and only asks for any that we need to prove the direct line of
reasoning. Backward chaining can occur in either breadth first or depth first
modes (see lecture on search techniques).
|
Rule 1 |
If cat is happy And jenny is relaxed Then goal is achieved |
|
Rule 2 |
If bowl is full Then cat is happy
|
|
Rule 3 |
If telly is on Then jenny is relaxed |
|
Rule 4 |
If cat is happy Then purring is happening |
Forward Chaining: given that bowl is full, and telly is on as initial facts
|
Pass 1 |
Rule 2 fires, cat is
instantiated as happy Rule 3 fires, jenny is
instantiated as relaxed Rule 4 fires, purring is
instantiated as happening |
|
Pass 2 |
Rule 1 fires, goal is
instantiated as achieved |
At the end of the process we know that
:
Cat is happy Bowl is full Jenny is relaxed Telly is on Purring is happening Goal is achieved
Applying depth first backward
chaining:
|
ACTIONS |
GOALS and INSTANTIATIONS |
|
Try Rule 1 Stack rule 1 |
Need value for cat |
|
Try Rule 2 No rule, query user
|
Need value for bowl Bowl instantiated to full by user input |
|
Rule 2 Fires |
Cat instantiated to happy |
|
Un-stack Rule 1 Stack rule 1
|
Need value for jenny |
|
Try Rule 3 No rule, query user |
Need value for telly Telly instantiated to on by user input |
|
Rule 3 fires |
Jenny instantiated to relaxed |
|
Un-stack rule 1 |
|
|
Rule 1 fires |
Goal instantiated to achieved |
We now know that:
Purring was not instantiated
because it’s not in our line of reasoning.
Leonardo uses depth first backward chaining with opportunistic forward chaining.